diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6be744a0..0b72cb7d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,18 +1,14 @@ name: Builds, tests & co on: - push: - pull_request: - release: - types: - - published + - push + - pull_request permissions: read-all jobs: build-and-test: runs-on: ubuntu-latest - steps: - name: Checkout tree uses: actions/checkout@v4 @@ -30,27 +26,4 @@ jobs: run: yarn format:check - name: Run the tests - run: yarn test-all - - publish: - if: github.event_name == 'release' - - needs: - - build-and-test - - runs-on: ubuntu-latest - - steps: - - name: Checkout tree - uses: actions/checkout@v4 - - - name: Set-up Node.js - uses: actions/setup-node@v4 - with: - node-version: 22 - check-latest: true - - - name: Publish - run: yarn npm publish --tolerate-republish - env: - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + run: yarn test diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..99fa4a56 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +name: Publish + +on: + release: + types: + - published + +permissions: read-all + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout tree + uses: actions/checkout@v4 + + - name: Set-up Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + check-latest: true + + - name: Publish + run: yarn npm publish --tolerate-republish + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} diff --git a/biome.json b/biome.json index 154aff13..c275b9ee 100644 --- a/biome.json +++ b/biome.json @@ -1,15 +1,7 @@ { "$schema": "node_modules/@biomejs/biome/configuration_schema.json", "files": { - "ignore": [ - "package.json", - "tests/**/expected.ts", - "tests/**/expected/**", - "tests/**/generated/**", - "tests/**/schema.d.ts", - "tests/**/schema.js", - "tests/**/schema.ts" - ], + "ignore": ["package.json"], "maxSize": 10000000 }, "formatter": { diff --git a/package.json b/package.json index 29f1969d..ae274d0e 100644 --- a/package.json +++ b/package.json @@ -30,61 +30,7 @@ "cli:yaml": "node index.js -r -d -p ./swagger-test-cli.yaml -n swagger-test-cli.ts", "format": "biome format --write .", "format:check": "biome format .", - "generate": "node tests/generate.js", - "generate-extended": "node tests/generate-extended.js", - "node": "node swagger-test-cli/generate.js", - "node:debug": "node --nolazy swagger-test-cli/generate.js", - "test-all": "yarn test-extended && yarn test-simple && yarn test-specific", - "test-all(update-snapshots)": "cross-env UPDATE_SNAPSHOTS=true yarn test-all", - "test-extended": "node --unhandled-rejections=strict scripts_runner.js generate-extended validate", - "test-simple": "node --unhandled-rejections=strict scripts_runner.js generate 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:*\"", - "test:--add-readonly": "node tests/spec/readonly/test.js", - "test:--another-array-type": "node tests/spec/another-array-type/test.js", - "test:--axios": "node tests/spec/axios/test.js", - "test:--axios--single-http-client": "node tests/spec/axiosSingleHttpClient/test.js", - "test:--cli": "shx rm -rf 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:--default-as-success": "node tests/spec/defaultAsSuccess/test.js", - "test:--default-response": "node tests/spec/defaultResponse/test.js", - "test:--dot-path-params": "node tests/spec/dot-path-params/test.js", - "test:--enum-names-as-values": "node tests/spec/enumNamesAsValues/test.js", - "test:--extract-request-body": "node tests/spec/extractRequestBody/test.js", - "test:--extract-request-params": "node tests/spec/extractRequestParams/test.js", - "test:--extract-response-body": "node tests/spec/extractResponseBody/test.js", - "test:--extract-response-error": "node tests/spec/extractResponseError/test.js", - "test:--js": "node tests/spec/js/test.js", - "test:--js--axios": "node tests/spec/jsAxios/test.js", - "test:--modular": "node tests/spec/modular/test.js", - "test:--module-name-first-tag": "node tests/spec/moduleNameFirstTag/test.js", - "test:--module-name-index": "node tests/spec/moduleNameIndex/test.js", - "test:--no-client": "node tests/spec/noClient/test.js", - "test:--object-types": "node tests/spec/object-types/test.js", - "test:--patch": "node tests/spec/patch/test.js", - "test:--primitive-type-constructs": "node tests/spec/primitive-type-constructs/test.js", - "test:--responses": "node tests/spec/responses/test.js", - "test:--route-types": "node tests/spec/routeTypes/test.js", - "test:--single-http-client": "node tests/spec/singleHttpClient/test.js", - "test:--templates": "node tests/spec/templates/test.js", - "test:--type-suffix--type-prefix": "node tests/spec/typeSuffixPrefix/test.js", - "test:--union-enums": "node tests/spec/unionEnums/test.js", - "test:additionalProperties2.0": "node tests/spec/additional-properties-2.0/test.js", - "test:another-query-params": "node tests/spec/another-query-params/test.js", - "test:const-keyword": "node tests/spec/const-keyword/test.js", - "test:deprecated": "node tests/spec/deprecated/test.js", - "test:discriminator": "node tests/spec/discriminator/test.js", - "test:enums2.0": "node tests/spec/enums-2.0/test.js", - "test:extra-templates": "node tests/spec/extra-templates/test.js", - "test:extract-enums": "node tests/spec/extract-enums/test.js", - "test:jsSingleHttpClientModular": "node tests/spec/jsSingleHttpClientModular/test.js", - "test:nullableRefTest2.0": "node tests/spec/nullable-2.0/test.js", - "test:nullableRefTest3.0": "node tests/spec/nullable-3.0/test.js", - "test:on-insert-path-param": "node tests/spec/on-insert-path-param/test.js", - "test:partialBaseTemplate": "node tests/spec/partialBaseTemplate/test.js", - "test:partialDefaultTemplate": "node tests/spec/partialDefaultTemplate/test.js", - "test:sort-types": "node tests/spec/sortTypes/test.js", - "test:sort-types-false": "node tests/spec/sortTypes-false/test.js", - "test:specProperty": "node tests/spec/specProperty/test.js", + "test": "vitest run", "validate": "node tests/validate.js", "validate:debug": "node --nolazy tests/validate.js" }, @@ -99,7 +45,7 @@ "node-emoji": "^2.1.3", "prettier": "3.3.2", "swagger-schema-official": "2.0.0-bab6bed", - "swagger2openapi": "^7.0.8", + "swagger2openapi": "7.0.8", "typescript": "5.4.5" }, "devDependencies": { @@ -110,7 +56,8 @@ "cross-env": "7.0.3", "dotenv": "16.4.5", "git-diff": "2.0.6", - "shx": "0.3.4" + "shx": "0.3.4", + "vitest": "1.6.0" }, "packageManager": "yarn@4.3.0", "engines": { diff --git a/scripts_runner.js b/scripts_runner.js deleted file mode 100644 index 22ec34e1..00000000 --- a/scripts_runner.js +++ /dev/null @@ -1,63 +0,0 @@ -const packageJson = require("./package.json"); -const { spawn } = require("node:child_process"); - -const commands = process.argv.slice(2); - -const packageScripts = Object.keys(packageJson.scripts); - -const execute = (scriptName) => - new Promise((resolve, reject) => { - console.log(`yarn ${scriptName}`); - const spawned = spawn("yarn", [scriptName]); - - spawned.stdout.on("data", (data) => { - process.stdout.write(data); - }); - - spawned.stderr.on("data", (data) => { - process.stderr.write(data); - }); - - spawned.on("error", (error) => { - console.error(error); - }); - - spawned.on("message", (message) => { - console.log(message); - }); - - spawned.on("close", (code) => { - if (code) { - reject(code); - } else { - resolve(code); - } - }); - }); - -const run = async () => { - for await (const command of commands) { - for await (const scriptName of packageScripts) { - try { - if (scriptName === command) { - await execute(scriptName); - } - - if (command.includes("*")) { - const commandPart = command.replace("*", ""); - // TODO: refactor - if ( - scriptName.startsWith(commandPart) || - scriptName.endsWith(commandPart) - ) { - await execute(scriptName); - } - } - } catch (e) { - process.exit(1); - } - } - } -}; - -run(); diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 01b2f2d0..00000000 --- a/tests/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# swagger-typescript-api - -## 📃 EXAMPLES - -As you see above here is two folders: - -1. [**`schemas`**](./schemas) - - - [**`v2.0`**](./schemas/v2.0) - schemas with Swagger 2.0 - - [**`v3.0`**](./schemas/v3.0) - schemas with OA 3.0 -1. [**`generated`**](./generated) - - - [**`v2.0`**](./generated/v2.0) - generated api modules for Swagger 2.0 schemas from above folder - - [**`v3.0`**](./generated/v3.0) - generated api modules for OA 3.0 schemas from above folder - -Most schemas taken from [apis.guru](https://apis.guru/openapi-directory/), [swagger.io github repo](https://swagger.io/), [Github api description](https://github.com/github/rest-api-description) and [up-banking](https://github.com/up-banking/api) diff --git a/tests/__snapshots__/extended.test.ts.snap b/tests/__snapshots__/extended.test.ts.snap new file mode 100644 index 00000000..5671d9cf --- /dev/null +++ b/tests/__snapshots__/extended.test.ts.snap @@ -0,0 +1,70846 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`extended > 'adafruit' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Activity { + action?: string; + /** @format dateTime */ + created_at?: string; + data?: object; + id?: number; + model?: string; + /** @format dateTime */ + updated_at?: string; + user_id?: number; +} + +export type AddFeedToGroupData = Group; + +export interface AddFeedToGroupParams { + feed_key?: string; + groupKey: string; + /** a valid username string */ + username: string; +} + +export type AllActivitiesData = Activity[]; + +export interface AllActivitiesParams { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + /** a valid username string */ + username: string; +} + +export type AllBlocksData = Block[]; + +export type AllDashboardsData = Dashboard[]; + +export type AllDataData = DataResponse[]; + +export interface AllDataParams { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** a valid feed key */ + feedKey: string; + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + /** a valid username string */ + username: string; +} + +export type AllFeedsData = Feed[]; + +export type AllGroupFeedDataData = DataResponse[]; + +export interface AllGroupFeedDataParams { + /** + * End time for filtering data. Returns data created before give time. + * @format date-time + */ + end_time?: string; + /** a valid feed key */ + feedKey: string; + groupKey: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering data. Returns data created after given time. + * @format date-time + */ + start_time?: string; + /** a valid username string */ + username: string; +} + +export type AllGroupFeedsData = Feed[]; + +export type AllGroupsData = Group[]; + +export type AllPermissionsData = Permission[]; + +export type AllTokensData = Token[]; + +export type AllTriggersData = Trigger[]; + +export type BatchCreateDataData = DataResponse[]; + +export type BatchCreateGroupFeedDataData = DataResponse[]; + +export interface Block { + block_feeds?: BlockFeed[]; + column?: number; + description?: string; + key?: string; + name?: string; + row?: number; + size_x?: number; + size_y?: number; + visual_type?: string; +} + +export interface BlockFeed { + feed?: Feed; + group?: Group; + id?: string; +} + +export interface ChartDataData { + /** The names of the columns returned as data. */ + columns?: string[]; + /** The actual chart data. */ + data?: string[][]; + feed?: { + id?: number; + key?: string; + name?: string; + }; + parameters?: object; +} + +export interface ChartDataParams { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** a valid feed key */ + feedKey: string; + /** + * The number of hours the chart should cover. + * @format int32 + */ + hours?: number; + /** + * A resolution size in minutes. By giving a resolution value you will get back grouped data points aggregated over resolution-sized intervals. NOTE: time span is preferred over resolution, so if you request a span of time that includes more than max limit points you may get a larger resolution than you requested. Valid resolutions are 1, 5, 10, 30, 60, and 120. + * @format int32 + */ + resolution?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + /** a valid username string */ + username: string; +} + +export type CreateBlockData = Block; + +export type CreateDashboardData = Dashboard; + +export type CreateDataData = Data; + +export type CreateFeedData = Feed; + +export interface CreateFeedParams { + group_key?: string; + /** a valid username string */ + username: string; +} + +export type CreateGroupData = Group; + +export type CreateGroupDataData = DataResponse[]; + +export interface CreateGroupDataPayload { + /** Optional created_at timestamp which will be applied to all feed values created. */ + created_at?: string; + /** An array of feed data records with \`key\` and \`value\` properties. */ + feeds: { + key: string; + value: string; + }[]; + /** A location record with \`lat\`, \`lon\`, and [optional] \`ele\` properties. */ + location?: { + ele?: number; + lat: number; + lon: number; + }; +} + +export type CreateGroupFeedData = Feed; + +export type CreateGroupFeedDataData = DataResponse; + +export type CreatePermissionData = Permission; + +/** @default "r" */ +export enum CreatePermissionModeEnum { + R = "r", + W = "w", + Rw = "rw", +} + +/** @default "public" */ +export enum CreatePermissionScopeEnum { + Secret = "secret", + Public = "public", + User = "user", + Organization = "organization", +} + +export type CreateRawWebhookFeedDataData = Data; + +export type CreateTokenData = Token; + +export type CreateTriggerData = Trigger; + +export type CreateWebhookFeedDataData = Data; + +export interface CreateWebhookFeedDataPayload { + value?: string; +} + +export type CurrentUserData = User; + +export interface Dashboard { + blocks?: Block[]; + description?: string; + key?: string; + name?: string; +} + +export interface Data { + completed_at?: string; + created_at?: string; + created_epoch?: number; + ele?: number; + expiration?: string; + feed_id?: number; + group_id?: number; + id?: string; + lat?: number; + lon?: number; + updated_at?: string; + value?: string; +} + +export interface DataResponse { + completed_at?: string; + created_at?: string; + created_epoch?: number; + ele?: number; + expiration?: string; + feed_id?: number; + group_id?: number; + id?: string; + lat?: number; + lon?: number; + updated_at?: string; + value?: string; +} + +export type DestroyActivitiesData = any; + +export type DestroyBlockData = string; + +export type DestroyDashboardData = string; + +export type DestroyDataData = string; + +export type DestroyFeedData = any; + +export type DestroyGroupData = string; + +export type DestroyPermissionData = string; + +export type DestroyTokenData = string; + +export type DestroyTriggerData = string; + +export interface Error { + code?: string; + message?: string; +} + +export interface Feed { + created_at?: string; + description?: string; + /** Additional details about this feed. */ + details?: { + data?: { + /** Number of data points stored by this feed. */ + count?: number; + first?: Record; + last?: Record; + }; + /** Access control list for this feed */ + shared_with?: object[]; + }; + enabled?: boolean; + group?: Record; + groups?: ShallowGroup[]; + history?: boolean; + id?: number; + key?: string; + last_value?: string; + license?: string; + name?: string; + status?: string; + /** Is status notification active? */ + status_notify?: boolean; + /** Status notification timeout in minutes. */ + status_timeout?: number; + unit_symbol?: string; + unit_type?: string; + updated_at?: string; + /** @default "private" */ + visibility?: FeedVisibilityEnum; +} + +/** @default "private" */ +export enum FeedVisibilityEnum { + Private = "private", + Public = "public", + InProgress = "in progress", + OutOfAccess = "out of access", +} + +export type FirstDataData = DataResponse; + +export interface FirstDataParams { + /** a valid feed key */ + feedKey: string; + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + /** a valid username string */ + username: string; +} + +export type GetActivityData = Activity[]; + +export interface GetActivityParams { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + type: string; + /** a valid username string */ + username: string; +} + +export type GetBlockData = Block; + +export interface GetCurrentUserThrottleData { + /** Actions taken inside the time window. */ + active_data_rate?: number; + /** Max possible actions inside the time window (usually 1 minute). */ + data_rate_limit?: number; +} + +export type GetDashboardData = Dashboard; + +export type GetDataData = DataResponse; + +export interface GetDataParams { + /** a valid feed key */ + feedKey: string; + id: string; + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + /** a valid username string */ + username: string; +} + +export type GetFeedData = Feed; + +export type GetFeedDetailsData = Feed; + +export type GetGroupData = Group; + +export type GetPermissionData = Permission; + +export type GetTokenData = Token; + +export type GetTriggerData = Trigger; + +export interface Group { + created_at?: string; + description?: string; + feeds?: Feed[]; + id?: number; + name?: string; + updated_at?: string; +} + +export type LastDataData = DataResponse; + +export interface LastDataParams { + /** a valid feed key */ + feedKey: string; + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + /** a valid username string */ + username: string; +} + +export type NextDataData = DataResponse; + +export interface NextDataParams { + /** a valid feed key */ + feedKey: string; + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + /** a valid username string */ + username: string; +} + +export interface Permission { + created_at?: string; + id?: number; + /** @default "feed" */ + model?: PermissionModelEnum; + object_id?: number; + /** @default "public" */ + scope?: PermissionScopeEnum; + scope_value?: string; + updated_at?: string; + user_id?: number; +} + +/** @default "feed" */ +export enum PermissionModelEnum { + Feed = "feed", + Group = "group", + Dashboard = "dashboard", +} + +/** @default "public" */ +export enum PermissionScopeEnum { + Secret = "secret", + Public = "public", + User = "user", + Organization = "organization", +} + +export type PreviousDataData = DataResponse; + +export interface PreviousDataParams { + /** a valid feed key */ + feedKey: string; + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + /** a valid username string */ + username: string; +} + +export type RemoveFeedFromGroupData = Group; + +export interface RemoveFeedFromGroupParams { + feed_key?: string; + groupKey: string; + /** a valid username string */ + username: string; +} + +export type ReplaceBlockData = Block; + +export type ReplaceDashboardData = Dashboard; + +export type ReplaceDataData = DataResponse; + +export type ReplaceFeedData = Feed; + +export type ReplaceGroupData = Group; + +export type ReplacePermissionData = Permission; + +export type ReplaceTokenData = Token; + +export type ReplaceTriggerData = Trigger; + +export type RetainDataData = string; + +export interface ShallowGroup { + created_at?: string; + description?: string; + id?: number; + name?: string; + updated_at?: string; +} + +export interface Token { + token?: string; +} + +export interface Trigger { + name?: string; +} + +export type UpdateBlockData = Block; + +export type UpdateDashboardData = Dashboard; + +export type UpdateDataData = DataResponse; + +export type UpdateFeedData = Feed; + +export type UpdateGroupData = Group; + +export type UpdatePermissionData = Permission; + +export type UpdateTokenData = Token; + +export type UpdateTriggerData = Trigger; + +export interface User { + color?: string; + /** @format dateTime */ + created_at?: string; + id?: number; + name?: string; + time_zone?: string; + /** @format dateTime */ + updated_at?: string; + username?: string; +} + +export namespace User { + /** + * No description + * @tags Users + * @name CurrentUser + * @summary Get information about the current user + * @request GET:/user + * @secure + */ + export namespace CurrentUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CurrentUserData; + } +} + +export namespace Webhooks { + /** + * @description The raw data webhook receiver accepts POST requests and stores the raw request body on your feed. This is useful when you don't have control of the webhook sender. If feed history is turned on, payloads will be truncated at 1024 bytes. If feed history is turned off, payloads will be truncated at 100KB. + * @tags Webhooks, Data + * @name CreateRawWebhookFeedData + * @summary Send arbitrary data to a feed via webhook URL. + * @request POST:/webhooks/feed/:token/raw + * @secure + */ + export namespace CreateRawWebhookFeedData { + export type RequestParams = { + token: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CreateRawWebhookFeedDataData; + } + /** + * No description + * @tags Webhooks, Data + * @name CreateWebhookFeedData + * @summary Send data to a feed via webhook URL. + * @request POST:/webhooks/feed/:token + * @secure + */ + export namespace CreateWebhookFeedData { + export type RequestParams = { + token: string; + }; + export type RequestQuery = {}; + export type RequestBody = CreateWebhookFeedDataPayload; + export type RequestHeaders = {}; + export type ResponseBody = CreateWebhookFeedDataData; + } +} + +export namespace Username { + /** + * No description + * @tags Groups, Feeds + * @name AddFeedToGroup + * @summary Add an existing Feed to a Group + * @request POST:/{username}/groups/{group_key}/add + * @secure + */ + export namespace AddFeedToGroup { + export type RequestParams = { + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + feed_key?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AddFeedToGroupData; + } + /** + * @description The Activities endpoint returns information about the user's activities. + * @tags Activities + * @name AllActivities + * @summary All activities for current user + * @request GET:/{username}/activities + * @secure + */ + export namespace AllActivities { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllActivitiesData; + } + /** + * @description The Blocks endpoint returns information about the user's blocks. + * @tags Blocks + * @name AllBlocks + * @summary All blocks for current user + * @request GET:/{username}/dashboards/{dashboard_id}/blocks + * @secure + */ + export namespace AllBlocks { + export type RequestParams = { + dashboardId: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllBlocksData; + } + /** + * @description The Dashboards endpoint returns information about the user's dashboards. + * @tags Dashboards + * @name AllDashboards + * @summary All dashboards for current user + * @request GET:/{username}/dashboards + * @secure + */ + export namespace AllDashboards { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllDashboardsData; + } + /** + * No description + * @tags Data + * @name AllData + * @summary Get all data for the given feed + * @request GET:/{username}/feeds/{feed_key}/data + * @secure + */ + export namespace AllData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllDataData; + } + /** + * @description The Feeds endpoint returns information about the user's feeds. The response includes the latest value of each feed, and other metadata about each feed. + * @tags Feeds + * @name AllFeeds + * @summary All feeds for current user + * @request GET:/{username}/feeds + * @secure + */ + export namespace AllFeeds { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllFeedsData; + } + /** + * No description + * @tags Data + * @name AllGroupFeedData + * @summary All data for current feed in a specific group + * @request GET:/{username}/groups/{group_key}/feeds/{feed_key}/data + * @secure + */ + export namespace AllGroupFeedData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + /** + * End time for filtering data. Returns data created before give time. + * @format date-time + */ + end_time?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering data. Returns data created after given time. + * @format date-time + */ + start_time?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllGroupFeedDataData; + } + /** + * @description The Group Feeds endpoint returns information about the user's feeds. The response includes the latest value of each feed, and other metadata about each feed, but only for feeds within the given group. + * @tags Groups, Feeds + * @name AllGroupFeeds + * @summary All feeds for current user in a given group + * @request GET:/{username}/groups/{group_key}/feeds + * @secure + */ + export namespace AllGroupFeeds { + export type RequestParams = { + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllGroupFeedsData; + } + /** + * @description The Groups endpoint returns information about the user's groups. The response includes the latest value of each feed in the group, and other metadata about the group. + * @tags Groups + * @name AllGroups + * @summary All groups for current user + * @request GET:/{username}/groups + * @secure + */ + export namespace AllGroups { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllGroupsData; + } + /** + * @description The Permissions endpoint returns information about the user's permissions. + * @tags Permissions + * @name AllPermissions + * @summary All permissions for current user and type + * @request GET:/{username}/{type}/{type_id}/acl + * @secure + */ + export namespace AllPermissions { + export type RequestParams = { + type: string; + typeId: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllPermissionsData; + } + /** + * @description The Tokens endpoint returns information about the user's tokens. + * @tags Tokens + * @name AllTokens + * @summary All tokens for current user + * @request GET:/{username}/tokens + * @secure + */ + export namespace AllTokens { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllTokensData; + } + /** + * @description The Triggers endpoint returns information about the user's triggers. + * @tags Triggers + * @name AllTriggers + * @summary All triggers for current user + * @request GET:/{username}/triggers + * @secure + */ + export namespace AllTriggers { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AllTriggersData; + } + /** + * No description + * @tags Data + * @name BatchCreateData + * @summary Create multiple new Data records + * @request POST:/{username}/feeds/{feed_key}/data/batch + * @secure + */ + export namespace BatchCreateData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }[]; + export type RequestHeaders = {}; + export type ResponseBody = BatchCreateDataData; + } + /** + * No description + * @tags Data + * @name BatchCreateGroupFeedData + * @summary Create multiple new Data records in a feed belonging to a particular group + * @request POST:/{username}/groups/{group_key}/feeds/{feed_key}/data/batch + * @secure + */ + export namespace BatchCreateGroupFeedData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }[]; + export type RequestHeaders = {}; + export type ResponseBody = BatchCreateGroupFeedDataData; + } + /** + * @description The Chart API is what we use on io.adafruit.com to populate charts over varying timespans with a consistent number of data points. The maximum number of points returned is 480. This API works by aggregating slices of time into a single value by averaging. All time-based parameters are optional, if none are given it will default to 1 hour at the finest-grained resolution possible. + * @tags Data + * @name ChartData + * @summary Chart data for current feed + * @request GET:/{username}/feeds/{feed_key}/data/chart + * @secure + */ + export namespace ChartData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** + * The number of hours the chart should cover. + * @format int32 + */ + hours?: number; + /** + * A resolution size in minutes. By giving a resolution value you will get back grouped data points aggregated over resolution-sized intervals. NOTE: time span is preferred over resolution, so if you request a span of time that includes more than max limit points you may get a larger resolution than you requested. Valid resolutions are 1, 5, 10, 30, 60, and 120. + * @format int32 + */ + resolution?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ChartDataData; + } + /** + * No description + * @tags Blocks + * @name CreateBlock + * @summary Create a new Block + * @request POST:/{username}/dashboards/{dashboard_id}/blocks + * @secure + */ + export namespace CreateBlock { + export type RequestParams = { + dashboardId: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + block_feeds?: { + feed_id?: string; + group_id?: string; + }[]; + column?: number; + dashboard_id?: number; + description?: string; + key?: string; + name?: string; + properties?: object; + row?: number; + size_x?: number; + size_y?: number; + visual_type?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = CreateBlockData; + } + /** + * No description + * @tags Dashboards + * @name CreateDashboard + * @summary Create a new Dashboard + * @request POST:/{username}/dashboards + * @secure + */ + export namespace CreateDashboard { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + description?: string; + key?: string; + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = CreateDashboardData; + } + /** + * @description Create new data records on the given feed. **NOTE:** when feed history is on, data \`value\` size is limited to 1KB, when feed history is turned off data value size is limited to 100KB. + * @tags Data + * @name CreateData + * @summary Create new Data + * @request POST:/{username}/feeds/{feed_key}/data + * @secure + */ + export namespace CreateData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = CreateDataData; + } + /** + * No description + * @tags Feeds + * @name CreateFeed + * @summary Create a new Feed + * @request POST:/{username}/feeds + * @secure + */ + export namespace CreateFeed { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + group_key?: string; + }; + export type RequestBody = { + description?: string; + key?: string; + license?: string; + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = CreateFeedData; + } + /** + * No description + * @tags Groups + * @name CreateGroup + * @summary Create a new Group + * @request POST:/{username}/groups + * @secure + */ + export namespace CreateGroup { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + description?: string; + key?: string; + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = CreateGroupData; + } + /** + * No description + * @tags Data + * @name CreateGroupData + * @summary Create new data for multiple feeds in a group + * @request POST:/{username}/groups/{group_key}/data + * @secure + */ + export namespace CreateGroupData { + export type RequestParams = { + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = CreateGroupDataPayload; + export type RequestHeaders = {}; + export type ResponseBody = CreateGroupDataData; + } + /** + * No description + * @tags Feeds + * @name CreateGroupFeed + * @summary Create a new Feed in a Group + * @request POST:/{username}/groups/{group_key}/feeds + * @secure + */ + export namespace CreateGroupFeed { + export type RequestParams = { + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + description?: string; + key?: string; + license?: string; + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = CreateGroupFeedData; + } + /** + * No description + * @tags Data + * @name CreateGroupFeedData + * @summary Create new Data in a feed belonging to a particular group + * @request POST:/{username}/groups/{group_key}/feeds/{feed_key}/data + * @secure + */ + export namespace CreateGroupFeedData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = CreateGroupFeedDataData; + } + /** + * No description + * @tags Permissions + * @name CreatePermission + * @summary Create a new Permission + * @request POST:/{username}/{type}/{type_id}/acl + * @secure + */ + export namespace CreatePermission { + export type RequestParams = { + type: string; + typeId: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + /** @default "r" */ + mode?: CreatePermissionModeEnum; + /** @default "public" */ + scope?: CreatePermissionScopeEnum; + scope_value?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = CreatePermissionData; + } + /** + * No description + * @tags Tokens + * @name CreateToken + * @summary Create a new Token + * @request POST:/{username}/tokens + * @secure + */ + export namespace CreateToken { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + token?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = CreateTokenData; + } + /** + * No description + * @tags Triggers + * @name CreateTrigger + * @summary Create a new Trigger + * @request POST:/{username}/triggers + * @secure + */ + export namespace CreateTrigger { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = CreateTriggerData; + } + /** + * @description Delete all your activities. + * @tags Activities + * @name DestroyActivities + * @summary All activities for current user + * @request DELETE:/{username}/activities + * @secure + */ + export namespace DestroyActivities { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DestroyActivitiesData; + } + /** + * No description + * @tags Blocks + * @name DestroyBlock + * @summary Delete an existing Block + * @request DELETE:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + export namespace DestroyBlock { + export type RequestParams = { + dashboardId: string; + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DestroyBlockData; + } + /** + * No description + * @tags Dashboards + * @name DestroyDashboard + * @summary Delete an existing Dashboard + * @request DELETE:/{username}/dashboards/{id} + * @secure + */ + export namespace DestroyDashboard { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DestroyDashboardData; + } + /** + * No description + * @tags Data + * @name DestroyData + * @summary Delete existing Data + * @request DELETE:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + export namespace DestroyData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DestroyDataData; + } + /** + * No description + * @tags Feeds + * @name DestroyFeed + * @summary Delete an existing Feed + * @request DELETE:/{username}/feeds/{feed_key} + * @secure + */ + export namespace DestroyFeed { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DestroyFeedData; + } + /** + * No description + * @tags Groups + * @name DestroyGroup + * @summary Delete an existing Group + * @request DELETE:/{username}/groups/{group_key} + * @secure + */ + export namespace DestroyGroup { + export type RequestParams = { + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DestroyGroupData; + } + /** + * No description + * @tags Permissions + * @name DestroyPermission + * @summary Delete an existing Permission + * @request DELETE:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + export namespace DestroyPermission { + export type RequestParams = { + id: string; + type: string; + typeId: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DestroyPermissionData; + } + /** + * No description + * @tags Tokens + * @name DestroyToken + * @summary Delete an existing Token + * @request DELETE:/{username}/tokens/{id} + * @secure + */ + export namespace DestroyToken { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DestroyTokenData; + } + /** + * No description + * @tags Triggers + * @name DestroyTrigger + * @summary Delete an existing Trigger + * @request DELETE:/{username}/triggers/{id} + * @secure + */ + export namespace DestroyTrigger { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DestroyTriggerData; + } + /** + * @description Get the oldest data point in the feed. This request sets the queue pointer to the beginning of the feed. + * @tags Data + * @name FirstData + * @summary First Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/first + * @secure + */ + export namespace FirstData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FirstDataData; + } + /** + * @description The Activities endpoint returns information about the user's activities. + * @tags Activities + * @name GetActivity + * @summary Get activities by type for current user + * @request GET:/{username}/activities/{type} + * @secure + */ + export namespace GetActivity { + export type RequestParams = { + type: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetActivityData; + } + /** + * No description + * @tags Blocks + * @name GetBlock + * @summary Returns Block based on ID + * @request GET:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + export namespace GetBlock { + export type RequestParams = { + dashboardId: string; + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetBlockData; + } + /** + * No description + * @tags Users + * @name GetCurrentUserThrottle + * @summary Get the user's data rate limit and current activity level. + * @request GET:/{username}/throttle + * @secure + */ + export namespace GetCurrentUserThrottle { + export type RequestParams = { + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetCurrentUserThrottleData; + } + /** + * No description + * @tags Dashboards + * @name GetDashboard + * @summary Returns Dashboard based on ID + * @request GET:/{username}/dashboards/{id} + * @secure + */ + export namespace GetDashboard { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetDashboardData; + } + /** + * No description + * @tags Data + * @name GetData + * @summary Returns data based on feed key + * @request GET:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + export namespace GetData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetDataData; + } + /** + * @description Returns feed based on the feed key + * @tags Feeds + * @name GetFeed + * @summary Get feed by feed key + * @request GET:/{username}/feeds/{feed_key} + * @secure + */ + export namespace GetFeed { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetFeedData; + } + /** + * @description Returns more detailed feed record based on the feed key + * @tags Feeds + * @name GetFeedDetails + * @summary Get detailed feed by feed key + * @request GET:/{username}/feeds/{feed_key}/details + * @secure + */ + export namespace GetFeedDetails { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetFeedDetailsData; + } + /** + * No description + * @tags Groups + * @name GetGroup + * @summary Returns Group based on ID + * @request GET:/{username}/groups/{group_key} + * @secure + */ + export namespace GetGroup { + export type RequestParams = { + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetGroupData; + } + /** + * No description + * @tags Permissions + * @name GetPermission + * @summary Returns Permission based on ID + * @request GET:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + export namespace GetPermission { + export type RequestParams = { + id: string; + type: string; + typeId: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetPermissionData; + } + /** + * No description + * @tags Tokens + * @name GetToken + * @summary Returns Token based on ID + * @request GET:/{username}/tokens/{id} + * @secure + */ + export namespace GetToken { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetTokenData; + } + /** + * No description + * @tags Triggers + * @name GetTrigger + * @summary Returns Trigger based on ID + * @request GET:/{username}/triggers/{id} + * @secure + */ + export namespace GetTrigger { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetTriggerData; + } + /** + * @description Get the most recent data point in the feed. This request sets the queue pointer to the end of the feed. + * @tags Data + * @name LastData + * @summary Last Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/last + * @secure + */ + export namespace LastData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = LastDataData; + } + /** + * @description Get the next newest data point in the feed. If queue processing hasn't been started, the first data point in the feed will be returned. + * @tags Data + * @name NextData + * @summary Next Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/next + * @secure + */ + export namespace NextData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = NextDataData; + } + /** + * @description Get the previously processed data point in the feed. NOTE: this method doesn't move the processing queue pointer. + * @tags Data + * @name PreviousData + * @summary Previous Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/previous + * @secure + */ + export namespace PreviousData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PreviousDataData; + } + /** + * No description + * @tags Groups, Feeds + * @name RemoveFeedFromGroup + * @summary Remove a Feed from a Group + * @request POST:/{username}/groups/{group_key}/remove + * @secure + */ + export namespace RemoveFeedFromGroup { + export type RequestParams = { + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = { + feed_key?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = RemoveFeedFromGroupData; + } + /** + * No description + * @tags Blocks + * @name ReplaceBlock + * @summary Replace an existing Block + * @request PUT:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + export namespace ReplaceBlock { + export type RequestParams = { + dashboardId: string; + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + block_feeds?: { + feed_id?: string; + group_id?: string; + }[]; + column?: number; + dashboard_id?: number; + description?: string; + key?: string; + name?: string; + properties?: object; + row?: number; + size_x?: number; + size_y?: number; + visual_type?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = ReplaceBlockData; + } + /** + * No description + * @tags Dashboards + * @name ReplaceDashboard + * @summary Replace an existing Dashboard + * @request PUT:/{username}/dashboards/{id} + * @secure + */ + export namespace ReplaceDashboard { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + description?: string; + key?: string; + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = ReplaceDashboardData; + } + /** + * No description + * @tags Data + * @name ReplaceData + * @summary Replace existing Data + * @request PUT:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + export namespace ReplaceData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = ReplaceDataData; + } + /** + * No description + * @tags Feeds + * @name ReplaceFeed + * @summary Replace an existing Feed + * @request PUT:/{username}/feeds/{feed_key} + * @secure + */ + export namespace ReplaceFeed { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + description?: string; + key?: string; + license?: string; + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = ReplaceFeedData; + } + /** + * No description + * @tags Groups + * @name ReplaceGroup + * @summary Replace an existing Group + * @request PUT:/{username}/groups/{group_key} + * @secure + */ + export namespace ReplaceGroup { + export type RequestParams = { + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + description?: string; + key?: string; + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = ReplaceGroupData; + } + /** + * No description + * @tags Permissions + * @name ReplacePermission + * @summary Replace an existing Permission + * @request PUT:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + export namespace ReplacePermission { + export type RequestParams = { + id: string; + type: string; + typeId: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + /** @default "r" */ + mode?: CreatePermissionModeEnum; + /** @default "public" */ + scope?: CreatePermissionScopeEnum; + scope_value?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = ReplacePermissionData; + } + /** + * No description + * @tags Tokens + * @name ReplaceToken + * @summary Replace an existing Token + * @request PUT:/{username}/tokens/{id} + * @secure + */ + export namespace ReplaceToken { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + token?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = ReplaceTokenData; + } + /** + * No description + * @tags Triggers + * @name ReplaceTrigger + * @summary Replace an existing Trigger + * @request PUT:/{username}/triggers/{id} + * @secure + */ + export namespace ReplaceTrigger { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = ReplaceTriggerData; + } + /** + * @description Get the most recent data point in the feed in an MQTT compatible CSV format: \`value,lat,lon,ele\` + * @tags Data + * @name RetainData + * @summary Last Data in MQTT CSV format + * @request GET:/{username}/feeds/{feed_key}/data/retain + * @secure + */ + export namespace RetainData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = RetainDataData; + } + /** + * No description + * @tags Blocks + * @name UpdateBlock + * @summary Update properties of an existing Block + * @request PATCH:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + export namespace UpdateBlock { + export type RequestParams = { + dashboardId: string; + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + block_feeds?: { + feed_id?: string; + group_id?: string; + }[]; + column?: number; + dashboard_id?: number; + description?: string; + key?: string; + name?: string; + properties?: object; + row?: number; + size_x?: number; + size_y?: number; + visual_type?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = UpdateBlockData; + } + /** + * No description + * @tags Dashboards + * @name UpdateDashboard + * @summary Update properties of an existing Dashboard + * @request PATCH:/{username}/dashboards/{id} + * @secure + */ + export namespace UpdateDashboard { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + description?: string; + key?: string; + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = UpdateDashboardData; + } + /** + * No description + * @tags Data + * @name UpdateData + * @summary Update properties of existing Data + * @request PATCH:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + export namespace UpdateData { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = UpdateDataData; + } + /** + * No description + * @tags Feeds + * @name UpdateFeed + * @summary Update properties of an existing Feed + * @request PATCH:/{username}/feeds/{feed_key} + * @secure + */ + export namespace UpdateFeed { + export type RequestParams = { + /** a valid feed key */ + feedKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + description?: string; + key?: string; + license?: string; + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = UpdateFeedData; + } + /** + * No description + * @tags Groups + * @name UpdateGroup + * @summary Update properties of an existing Group + * @request PATCH:/{username}/groups/{group_key} + * @secure + */ + export namespace UpdateGroup { + export type RequestParams = { + groupKey: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + description?: string; + key?: string; + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = UpdateGroupData; + } + /** + * No description + * @tags Permissions + * @name UpdatePermission + * @summary Update properties of an existing Permission + * @request PATCH:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + export namespace UpdatePermission { + export type RequestParams = { + id: string; + type: string; + typeId: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + /** @default "r" */ + mode?: CreatePermissionModeEnum; + /** @default "public" */ + scope?: CreatePermissionScopeEnum; + scope_value?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = UpdatePermissionData; + } + /** + * No description + * @tags Tokens + * @name UpdateToken + * @summary Update properties of an existing Token + * @request PATCH:/{username}/tokens/{id} + * @secure + */ + export namespace UpdateToken { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + token?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = UpdateTokenData; + } + /** + * No description + * @tags Triggers + * @name UpdateTrigger + * @summary Update properties of an existing Trigger + * @request PATCH:/{username}/triggers/{id} + * @secure + */ + export namespace UpdateTrigger { + export type RequestParams = { + id: string; + /** a valid username string */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = { + name?: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = UpdateTriggerData; + } +} + +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://io.adafruit.com/api/v2"; + 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.clone() 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 Adafruit IO + * @version 2.0.0 + * @baseUrl https://io.adafruit.com/api/v2 + * + * ### The Internet of Things for Everyone + * + * The Adafruit IO HTTP API provides access to your Adafruit IO data from any programming language or hardware environment that can speak HTTP. The easiest way to get started is with [an Adafruit IO learn guide](https://learn.adafruit.com/series/adafruit-io-basics) and [a simple Internet of Things capable device like the Feather Huzzah](https://www.adafruit.com/product/2821). + * + * This API documentation is hosted on GitHub Pages and is available at [https://github.com/adafruit/io-api](https://github.com/adafruit/io-api). For questions or comments visit the [Adafruit IO Forums](https://forums.adafruit.com/viewforum.php?f=56) or the [adafruit-io channel on the Adafruit Discord server](https://discord.gg/adafruit). + * + * #### Authentication + * + * Authentication for every API request happens through the \`X-AIO-Key\` header or query parameter and your IO API key. A simple cURL request to get all available feeds for a user with the username "io_username" and the key "io_key_12345" could look like this: + * + * $ curl -H "X-AIO-Key: io_key_12345" https://io.adafruit.com/api/v2/io_username/feeds + * + * Or like this: + * + * $ curl "https://io.adafruit.com/api/v2/io_username/feeds?X-AIO-Key=io_key_12345 + * + * Using the node.js [request](https://github.com/request/request) library, IO HTTP requests are as easy as: + * + * \`\`\`js + * var request = require('request'); + * + * var options = { + * url: 'https://io.adafruit.com/api/v2/io_username/feeds', + * headers: { + * 'X-AIO-Key': 'io_key_12345', + * 'Content-Type': 'application/json' + * } + * }; + * + * function callback(error, response, body) { + * if (!error && response.statusCode == 200) { + * var feeds = JSON.parse(body); + * console.log(feeds.length + " FEEDS AVAILABLE"); + * + * feeds.forEach(function (feed) { + * console.log(feed.name, feed.key); + * }) + * } + * } + * + * request(options, callback); + * \`\`\` + * + * Using the ESP8266 Arduino HTTPClient library, an HTTPS GET request would look like this (replacing \`---\` with your own values in the appropriate locations): + * + * \`\`\`arduino + * /// based on + * /// https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/examples/Authorization/Authorization.ino + * + * #include + * #include + * #include + * #include + * + * ESP8266WiFiMulti WiFiMulti; + * + * const char* ssid = "---"; + * const char* password = "---"; + * + * const char* host = "io.adafruit.com"; + * + * const char* io_key = "---"; + * const char* path_with_username = "/api/v2/---/dashboards"; + * + * // Use web browser to view and copy + * // SHA1 fingerprint of the certificate + * const char* fingerprint = "77 00 54 2D DA E7 D8 03 27 31 23 99 EB 27 DB CB A5 4C 57 18"; + * + * void setup() { + * Serial.begin(115200); + * + * for(uint8_t t = 4; t > 0; t--) { + * Serial.printf("[SETUP] WAIT %d...\\n", t); + * Serial.flush(); + * delay(1000); + * } + * + * WiFi.mode(WIFI_STA); + * WiFiMulti.addAP(ssid, password); + * + * // wait for WiFi connection + * while(WiFiMulti.run() != WL_CONNECTED) { + * Serial.print('.'); + * delay(1000); + * } + * + * Serial.println("[WIFI] connected!"); + * + * HTTPClient http; + * + * // start request with URL and TLS cert fingerprint for verification + * http.begin("https://" + String(host) + String(path_with_username), fingerprint); + * + * // IO API authentication + * http.addHeader("X-AIO-Key", io_key); + * + * // start connection and send HTTP header + * int httpCode = http.GET(); + * + * // httpCode will be negative on error + * if(httpCode > 0) { + * // HTTP header has been send and Server response header has been handled + * Serial.printf("[HTTP] GET response: %d\\n", httpCode); + * + * // HTTP 200 OK + * if(httpCode == HTTP_CODE_OK) { + * String payload = http.getString(); + * Serial.println(payload); + * } + * + * http.end(); + * } + * } + * + * void loop() {} + * \`\`\` + * + * #### Client Libraries + * + * We have client libraries to help you get started with your project: [Python](https://github.com/adafruit/io-client-python), [Ruby](https://github.com/adafruit/io-client-ruby), [Arduino C++](https://github.com/adafruit/Adafruit_IO_Arduino), [Javascript](https://github.com/adafruit/adafruit-io-node), and [Go](https://github.com/adafruit/io-client-go) are available. They're all open source, so if they don't already do what you want, you can fork and add any feature you'd like. + * + */ +export class Api extends HttpClient { + user = { + /** + * No description + * + * @tags Users + * @name CurrentUser + * @summary Get information about the current user + * @request GET:/user + * @secure + */ + currentUser: (params: RequestParams = {}) => + this.request({ + path: \`/user\`, + method: "GET", + secure: true, + ...params, + }), + }; + webhooks = { + /** + * @description The raw data webhook receiver accepts POST requests and stores the raw request body on your feed. This is useful when you don't have control of the webhook sender. If feed history is turned on, payloads will be truncated at 1024 bytes. If feed history is turned off, payloads will be truncated at 100KB. + * + * @tags Webhooks, Data + * @name CreateRawWebhookFeedData + * @summary Send arbitrary data to a feed via webhook URL. + * @request POST:/webhooks/feed/:token/raw + * @secure + */ + createRawWebhookFeedData: (token: string, params: RequestParams = {}) => + this.request({ + path: \`/webhooks/feed/\${token}/raw\`, + method: "POST", + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Webhooks, Data + * @name CreateWebhookFeedData + * @summary Send data to a feed via webhook URL. + * @request POST:/webhooks/feed/:token + * @secure + */ + createWebhookFeedData: (token: string, payload: CreateWebhookFeedDataPayload, params: RequestParams = {}) => + this.request({ + path: \`/webhooks/feed/\${token}\`, + method: "POST", + body: payload, + secure: true, + type: ContentType.Json, + ...params, + }), + }; + username = { + /** + * No description + * + * @tags Groups, Feeds + * @name AddFeedToGroup + * @summary Add an existing Feed to a Group + * @request POST:/{username}/groups/{group_key}/add + * @secure + */ + addFeedToGroup: ({ groupKey, username, ...query }: AddFeedToGroupParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/add\`, + method: "POST", + query: query, + secure: true, + ...params, + }), + + /** + * @description The Activities endpoint returns information about the user's activities. + * + * @tags Activities + * @name AllActivities + * @summary All activities for current user + * @request GET:/{username}/activities + * @secure + */ + allActivities: ({ username, ...query }: AllActivitiesParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/activities\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description The Blocks endpoint returns information about the user's blocks. + * + * @tags Blocks + * @name AllBlocks + * @summary All blocks for current user + * @request GET:/{username}/dashboards/{dashboard_id}/blocks + * @secure + */ + allBlocks: (username: string, dashboardId: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description The Dashboards endpoint returns information about the user's dashboards. + * + * @tags Dashboards + * @name AllDashboards + * @summary All dashboards for current user + * @request GET:/{username}/dashboards + * @secure + */ + allDashboards: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Data + * @name AllData + * @summary Get all data for the given feed + * @request GET:/{username}/feeds/{feed_key}/data + * @secure + */ + allData: ({ username, feedKey, ...query }: AllDataParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description The Feeds endpoint returns information about the user's feeds. The response includes the latest value of each feed, and other metadata about each feed. + * + * @tags Feeds + * @name AllFeeds + * @summary All feeds for current user + * @request GET:/{username}/feeds + * @secure + */ + allFeeds: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Data + * @name AllGroupFeedData + * @summary All data for current feed in a specific group + * @request GET:/{username}/groups/{group_key}/feeds/{feed_key}/data + * @secure + */ + allGroupFeedData: ({ username, groupKey, feedKey, ...query }: AllGroupFeedDataParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/feeds/\${feedKey}/data\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description The Group Feeds endpoint returns information about the user's feeds. The response includes the latest value of each feed, and other metadata about each feed, but only for feeds within the given group. + * + * @tags Groups, Feeds + * @name AllGroupFeeds + * @summary All feeds for current user in a given group + * @request GET:/{username}/groups/{group_key}/feeds + * @secure + */ + allGroupFeeds: (groupKey: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/feeds\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description The Groups endpoint returns information about the user's groups. The response includes the latest value of each feed in the group, and other metadata about the group. + * + * @tags Groups + * @name AllGroups + * @summary All groups for current user + * @request GET:/{username}/groups + * @secure + */ + allGroups: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description The Permissions endpoint returns information about the user's permissions. + * + * @tags Permissions + * @name AllPermissions + * @summary All permissions for current user and type + * @request GET:/{username}/{type}/{type_id}/acl + * @secure + */ + allPermissions: (username: string, type: string, typeId: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description The Tokens endpoint returns information about the user's tokens. + * + * @tags Tokens + * @name AllTokens + * @summary All tokens for current user + * @request GET:/{username}/tokens + * @secure + */ + allTokens: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/tokens\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description The Triggers endpoint returns information about the user's triggers. + * + * @tags Triggers + * @name AllTriggers + * @summary All triggers for current user + * @request GET:/{username}/triggers + * @secure + */ + allTriggers: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/triggers\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Data + * @name BatchCreateData + * @summary Create multiple new Data records + * @request POST:/{username}/feeds/{feed_key}/data/batch + * @secure + */ + batchCreateData: ( + username: string, + feedKey: string, + data: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }[], + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/batch\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Data + * @name BatchCreateGroupFeedData + * @summary Create multiple new Data records in a feed belonging to a particular group + * @request POST:/{username}/groups/{group_key}/feeds/{feed_key}/data/batch + * @secure + */ + batchCreateGroupFeedData: ( + username: string, + groupKey: string, + feedKey: string, + data: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }[], + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/feeds/\${feedKey}/data/batch\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * @description The Chart API is what we use on io.adafruit.com to populate charts over varying timespans with a consistent number of data points. The maximum number of points returned is 480. This API works by aggregating slices of time into a single value by averaging. All time-based parameters are optional, if none are given it will default to 1 hour at the finest-grained resolution possible. + * + * @tags Data + * @name ChartData + * @summary Chart data for current feed + * @request GET:/{username}/feeds/{feed_key}/data/chart + * @secure + */ + chartData: ({ username, feedKey, ...query }: ChartDataParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/chart\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Blocks + * @name CreateBlock + * @summary Create a new Block + * @request POST:/{username}/dashboards/{dashboard_id}/blocks + * @secure + */ + createBlock: ( + username: string, + dashboardId: string, + block: { + block_feeds?: { + feed_id?: string; + group_id?: string; + }[]; + column?: number; + dashboard_id?: number; + description?: string; + key?: string; + name?: string; + properties?: object; + row?: number; + size_x?: number; + size_y?: number; + visual_type?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks\`, + method: "POST", + body: block, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Dashboards + * @name CreateDashboard + * @summary Create a new Dashboard + * @request POST:/{username}/dashboards + * @secure + */ + createDashboard: ( + username: string, + dashboard: { + description?: string; + key?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/dashboards\`, + method: "POST", + body: dashboard, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * @description Create new data records on the given feed. **NOTE:** when feed history is on, data \`value\` size is limited to 1KB, when feed history is turned off data value size is limited to 100KB. + * + * @tags Data + * @name CreateData + * @summary Create new Data + * @request POST:/{username}/feeds/{feed_key}/data + * @secure + */ + createData: ( + username: string, + feedKey: string, + datum: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data\`, + method: "POST", + body: datum, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Feeds + * @name CreateFeed + * @summary Create a new Feed + * @request POST:/{username}/feeds + * @secure + */ + createFeed: ( + { username, ...query }: CreateFeedParams, + feed: { + description?: string; + key?: string; + license?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds\`, + method: "POST", + query: query, + body: feed, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Groups + * @name CreateGroup + * @summary Create a new Group + * @request POST:/{username}/groups + * @secure + */ + createGroup: ( + username: string, + group: { + description?: string; + key?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups\`, + method: "POST", + body: group, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Data + * @name CreateGroupData + * @summary Create new data for multiple feeds in a group + * @request POST:/{username}/groups/{group_key}/data + * @secure + */ + createGroupData: ( + username: string, + groupKey: string, + group_feed_data: CreateGroupDataPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/data\`, + method: "POST", + body: group_feed_data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Feeds + * @name CreateGroupFeed + * @summary Create a new Feed in a Group + * @request POST:/{username}/groups/{group_key}/feeds + * @secure + */ + createGroupFeed: ( + username: string, + groupKey: string, + feed: { + description?: string; + key?: string; + license?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/feeds\`, + method: "POST", + body: feed, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Data + * @name CreateGroupFeedData + * @summary Create new Data in a feed belonging to a particular group + * @request POST:/{username}/groups/{group_key}/feeds/{feed_key}/data + * @secure + */ + createGroupFeedData: ( + username: string, + groupKey: string, + feedKey: string, + datum: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/feeds/\${feedKey}/data\`, + method: "POST", + body: datum, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Permissions + * @name CreatePermission + * @summary Create a new Permission + * @request POST:/{username}/{type}/{type_id}/acl + * @secure + */ + createPermission: ( + username: string, + type: string, + typeId: string, + permission: { + /** @default "r" */ + mode?: CreatePermissionModeEnum; + /** @default "public" */ + scope?: CreatePermissionScopeEnum; + scope_value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl\`, + method: "POST", + body: permission, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Tokens + * @name CreateToken + * @summary Create a new Token + * @request POST:/{username}/tokens + * @secure + */ + createToken: ( + username: string, + token: { + token?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/tokens\`, + method: "POST", + body: token, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Triggers + * @name CreateTrigger + * @summary Create a new Trigger + * @request POST:/{username}/triggers + * @secure + */ + createTrigger: ( + username: string, + trigger: { + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/triggers\`, + method: "POST", + body: trigger, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * @description Delete all your activities. + * + * @tags Activities + * @name DestroyActivities + * @summary All activities for current user + * @request DELETE:/{username}/activities + * @secure + */ + destroyActivities: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/activities\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Blocks + * @name DestroyBlock + * @summary Delete an existing Block + * @request DELETE:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + destroyBlock: (username: string, dashboardId: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks/\${id}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Dashboards + * @name DestroyDashboard + * @summary Delete an existing Dashboard + * @request DELETE:/{username}/dashboards/{id} + * @secure + */ + destroyDashboard: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${id}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Data + * @name DestroyData + * @summary Delete existing Data + * @request DELETE:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + destroyData: (username: string, feedKey: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/\${id}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Feeds + * @name DestroyFeed + * @summary Delete an existing Feed + * @request DELETE:/{username}/feeds/{feed_key} + * @secure + */ + destroyFeed: (username: string, feedKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Groups + * @name DestroyGroup + * @summary Delete an existing Group + * @request DELETE:/{username}/groups/{group_key} + * @secure + */ + destroyGroup: (username: string, groupKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups/\${groupKey}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Permissions + * @name DestroyPermission + * @summary Delete an existing Permission + * @request DELETE:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + destroyPermission: (username: string, type: string, typeId: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl/\${id}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Tokens + * @name DestroyToken + * @summary Delete an existing Token + * @request DELETE:/{username}/tokens/{id} + * @secure + */ + destroyToken: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/tokens/\${id}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Triggers + * @name DestroyTrigger + * @summary Delete an existing Trigger + * @request DELETE:/{username}/triggers/{id} + * @secure + */ + destroyTrigger: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/triggers/\${id}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * @description Get the oldest data point in the feed. This request sets the queue pointer to the beginning of the feed. + * + * @tags Data + * @name FirstData + * @summary First Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/first + * @secure + */ + firstData: ({ username, feedKey, ...query }: FirstDataParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/first\`, + method: "GET", + query: query, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * @description The Activities endpoint returns information about the user's activities. + * + * @tags Activities + * @name GetActivity + * @summary Get activities by type for current user + * @request GET:/{username}/activities/{type} + * @secure + */ + getActivity: ({ username, type, ...query }: GetActivityParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/activities/\${type}\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Blocks + * @name GetBlock + * @summary Returns Block based on ID + * @request GET:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + getBlock: (username: string, dashboardId: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Users + * @name GetCurrentUserThrottle + * @summary Get the user's data rate limit and current activity level. + * @request GET:/{username}/throttle + * @secure + */ + getCurrentUserThrottle: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/throttle\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Dashboards + * @name GetDashboard + * @summary Returns Dashboard based on ID + * @request GET:/{username}/dashboards/{id} + * @secure + */ + getDashboard: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Data + * @name GetData + * @summary Returns data based on feed key + * @request GET:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + getData: ({ username, feedKey, id, ...query }: GetDataParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/\${id}\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Returns feed based on the feed key + * + * @tags Feeds + * @name GetFeed + * @summary Get feed by feed key + * @request GET:/{username}/feeds/{feed_key} + * @secure + */ + getFeed: (username: string, feedKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description Returns more detailed feed record based on the feed key + * + * @tags Feeds + * @name GetFeedDetails + * @summary Get detailed feed by feed key + * @request GET:/{username}/feeds/{feed_key}/details + * @secure + */ + getFeedDetails: (username: string, feedKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/details\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Groups + * @name GetGroup + * @summary Returns Group based on ID + * @request GET:/{username}/groups/{group_key} + * @secure + */ + getGroup: (username: string, groupKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups/\${groupKey}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Permissions + * @name GetPermission + * @summary Returns Permission based on ID + * @request GET:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + getPermission: (username: string, type: string, typeId: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Tokens + * @name GetToken + * @summary Returns Token based on ID + * @request GET:/{username}/tokens/{id} + * @secure + */ + getToken: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/tokens/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Triggers + * @name GetTrigger + * @summary Returns Trigger based on ID + * @request GET:/{username}/triggers/{id} + * @secure + */ + getTrigger: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/triggers/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description Get the most recent data point in the feed. This request sets the queue pointer to the end of the feed. + * + * @tags Data + * @name LastData + * @summary Last Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/last + * @secure + */ + lastData: ({ username, feedKey, ...query }: LastDataParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/last\`, + method: "GET", + query: query, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * @description Get the next newest data point in the feed. If queue processing hasn't been started, the first data point in the feed will be returned. + * + * @tags Data + * @name NextData + * @summary Next Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/next + * @secure + */ + nextData: ({ username, feedKey, ...query }: NextDataParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/next\`, + method: "GET", + query: query, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * @description Get the previously processed data point in the feed. NOTE: this method doesn't move the processing queue pointer. + * + * @tags Data + * @name PreviousData + * @summary Previous Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/previous + * @secure + */ + previousData: ({ username, feedKey, ...query }: PreviousDataParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/previous\`, + method: "GET", + query: query, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Groups, Feeds + * @name RemoveFeedFromGroup + * @summary Remove a Feed from a Group + * @request POST:/{username}/groups/{group_key}/remove + * @secure + */ + removeFeedFromGroup: ({ groupKey, username, ...query }: RemoveFeedFromGroupParams, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/remove\`, + method: "POST", + query: query, + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Blocks + * @name ReplaceBlock + * @summary Replace an existing Block + * @request PUT:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + replaceBlock: ( + username: string, + dashboardId: string, + id: string, + block: { + block_feeds?: { + feed_id?: string; + group_id?: string; + }[]; + column?: number; + dashboard_id?: number; + description?: string; + key?: string; + name?: string; + properties?: object; + row?: number; + size_x?: number; + size_y?: number; + visual_type?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks/\${id}\`, + method: "PUT", + body: block, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Dashboards + * @name ReplaceDashboard + * @summary Replace an existing Dashboard + * @request PUT:/{username}/dashboards/{id} + * @secure + */ + replaceDashboard: ( + username: string, + id: string, + dashboard: { + description?: string; + key?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/dashboards/\${id}\`, + method: "PUT", + body: dashboard, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Data + * @name ReplaceData + * @summary Replace existing Data + * @request PUT:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + replaceData: ( + username: string, + feedKey: string, + id: string, + datum: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/\${id}\`, + method: "PUT", + body: datum, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Feeds + * @name ReplaceFeed + * @summary Replace an existing Feed + * @request PUT:/{username}/feeds/{feed_key} + * @secure + */ + replaceFeed: ( + username: string, + feedKey: string, + feed: { + description?: string; + key?: string; + license?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}\`, + method: "PUT", + body: feed, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Groups + * @name ReplaceGroup + * @summary Replace an existing Group + * @request PUT:/{username}/groups/{group_key} + * @secure + */ + replaceGroup: ( + username: string, + groupKey: string, + group: { + description?: string; + key?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}\`, + method: "PUT", + body: group, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Permissions + * @name ReplacePermission + * @summary Replace an existing Permission + * @request PUT:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + replacePermission: ( + username: string, + type: string, + typeId: string, + id: string, + permission: { + /** @default "r" */ + mode?: CreatePermissionModeEnum; + /** @default "public" */ + scope?: CreatePermissionScopeEnum; + scope_value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl/\${id}\`, + method: "PUT", + body: permission, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Tokens + * @name ReplaceToken + * @summary Replace an existing Token + * @request PUT:/{username}/tokens/{id} + * @secure + */ + replaceToken: ( + username: string, + id: string, + token: { + token?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/tokens/\${id}\`, + method: "PUT", + body: token, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Triggers + * @name ReplaceTrigger + * @summary Replace an existing Trigger + * @request PUT:/{username}/triggers/{id} + * @secure + */ + replaceTrigger: ( + username: string, + id: string, + trigger: { + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/triggers/\${id}\`, + method: "PUT", + body: trigger, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * @description Get the most recent data point in the feed in an MQTT compatible CSV format: \`value,lat,lon,ele\` + * + * @tags Data + * @name RetainData + * @summary Last Data in MQTT CSV format + * @request GET:/{username}/feeds/{feed_key}/data/retain + * @secure + */ + retainData: (username: string, feedKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/retain\`, + method: "GET", + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Blocks + * @name UpdateBlock + * @summary Update properties of an existing Block + * @request PATCH:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + updateBlock: ( + username: string, + dashboardId: string, + id: string, + block: { + block_feeds?: { + feed_id?: string; + group_id?: string; + }[]; + column?: number; + dashboard_id?: number; + description?: string; + key?: string; + name?: string; + properties?: object; + row?: number; + size_x?: number; + size_y?: number; + visual_type?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks/\${id}\`, + method: "PATCH", + body: block, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Dashboards + * @name UpdateDashboard + * @summary Update properties of an existing Dashboard + * @request PATCH:/{username}/dashboards/{id} + * @secure + */ + updateDashboard: ( + username: string, + id: string, + dashboard: { + description?: string; + key?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/dashboards/\${id}\`, + method: "PATCH", + body: dashboard, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Data + * @name UpdateData + * @summary Update properties of existing Data + * @request PATCH:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + updateData: ( + username: string, + feedKey: string, + id: string, + datum: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/\${id}\`, + method: "PATCH", + body: datum, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Feeds + * @name UpdateFeed + * @summary Update properties of an existing Feed + * @request PATCH:/{username}/feeds/{feed_key} + * @secure + */ + updateFeed: ( + username: string, + feedKey: string, + feed: { + description?: string; + key?: string; + license?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}\`, + method: "PATCH", + body: feed, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Groups + * @name UpdateGroup + * @summary Update properties of an existing Group + * @request PATCH:/{username}/groups/{group_key} + * @secure + */ + updateGroup: ( + username: string, + groupKey: string, + group: { + description?: string; + key?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}\`, + method: "PATCH", + body: group, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Permissions + * @name UpdatePermission + * @summary Update properties of an existing Permission + * @request PATCH:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + updatePermission: ( + username: string, + type: string, + typeId: string, + id: string, + permission: { + /** @default "r" */ + mode?: CreatePermissionModeEnum; + /** @default "public" */ + scope?: CreatePermissionScopeEnum; + scope_value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl/\${id}\`, + method: "PATCH", + body: permission, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Tokens + * @name UpdateToken + * @summary Update properties of an existing Token + * @request PATCH:/{username}/tokens/{id} + * @secure + */ + updateToken: ( + username: string, + id: string, + token: { + token?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/tokens/\${id}\`, + method: "PATCH", + body: token, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Triggers + * @name UpdateTrigger + * @summary Update properties of an existing Trigger + * @request PATCH:/{username}/triggers/{id} + * @secure + */ + updateTrigger: ( + username: string, + id: string, + trigger: { + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/triggers/\${id}\`, + method: "PATCH", + body: trigger, + secure: true, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'additional-properties' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Message { + code?: number; + text?: string; +} + +export type Messages = Record; + +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.clone() 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 Additional properties Example + * @version 1.0.0 + */ +export class Api extends HttpClient {} +" +`; + +exports[`extended > 'additional-properties2' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type Primitive = string | number | boolean | null; + +export type PrimitiveMap = Record; + +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.clone() 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 + */ +export class Api extends HttpClient {} +" +`; + +exports[`extended > 'allof-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type Cat = Pet & { + age?: number; + hunts?: boolean; +}; + +export type Dog = Pet & { + bark?: boolean; + breed: DogBreedEnum; +}; + +export enum DogBreedEnum { + Dingo = "Dingo", + Husky = "Husky", + Retriever = "Retriever", + Shepherd = "Shepherd", +} + +export interface Pet { + pet_type: string; +} + +export type PetsPartialUpdateData = any; + +export type PetsPartialUpdatePayload = Cat | Dog; + +export namespace Pets { + /** + * No description + * @name PetsPartialUpdate + * @request PATCH:/pets + */ + export namespace PetsPartialUpdate { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = PetsPartialUpdatePayload; + export type RequestHeaders = {}; + export type ResponseBody = PetsPartialUpdateData; + } +} + +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.clone() 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 Allof Example + * @version 1.0.0 + */ +export class Api extends HttpClient { + pets = { + /** + * No description + * + * @name PetsPartialUpdate + * @request PATCH:/pets + */ + petsPartialUpdate: (data: PetsPartialUpdatePayload, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'another-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** some description */ +export interface Amount { + /** some description */ + currency: Currency; + /** + * some description + * @format double + * @min 0.01 + * @max 1000000000000000 + */ + value: number; +} + +/** + * An uploaded response + * Describes the result of uploading an image resource + * @example {"code":0,"type":"type","message":"message"} + */ +export interface ApiResponse { + /** @format int32 */ + code?: number; + message?: string; + type?: string; +} + +/** + * Pet category + * A category for a pet + * @example {"name":"name","id":6} + */ +export interface Category { + /** @format int64 */ + id?: number; + name?: string; +} + +/** + * some description + * @pattern ^[A-Z]{3,3}$ + */ +export type Currency = string; + +export type FindPetsByStatusData = Pet[]; + +export interface FindPetsByStatusParams { + /** Status values that need to be considered for filter */ + status: StatusEnum[]; +} + +/** @default "available" */ +export enum FindPetsByStatusParams1StatusEnum { + Available = "available", + Pending = "pending", + Sold = "sold", +} + +export type FindPetsByTagsData = Pet[]; + +export interface FindPetsByTagsParams { + /** Tags to filter by */ + tags: string[]; +} + +export type FormUrlEncodedRequest2Data = any; + +export type FormUrlEncodedRequestData = any; + +export type GetInventoryData = Record; + +export type GetOrderByIdData = Order; + +export type GetPetByIdData = Pet; + +export type GetUserByNameData = User; + +export type LoginUserData = string; + +export interface LoginUserParams { + /** The password for login in clear text */ + password: string; + /** The user name for login */ + username: string; +} + +/** + * Pet Order + * An order for a pets from the pet store + * @example {"petId":6,"quantity":1,"id":0,"shipDate":"2000-01-23T04:56:07.000+00:00","complete":false,"status":"placed"} + */ +export interface Order { + /** @default false */ + complete?: boolean; + /** @format int64 */ + id?: number; + /** @format int64 */ + petId?: number; + /** @format int32 */ + quantity?: number; + /** @format date-time */ + shipDate?: string; + /** Order Status */ + status?: OrderStatusEnum; +} + +/** Order Status */ +export enum OrderStatusEnum { + Placed = "placed", + Approved = "approved", + Delivered = "delivered", +} + +/** + * a Pet + * A pet for sale in the pet store + * @example {"photoUrls":["photoUrls","photoUrls"],"name":"doggie","id":0,"category":{"name":"name","id":6},"tags":[{"name":"name","id":1},{"name":"name","id":1}],"status":"available"} + */ +export interface Pet { + /** A category for a pet */ + category?: Category; + /** @format int64 */ + id?: number; + /** @example "doggie" */ + name: string; + photoUrls: string[]; + /** pet status in the store */ + status?: PetStatusEnum; + tags?: Tag[]; +} + +export enum PetIds { + Value10 = 10, + Value20 = 20, + Value30 = 30, + Value40 = 40, +} + +export enum PetIdsWithWrongEnum { + Value10 = 10, + Value20 = 20, + Value30 = 30, + Value40 = 40, +} + +export enum PetNames { + FluffyHero = "Fluffy Hero", + PiggyPo = "Piggy Po", + SwaggerTypescriptApi = "Swagger Typescript Api", + UPPER_CASE = "UPPER_CASE", +} + +/** pet status in the store */ +export enum PetStatusEnum { + Available = "available", + Pending = "pending", + Sold = "sold", +} + +export type PlaceOrderData = Order; + +export type SingleFormUrlEncodedRequestData = any; + +export interface SingleFormUrlEncodedRequestPayload { + /** @format string */ + param1: string; + param2: string; +} + +/** @default "available" */ +export enum StatusEnum { + Available = "available", + Pending = "pending", + Sold = "sold", +} + +/** + * Pet Tag + * A tag for a pet + * @example {"name":"name","id":1} + */ +export interface Tag { + /** @format int64 */ + id?: number; + name?: string; +} + +export interface UpdatePetWithFormPayload { + /** Updated name of the pet */ + name?: string; + /** Updated status of the pet */ + status?: string; +} + +export type UploadFileData = ApiResponse; + +export interface UploadFilePayload { + /** Additional data to pass to server */ + additionalMetadata?: string; + /** file to upload */ + file?: File; +} + +/** + * a User + * A User who is purchasing from the pet store + * @example {"firstName":"firstName","lastName":"lastName","password":"password","userStatus":6,"phone":"phone","id":0,"email":"email","username":"username"} + */ +export interface User { + email?: string; + firstName?: string; + /** @format int64 */ + id?: number; + lastName?: string; + password?: string; + phone?: string; + /** + * User Status + * @format int32 + */ + userStatus?: number; + username?: string; +} + +export namespace Pet { + /** + * No description + * @tags pet + * @name AddPet + * @summary Add a new pet to the store + * @request POST:/pet + * @secure + */ + export namespace AddPet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = Pet; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags pet + * @name DeletePet + * @summary Deletes a pet + * @request DELETE:/pet/{petId} + * @secure + */ + export namespace DeletePet { + export type RequestParams = { + /** + * Pet id to delete + * @format int64 + */ + petId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = { + api_key?: string; + }; + export type ResponseBody = any; + } + /** + * @description Multiple status values can be provided with comma separated strings + * @tags pet + * @name FindPetsByStatus + * @summary Finds Pets by status + * @request GET:/pet/findByStatus + * @secure + */ + export namespace FindPetsByStatus { + export type RequestParams = {}; + export type RequestQuery = { + /** Status values that need to be considered for filter */ + status: FindPetsByStatusParams1StatusEnum[]; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetsByStatusData; + } + /** + * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @tags pet + * @name FindPetsByTags + * @summary Finds Pets by tags + * @request GET:/pet/findByTags + * @deprecated + * @secure + */ + export namespace FindPetsByTags { + export type RequestParams = {}; + export type RequestQuery = { + /** Tags to filter by */ + tags: string[]; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetsByTagsData; + } + /** + * No description + * @tags pet + * @name FormUrlEncodedRequest + * @summary summary + * @request POST:/pet/form-url-encoded + */ + export namespace FormUrlEncodedRequest { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = { + /** @format string */ + param1: string; + param2: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = FormUrlEncodedRequestData; + } + /** + * No description + * @tags pet + * @name FormUrlEncodedRequest2 + * @summary summary + * @request POST:/pet/end-form-url-encoded + * @originalName formUrlEncodedRequest + * @duplicate + */ + export namespace FormUrlEncodedRequest2 { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = { + /** @format string */ + param1: string; + param2: string; + }; + export type RequestHeaders = {}; + export type ResponseBody = FormUrlEncodedRequest2Data; + } + /** + * @description Returns a single pet + * @tags pet + * @name GetPetById + * @summary Find pet by ID + * @request GET:/pet/{petId} + * @secure + */ + export namespace GetPetById { + export type RequestParams = { + /** + * ID of pet to return + * @format int64 + */ + petId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetPetByIdData; + } + /** + * No description + * @tags pet + * @name SingleFormUrlEncodedRequest + * @summary summary + * @request POST:/pet/single-form-url-encoded + */ + export namespace SingleFormUrlEncodedRequest { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = SingleFormUrlEncodedRequestPayload; + export type RequestHeaders = {}; + export type ResponseBody = SingleFormUrlEncodedRequestData; + } + /** + * No description + * @tags pet + * @name UpdatePet + * @summary Update an existing pet + * @request PUT:/pet + * @secure + */ + export namespace UpdatePet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = Pet; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags pet + * @name UpdatePetWithForm + * @summary Updates a pet in the store with form data + * @request POST:/pet/{petId} + * @secure + */ + export namespace UpdatePetWithForm { + export type RequestParams = { + /** + * ID of pet that needs to be updated + * @format int64 + */ + petId: number; + }; + export type RequestQuery = {}; + export type RequestBody = UpdatePetWithFormPayload; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags pet + * @name UploadFile + * @summary uploads an image + * @request POST:/pet/{petId}/uploadImage + * @secure + */ + export namespace UploadFile { + export type RequestParams = { + /** + * ID of pet to update + * @format int64 + */ + petId: number; + }; + export type RequestQuery = {}; + export type RequestBody = UploadFilePayload; + export type RequestHeaders = {}; + export type ResponseBody = UploadFileData; + } +} + +export namespace Store { + /** + * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @tags store + * @name DeleteOrder + * @summary Delete purchase order by ID + * @request DELETE:/store/order/{orderId} + */ + export namespace DeleteOrder { + export type RequestParams = { + /** ID of the order that needs to be deleted */ + orderId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description Returns a map of status codes to quantities + * @tags store + * @name GetInventory + * @summary Returns pet inventories by status + * @request GET:/store/inventory + * @secure + */ + export namespace GetInventory { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetInventoryData; + } + /** + * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @tags store + * @name GetOrderById + * @summary Find purchase order by ID + * @request GET:/store/order/{orderId} + */ + export namespace GetOrderById { + export type RequestParams = { + /** + * ID of pet that needs to be fetched + * @format int64 + * @min 1 + * @max 5 + */ + orderId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetOrderByIdData; + } + /** + * No description + * @tags store + * @name PlaceOrder + * @summary Place an order for a pet + * @request POST:/store/order + */ + export namespace PlaceOrder { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = Order; + export type RequestHeaders = {}; + export type ResponseBody = PlaceOrderData; + } +} + +export namespace User { + /** + * @description This can only be done by the logged in user. + * @tags user + * @name CreateUser + * @summary Create user + * @request POST:/user + */ + export namespace CreateUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = User; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags user + * @name CreateUsersWithArrayInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithArray + */ + export namespace CreateUsersWithArrayInput { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = User[]; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags user + * @name CreateUsersWithListInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithList + */ + export namespace CreateUsersWithListInput { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = User[]; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description This can only be done by the logged in user. + * @tags user + * @name DeleteUser + * @summary Delete user + * @request DELETE:/user/{username} + */ + export namespace DeleteUser { + export type RequestParams = { + /** The name that needs to be deleted */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags user + * @name GetUserByName + * @summary Get user by user name + * @request GET:/user/{username} + */ + export namespace GetUserByName { + export type RequestParams = { + /** The name that needs to be fetched. Use user1 for testing. */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetUserByNameData; + } + /** + * No description + * @tags user + * @name LoginUser + * @summary Logs user into the system + * @request GET:/user/login + */ + export namespace LoginUser { + export type RequestParams = {}; + export type RequestQuery = { + /** The password for login in clear text */ + password: string; + /** The user name for login */ + username: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = LoginUserData; + } + /** + * No description + * @tags user + * @name LogoutUser + * @summary Logs out current logged in user session + * @request GET:/user/logout + */ + export namespace LogoutUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description This can only be done by the logged in user. + * @tags user + * @name UpdateUser + * @summary Updated user + * @request PUT:/user/{username} + */ + export namespace UpdateUser { + export type RequestParams = { + /** name that need to be deleted */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = User; + export type RequestHeaders = {}; + export type ResponseBody = any; + } +} + +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 = "http://petstore.swagger.io/v2"; + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/v2 + * @externalDocs http://swagger.io + * @contact + * + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key \`special-key\` to test the authorization filters. + */ +export class Api extends HttpClient { + pet = { + /** + * No description + * + * @tags pet + * @name AddPet + * @summary Add a new pet to the store + * @request POST:/pet + * @secure + */ + addPet: (body: Pet, params: RequestParams = {}) => + this.request({ + path: \`/pet\`, + method: "POST", + body: body, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name DeletePet + * @summary Deletes a pet + * @request DELETE:/pet/{petId} + * @secure + */ + deletePet: (petId: number, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * @description Multiple status values can be provided with comma separated strings + * + * @tags pet + * @name FindPetsByStatus + * @summary Finds Pets by status + * @request GET:/pet/findByStatus + * @secure + */ + findPetsByStatus: (query: FindPetsByStatusParams, params: RequestParams = {}) => + this.request({ + path: \`/pet/findByStatus\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @tags pet + * @name FindPetsByTags + * @summary Finds Pets by tags + * @request GET:/pet/findByTags + * @deprecated + * @secure + */ + findPetsByTags: (query: FindPetsByTagsParams, params: RequestParams = {}) => + this.request({ + path: \`/pet/findByTags\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name FormUrlEncodedRequest + * @summary summary + * @request POST:/pet/form-url-encoded + */ + formUrlEncodedRequest: ( + data: { + /** @format string */ + param1: string; + param2: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/pet/form-url-encoded\`, + method: "POST", + body: data, + type: ContentType.UrlEncoded, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name FormUrlEncodedRequest2 + * @summary summary + * @request POST:/pet/end-form-url-encoded + * @originalName formUrlEncodedRequest + * @duplicate + */ + formUrlEncodedRequest2: ( + data: { + /** @format string */ + param1: string; + param2: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/pet/end-form-url-encoded\`, + method: "POST", + body: data, + type: ContentType.UrlEncoded, + ...params, + }), + + /** + * @description Returns a single pet + * + * @tags pet + * @name GetPetById + * @summary Find pet by ID + * @request GET:/pet/{petId} + * @secure + */ + getPetById: (petId: number, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name SingleFormUrlEncodedRequest + * @summary summary + * @request POST:/pet/single-form-url-encoded + */ + singleFormUrlEncodedRequest: (data: SingleFormUrlEncodedRequestPayload, params: RequestParams = {}) => + this.request({ + path: \`/pet/single-form-url-encoded\`, + method: "POST", + body: data, + type: ContentType.UrlEncoded, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name UpdatePet + * @summary Update an existing pet + * @request PUT:/pet + * @secure + */ + updatePet: (body: Pet, params: RequestParams = {}) => + this.request({ + path: \`/pet\`, + method: "PUT", + body: body, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name UpdatePetWithForm + * @summary Updates a pet in the store with form data + * @request POST:/pet/{petId} + * @secure + */ + updatePetWithForm: (petId: number, data: UpdatePetWithFormPayload, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}\`, + method: "POST", + body: data, + secure: true, + type: ContentType.FormData, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name UploadFile + * @summary uploads an image + * @request POST:/pet/{petId}/uploadImage + * @secure + */ + uploadFile: (petId: number, data: UploadFilePayload, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}/uploadImage\`, + method: "POST", + body: data, + secure: true, + type: ContentType.FormData, + ...params, + }), + }; + store = { + /** + * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @tags store + * @name DeleteOrder + * @summary Delete purchase order by ID + * @request DELETE:/store/order/{orderId} + */ + deleteOrder: (orderId: string, params: RequestParams = {}) => + this.request({ + path: \`/store/order/\${orderId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Returns a map of status codes to quantities + * + * @tags store + * @name GetInventory + * @summary Returns pet inventories by status + * @request GET:/store/inventory + * @secure + */ + getInventory: (params: RequestParams = {}) => + this.request({ + path: \`/store/inventory\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @tags store + * @name GetOrderById + * @summary Find purchase order by ID + * @request GET:/store/order/{orderId} + */ + getOrderById: (orderId: number, params: RequestParams = {}) => + this.request({ + path: \`/store/order/\${orderId}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags store + * @name PlaceOrder + * @summary Place an order for a pet + * @request POST:/store/order + */ + placeOrder: (body: Order, params: RequestParams = {}) => + this.request({ + path: \`/store/order\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + }; + user = { + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name CreateUser + * @summary Create user + * @request POST:/user + */ + createUser: (body: User, params: RequestParams = {}) => + this.request({ + path: \`/user\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags user + * @name CreateUsersWithArrayInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithArray + */ + createUsersWithArrayInput: (body: User[], params: RequestParams = {}) => + this.request({ + path: \`/user/createWithArray\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags user + * @name CreateUsersWithListInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithList + */ + createUsersWithListInput: (body: User[], params: RequestParams = {}) => + this.request({ + path: \`/user/createWithList\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name DeleteUser + * @summary Delete user + * @request DELETE:/user/{username} + */ + deleteUser: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags user + * @name GetUserByName + * @summary Get user by user name + * @request GET:/user/{username} + */ + getUserByName: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags user + * @name LoginUser + * @summary Logs user into the system + * @request GET:/user/login + */ + loginUser: (query: LoginUserParams, params: RequestParams = {}) => + this.request({ + path: \`/user/login\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags user + * @name LogoutUser + * @summary Logs out current logged in user session + * @request GET:/user/logout + */ + logoutUser: (params: RequestParams = {}) => + this.request({ + path: \`/user/logout\`, + method: "GET", + ...params, + }), + + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name UpdateUser + * @summary Updated user + * @request PUT:/user/{username} + */ + updateUser: (username: string, body: User, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "PUT", + body: body, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'another-schema' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Bar { + A?: string; + /** @format int32 */ + B: number; + Baz?: Baz; + /** @format date-time */ + C: string; +} + +export interface Baz { + Color: Color; + /** @format decimal */ + D: number; +} + +export enum Color { + RED = 0, + GREEN = 1, + BLUE = 2, +} + +export type FooGetBarData = Bar; + +export type FooGetBarDescriptionsData = string[]; + +export interface FooGetBarParams { + /** @format int32 */ + id: number; +} + +export type FooSetBarData = any; + +export namespace Api { + /** + * No description + * @tags Foo + * @name FooGetBar + * @request GET:/api/Foo/GetBar + */ + export namespace FooGetBar { + export type RequestParams = {}; + export type RequestQuery = { + /** @format int32 */ + id: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FooGetBarData; + } + /** + * No description + * @tags Foo + * @name FooGetBarDescriptions + * @request GET:/api/Foo/GetBarDescriptions + */ + export namespace FooGetBarDescriptions { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FooGetBarDescriptionsData; + } + /** + * No description + * @tags Foo + * @name FooSetBar + * @request POST:/api/Foo/SetBar + */ + export namespace FooSetBar { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = Bar | null; + export type RequestHeaders = {}; + export type ResponseBody = FooSetBarData; + } +} + +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.clone() 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 + */ +export class Api extends HttpClient { + api = { + /** + * No description + * + * @tags Foo + * @name FooGetBar + * @request GET:/api/Foo/GetBar + */ + fooGetBar: (query: FooGetBarParams, params: RequestParams = {}) => + this.request({ + path: \`/api/Foo/GetBar\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags Foo + * @name FooGetBarDescriptions + * @request GET:/api/Foo/GetBarDescriptions + */ + fooGetBarDescriptions: (params: RequestParams = {}) => + this.request({ + path: \`/api/Foo/GetBarDescriptions\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags Foo + * @name FooSetBar + * @request POST:/api/Foo/SetBar + */ + fooSetBar: (value: Bar | null, params: RequestParams = {}) => + this.request({ + path: \`/api/Foo/SetBar\`, + method: "POST", + body: value, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'anyof-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface PetByAge { + age: number; + nickname?: string; +} + +export interface PetByType { + hunts?: boolean; + pet_type: PetByTypePetTypeEnum; +} + +export enum PetByTypePetTypeEnum { + Cat = "Cat", + Dog = "Dog", +} + +export type PetsPartialUpdateData = any; + +export type PetsPartialUpdatePayload = PetByAge | PetByType; + +export namespace Pets { + /** + * No description + * @name PetsPartialUpdate + * @request PATCH:/pets + */ + export namespace PetsPartialUpdate { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = PetsPartialUpdatePayload; + export type RequestHeaders = {}; + export type ResponseBody = PetsPartialUpdateData; + } +} + +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.clone() 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 Anyof Example + * @version 1.0.0 + */ +export class Api extends HttpClient { + pets = { + /** + * No description + * + * @name PetsPartialUpdate + * @request PATCH:/pets + */ + petsPartialUpdate: (data: PetsPartialUpdatePayload, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'api-with-examples' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type GetVersionDetailsv2Data = any; + +export type ListVersionsv2Data = any; + +export namespace V2 { + /** + * No description + * @name GetVersionDetailsv2 + * @summary Show API version details + * @request GET:/v2 + */ + export namespace GetVersionDetailsv2 { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetVersionDetailsv2Data; + } +} + +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.clone() 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 Simple API overview + * @version 2.0.0 + */ +export class Api extends HttpClient { + /** + * No description + * + * @name ListVersionsv2 + * @summary List API versions + * @request GET:/ + */ + listVersionsv2 = (params: RequestParams = {}) => + this.request({ + path: \`/\`, + method: "GET", + ...params, + }); + + v2 = { + /** + * No description + * + * @name GetVersionDetailsv2 + * @summary Show API version details + * @request GET:/v2 + */ + getVersionDetailsv2: (params: RequestParams = {}) => + this.request({ + path: \`/v2\`, + method: "GET", + ...params, + }), + }; +} +" +`; + +exports[`extended > 'api-with-examples' 2`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type ConsumesPlainTextPayload = string; + +export type GetVersionDetailsv2Data = any; + +export type ListVersionsv2Data = any; + +export type WithCharsetPayload = string; + +export namespace V2 { + /** + * No description + * @name GetVersionDetailsv2 + * @summary Show API version details + * @request GET:/v2 + */ + export namespace GetVersionDetailsv2 { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetVersionDetailsv2Data; + } +} + +export namespace WithCharset { + /** + * @description consumes contains charset + * @name WithCharset + * @summary consumes contains charset + * @request POST:/with-charset/ + */ + export namespace WithCharset { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = WithCharsetPayload; + export type RequestHeaders = {}; + export type ResponseBody = any; + } +} + +export namespace ConsumesPlainText { + /** + * @description consumes plain text + * @name ConsumesPlainText + * @summary consumes plain text + * @request POST:/consumes-plain-text/ + */ + export namespace ConsumesPlainText { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = ConsumesPlainTextPayload; + export type RequestHeaders = {}; + export type ResponseBody = any; + } +} + +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.clone() 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 Simple API overview + * @version v2 + */ +export class Api extends HttpClient { + /** + * @description multiple line 1 multiple line 2 multiple line 3 + * + * @name ListVersionsv2 + * @summary List API versions + * @request GET:/ + */ + listVersionsv2 = (params: RequestParams = {}) => + this.request({ + path: \`/\`, + method: "GET", + ...params, + }); + + v2 = { + /** + * No description + * + * @name GetVersionDetailsv2 + * @summary Show API version details + * @request GET:/v2 + */ + getVersionDetailsv2: (params: RequestParams = {}) => + this.request({ + path: \`/v2\`, + method: "GET", + ...params, + }), + }; + withCharset = { + /** + * @description consumes contains charset + * + * @name WithCharset + * @summary consumes contains charset + * @request POST:/with-charset/ + */ + withCharset: (someParm: WithCharsetPayload, params: RequestParams = {}) => + this.request({ + path: \`/with-charset/\`, + method: "POST", + body: someParm, + type: ContentType.Json, + ...params, + }), + }; + consumesPlainText = { + /** + * @description consumes plain text + * + * @name ConsumesPlainText + * @summary consumes plain text + * @request POST:/consumes-plain-text/ + */ + consumesPlainText: (someParm: ConsumesPlainTextPayload, params: RequestParams = {}) => + this.request({ + path: \`/consumes-plain-text/\`, + method: "POST", + body: someParm, + type: ContentType.Text, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'authentiq' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** Authentiq ID in JWT format, self-signed. */ +export interface AuthentiqID { + /** device token for push messages */ + devtoken?: string; + /** UUID and public signing key */ + sub: string; +} + +/** Claim in JWT format, self- or issuer-signed. */ +export interface Claims { + email?: string; + phone?: string; + /** claim scope */ + scope: string; + /** UUID */ + sub: string; + type?: string; +} + +export interface Error { + detail?: string; + error: number; + title?: string; + /** unique uri for this error */ + type?: string; +} + +/** Error response */ +export type ErrorResponse = Error; + +/** JWT */ +export interface GetKeyData { + /** @format date-time */ + since?: string; + status?: string; + /** base64safe encoded public signing key */ + sub?: string; +} + +export type GetKeyError = Error; + +export type HeadKeyData = any; + +export type HeadKeyError = Error; + +export interface KeyBindData { + /** confirmed */ + status?: string; +} + +export type KeyBindError = Error; + +export interface KeyRegisterData { + /** revoke key */ + secret?: string; + /** registered */ + status?: string; +} + +export type KeyRegisterError = Error; + +export interface KeyRevokeData { + /** done */ + status?: string; +} + +export type KeyRevokeError = Error; + +export interface KeyRevokeNosecretData { + /** pending or done */ + status?: string; +} + +export type KeyRevokeNosecretError = Error; + +export interface KeyRevokeNosecretParams { + /** verification code sent by email */ + code?: string; + /** primary email associated to Key (ID) */ + email: string; + /** primary phone number, international representation */ + phone: string; +} + +export interface KeyRevokeParams { + /** Public Signing Key - Authentiq ID (43 chars) */ + pk: string; + /** revokation secret */ + secret: string; +} + +export interface KeyUpdateData { + /** confirmed */ + status?: string; +} + +export type KeyUpdateError = Error; + +export interface PushLoginRequestData { + /** sent */ + status?: string; +} + +export type PushLoginRequestError = Error; + +export interface PushLoginRequestParams { + /** URI App will connect to */ + callback: string; +} + +/** PushToken in JWT format, self-signed. */ +export interface PushToken { + /** audience (URI) */ + aud: string; + exp?: number; + iat?: number; + /** issuer (URI) */ + iss: string; + nbf: number; + /** UUID and public signing key */ + sub: string; +} + +export interface SignConfirmData { + /** confirmed */ + status?: string; +} + +export type SignConfirmError = Error; + +export interface SignDeleteData { + /** done */ + status?: string; +} + +export type SignDeleteError = Error; + +export interface SignRequestData { + /** 20-character ID */ + job?: string; + /** waiting */ + status?: string; +} + +export type SignRequestError = Error; + +export interface SignRequestParams { + /** test only mode, using test issuer */ + test?: number; +} + +/** JWT */ +export interface SignRetrieveData { + exp?: number; + field?: string; + /** base64safe encoded public signing key */ + sub?: string; +} + +export type SignRetrieveError = Error; + +export type SignRetrieveHeadData = any; + +export type SignRetrieveHeadError = Error; + +export interface SignUpdateData { + /** result is JWT or JSON?? */ + jwt?: string; + /** ready */ + status?: string; +} + +export type SignUpdateError = Error; + +export type WrongPathParams1Data = any; + +export type WrongPathParams2Data = any; + +export namespace WrongPathParams1 { + /** + * @description DDD + * @tags key, delete + * @name WrongPathParams1 + * @request DELETE:/wrong-path-params1/{pathParam1}/{path_param2}/{path_param3}/:pathParam4 + */ + export namespace WrongPathParams1 { + export type RequestParams = { + pathParam1: string; + pathParam2: string; + pathParam3: string; + pathParam4: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = WrongPathParams1Data; + } +} + +export namespace WrongPathParams2 { + /** + * @description DDD + * @tags key, delete + * @name WrongPathParams2 + * @request DELETE:/wrong-path-params2 + */ + export namespace WrongPathParams2 { + export type RequestParams = { + /** DDD */ + pathParam1: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = WrongPathParams2Data; + } +} + +export namespace Key { + /** + * @description Get public details of an Authentiq ID. + * @tags key, get + * @name GetKey + * @request GET:/key/{PK} + */ + export namespace GetKey { + export type RequestParams = { + /** Public Signing Key - Authentiq ID (43 chars) */ + pk: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetKeyData; + } + /** + * @description HEAD info on Authentiq ID + * @tags key, head + * @name HeadKey + * @request HEAD:/key/{PK} + */ + export namespace HeadKey { + export type RequestParams = { + /** Public Signing Key - Authentiq ID (43 chars) */ + pk: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = HeadKeyData; + } + /** + * @description Update Authentiq ID by replacing the object. v4: \`JWT(sub,email,phone)\` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration \`JWT(sub, pk, devtoken, ...)\` See: https://github.com/skion/authentiq/wiki/JWT-Examples + * @tags key, put + * @name KeyBind + * @request PUT:/key/{PK} + */ + export namespace KeyBind { + export type RequestParams = { + /** Public Signing Key - Authentiq ID (43 chars) */ + pk: string; + }; + export type RequestQuery = {}; + export type RequestBody = AuthentiqID; + export type RequestHeaders = {}; + export type ResponseBody = KeyBindData; + } + /** + * @description Register a new ID \`JWT(sub, devtoken)\` v5: \`JWT(sub, pk, devtoken, ...)\` See: https://github.com/skion/authentiq/wiki/JWT-Examples + * @tags key, post + * @name KeyRegister + * @request POST:/key + */ + export namespace KeyRegister { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = AuthentiqID; + export type RequestHeaders = {}; + export type ResponseBody = KeyRegisterData; + } + /** + * @description Revoke an Identity (Key) with a revocation secret + * @tags key, delete + * @name KeyRevoke + * @request DELETE:/key/{PK} + */ + export namespace KeyRevoke { + export type RequestParams = { + /** Public Signing Key - Authentiq ID (43 chars) */ + pk: string; + }; + export type RequestQuery = { + /** revokation secret */ + secret: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = KeyRevokeData; + } + /** + * @description Revoke an Authentiq ID using email & phone. If called with \`email\` and \`phone\` only, a verification code will be sent by email. Do a second call adding \`code\` to complete the revocation. + * @tags key, delete + * @name KeyRevokeNosecret + * @request DELETE:/key + */ + export namespace KeyRevokeNosecret { + export type RequestParams = {}; + export type RequestQuery = { + /** verification code sent by email */ + code?: string; + /** primary email associated to Key (ID) */ + email: string; + /** primary phone number, international representation */ + phone: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = KeyRevokeNosecretData; + } + /** + * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples + * @tags key, post + * @name KeyUpdate + * @request POST:/key/{PK} + */ + export namespace KeyUpdate { + export type RequestParams = { + /** Public Signing Key - Authentiq ID (43 chars) */ + pk: string; + }; + export type RequestQuery = {}; + export type RequestBody = AuthentiqID; + export type RequestHeaders = {}; + export type ResponseBody = KeyUpdateData; + } +} + +export namespace Login { + /** + * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples + * @tags login, post + * @name PushLoginRequest + * @request POST:/login + */ + export namespace PushLoginRequest { + export type RequestParams = {}; + export type RequestQuery = { + /** URI App will connect to */ + callback: string; + }; + export type RequestBody = PushToken; + export type RequestHeaders = {}; + export type ResponseBody = PushLoginRequestData; + } +} + +export namespace Scope { + /** + * @description this is a scope confirmation + * @tags scope, post + * @name SignConfirm + * @request POST:/scope/{job} + */ + export namespace SignConfirm { + export type RequestParams = { + /** Job ID (20 chars) */ + job: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SignConfirmData; + } + /** + * @description delete a verification job + * @tags scope, delete + * @name SignDelete + * @request DELETE:/scope/{job} + */ + export namespace SignDelete { + export type RequestParams = { + /** Job ID (20 chars) */ + job: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SignDeleteData; + } + /** + * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples + * @tags scope, post + * @name SignRequest + * @request POST:/scope + */ + export namespace SignRequest { + export type RequestParams = {}; + export type RequestQuery = { + /** test only mode, using test issuer */ + test?: number; + }; + export type RequestBody = Claims; + export type RequestHeaders = {}; + export type ResponseBody = SignRequestData; + } + /** + * @description get the status / current content of a verification job + * @tags scope, get + * @name SignRetrieve + * @request GET:/scope/{job} + */ + export namespace SignRetrieve { + export type RequestParams = { + /** Job ID (20 chars) */ + job: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SignRetrieveData; + } + /** + * @description HEAD to get the status of a verification job + * @tags scope, head + * @name SignRetrieveHead + * @request HEAD:/scope/{job} + */ + export namespace SignRetrieveHead { + export type RequestParams = { + /** Job ID (20 chars) */ + job: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SignRetrieveHeadData; + } + /** + * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples + * @tags scope, put + * @name SignUpdate + * @request PUT:/scope/{job} + */ + export namespace SignUpdate { + export type RequestParams = { + /** Job ID (20 chars) */ + job: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SignUpdateData; + } +} + +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://6-dot-authentiqio.appspot.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) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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 Authentiq + * @version 6 + * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://authentiq.com/terms/ + * @baseUrl https://6-dot-authentiqio.appspot.com + * @contact Authentiq team (http://authentiq.io/support) + * + * Strong authentication, without the passwords. + */ +export class Api extends HttpClient { + wrongPathParams1 = { + /** + * @description DDD + * + * @tags key, delete + * @name WrongPathParams1 + * @request DELETE:/wrong-path-params1/{pathParam1}/{path_param2}/{path_param3}/:pathParam4 + */ + wrongPathParams1: ( + pathParam1: string, + pathParam2: string, + pathParam3: string, + pathParam4: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/wrong-path-params1/\${pathParam1}/\${pathParam2}/\${pathParam3}/\${pathParam4}\`, + method: "DELETE", + ...params, + }), + }; + wrongPathParams2 = { + /** + * @description DDD + * + * @tags key, delete + * @name WrongPathParams2 + * @request DELETE:/wrong-path-params2 + */ + wrongPathParams2: (pathParam1: string, params: RequestParams = {}) => + this.request({ + path: \`/wrong-path-params2\`, + method: "DELETE", + ...params, + }), + }; + key = { + /** + * @description Get public details of an Authentiq ID. + * + * @tags key, get + * @name GetKey + * @request GET:/key/{PK} + */ + getKey: (pk: string, params: RequestParams = {}) => + this.request({ + path: \`/key/\${pk}\`, + method: "GET", + ...params, + }), + + /** + * @description HEAD info on Authentiq ID + * + * @tags key, head + * @name HeadKey + * @request HEAD:/key/{PK} + */ + headKey: (pk: string, params: RequestParams = {}) => + this.request({ + path: \`/key/\${pk}\`, + method: "HEAD", + ...params, + }), + + /** + * @description Update Authentiq ID by replacing the object. v4: \`JWT(sub,email,phone)\` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration \`JWT(sub, pk, devtoken, ...)\` See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags key, put + * @name KeyBind + * @request PUT:/key/{PK} + */ + keyBind: (pk: string, body: AuthentiqID, params: RequestParams = {}) => + this.request({ + path: \`/key/\${pk}\`, + method: "PUT", + body: body, + ...params, + }), + + /** + * @description Register a new ID \`JWT(sub, devtoken)\` v5: \`JWT(sub, pk, devtoken, ...)\` See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags key, post + * @name KeyRegister + * @request POST:/key + */ + keyRegister: (body: AuthentiqID, params: RequestParams = {}) => + this.request({ + path: \`/key\`, + method: "POST", + body: body, + ...params, + }), + + /** + * @description Revoke an Identity (Key) with a revocation secret + * + * @tags key, delete + * @name KeyRevoke + * @request DELETE:/key/{PK} + */ + keyRevoke: ({ pk, ...query }: KeyRevokeParams, params: RequestParams = {}) => + this.request({ + path: \`/key/\${pk}\`, + method: "DELETE", + query: query, + ...params, + }), + + /** + * @description Revoke an Authentiq ID using email & phone. If called with \`email\` and \`phone\` only, a verification code will be sent by email. Do a second call adding \`code\` to complete the revocation. + * + * @tags key, delete + * @name KeyRevokeNosecret + * @request DELETE:/key + */ + keyRevokeNosecret: (query: KeyRevokeNosecretParams, params: RequestParams = {}) => + this.request({ + path: \`/key\`, + method: "DELETE", + query: query, + ...params, + }), + + /** + * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags key, post + * @name KeyUpdate + * @request POST:/key/{PK} + */ + keyUpdate: (pk: string, body: AuthentiqID, params: RequestParams = {}) => + this.request({ + path: \`/key/\${pk}\`, + method: "POST", + body: body, + ...params, + }), + }; + login = { + /** + * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags login, post + * @name PushLoginRequest + * @request POST:/login + */ + pushLoginRequest: (query: PushLoginRequestParams, body: PushToken, params: RequestParams = {}) => + this.request({ + path: \`/login\`, + method: "POST", + query: query, + body: body, + ...params, + }), + }; + scope = { + /** + * @description this is a scope confirmation + * + * @tags scope, post + * @name SignConfirm + * @request POST:/scope/{job} + */ + signConfirm: (job: string, params: RequestParams = {}) => + this.request({ + path: \`/scope/\${job}\`, + method: "POST", + type: ContentType.Json, + ...params, + }), + + /** + * @description delete a verification job + * + * @tags scope, delete + * @name SignDelete + * @request DELETE:/scope/{job} + */ + signDelete: (job: string, params: RequestParams = {}) => + this.request({ + path: \`/scope/\${job}\`, + method: "DELETE", + ...params, + }), + + /** + * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags scope, post + * @name SignRequest + * @request POST:/scope + */ + signRequest: (query: SignRequestParams, body: Claims, params: RequestParams = {}) => + this.request({ + path: \`/scope\`, + method: "POST", + query: query, + body: body, + ...params, + }), + + /** + * @description get the status / current content of a verification job + * + * @tags scope, get + * @name SignRetrieve + * @request GET:/scope/{job} + */ + signRetrieve: (job: string, params: RequestParams = {}) => + this.request({ + path: \`/scope/\${job}\`, + method: "GET", + ...params, + }), + + /** + * @description HEAD to get the status of a verification job + * + * @tags scope, head + * @name SignRetrieveHead + * @request HEAD:/scope/{job} + */ + signRetrieveHead: (job: string, params: RequestParams = {}) => + this.request({ + path: \`/scope/\${job}\`, + method: "HEAD", + ...params, + }), + + /** + * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags scope, put + * @name SignUpdate + * @request PUT:/scope/{job} + */ + signUpdate: (job: string, params: RequestParams = {}) => + this.request({ + path: \`/scope/\${job}\`, + method: "PUT", + ...params, + }), + }; +} +" +`; + +exports[`extended > 'callback-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** subscription information */ +export interface StreamsCreateData { + /** + * this unique identifier allows management of the subscription + * @example "2531329f-fb09-4ef7-887e-84e648214436" + */ + subscriptionId: string; +} + +export interface StreamsCreateParams { + /** + * the location where data will be sent. Must be network accessible + * by the source server + * @format uri + * @example "https://tonys-server.com" + */ + callbackUrl: string; +} + +export namespace Streams { + /** + * @description subscribes a client to receive out-of-band data + * @name StreamsCreate + * @request POST:/streams + */ + export namespace StreamsCreate { + export type RequestParams = {}; + export type RequestQuery = { + /** + * the location where data will be sent. Must be network accessible + * by the source server + * @format uri + * @example "https://tonys-server.com" + */ + callbackUrl: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = StreamsCreateData; + } +} + +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.clone() 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 Callback Example + * @version 1.0.0 + */ +export class Api extends HttpClient { + streams = { + /** + * @description subscribes a client to receive out-of-band data + * + * @name StreamsCreate + * @request POST:/streams + */ + streamsCreate: (query: StreamsCreateParams, params: RequestParams = {}) => + this.request({ + path: \`/streams\`, + method: "POST", + query: query, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'components-responses' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** OK */ +export interface Default { + data?: string; +} + +export namespace Api { + /** + * No description + * @name GetData + * @request GET:/api + */ + export namespace GetData { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = { + data?: string; + }; + } +} + +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.clone() 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 Title + * @version latest + * + * Description + */ +export class Api extends HttpClient { + api = { + /** + * No description + * + * @name GetData + * @request GET:/api + */ + getData: (params: RequestParams = {}) => + this.request< + { + data?: string; + }, + any + >({ + path: \`/api\`, + method: "GET", + ...params, + }), + }; +} +" +`; + +exports[`extended > 'enums' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** @format int32 */ +export enum EmptyEnum { + Bla = "Bla", + Blabla = "Blabla", + Boiler = "Boiler", +} + +/** @format int32 */ +export enum EnumWithMoreNames { + Bla = 1, + Blabla = "Blabla", + Boiler = "Boiler", +} + +export enum OnlyEnumNames { + Bla = "Bla", + Blabla = "Blabla", + Boiler = "Boiler", +} + +/** @format int32 */ +export enum SomeInterestEnum { + Bla = 6, + Blabla = 2, + Boiler = 1, + Bbabab = 67, + Nowadays = 88, + FAIL = 122, + Vvvvv = 88, + ASdasAS = 0, + ASDsacZX = 213, + Zook = 12378, + EnumMm = 123125, + VCsa = 32452, + Yuuu = 1111, + ASddd = 66666, + ASdsdsa = "ASdsdsa", + ASDds = "ASDds", + HSDFDS = "HSDFDS", +} + +export enum StringCompleteEnums { + Bla = "foo", + Blabla = "bar", + Boiler = "baz", +} + +export enum StringEnums { + Bla = "foo", + Blabla = "bar", + Boiler = "Boiler", +} + +export enum StringOnlyEnumNames { + Bla = "Bla", + Blabla = "Blabla", + Boiler = "Boiler", +} + +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://ffff.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) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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://ffff.com + */ +export class Api extends HttpClient {} +" +`; + +exports[`extended > 'example1' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** + * some description + * @pattern ^[A-Z]{3,3}$ + */ +export type Currency = string; + +export type ManagedInstanceTdeCertificatesCreateData = any; + +export interface ManagedInstanceTdeCertificatesCreateParams { + /** The API version to use for the request. */ + "api-version": string; + /** The name of the managed instance. */ + managedInstanceName: string; + /** The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. */ + resourceGroupName: string; + /** The subscription ID that identifies an Azure subscription. */ + subscriptionId: string; +} + +/** A TDE certificate that can be uploaded into a server. */ +export type TdeCertificate = { + /** Resource ID. */ + id?: string; + /** Resource name. */ + name?: string; + /** Resource type. */ + type?: string; +} & { + /** Resource properties. */ + properties?: TdeCertificateProperties; +}; + +/** A TDE certificate that can be uploaded into a server. */ +export type TdeCertificate2 = { + /** Resource ID. */ + id?: string; + /** Resource name. */ + name?: string; + /** Resource type. */ + type?: string; +}; + +/** Properties of a TDE certificate. */ +export interface TdeCertificateProperties { + /** The certificate password. */ + certPassword?: string; + /** The base64 encoded certificate private blob. */ + privateBlob: string; +} + +export namespace Subscriptions { + /** + * @description Creates a TDE certificate for a given server. + * @tags ManagedInstanceTdeCertificates + * @name ManagedInstanceTdeCertificatesCreate + * @request POST:/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates + */ + export namespace ManagedInstanceTdeCertificatesCreate { + export type RequestParams = { + /** The name of the managed instance. */ + managedInstanceName: string; + /** The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. */ + resourceGroupName: string; + /** The subscription ID that identifies an Azure subscription. */ + subscriptionId: string; + }; + export type RequestQuery = { + /** The API version to use for the request. */ + "api-version": string; + }; + export type RequestBody = TdeCertificate; + export type RequestHeaders = {}; + export type ResponseBody = ManagedInstanceTdeCertificatesCreateData; + } +} + +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://management.azure.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) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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 SqlManagementClient + * @version 2017-10-01-preview + * @baseUrl https://management.azure.com + * + * The Azure SQL Database management API provides a RESTful set of web APIs that interact with Azure SQL Database services to manage your databases. The API enables users to create, retrieve, update, and delete databases, servers, and other entities. + */ +export class Api extends HttpClient { + subscriptions = { + /** + * @description Creates a TDE certificate for a given server. + * + * @tags ManagedInstanceTdeCertificates + * @name ManagedInstanceTdeCertificatesCreate + * @request POST:/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates + */ + managedInstanceTdeCertificatesCreate: ( + { resourceGroupName, managedInstanceName, subscriptionId, ...query }: ManagedInstanceTdeCertificatesCreateParams, + parameters: TdeCertificate, + params: RequestParams = {}, + ) => + this.request({ + path: \`/subscriptions/\${subscriptionId}/resourceGroups/\${resourceGroupName}/providers/Microsoft.Sql/managedInstances/\${managedInstanceName}/tdeCertificates\`, + method: "POST", + query: query, + body: parameters, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'explode-param-3' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type CreateFileData = Floop; + +export interface CreateFilePayload { + /** @default "" */ + meme: string; + memeType?: string; +} + +export interface Floop { + info?: string; +} + +export interface GetsParams { + params?: QueryParams; +} + +export interface QueryParams { + /** + * Page size + * @format int32 + * @min 0 + */ + "page-size"?: number | null; + /** + * Page number + * @format int32 + * @min 0 + */ + page?: number | null; +} + +export namespace User { + /** + * No description + * @name CreateFile + * @summary Some summary + * @request POST:/{user}/foos + */ + export namespace CreateFile { + export type RequestParams = { + user: string; + }; + export type RequestQuery = {}; + export type RequestBody = CreateFilePayload; + export type RequestHeaders = {}; + export type ResponseBody = CreateFileData; + } +} + +export namespace Something { + /** + * No description + * @name Gets + * @request GET:/something/ + */ + export namespace Gets { + export type RequestParams = {}; + export type RequestQuery = { + params?: QueryParams; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } +} + +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.clone() 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 API + * @version 0.1 + * + * Documentation + */ +export class Api extends HttpClient { + user = { + /** + * No description + * + * @name CreateFile + * @summary Some summary + * @request POST:/{user}/foos + */ + createFile: (user: string, data: CreateFilePayload, params: RequestParams = {}) => + this.request({ + path: \`/\${user}/foos\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + }; + something = { + /** + * No description + * + * @name Gets + * @request GET:/something/ + */ + gets: (query: GetsParams, params: RequestParams = {}) => + this.request({ + path: \`/something/\`, + method: "GET", + query: query, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'file-formdata-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type UploadFileData = any; + +export interface UploadFilePayload { + /** + * File description + * @format binary + */ + file?: File; + /** Boolean flag */ + someFlag?: boolean; +} + +export namespace UploadFile { + /** + * No description + * @tags tag + * @name UploadFile + * @summary Upload file + * @request POST:/upload-file + */ + export namespace UploadFile { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = UploadFilePayload; + export type RequestHeaders = {}; + export type ResponseBody = UploadFileData; + } +} + +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.clone() 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 Title + * @version v0.1 + */ +export class Api extends HttpClient { + uploadFile = { + /** + * No description + * + * @tags tag + * @name UploadFile + * @summary Upload file + * @request POST:/upload-file + */ + uploadFile: (data: UploadFilePayload, params: RequestParams = {}) => + this.request({ + path: \`/upload-file\`, + method: "POST", + body: data, + type: ContentType.FormData, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'full-swagger-scheme' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgData = any; + +export type ActionsAddSelectedRepoToOrgSecretData = any; + +export type ActionsAddSelfHostedRunnerToGroupForOrgData = any; + +export interface ActionsBillingUsage { + /** The amount of free GitHub Actions minutes available. */ + included_minutes: number; + minutes_used_breakdown: { + /** 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; + }; + /** The sum of the free and paid GitHub Actions minutes used. */ + total_minutes_used: number; + /** The total paid GitHub Actions minutes used. */ + total_paid_minutes_used: number; +} + +export type ActionsCancelWorkflowRunData = any; + +export type ActionsCreateOrUpdateOrgSecretData = any; + +export interface ActionsCreateOrUpdateOrgSecretPayload { + /** Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get an organization public key](https://docs.github.com/rest/reference/actions#get-an-organization-public-key) endpoint. */ + encrypted_value?: string; + /** ID of the key you used to encrypt the secret. */ + key_id?: string; + /** An array of repository ids that can access the organization secret. You can only provide a list of repository ids when the \`visibility\` is set to \`selected\`. You can manage the list of selected repositories using the [List selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#list-selected-repositories-for-an-organization-secret), [Set selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#set-selected-repositories-for-an-organization-secret), and [Remove selected repository from an organization secret](https://docs.github.com/rest/reference/actions#remove-selected-repository-from-an-organization-secret) endpoints. */ + selected_repository_ids?: string[]; + /** + * Configures the access that repositories have to the organization secret. Can be one of: + * \\- \`all\` - All repositories in an organization can access the secret. + * \\- \`private\` - Private repositories in an organization can access the secret. + * \\- \`selected\` - Only specific repositories can access the secret. + */ + visibility?: ActionsCreateOrUpdateOrgSecretVisibilityEnum; +} + +/** + * Configures the access that repositories have to the organization secret. Can be one of: + * \\- \`all\` - All repositories in an organization can access the secret. + * \\- \`private\` - Private repositories in an organization can access the secret. + * \\- \`selected\` - Only specific repositories can access the secret. + */ +export enum ActionsCreateOrUpdateOrgSecretVisibilityEnum { + All = "all", + Private = "private", + Selected = "selected", +} + +export type ActionsCreateOrUpdateRepoSecretData = any; + +export interface ActionsCreateOrUpdateRepoSecretPayload { + /** Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get a repository public key](https://docs.github.com/rest/reference/actions#get-a-repository-public-key) endpoint. */ + encrypted_value?: string; + /** ID of the key you used to encrypt the secret. */ + key_id?: string; +} + +export type ActionsCreateRegistrationTokenForOrgData = AuthenticationToken; + +export type ActionsCreateRegistrationTokenForRepoData = AuthenticationToken; + +export type ActionsCreateRemoveTokenForOrgData = AuthenticationToken; + +export type ActionsCreateRemoveTokenForRepoData = AuthenticationToken; + +export type ActionsCreateSelfHostedRunnerGroupForOrgData = RunnerGroupsOrg; + +export interface ActionsCreateSelfHostedRunnerGroupForOrgPayload { + /** Name of the runner group. */ + name: string; + /** List of runner IDs to add to the runner group. */ + runners?: number[]; + /** List of repository IDs that can access the runner group. */ + selected_repository_ids?: number[]; + /** + * Visibility of a runner group. You can select all repositories, select individual repositories, or limit access to private repositories. Can be one of: \`all\`, \`selected\`, or \`private\`. + * @default "all" + */ + visibility?: ActionsCreateSelfHostedRunnerGroupForOrgVisibilityEnum; +} + +/** + * Visibility of a runner group. You can select all repositories, select individual repositories, or limit access to private repositories. Can be one of: \`all\`, \`selected\`, or \`private\`. + * @default "all" + */ +export enum ActionsCreateSelfHostedRunnerGroupForOrgVisibilityEnum { + Selected = "selected", + All = "all", + Private = "private", +} + +export type ActionsCreateWorkflowDispatchData = any; + +export interface ActionsCreateWorkflowDispatchPayload { + /** Input keys and values configured in the workflow file. The maximum number of properties is 10. Any default properties configured in the workflow file will be used when \`inputs\` are omitted. */ + inputs?: Record; + /** The git reference for the workflow. The reference can be a branch or tag name. */ + ref: string; +} + +export type ActionsDeleteArtifactData = any; + +export type ActionsDeleteOrgSecretData = any; + +export type ActionsDeleteRepoSecretData = any; + +export type ActionsDeleteSelfHostedRunnerFromOrgData = any; + +export type ActionsDeleteSelfHostedRunnerFromRepoData = any; + +export type ActionsDeleteSelfHostedRunnerGroupFromOrgData = any; + +export type ActionsDeleteWorkflowRunData = any; + +export type ActionsDeleteWorkflowRunLogsData = any; + +export type ActionsDisableSelectedRepositoryGithubActionsOrganizationData = any; + +export type ActionsDisableWorkflowData = any; + +export type ActionsEnableSelectedRepositoryGithubActionsOrganizationData = any; + +export type ActionsEnableWorkflowData = any; + +/** Whether GitHub Actions is enabled on the repository. */ +export type ActionsEnabled = boolean; + +export interface ActionsEnterprisePermissions { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions: AllowedActions; + /** The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ + enabled_organizations: EnabledOrganizations; + /** The API URL to use to get or set the actions that are allowed to run, when \`allowed_actions\` is set to \`selected\`. */ + selected_actions_url?: SelectedActionsUrl; + /** The API URL to use to get or set the selected organizations that are allowed to run GitHub Actions, when \`enabled_organizations\` is set to \`selected\`. */ + selected_organizations_url?: string; +} + +export type ActionsGetAllowedActionsOrganizationData = SelectedActions; + +export type ActionsGetAllowedActionsRepositoryData = SelectedActions; + +export type ActionsGetArtifactData = Artifact; + +export type ActionsGetGithubActionsPermissionsOrganizationData = ActionsOrganizationPermissions; + +export type ActionsGetGithubActionsPermissionsRepositoryData = ActionsRepositoryPermissions; + +export type ActionsGetJobForWorkflowRunData = Job; + +export type ActionsGetOrgPublicKeyData = ActionsPublicKey; + +export type ActionsGetOrgSecretData = OrganizationActionsSecret; + +export type ActionsGetRepoPublicKeyData = ActionsPublicKey; + +export type ActionsGetRepoSecretData = ActionsSecret; + +export type ActionsGetSelfHostedRunnerForOrgData = Runner; + +export type ActionsGetSelfHostedRunnerForRepoData = Runner; + +export type ActionsGetSelfHostedRunnerGroupForOrgData = RunnerGroupsOrg; + +export type ActionsGetWorkflowData = Workflow; + +export type ActionsGetWorkflowRunData = WorkflowRun; + +export type ActionsGetWorkflowRunUsageData = WorkflowRunUsage; + +export type ActionsGetWorkflowUsageData = WorkflowUsage; + +export interface ActionsListArtifactsForRepoData { + artifacts: Artifact[]; + total_count: number; +} + +export interface ActionsListArtifactsForRepoParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export interface ActionsListJobsForWorkflowRunData { + jobs: Job[]; + total_count: number; +} + +export interface ActionsListJobsForWorkflowRunParams { + /** + * Filters jobs by their \`completed_at\` timestamp. Can be one of: + * \\* \`latest\`: Returns jobs from the most recent execution of the workflow run. + * \\* \`all\`: Returns all jobs for a workflow run, including from old executions of the workflow run. + * @default "latest" + */ + filter?: FilterEnum4; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + runId: number; +} + +/** + * Filters jobs by their \`completed_at\` timestamp. Can be one of: + * \\* \`latest\`: Returns jobs from the most recent execution of the workflow run. + * \\* \`all\`: Returns all jobs for a workflow run, including from old executions of the workflow run. + * @default "latest" + */ +export enum ActionsListJobsForWorkflowRunParams1FilterEnum { + Latest = "latest", + All = "all", +} + +export interface ActionsListOrgSecretsData { + secrets: OrganizationActionsSecret[]; + total_count: number; +} + +export interface ActionsListOrgSecretsParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface ActionsListRepoAccessToSelfHostedRunnerGroupInOrgData { + repositories: Repository[]; + total_count: number; +} + +export interface ActionsListRepoSecretsData { + secrets: ActionsSecret[]; + total_count: number; +} + +export interface ActionsListRepoSecretsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export interface ActionsListRepoWorkflowsData { + total_count: number; + workflows: Workflow[]; +} + +export interface ActionsListRepoWorkflowsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ActionsListRunnerApplicationsForOrgData = RunnerApplication[]; + +export type ActionsListRunnerApplicationsForRepoData = RunnerApplication[]; + +export interface ActionsListSelectedReposForOrgSecretData { + repositories: MinimalRepository[]; + total_count: number; +} + +export interface ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationData { + repositories: Repository[]; + total_count: number; +} + +export interface ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface ActionsListSelfHostedRunnerGroupsForOrgData { + runner_groups: RunnerGroupsOrg[]; + total_count: number; +} + +export interface ActionsListSelfHostedRunnerGroupsForOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface ActionsListSelfHostedRunnersForOrgData { + runners: Runner[]; + total_count: number; +} + +export interface ActionsListSelfHostedRunnersForOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface ActionsListSelfHostedRunnersForRepoData { + runners: Runner[]; + total_count: number; +} + +export interface ActionsListSelfHostedRunnersForRepoParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export interface ActionsListSelfHostedRunnersInGroupForOrgData { + runners: Runner[]; + total_count: number; +} + +export interface ActionsListSelfHostedRunnersInGroupForOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; +} + +export interface ActionsListWorkflowRunArtifactsData { + artifacts: Artifact[]; + total_count: number; +} + +export interface ActionsListWorkflowRunArtifactsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + runId: number; +} + +export interface ActionsListWorkflowRunsData { + total_count: number; + workflow_runs: WorkflowRun[]; +} + +export interface ActionsListWorkflowRunsForRepoData { + total_count: number; + workflow_runs: WorkflowRun[]; +} + +export interface ActionsListWorkflowRunsForRepoParams { + /** Returns someone's workflow runs. Use the login for the user who created the \`push\` associated with the check suite or workflow run. */ + actor?: string; + /** Returns workflow runs associated with a branch. Use the name of the branch of the \`push\`. */ + branch?: string; + /** Returns workflow run triggered by the event you specify. For example, \`push\`, \`pull_request\` or \`issue\`. For more information, see "[Events that trigger workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." */ + event?: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** Returns workflow runs associated with the check run \`status\` or \`conclusion\` you specify. For example, a conclusion can be \`success\` or a status can be \`completed\`. For more information, see the \`status\` and \`conclusion\` options available in "[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run)." */ + status?: StatusEnum; +} + +/** Returns workflow runs associated with the check run \`status\` or \`conclusion\` you specify. For example, a conclusion can be \`success\` or a status can be \`completed\`. For more information, see the \`status\` and \`conclusion\` options available in "[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run)." */ +export enum ActionsListWorkflowRunsForRepoParams1StatusEnum { + Completed = "completed", + Status = "status", + Conclusion = "conclusion", +} + +export interface ActionsListWorkflowRunsParams { + /** Returns someone's workflow runs. Use the login for the user who created the \`push\` associated with the check suite or workflow run. */ + actor?: string; + /** Returns workflow runs associated with a branch. Use the name of the branch of the \`push\`. */ + branch?: string; + /** Returns workflow run triggered by the event you specify. For example, \`push\`, \`pull_request\` or \`issue\`. For more information, see "[Events that trigger workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." */ + event?: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** Returns workflow runs associated with the check run \`status\` or \`conclusion\` you specify. For example, a conclusion can be \`success\` or a status can be \`completed\`. For more information, see the \`status\` and \`conclusion\` options available in "[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run)." */ + status?: StatusEnum1; + /** The ID of the workflow. You can also pass the workflow file name as a string. */ + workflowId: number | string; +} + +/** Returns workflow runs associated with the check run \`status\` or \`conclusion\` you specify. For example, a conclusion can be \`success\` or a status can be \`completed\`. For more information, see the \`status\` and \`conclusion\` options available in "[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run)." */ +export enum ActionsListWorkflowRunsParams1StatusEnum { + Completed = "completed", + Status = "status", + Conclusion = "conclusion", +} + +export interface ActionsOrganizationPermissions { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions: AllowedActions; + /** The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ + enabled_repositories: EnabledRepositories; + /** The API URL to use to get or set the actions that are allowed to run, when \`allowed_actions\` is set to \`selected\`. */ + selected_actions_url?: SelectedActionsUrl; + /** The API URL to use to get or set the selected repositories that are allowed to run GitHub Actions, when \`enabled_repositories\` is set to \`selected\`. */ + selected_repositories_url?: string; +} + +/** + * ActionsPublicKey + * The public key used for setting Actions Secrets. + */ +export interface ActionsPublicKey { + /** @example "2011-01-26T19:01:12Z" */ + created_at?: string; + /** @example 2 */ + id?: number; + /** + * The Base64 encoded public key. + * @example "hBT5WZEj8ZoOv6TYJsfWq7MxTEQopZO5/IT3ZCVQPzs=" + */ + key: string; + /** + * The identifier for the key. + * @example "1234567" + */ + key_id: string; + /** @example "ssh-rsa AAAAB3NzaC1yc2EAAA" */ + title?: string; + /** @example "https://api.github.com/user/keys/2" */ + url?: string; +} + +export type ActionsReRunWorkflowData = any; + +export type ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgData = any; + +export type ActionsRemoveSelectedRepoFromOrgSecretData = any; + +export type ActionsRemoveSelfHostedRunnerFromGroupForOrgData = any; + +export interface ActionsRepositoryPermissions { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions: AllowedActions; + /** Whether GitHub Actions is enabled on the repository. */ + enabled: ActionsEnabled; + /** The API URL to use to get or set the actions that are allowed to run, when \`allowed_actions\` is set to \`selected\`. */ + selected_actions_url?: SelectedActionsUrl; +} + +/** + * Actions Secret + * Set secrets for GitHub Actions. + */ +export interface ActionsSecret { + /** @format date-time */ + created_at: string; + /** + * The name of the secret. + * @example "SECRET_TOKEN" + */ + name: string; + /** @format date-time */ + updated_at: string; +} + +export type ActionsSetAllowedActionsOrganizationData = any; + +export type ActionsSetAllowedActionsRepositoryData = any; + +export type ActionsSetGithubActionsPermissionsOrganizationData = any; + +export interface ActionsSetGithubActionsPermissionsOrganizationPayload { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions?: AllowedActions; + /** The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ + enabled_repositories: EnabledRepositories; +} + +export type ActionsSetGithubActionsPermissionsRepositoryData = any; + +export interface ActionsSetGithubActionsPermissionsRepositoryPayload { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions?: AllowedActions; + /** Whether GitHub Actions is enabled on the repository. */ + enabled: ActionsEnabled; +} + +export type ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgData = any; + +export interface ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgPayload { + /** List of repository IDs that can access the runner group. */ + selected_repository_ids: number[]; +} + +export type ActionsSetSelectedReposForOrgSecretData = any; + +export interface ActionsSetSelectedReposForOrgSecretPayload { + /** An array of repository ids that can access the organization secret. You can only provide a list of repository ids when the \`visibility\` is set to \`selected\`. You can add and remove individual repositories using the [Set selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#set-selected-repositories-for-an-organization-secret) and [Remove selected repository from an organization secret](https://docs.github.com/rest/reference/actions#remove-selected-repository-from-an-organization-secret) endpoints. */ + selected_repository_ids?: number[]; +} + +export type ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationData = any; + +export interface ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationPayload { + /** List of repository IDs to enable for GitHub Actions. */ + selected_repository_ids: number[]; +} + +export type ActionsSetSelfHostedRunnersInGroupForOrgData = any; + +export interface ActionsSetSelfHostedRunnersInGroupForOrgPayload { + /** List of runner IDs to add to the runner group. */ + runners: number[]; +} + +export type ActionsUpdateSelfHostedRunnerGroupForOrgData = RunnerGroupsOrg; + +export interface ActionsUpdateSelfHostedRunnerGroupForOrgPayload { + /** Name of the runner group. */ + name?: string; + /** Visibility of a runner group. You can select all repositories, select individual repositories, or all private repositories. Can be one of: \`all\`, \`selected\`, or \`private\`. */ + visibility?: ActionsUpdateSelfHostedRunnerGroupForOrgVisibilityEnum; +} + +/** Visibility of a runner group. You can select all repositories, select individual repositories, or all private repositories. Can be one of: \`all\`, \`selected\`, or \`private\`. */ +export enum ActionsUpdateSelfHostedRunnerGroupForOrgVisibilityEnum { + Selected = "selected", + All = "all", + Private = "private", +} + +export type ActivityCheckRepoIsStarredByAuthenticatedUserData = any; + +export type ActivityCheckRepoIsStarredByAuthenticatedUserError = BasicError; + +export type ActivityDeleteRepoSubscriptionData = any; + +export type ActivityDeleteThreadSubscriptionData = any; + +export type ActivityGetFeedsData = Feed; + +export type ActivityGetRepoSubscriptionData = RepositorySubscription; + +export type ActivityGetThreadData = Thread; + +export type ActivityGetThreadSubscriptionForAuthenticatedUserData = ThreadSubscription; + +export type ActivityListEventsForAuthenticatedUserData = Event[]; + +export interface ActivityListEventsForAuthenticatedUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export type ActivityListNotificationsForAuthenticatedUserData = Thread[]; + +export interface ActivityListNotificationsForAuthenticatedUserParams { + /** + * If \`true\`, show notifications marked as read. + * @default false + */ + all?: boolean; + /** Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + before?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * If \`true\`, only shows notifications in which the user is directly participating or mentioned. + * @default false + */ + participating?: boolean; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; +} + +export type ActivityListOrgEventsForAuthenticatedUserData = Event[]; + +export interface ActivityListOrgEventsForAuthenticatedUserParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export type ActivityListPublicEventsData = Event[]; + +export type ActivityListPublicEventsForRepoNetworkData = Event[]; + +export interface ActivityListPublicEventsForRepoNetworkParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ActivityListPublicEventsForUserData = Event[]; + +export interface ActivityListPublicEventsForUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export interface ActivityListPublicEventsParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type ActivityListPublicOrgEventsData = Event[]; + +export interface ActivityListPublicOrgEventsParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type ActivityListReceivedEventsForUserData = Event[]; + +export interface ActivityListReceivedEventsForUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export type ActivityListReceivedPublicEventsForUserData = Event[]; + +export interface ActivityListReceivedPublicEventsForUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export type ActivityListRepoEventsData = Event[]; + +export interface ActivityListRepoEventsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ActivityListRepoNotificationsForAuthenticatedUserData = Thread[]; + +export interface ActivityListRepoNotificationsForAuthenticatedUserParams { + /** + * If \`true\`, show notifications marked as read. + * @default false + */ + all?: boolean; + /** Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + before?: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * If \`true\`, only shows notifications in which the user is directly participating or mentioned. + * @default false + */ + participating?: boolean; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; +} + +export type ActivityListReposStarredByAuthenticatedUserData = Repository[]; + +export interface ActivityListReposStarredByAuthenticatedUserParams { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: DirectionEnum17; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: SortEnum20; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum ActivityListReposStarredByAuthenticatedUserParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum ActivityListReposStarredByAuthenticatedUserParams1SortEnum { + Created = "created", + Updated = "updated", +} + +export type ActivityListReposStarredByUserData = Repository[]; + +export interface ActivityListReposStarredByUserParams { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: DirectionEnum19; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: SortEnum22; + username: string; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum ActivityListReposStarredByUserParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum ActivityListReposStarredByUserParams1SortEnum { + Created = "created", + Updated = "updated", +} + +export type ActivityListReposWatchedByUserData = MinimalRepository[]; + +export interface ActivityListReposWatchedByUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export type ActivityListStargazersForRepoData = SimpleUser[]; + +export interface ActivityListStargazersForRepoParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ActivityListWatchedReposForAuthenticatedUserData = MinimalRepository[]; + +export interface ActivityListWatchedReposForAuthenticatedUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type ActivityListWatchersForRepoData = SimpleUser[]; + +export interface ActivityListWatchersForRepoParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export interface ActivityMarkNotificationsAsReadData { + message?: string; +} + +export interface ActivityMarkNotificationsAsReadPayload { + /** + * Describes the last point that notifications were checked. + * @format date-time + */ + last_read_at?: string; + /** Whether the notification has been read. */ + read?: boolean; +} + +export type ActivityMarkRepoNotificationsAsReadData = any; + +export interface ActivityMarkRepoNotificationsAsReadPayload { + /** Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. Default: The current timestamp. */ + last_read_at?: string; +} + +export type ActivityMarkThreadAsReadData = any; + +export type ActivitySetRepoSubscriptionData = RepositorySubscription; + +export interface ActivitySetRepoSubscriptionPayload { + /** Determines if all notifications should be blocked from this repository. */ + ignored?: boolean; + /** Determines if notifications should be received from this repository. */ + subscribed?: boolean; +} + +export type ActivitySetThreadSubscriptionData = ThreadSubscription; + +export interface ActivitySetThreadSubscriptionPayload { + /** + * Whether to block all notifications from a thread. + * @default false + */ + ignored?: boolean; +} + +export type ActivityStarRepoForAuthenticatedUserData = any; + +export type ActivityUnstarRepoForAuthenticatedUserData = any; + +/** + * Actor + * Actor + */ +export interface Actor { + /** @format uri */ + avatar_url: string; + display_login?: string; + gravatar_id: string | null; + id: number; + login: string; + /** @format uri */ + url: string; +} + +/** + * Filters the collaborators by their affiliation. Can be one of: + * \\* \`outside\`: Outside collaborators of a project that are not a member of the project's organization. + * \\* \`direct\`: Collaborators with permissions to a project, regardless of organization membership status. + * \\* \`all\`: All collaborators the authenticated user can see. + * @default "all" + */ +export enum AffiliationEnum { + Outside = "outside", + Direct = "direct", + All = "all", +} + +/** + * Filter collaborators returned by their affiliation. Can be one of: + * \\* \`outside\`: All outside collaborators of an organization-owned repository. + * \\* \`direct\`: All collaborators with permissions to an organization-owned repository, regardless of organization membership status. + * \\* \`all\`: All collaborators the authenticated user can see. + * @default "all" + */ +export enum AffiliationEnum1 { + Outside = "outside", + Direct = "direct", + All = "all", +} + +/** + * The time that the alert was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. + * @format date-time + */ +export type AlertCreatedAt = string; + +/** + * The GitHub URL of the alert resource. + * @format uri + */ +export type AlertHtmlUrl = string; + +/** The security alert number. */ +export type AlertNumber = number; + +/** + * The REST API URL of the alert resource. + * @format uri + */ +export type AlertUrl = string; + +/** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ +export enum AllowedActions { + All = "all", + LocalOnly = "local_only", + Selected = "selected", +} + +/** + * Api Overview + * Api Overview + */ +export interface ApiOverview { + /** @example ["13.64.0.0/16","13.65.0.0/16"] */ + actions?: string[]; + /** @example ["127.0.0.1/32"] */ + api?: string[]; + /** @example ["127.0.0.1/32"] */ + git?: string[]; + /** @example ["127.0.0.1/32"] */ + hooks?: string[]; + /** @example ["54.158.161.132","54.226.70.38"] */ + importer?: string[]; + /** @example ["192.30.252.153/32","192.30.252.154/32"] */ + pages?: string[]; + ssh_key_fingerprints?: { + SHA256_DSA?: string; + SHA256_RSA?: string; + }; + /** @example true */ + verifiable_password_authentication: boolean; + /** @example ["127.0.0.1/32"] */ + web?: string[]; +} + +/** + * App Permissions + * The permissions granted to the user-to-server access token. + * @example {"contents":"read","issues":"read","deployments":"write","single_file":"read"} + */ +export interface AppPermissions { + /** The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be one of: \`read\` or \`write\`. */ + actions?: AppPermissionsActionsEnum; + /** The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. Can be one of: \`read\` or \`write\`. */ + administration?: AppPermissionsAdministrationEnum; + /** The level of permission to grant the access token for checks on code. Can be one of: \`read\` or \`write\`. */ + checks?: AppPermissionsChecksEnum; + /** The level of permission to grant the access token for notification of content references and creation content attachments. Can be one of: \`read\` or \`write\`. */ + content_references?: AppPermissionsContentReferencesEnum; + /** The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges. Can be one of: \`read\` or \`write\`. */ + contents?: AppPermissionsContentsEnum; + /** The level of permission to grant the access token for deployments and deployment statuses. Can be one of: \`read\` or \`write\`. */ + deployments?: AppPermissionsDeploymentsEnum; + /** The level of permission to grant the access token for managing repository environments. Can be one of: \`read\` or \`write\`. */ + environments?: AppPermissionsEnvironmentsEnum; + /** The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. Can be one of: \`read\` or \`write\`. */ + issues?: AppPermissionsIssuesEnum; + /** The level of permission to grant the access token for organization teams and members. Can be one of: \`read\` or \`write\`. */ + members?: AppPermissionsMembersEnum; + /** The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. Can be one of: \`read\` or \`write\`. */ + metadata?: AppPermissionsMetadataEnum; + /** The level of permission to grant the access token to manage access to an organization. Can be one of: \`read\` or \`write\`. */ + organization_administration?: AppPermissionsOrganizationAdministrationEnum; + /** The level of permission to grant the access token to manage the post-receive hooks for an organization. Can be one of: \`read\` or \`write\`. */ + organization_hooks?: AppPermissionsOrganizationHooksEnum; + /** The level of permission to grant the access token for viewing an organization's plan. Can be one of: \`read\`. */ + organization_plan?: AppPermissionsOrganizationPlanEnum; + /** The level of permission to grant the access token to manage organization projects, columns, and cards. Can be one of: \`read\`, \`write\`, or \`admin\`. */ + organization_projects?: AppPermissionsOrganizationProjectsEnum; + /** The level of permission to grant the access token to manage organization secrets. Can be one of: \`read\` or \`write\`. */ + organization_secrets?: AppPermissionsOrganizationSecretsEnum; + /** The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization. Can be one of: \`read\` or \`write\`. */ + organization_self_hosted_runners?: AppPermissionsOrganizationSelfHostedRunnersEnum; + /** The level of permission to grant the access token to view and manage users blocked by the organization. Can be one of: \`read\` or \`write\`. */ + organization_user_blocking?: AppPermissionsOrganizationUserBlockingEnum; + /** The level of permission to grant the access token for packages published to GitHub Packages. Can be one of: \`read\` or \`write\`. */ + packages?: AppPermissionsPackagesEnum; + /** The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds. Can be one of: \`read\` or \`write\`. */ + pages?: AppPermissionsPagesEnum; + /** The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges. Can be one of: \`read\` or \`write\`. */ + pull_requests?: AppPermissionsPullRequestsEnum; + /** The level of permission to grant the access token to manage the post-receive hooks for a repository. Can be one of: \`read\` or \`write\`. */ + repository_hooks?: AppPermissionsRepositoryHooksEnum; + /** The level of permission to grant the access token to manage repository projects, columns, and cards. Can be one of: \`read\`, \`write\`, or \`admin\`. */ + repository_projects?: AppPermissionsRepositoryProjectsEnum; + /** The level of permission to grant the access token to view and manage secret scanning alerts. Can be one of: \`read\` or \`write\`. */ + secret_scanning_alerts?: AppPermissionsSecretScanningAlertsEnum; + /** The level of permission to grant the access token to manage repository secrets. Can be one of: \`read\` or \`write\`. */ + secrets?: AppPermissionsSecretsEnum; + /** The level of permission to grant the access token to view and manage security events like code scanning alerts. Can be one of: \`read\` or \`write\`. */ + security_events?: AppPermissionsSecurityEventsEnum; + /** The level of permission to grant the access token to manage just a single file. Can be one of: \`read\` or \`write\`. */ + single_file?: AppPermissionsSingleFileEnum; + /** The level of permission to grant the access token for commit statuses. Can be one of: \`read\` or \`write\`. */ + statuses?: AppPermissionsStatusesEnum; + /** The level of permission to grant the access token to manage team discussions and related comments. Can be one of: \`read\` or \`write\`. */ + team_discussions?: AppPermissionsTeamDiscussionsEnum; + /** The level of permission to grant the access token to retrieve Dependabot alerts. Can be one of: \`read\`. */ + vulnerability_alerts?: AppPermissionsVulnerabilityAlertsEnum; + /** The level of permission to grant the access token to update GitHub Actions workflow files. Can be one of: \`write\`. */ + workflows?: AppPermissionsWorkflowsEnum; +} + +/** The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsActionsEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsAdministrationEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for checks on code. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsChecksEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for notification of content references and creation content attachments. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsContentReferencesEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsContentsEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for deployments and deployment statuses. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsDeploymentsEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for managing repository environments. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsEnvironmentsEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsIssuesEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for organization teams and members. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsMembersEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsMetadataEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to manage access to an organization. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsOrganizationAdministrationEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to manage the post-receive hooks for an organization. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsOrganizationHooksEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for viewing an organization's plan. Can be one of: \`read\`. */ +export enum AppPermissionsOrganizationPlanEnum { + Read = "read", +} + +/** The level of permission to grant the access token to manage organization projects, columns, and cards. Can be one of: \`read\`, \`write\`, or \`admin\`. */ +export enum AppPermissionsOrganizationProjectsEnum { + Read = "read", + Write = "write", + Admin = "admin", +} + +/** The level of permission to grant the access token to manage organization secrets. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsOrganizationSecretsEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsOrganizationSelfHostedRunnersEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to view and manage users blocked by the organization. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsOrganizationUserBlockingEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for packages published to GitHub Packages. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsPackagesEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsPagesEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsPullRequestsEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to manage the post-receive hooks for a repository. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsRepositoryHooksEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to manage repository projects, columns, and cards. Can be one of: \`read\`, \`write\`, or \`admin\`. */ +export enum AppPermissionsRepositoryProjectsEnum { + Read = "read", + Write = "write", + Admin = "admin", +} + +/** The level of permission to grant the access token to view and manage secret scanning alerts. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsSecretScanningAlertsEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to manage repository secrets. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsSecretsEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to view and manage security events like code scanning alerts. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsSecurityEventsEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to manage just a single file. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsSingleFileEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token for commit statuses. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsStatusesEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to manage team discussions and related comments. Can be one of: \`read\` or \`write\`. */ +export enum AppPermissionsTeamDiscussionsEnum { + Read = "read", + Write = "write", +} + +/** The level of permission to grant the access token to retrieve Dependabot alerts. Can be one of: \`read\`. */ +export enum AppPermissionsVulnerabilityAlertsEnum { + Read = "read", +} + +/** The level of permission to grant the access token to update GitHub Actions workflow files. Can be one of: \`write\`. */ +export enum AppPermissionsWorkflowsEnum { + Write = "write", +} + +/** + * Application Grant + * The authorization associated with an OAuth Access. + */ +export interface ApplicationGrant { + app: { + client_id: string; + name: string; + /** @format uri */ + url: string; + }; + /** + * @format date-time + * @example "2011-09-06T17:26:27Z" + */ + created_at: string; + /** @example 1 */ + id: number; + /** @example ["public_repo"] */ + scopes: string[]; + /** + * @format date-time + * @example "2011-09-06T20:39:23Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/applications/grants/1" + */ + url: string; + user?: SimpleUser | null; +} + +export type AppsAddRepoToInstallationData = any; + +export type AppsCheckAuthorizationData = Authorization | null; + +export type AppsCheckTokenData = Authorization; + +export interface AppsCheckTokenPayload { + /** The access_token of the OAuth application. */ + access_token: string; +} + +export type AppsCreateContentAttachmentData = ContentReferenceAttachment; + +export interface AppsCreateContentAttachmentPayload { + /** + * The body of the attachment + * @maxLength 262144 + * @example "Body of the attachment" + */ + body: string; + /** + * The title of the attachment + * @maxLength 1024 + * @example "Title of the attachment" + */ + title: string; +} + +export type AppsCreateFromManifestData = Integration & { + client_id: string; + client_secret: string; + pem: string; + webhook_secret: string; + [key: string]: any; +}; + +export type AppsCreateInstallationAccessTokenData = InstallationToken; + +export interface AppsCreateInstallationAccessTokenPayload { + /** The permissions granted to the user-to-server access token. */ + permissions?: AppPermissions; + /** List of repository names that the token should have access to */ + repositories?: string[]; + /** + * List of repository IDs that the token should have access to + * @example [1] + */ + repository_ids?: number[]; +} + +export type AppsDeleteAuthorizationData = any; + +export interface AppsDeleteAuthorizationPayload { + /** The OAuth access token used to authenticate to the GitHub API. */ + access_token?: string; +} + +export type AppsDeleteInstallationData = any; + +export type AppsDeleteTokenData = any; + +export interface AppsDeleteTokenPayload { + /** The OAuth access token used to authenticate to the GitHub API. */ + access_token?: string; +} + +export type AppsGetAuthenticatedData = Integration; + +export type AppsGetBySlugData = Integration; + +export type AppsGetInstallationData = Installation; + +export type AppsGetOrgInstallationData = Installation; + +export type AppsGetRepoInstallationData = Installation; + +export type AppsGetSubscriptionPlanForAccountData = MarketplacePurchase; + +export type AppsGetSubscriptionPlanForAccountError = BasicError; + +export type AppsGetSubscriptionPlanForAccountStubbedData = MarketplacePurchase; + +export type AppsGetUserInstallationData = Installation; + +export type AppsGetWebhookConfigForAppData = WebhookConfig; + +export type AppsListAccountsForPlanData = MarketplacePurchase[]; + +export interface AppsListAccountsForPlanParams { + /** To return the oldest accounts first, set to \`asc\`. Can be one of \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ + direction?: DirectionEnum1; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** plan_id parameter */ + planId: number; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: SortEnum1; +} + +/** To return the oldest accounts first, set to \`asc\`. Can be one of \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ +export enum AppsListAccountsForPlanParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum AppsListAccountsForPlanParams1SortEnum { + Created = "created", + Updated = "updated", +} + +export type AppsListAccountsForPlanStubbedData = MarketplacePurchase[]; + +export interface AppsListAccountsForPlanStubbedParams { + /** To return the oldest accounts first, set to \`asc\`. Can be one of \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ + direction?: DirectionEnum2; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** plan_id parameter */ + planId: number; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: SortEnum2; +} + +/** To return the oldest accounts first, set to \`asc\`. Can be one of \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ +export enum AppsListAccountsForPlanStubbedParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum AppsListAccountsForPlanStubbedParams1SortEnum { + Created = "created", + Updated = "updated", +} + +export interface AppsListInstallationReposForAuthenticatedUserData { + repositories: Repository[]; + repository_selection?: string; + total_count: number; +} + +export interface AppsListInstallationReposForAuthenticatedUserParams { + /** installation_id parameter */ + installationId: number; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type AppsListInstallationsData = Installation[]; + +export interface AppsListInstallationsForAuthenticatedUserData { + installations: Installation[]; + total_count: number; +} + +export interface AppsListInstallationsForAuthenticatedUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface AppsListInstallationsParams { + outdated?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; +} + +export type AppsListPlansData = MarketplaceListingPlan[]; + +export interface AppsListPlansParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type AppsListPlansStubbedData = MarketplaceListingPlan[]; + +export interface AppsListPlansStubbedParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface AppsListReposAccessibleToInstallationData { + repositories: Repository[]; + /** @example "selected" */ + repository_selection?: string; + total_count: number; +} + +export interface AppsListReposAccessibleToInstallationParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type AppsListSubscriptionsForAuthenticatedUserData = UserMarketplacePurchase[]; + +export interface AppsListSubscriptionsForAuthenticatedUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type AppsListSubscriptionsForAuthenticatedUserStubbedData = UserMarketplacePurchase[]; + +export interface AppsListSubscriptionsForAuthenticatedUserStubbedParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type AppsRemoveRepoFromInstallationData = any; + +export type AppsResetAuthorizationData = Authorization; + +export type AppsResetTokenData = Authorization; + +export interface AppsResetTokenPayload { + /** The access_token of the OAuth application. */ + access_token: string; +} + +export type AppsRevokeAuthorizationForApplicationData = any; + +export type AppsRevokeGrantForApplicationData = any; + +export type AppsRevokeInstallationAccessTokenData = any; + +export type AppsScopeTokenData = Authorization; + +export interface AppsScopeTokenPayload { + /** + * **Required.** The OAuth access token used to authenticate to the GitHub API. + * @example "e72e16c7e42f292c6912e7710c838347ae178b4a" + */ + access_token?: string; + /** The permissions granted to the user-to-server access token. */ + permissions?: AppPermissions; + /** The list of repository IDs to scope the user-to-server access token to. \`repositories\` may not be specified if \`repository_ids\` is specified. */ + repositories?: string[]; + /** + * The list of repository names to scope the user-to-server access token to. \`repository_ids\` may not be specified if \`repositories\` is specified. + * @example [1] + */ + repository_ids?: number[]; + /** + * The name of the user or organization to scope the user-to-server access token to. **Required** unless \`target_id\` is specified. + * @example "octocat" + */ + target?: string; + /** + * The ID of the user or organization to scope the user-to-server access token to. **Required** unless \`target\` is specified. + * @example 1 + */ + target_id?: number; +} + +export type AppsSuspendInstallationData = any; + +export type AppsUnsuspendInstallationData = any; + +export type AppsUpdateWebhookConfigForAppData = WebhookConfig; + +/** @example {"content_type":"json","insecure_ssl":"0","secret":"********","url":"https://example.com/webhook"} */ +export interface AppsUpdateWebhookConfigForAppPayload { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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; + /** 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; + /** The URL to which the payloads will be delivered. */ + url?: WebhookConfigUrl; +} + +/** + * Filters the project cards that are returned by the card's state. Can be one of \`all\`,\`archived\`, or \`not_archived\`. + * @default "not_archived" + */ +export enum ArchivedStateEnum { + All = "all", + Archived = "archived", + NotArchived = "not_archived", +} + +/** + * Artifact + * An artifact + */ +export interface Artifact { + /** @example "https://api.github.com/repos/github/hello-world/actions/artifacts/5/zip" */ + archive_download_url: string; + /** @format date-time */ + created_at: string | null; + /** Whether or not the artifact has expired. */ + expired: boolean; + /** @format date-time */ + expires_at: string; + /** @example 5 */ + id: number; + /** + * The name of the artifact. + * @example "AdventureWorks.Framework" + */ + name: string; + /** @example "MDEwOkNoZWNrU3VpdGU1" */ + node_id: string; + /** + * The size in bytes of the artifact. + * @example 12345 + */ + size_in_bytes: number; + /** @format date-time */ + updated_at: string | null; + /** @example "https://api.github.com/repos/github/hello-world/actions/artifacts/5" */ + url: string; +} + +export interface AuditLogEvent { + /** The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). */ + "@timestamp"?: number; + /** The name of the action that was performed, for example \`user.login\` or \`repo.create\`. */ + action?: string; + active?: boolean; + active_was?: boolean; + /** The actor who performed the action. */ + actor?: string; + /** The username of the account being blocked. */ + blocked_user?: string; + business?: string; + config?: any[]; + config_was?: any[]; + content_type?: string; + /** The time the audit log event was recorded, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). */ + created_at?: number; + deploy_key_fingerprint?: string; + emoji?: string; + events?: any[]; + events_were?: any[]; + explanation?: string; + fingerprint?: string; + hook_id?: number; + limited_availability?: boolean; + message?: string; + name?: string; + old_user?: string; + openssh_public_key?: string; + org?: string; + previous_visibility?: string; + read_only?: boolean; + /** The name of the repository. */ + repo?: string; + /** The name of the repository. */ + repository?: string; + repository_public?: boolean; + target_login?: string; + team?: string; + /** The type of protocol (for example, HTTP or SSH) used to transfer Git data. */ + transport_protocol?: number; + /** A human readable name for the protocol (for example, HTTP or SSH) used to transfer Git data. */ + transport_protocol_name?: string; + /** The user that was affected by the action performed (if available). */ + user?: string; + /** The repository visibility, for example \`public\` or \`private\`. */ + visibility?: string; +} + +export type AuditLogGetAuditLogData = AuditLogEvent[]; + +export interface AuditLogGetAuditLogParams { + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor. */ + after?: string; + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor. */ + before?: string; + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** + * The event types to include: + * + * - \`web\` - returns web (non-Git) events + * - \`git\` - returns Git events + * - \`all\` - returns both web and Git events + * + * The default is \`web\`. + */ + include?: IncludeEnum; + /** + * The order of audit log events. To list newest events first, specify \`desc\`. To list oldest events first, specify \`asc\`. + * + * The default is \`desc\`. + */ + order?: OrderEnum; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** A search phrase. For more information, see [Searching the audit log](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#searching-the-audit-log). */ + phrase?: string; +} + +/** + * The event types to include: + * + * - \`web\` - returns web (non-Git) events + * - \`git\` - returns Git events + * - \`all\` - returns both web and Git events + * + * The default is \`web\`. + */ +export enum AuditLogGetAuditLogParams1IncludeEnum { + Web = "web", + Git = "git", + All = "all", +} + +/** + * The order of audit log events. To list newest events first, specify \`desc\`. To list oldest events first, specify \`asc\`. + * + * The default is \`desc\`. + */ +export enum AuditLogGetAuditLogParams1OrderEnum { + Desc = "desc", + Asc = "asc", +} + +/** + * Authentication Token + * Authentication Token + */ +export interface AuthenticationToken { + /** + * The time this token expires + * @format date-time + * @example "2016-07-11T22:14:10Z" + */ + expires_at: string; + /** @example {"issues":"read","deployments":"write"} */ + permissions?: object; + /** The repositories this token has access to */ + repositories?: Repository[]; + /** Describe whether all repositories have been selected or there's a selection involved */ + repository_selection?: AuthenticationTokenRepositorySelectionEnum; + /** @example "config.yaml" */ + single_file?: string | null; + /** + * The token used for authentication + * @example "v1.1f699f1069f60xxx" + */ + token: string; +} + +/** Describe whether all repositories have been selected or there's a selection involved */ +export enum AuthenticationTokenRepositorySelectionEnum { + All = "all", + Selected = "selected", +} + +/** + * author_association + * How the author is associated with the repository. + * @example "OWNER" + */ +export enum AuthorAssociation { + COLLABORATOR = "COLLABORATOR", + CONTRIBUTOR = "CONTRIBUTOR", + FIRST_TIMER = "FIRST_TIMER", + FIRST_TIME_CONTRIBUTOR = "FIRST_TIME_CONTRIBUTOR", + MANNEQUIN = "MANNEQUIN", + MEMBER = "MEMBER", + NONE = "NONE", + OWNER = "OWNER", +} + +/** + * Authorization + * The authorization for an OAuth app, GitHub App, or a Personal Access Token. + */ +export interface Authorization { + app: { + client_id: string; + name: string; + /** @format uri */ + url: string; + }; + /** @format date-time */ + created_at: string; + fingerprint: string | null; + hashed_token: string | null; + id: number; + installation?: ScopedInstallation | null; + note: string | null; + /** @format uri */ + note_url: string | null; + /** A list of scopes that this authorization is in. */ + scopes: string[] | null; + token: string; + token_last_eight: string | null; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + user?: SimpleUser | null; +} + +/** + * Auto merge + * The status of auto merging a pull request. + */ +export type AutoMerge = { + /** Commit message for the merge commit. */ + commit_message: string; + /** Title for the merge commit message. */ + commit_title: string; + /** Simple User */ + enabled_by: SimpleUser; + /** The merge method to use. */ + merge_method: AutoMergeMergeMethodEnum; +} | null; + +/** The merge method to use. */ +export enum AutoMergeMergeMethodEnum { + Merge = "merge", + Squash = "squash", + Rebase = "rebase", +} + +/** Bad Request */ +export type BadRequest = BasicError; + +/** + * Base Gist + * Base Gist + */ +export interface BaseGist { + comments: number; + /** @format uri */ + comments_url: string; + /** @format uri */ + commits_url: string; + /** @format date-time */ + created_at: string; + description: string | null; + files: Record< + string, + { + filename?: string; + language?: string; + raw_url?: string; + size?: number; + type?: string; + } + >; + forks?: any[]; + /** @format uri */ + forks_url: string; + /** @format uri */ + git_pull_url: string; + /** @format uri */ + git_push_url: string; + history?: any[]; + /** @format uri */ + html_url: string; + id: string; + node_id: string; + owner?: SimpleUser | null; + public: boolean; + truncated?: boolean; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + user: SimpleUser | null; +} + +/** + * Basic Error + * Basic Error + */ +export interface BasicError { + documentation_url?: string; + message?: string; +} + +export type BillingGetGithubActionsBillingGheData = ActionsBillingUsage; + +export type BillingGetGithubActionsBillingOrgData = ActionsBillingUsage; + +export type BillingGetGithubActionsBillingUserData = ActionsBillingUsage; + +export type BillingGetGithubPackagesBillingGheData = PackagesBillingUsage; + +export type BillingGetGithubPackagesBillingOrgData = PackagesBillingUsage; + +export type BillingGetGithubPackagesBillingUserData = PackagesBillingUsage; + +export type BillingGetSharedStorageBillingGheData = CombinedBillingUsage; + +export type BillingGetSharedStorageBillingOrgData = CombinedBillingUsage; + +export type BillingGetSharedStorageBillingUserData = CombinedBillingUsage; + +/** + * Blob + * Blob + */ +export interface Blob { + content: string; + encoding: string; + highlighted_content?: string; + node_id: string; + sha: string; + size: number | null; + /** @format uri */ + url: string; +} + +/** + * Branch Protection + * Branch Protection + */ +export interface BranchProtection { + allow_deletions?: { + enabled?: boolean; + }; + allow_force_pushes?: { + enabled?: boolean; + }; + enabled: boolean; + /** Protected Branch Admin Enforced */ + enforce_admins?: ProtectedBranchAdminEnforced; + /** @example ""branch/with/protection"" */ + name?: string; + /** @example ""https://api.github.com/repos/owner-79e94e2d36b3fd06a32bb213/AAA_Public_Repo/branches/branch/with/protection/protection"" */ + protection_url?: string; + required_linear_history?: { + enabled?: boolean; + }; + /** Protected Branch Pull Request Review */ + required_pull_request_reviews?: ProtectedBranchPullRequestReview; + required_status_checks: { + contexts: string[]; + contexts_url?: string; + enforcement_level: string; + url?: string; + }; + /** Branch Restriction Policy */ + restrictions?: BranchRestrictionPolicy; + url?: string; +} + +/** + * Branch Restriction Policy + * Branch Restriction Policy + */ +export interface BranchRestrictionPolicy { + apps: { + created_at?: string; + description?: string; + events?: string[]; + external_url?: string; + html_url?: string; + id?: number; + name?: string; + node_id?: string; + owner?: { + avatar_url?: string; + description?: 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 """" */ + 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; + }; + permissions?: { + contents?: string; + issues?: string; + metadata?: string; + single_file?: string; + }; + slug?: string; + updated_at?: string; + }[]; + /** @format uri */ + apps_url: string; + teams: { + description?: string | null; + html_url?: string; + id?: number; + members_url?: string; + name?: string; + node_id?: string; + parent?: string | null; + permission?: string; + privacy?: string; + repositories_url?: string; + slug?: string; + url?: string; + }[]; + /** @format uri */ + teams_url: string; + /** @format uri */ + url: string; + users: { + 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; + }[]; + /** @format uri */ + users_url: string; +} + +/** + * Branch Short + * Branch Short + */ +export interface BranchShort { + commit: { + sha: string; + url: string; + }; + name: string; + protected: boolean; +} + +/** + * Branch With Protection + * Branch With Protection + */ +export interface BranchWithProtection { + _links: { + html: string; + /** @format uri */ + self: string; + }; + /** Commit */ + commit: Commit; + name: string; + /** @example ""mas*"" */ + pattern?: string; + protected: boolean; + /** Branch Protection */ + protection: BranchProtection; + /** @format uri */ + protection_url: string; + /** @example 1 */ + required_approving_review_count?: number; +} + +/** + * Check Annotation + * Check Annotation + */ +export interface CheckAnnotation { + /** @example "warning" */ + annotation_level: string | null; + blob_href: string; + /** @example 10 */ + end_column: number | null; + /** @example 2 */ + end_line: number; + /** @example "Check your spelling for 'banaas'." */ + message: string | null; + /** @example "README.md" */ + path: string; + /** @example "Do you mean 'bananas' or 'banana'?" */ + raw_details: string | null; + /** @example 5 */ + start_column: number | null; + /** @example 2 */ + start_line: number; + /** @example "Spell Checker" */ + title: string | null; +} + +/** + * CheckRun + * A check performed on the code of a given code change + */ +export interface CheckRun { + app: Integration | null; + check_suite: { + id: number; + } | null; + /** + * @format date-time + * @example "2018-05-04T01:14:52Z" + */ + completed_at: string | null; + /** @example "neutral" */ + conclusion: CheckRunConclusionEnum; + /** @example "https://example.com" */ + details_url: string | null; + /** @example "42" */ + external_id: string | null; + /** + * The SHA of the commit that is being checked. + * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" + */ + head_sha: string; + /** @example "https://github.com/github/hello-world/runs/4" */ + html_url: string | null; + /** + * The id of the check. + * @example 21 + */ + id: number; + /** + * The name of the check. + * @example "test-coverage" + */ + name: string; + /** @example "MDg6Q2hlY2tSdW40" */ + node_id: string; + output: { + annotations_count: number; + /** @format uri */ + annotations_url: string; + summary: string | null; + text: string | null; + title: string | null; + }; + pull_requests: PullRequestMinimal[]; + /** + * @format date-time + * @example "2018-05-04T01:14:52Z" + */ + started_at: string | null; + /** + * The phase of the lifecycle that the check is currently in. + * @example "queued" + */ + status: CheckRunStatusEnum; + /** @example "https://api.github.com/repos/github/hello-world/check-runs/4" */ + url: string; +} + +/** @example "neutral" */ +export enum CheckRunConclusionEnum { + Success = "success", + Failure = "failure", + Neutral = "neutral", + Cancelled = "cancelled", + Skipped = "skipped", + TimedOut = "timed_out", + ActionRequired = "action_required", +} + +/** + * The phase of the lifecycle that the check is currently in. + * @example "queued" + */ +export enum CheckRunStatusEnum { + Queued = "queued", + InProgress = "in_progress", + Completed = "completed", +} + +/** + * CheckSuite + * A suite of checks performed on the code of a given code change + */ +export interface CheckSuite { + /** @example "d6fde92930d4715a2b49857d24b940956b26d2d3" */ + after: string | null; + app: Integration | null; + /** @example "146e867f55c26428e5f9fade55a9bbf5e95a7912" */ + before: string | null; + check_runs_url: string; + /** @example "neutral" */ + conclusion: CheckSuiteConclusionEnum; + /** @format date-time */ + created_at: string | null; + /** @example "master" */ + head_branch: string | null; + /** Simple Commit */ + head_commit: SimpleCommit; + /** + * The SHA of the head commit that is being checked. + * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" + */ + head_sha: string; + /** @example 5 */ + id: number; + latest_check_runs_count: number; + /** @example "MDEwOkNoZWNrU3VpdGU1" */ + node_id: string; + pull_requests: PullRequestMinimal[] | null; + /** Minimal Repository */ + repository: MinimalRepository; + /** @example "completed" */ + status: CheckSuiteStatusEnum; + /** @format date-time */ + updated_at: string | null; + /** @example "https://api.github.com/repos/github/hello-world/check-suites/5" */ + url: string | null; +} + +/** @example "neutral" */ +export enum CheckSuiteConclusionEnum { + Success = "success", + Failure = "failure", + Neutral = "neutral", + Cancelled = "cancelled", + Skipped = "skipped", + TimedOut = "timed_out", + ActionRequired = "action_required", +} + +/** + * Check Suite Preference + * Check suite configuration preferences for a repository. + */ +export interface CheckSuitePreference { + preferences: { + auto_trigger_checks?: { + app_id: number; + setting: boolean; + }[]; + }; + /** A git repository */ + repository: Repository; +} + +/** @example "completed" */ +export enum CheckSuiteStatusEnum { + Queued = "queued", + InProgress = "in_progress", + Completed = "completed", +} + +/** The level of the annotation. Can be one of \`notice\`, \`warning\`, or \`failure\`. */ +export enum ChecksCreateAnnotationLevelEnum { + Notice = "notice", + Warning = "warning", + Failure = "failure", +} + +/** + * **Required if you provide \`completed_at\` or a \`status\` of \`completed\`**. The final conclusion of the check. Can be one of \`success\`, \`failure\`, \`neutral\`, \`cancelled\`, \`skipped\`, \`timed_out\`, or \`action_required\`. When the conclusion is \`action_required\`, additional details should be provided on the site specified by \`details_url\`. + * **Note:** Providing \`conclusion\` will automatically set the \`status\` parameter to \`completed\`. Only GitHub can change a check run conclusion to \`stale\`. + */ +export enum ChecksCreateConclusionEnum { + Success = "success", + Failure = "failure", + Neutral = "neutral", + Cancelled = "cancelled", + Skipped = "skipped", + TimedOut = "timed_out", + ActionRequired = "action_required", +} + +export type ChecksCreateData = CheckRun; + +export type ChecksCreatePayload = ( + | { + status?: ChecksCreateStatusEnum; + [key: string]: any; + } + | { + status?: ChecksCreateStatusEnum1; + [key: string]: any; + } +) & { + /** + * Displays a button on GitHub that can be clicked to alert your app to do additional tasks. For example, a code linting app can display a button that automatically fixes detected errors. The button created in this object is displayed after the check run completes. When a user clicks the button, GitHub sends the [\`check_run.requested_action\` webhook](https://docs.github.com/webhooks/event-payloads/#check_run) to your app. Each action includes a \`label\`, \`identifier\` and \`description\`. A maximum of three actions are accepted. See the [\`actions\` object](https://docs.github.com/rest/reference/checks#actions-object) description. To learn more about check runs and requested actions, see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)." To learn more about check runs and requested actions, see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)." + * @maxItems 3 + */ + actions?: { + /** + * A short explanation of what this action would do. The maximum size is 40 characters. + * @maxLength 40 + */ + description: string; + /** + * A reference for the action on the integrator's system. The maximum size is 20 characters. + * @maxLength 20 + */ + identifier: string; + /** + * The text to be displayed on a button in the web UI. The maximum size is 20 characters. + * @maxLength 20 + */ + label: string; + }[]; + /** The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + completed_at?: string; + /** + * **Required if you provide \`completed_at\` or a \`status\` of \`completed\`**. The final conclusion of the check. Can be one of \`success\`, \`failure\`, \`neutral\`, \`cancelled\`, \`skipped\`, \`timed_out\`, or \`action_required\`. When the conclusion is \`action_required\`, additional details should be provided on the site specified by \`details_url\`. + * **Note:** Providing \`conclusion\` will automatically set the \`status\` parameter to \`completed\`. Only GitHub can change a check run conclusion to \`stale\`. + */ + conclusion?: ChecksCreateConclusionEnum; + /** The URL of the integrator's site that has the full details of the check. If the integrator does not provide this, then the homepage of the GitHub app is used. */ + details_url?: string; + /** A reference for the run on the integrator's system. */ + external_id?: string; + /** The SHA of the commit. */ + head_sha: string; + /** The name of the check. For example, "code-coverage". */ + name: string; + /** Check runs can accept a variety of data in the \`output\` object, including a \`title\` and \`summary\` and can optionally provide descriptive details about the run. See the [\`output\` object](https://docs.github.com/rest/reference/checks#output-object) description. */ + output?: { + /** + * Adds information from your analysis to specific lines of code. Annotations are visible on GitHub in the **Checks** and **Files changed** tab of the pull request. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the [Update a check run](https://docs.github.com/rest/reference/checks#update-a-check-run) endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. For details about how you can view annotations on GitHub, see "[About status checks](https://help.github.com/articles/about-status-checks#checks)". See the [\`annotations\` object](https://docs.github.com/rest/reference/checks#annotations-object) description for details about how to use this parameter. + * @maxItems 50 + */ + annotations?: { + /** The level of the annotation. Can be one of \`notice\`, \`warning\`, or \`failure\`. */ + annotation_level: ChecksCreateAnnotationLevelEnum; + /** The end column of the annotation. Annotations only support \`start_column\` and \`end_column\` on the same line. Omit this parameter if \`start_line\` and \`end_line\` have different values. */ + end_column?: number; + /** The end line of the annotation. */ + end_line: number; + /** A short description of the feedback for these lines of code. The maximum size is 64 KB. */ + message: string; + /** The path of the file to add an annotation to. For example, \`assets/css/main.css\`. */ + path: string; + /** Details about this annotation. The maximum size is 64 KB. */ + raw_details?: string; + /** The start column of the annotation. Annotations only support \`start_column\` and \`end_column\` on the same line. Omit this parameter if \`start_line\` and \`end_line\` have different values. */ + start_column?: number; + /** The start line of the annotation. */ + start_line: number; + /** The title that represents the annotation. The maximum size is 255 characters. */ + title?: string; + }[]; + /** Adds images to the output displayed in the GitHub pull request UI. See the [\`images\` object](https://docs.github.com/rest/reference/checks#images-object) description for details. */ + images?: { + /** The alternative text for the image. */ + alt: string; + /** A short image description. */ + caption?: string; + /** The full URL of the image. */ + image_url: string; + }[]; + /** + * The summary of the check run. This parameter supports Markdown. + * @maxLength 65535 + */ + summary: string; + /** + * The details of the check run. This parameter supports Markdown. + * @maxLength 65535 + */ + text?: string; + /** The title of the check run. */ + title: string; + }; + /** The time that the check run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + started_at?: string; + /** + * The current status. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. + * @default "queued" + */ + status?: ChecksCreateStatusEnum2; +}; + +export enum ChecksCreateStatusEnum { + Completed = "completed", +} + +export enum ChecksCreateStatusEnum1 { + Queued = "queued", + InProgress = "in_progress", +} + +/** + * The current status. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. + * @default "queued" + */ +export enum ChecksCreateStatusEnum2 { + Queued = "queued", + InProgress = "in_progress", + Completed = "completed", +} + +export type ChecksCreateSuiteData = CheckSuite; + +export interface ChecksCreateSuitePayload { + /** The sha of the head commit. */ + head_sha: string; +} + +export type ChecksGetData = CheckRun; + +export type ChecksGetSuiteData = CheckSuite; + +export type ChecksListAnnotationsData = CheckAnnotation[]; + +export interface ChecksListAnnotationsParams { + /** check_run_id parameter */ + checkRunId: number; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export interface ChecksListForRefData { + check_runs: CheckRun[]; + total_count: number; +} + +export interface ChecksListForRefParams { + /** Returns check runs with the specified \`name\`. */ + check_name?: string; + /** + * Filters check runs by their \`completed_at\` timestamp. Can be one of \`latest\` (returning the most recent check runs) or \`all\`. + * @default "latest" + */ + filter?: FilterEnum6; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** ref+ parameter */ + ref: string; + repo: string; + /** Returns check runs with the specified \`status\`. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ + status?: StatusEnum3; +} + +/** + * Filters check runs by their \`completed_at\` timestamp. Can be one of \`latest\` (returning the most recent check runs) or \`all\`. + * @default "latest" + */ +export enum ChecksListForRefParams1FilterEnum { + Latest = "latest", + All = "all", +} + +/** Returns check runs with the specified \`status\`. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ +export enum ChecksListForRefParams1StatusEnum { + Queued = "queued", + InProgress = "in_progress", + Completed = "completed", +} + +export interface ChecksListForSuiteData { + check_runs: CheckRun[]; + total_count: number; +} + +export interface ChecksListForSuiteParams { + /** check_suite_id parameter */ + checkSuiteId: number; + /** Returns check runs with the specified \`name\`. */ + check_name?: string; + /** + * Filters check runs by their \`completed_at\` timestamp. Can be one of \`latest\` (returning the most recent check runs) or \`all\`. + * @default "latest" + */ + filter?: FilterEnum5; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** Returns check runs with the specified \`status\`. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ + status?: StatusEnum2; +} + +/** + * Filters check runs by their \`completed_at\` timestamp. Can be one of \`latest\` (returning the most recent check runs) or \`all\`. + * @default "latest" + */ +export enum ChecksListForSuiteParams1FilterEnum { + Latest = "latest", + All = "all", +} + +/** Returns check runs with the specified \`status\`. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ +export enum ChecksListForSuiteParams1StatusEnum { + Queued = "queued", + InProgress = "in_progress", + Completed = "completed", +} + +export interface ChecksListSuitesForRefData { + check_suites: CheckSuite[]; + total_count: number; +} + +export interface ChecksListSuitesForRefParams { + /** + * Filters check suites by GitHub App \`id\`. + * @example 1 + */ + app_id?: number; + /** Returns check runs with the specified \`name\`. */ + check_name?: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** ref+ parameter */ + ref: string; + repo: string; +} + +export type ChecksRerequestSuiteData = any; + +export type ChecksSetSuitesPreferencesData = CheckSuitePreference; + +export interface ChecksSetSuitesPreferencesPayload { + /** Enables or disables automatic creation of CheckSuite events upon pushes to the repository. Enabled by default. See the [\`auto_trigger_checks\` object](https://docs.github.com/rest/reference/checks#auto_trigger_checks-object) description for details. */ + auto_trigger_checks?: { + /** The \`id\` of the GitHub App. */ + app_id: number; + /** + * Set to \`true\` to enable automatic creation of CheckSuite events upon pushes to the repository, or \`false\` to disable them. + * @default true + */ + setting: boolean; + }[]; +} + +/** The level of the annotation. Can be one of \`notice\`, \`warning\`, or \`failure\`. */ +export enum ChecksUpdateAnnotationLevelEnum { + Notice = "notice", + Warning = "warning", + Failure = "failure", +} + +/** + * **Required if you provide \`completed_at\` or a \`status\` of \`completed\`**. The final conclusion of the check. Can be one of \`success\`, \`failure\`, \`neutral\`, \`cancelled\`, \`skipped\`, \`timed_out\`, or \`action_required\`. + * **Note:** Providing \`conclusion\` will automatically set the \`status\` parameter to \`completed\`. Only GitHub can change a check run conclusion to \`stale\`. + */ +export enum ChecksUpdateConclusionEnum { + Success = "success", + Failure = "failure", + Neutral = "neutral", + Cancelled = "cancelled", + Skipped = "skipped", + TimedOut = "timed_out", + ActionRequired = "action_required", +} + +export type ChecksUpdateData = CheckRun; + +export type ChecksUpdatePayload = ( + | { + status?: ChecksUpdateStatusEnum; + [key: string]: any; + } + | { + status?: ChecksUpdateStatusEnum1; + [key: string]: any; + } +) & { + /** + * Possible further actions the integrator can perform, which a user may trigger. Each action includes a \`label\`, \`identifier\` and \`description\`. A maximum of three actions are accepted. See the [\`actions\` object](https://docs.github.com/rest/reference/checks#actions-object) description. To learn more about check runs and requested actions, see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)." + * @maxItems 3 + */ + actions?: { + /** + * A short explanation of what this action would do. The maximum size is 40 characters. + * @maxLength 40 + */ + description: string; + /** + * A reference for the action on the integrator's system. The maximum size is 20 characters. + * @maxLength 20 + */ + identifier: string; + /** + * The text to be displayed on a button in the web UI. The maximum size is 20 characters. + * @maxLength 20 + */ + label: string; + }[]; + /** The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + completed_at?: string; + /** + * **Required if you provide \`completed_at\` or a \`status\` of \`completed\`**. The final conclusion of the check. Can be one of \`success\`, \`failure\`, \`neutral\`, \`cancelled\`, \`skipped\`, \`timed_out\`, or \`action_required\`. + * **Note:** Providing \`conclusion\` will automatically set the \`status\` parameter to \`completed\`. Only GitHub can change a check run conclusion to \`stale\`. + */ + conclusion?: ChecksUpdateConclusionEnum; + /** The URL of the integrator's site that has the full details of the check. */ + details_url?: string; + /** A reference for the run on the integrator's system. */ + external_id?: string; + /** The name of the check. For example, "code-coverage". */ + name?: string; + /** Check runs can accept a variety of data in the \`output\` object, including a \`title\` and \`summary\` and can optionally provide descriptive details about the run. See the [\`output\` object](https://docs.github.com/rest/reference/checks#output-object-1) description. */ + output?: { + /** + * Adds information from your analysis to specific lines of code. Annotations are visible in GitHub's pull request UI. Annotations are visible in GitHub's pull request UI. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the [Update a check run](https://docs.github.com/rest/reference/checks#update-a-check-run) endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. For details about annotations in the UI, see "[About status checks](https://help.github.com/articles/about-status-checks#checks)". See the [\`annotations\` object](https://docs.github.com/rest/reference/checks#annotations-object-1) description for details. + * @maxItems 50 + */ + annotations?: { + /** The level of the annotation. Can be one of \`notice\`, \`warning\`, or \`failure\`. */ + annotation_level: ChecksUpdateAnnotationLevelEnum; + /** The end column of the annotation. Annotations only support \`start_column\` and \`end_column\` on the same line. Omit this parameter if \`start_line\` and \`end_line\` have different values. */ + end_column?: number; + /** The end line of the annotation. */ + end_line: number; + /** A short description of the feedback for these lines of code. The maximum size is 64 KB. */ + message: string; + /** The path of the file to add an annotation to. For example, \`assets/css/main.css\`. */ + path: string; + /** Details about this annotation. The maximum size is 64 KB. */ + raw_details?: string; + /** The start column of the annotation. Annotations only support \`start_column\` and \`end_column\` on the same line. Omit this parameter if \`start_line\` and \`end_line\` have different values. */ + start_column?: number; + /** The start line of the annotation. */ + start_line: number; + /** The title that represents the annotation. The maximum size is 255 characters. */ + title?: string; + }[]; + /** Adds images to the output displayed in the GitHub pull request UI. See the [\`images\` object](https://docs.github.com/rest/reference/checks#annotations-object-1) description for details. */ + images?: { + /** The alternative text for the image. */ + alt: string; + /** A short image description. */ + caption?: string; + /** The full URL of the image. */ + image_url: string; + }[]; + /** + * Can contain Markdown. + * @maxLength 65535 + */ + summary: string; + /** + * Can contain Markdown. + * @maxLength 65535 + */ + text?: string; + /** **Required**. */ + title?: string; + }; + /** This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + started_at?: string; + /** The current status. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ + status?: ChecksUpdateStatusEnum2; +}; + +export enum ChecksUpdateStatusEnum { + Completed = "completed", +} + +export enum ChecksUpdateStatusEnum1 { + Queued = "queued", + InProgress = "in_progress", +} + +/** The current status. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ +export enum ChecksUpdateStatusEnum2 { + Queued = "queued", + InProgress = "in_progress", + Completed = "completed", +} + +/** + * Clone Traffic + * Clone Traffic + */ +export interface CloneTraffic { + clones: Traffic[]; + /** @example 173 */ + count: number; + /** @example 128 */ + uniques: number; +} + +/** + * Code Frequency Stat + * Code Frequency Stat + */ +export type CodeFrequencyStat = number[]; + +/** + * Code Of Conduct + * Code Of Conduct + */ +export interface CodeOfConduct { + /** + * @example "# Contributor Covenant Code of Conduct + * + * ## Our Pledge + * + * In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + * + * ## Our Standards + * + * Examples of behavior that contributes to creating a positive environment include: + * + * * Using welcoming and inclusive language + * * Being respectful of differing viewpoints and experiences + * * Gracefully accepting constructive criticism + * * Focusing on what is best for the community + * * Showing empathy towards other community members + * + * Examples of unacceptable behavior by participants include: + * + * * The use of sexualized language or imagery and unwelcome sexual attention or advances + * * Trolling, insulting/derogatory comments, and personal or political attacks + * * Public or private harassment + * * Publishing others' private information, such as a physical or electronic address, without explicit permission + * * Other conduct which could reasonably be considered inappropriate in a professional setting + * + * ## Our Responsibilities + * + * Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response + * to any instances of unacceptable behavior. + * + * Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + * + * ## Scope + * + * This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, + * posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + * + * ## Enforcement + * + * Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [EMAIL]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + * + * Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + * + * ## Attribution + * + * This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + * + * [homepage]: http://contributor-covenant.org + * [version]: http://contributor-covenant.org/version/1/4/ + * " + */ + body?: string; + /** @format uri */ + html_url: string | null; + /** @example "contributor_covenant" */ + key: string; + /** @example "Contributor Covenant" */ + name: string; + /** + * @format uri + * @example "https://api.github.com/codes_of_conduct/contributor_covenant" + */ + url: string; +} + +/** + * Code Of Conduct Simple + * Code of Conduct Simple + */ +export interface CodeOfConductSimple { + /** @format uri */ + html_url: string | null; + /** @example "citizen_code_of_conduct" */ + key: string; + /** @example "Citizen Code of Conduct" */ + name: string; + /** + * @format uri + * @example "https://api.github.com/codes_of_conduct/citizen_code_of_conduct" + */ + url: string; +} + +export interface CodeScanningAlertCodeScanningAlert { + /** The time that the alert was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + created_at: AlertCreatedAt; + /** The time that the alert was dismissed in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + dismissed_at: CodeScanningAlertDismissedAt; + /** Simple User */ + dismissed_by: SimpleUser; + /** **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\`. */ + dismissed_reason: CodeScanningAlertDismissedReason; + /** The GitHub URL of the alert resource. */ + html_url: AlertHtmlUrl; + instances: CodeScanningAlertInstances; + /** The security alert number. */ + number: AlertNumber; + rule: CodeScanningAlertRule; + /** State of a code scanning alert. */ + state: CodeScanningAlertState; + tool: CodeScanningAnalysisTool; + /** The REST API URL of the alert resource. */ + url: AlertUrl; +} + +export interface CodeScanningAlertCodeScanningAlertItems { + /** The time that the alert was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + created_at: AlertCreatedAt; + /** The time that the alert was dismissed in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + dismissed_at: CodeScanningAlertDismissedAt; + /** Simple User */ + dismissed_by: SimpleUser; + /** **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\`. */ + dismissed_reason: CodeScanningAlertDismissedReason; + /** The GitHub URL of the alert resource. */ + html_url: AlertHtmlUrl; + /** The security alert number. */ + number: AlertNumber; + rule: CodeScanningAlertRule; + /** State of a code scanning alert. */ + state: CodeScanningAlertState; + tool: CodeScanningAnalysisTool; + /** The REST API URL of the alert resource. */ + url: AlertUrl; +} + +/** + * The time that the alert was dismissed in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. + * @format date-time + */ +export type CodeScanningAlertDismissedAt = string | 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 CodeScanningAlertDismissedReason = CodeScanningAlertDismissedReasonEnum | null; + +export enum CodeScanningAlertDismissedReasonEnum { + FalsePositive = "false positive", + WontFix = "won't fix", + UsedInTests = "used in tests", +} + +/** 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. */ +export type CodeScanningAlertEnvironment = string; + +export type CodeScanningAlertInstances = { + /** 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; +}[]; + +/** The full Git reference, formatted as \`refs/heads/\`. */ +export type CodeScanningAlertRef = string; + +export interface CodeScanningAlertRule { + /** A short description of the rule used to detect the alert. */ + description?: string; + /** A unique identifier for the rule used to detect the alert. */ + id?: string | null; + /** The severity of the alert. */ + severity?: CodeScanningAlertRuleSeverityEnum; +} + +/** The severity of the alert. */ +export enum CodeScanningAlertRuleSeverityEnum { + None = "none", + Note = "note", + Warning = "warning", + Error = "error", +} + +/** Sets the state of the code scanning alert. Can be one of \`open\` or \`dismissed\`. You must provide \`dismissed_reason\` when you set the state to \`dismissed\`. */ +export enum CodeScanningAlertSetState { + Open = "open", + Dismissed = "dismissed", +} + +/** State of a code scanning alert. */ +export enum CodeScanningAlertState { + Open = "open", + Dismissed = "dismissed", + Fixed = "fixed", +} + +/** Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name. */ +export type CodeScanningAnalysisAnalysisKey = string; + +export interface CodeScanningAnalysisCodeScanningAnalysis { + /** 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; + /** The commit SHA of the code scanning analysis file. */ + commit_sha: CodeScanningAnalysisCommitSha; + /** The time that the analysis was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + created_at: CodeScanningAnalysisCreatedAt; + /** Identifies the variable values associated with the environment in which this analysis was performed. */ + environment: CodeScanningAnalysisEnvironment; + /** @example "error reading field xyz" */ + error: string; + /** The full Git reference of the code scanning analysis file, formatted as \`refs/heads/\`. */ + ref: CodeScanningAnalysisRef; + /** The name of the tool used to generate the code scanning analysis alert. */ + tool_name: CodeScanningAnalysisToolName; +} + +/** + * The commit SHA of the code scanning analysis file. + * @minLength 40 + * @maxLength 40 + * @pattern ^[0-9a-fA-F]+$ + */ +export type CodeScanningAnalysisCommitSha = string; + +/** + * The time that the analysis was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. + * @format date-time + */ +export type CodeScanningAnalysisCreatedAt = string; + +/** Identifies the variable values associated with the environment in which this analysis was performed. */ +export type CodeScanningAnalysisEnvironment = string; + +/** The full Git reference of the code scanning analysis file, formatted as \`refs/heads/\`. */ +export type CodeScanningAnalysisRef = string; + +/** 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. */ +export type CodeScanningAnalysisSarifFile = string; + +export interface CodeScanningAnalysisTool { + /** The name of the tool used to generate the code scanning analysis alert. */ + name?: CodeScanningAnalysisToolName; + /** The version of the tool used to detect the alert. */ + version?: string | null; +} + +/** The name of the tool used to generate the code scanning analysis alert. */ +export type CodeScanningAnalysisToolName = string; + +export type CodeScanningGetAlertData = CodeScanningAlertCodeScanningAlert; + +export type CodeScanningListAlertsForRepoData = CodeScanningAlertCodeScanningAlertItems[]; + +export interface CodeScanningListAlertsForRepoParams { + owner: string; + /** Set a full Git reference to list alerts for a specific branch. The \`ref\` must be formatted as \`refs/heads/\`. */ + ref?: CodeScanningAlertRef; + repo: string; + /** Set to \`open\`, \`fixed\`, or \`dismissed\` to list code scanning alerts in a specific state. */ + state?: CodeScanningAlertState; +} + +export type CodeScanningListRecentAnalysesData = CodeScanningAnalysisCodeScanningAnalysis[]; + +export interface CodeScanningListRecentAnalysesParams { + owner: string; + /** Set a full Git reference to list alerts for a specific branch. The \`ref\` must be formatted as \`refs/heads/\`. */ + ref?: CodeScanningAnalysisRef; + repo: string; + /** Set a single code scanning tool name to filter alerts by tool. */ + tool_name?: CodeScanningAnalysisToolName; +} + +export type CodeScanningUpdateAlertData = CodeScanningAlertCodeScanningAlert; + +export interface CodeScanningUpdateAlertPayload { + /** **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\`. */ + dismissed_reason?: CodeScanningAlertDismissedReason; + /** Sets the state of the code scanning alert. Can be one of \`open\` or \`dismissed\`. You must provide \`dismissed_reason\` when you set the state to \`dismissed\`. */ + state: CodeScanningAlertSetState; +} + +export type CodeScanningUploadSarifData = any; + +export interface CodeScanningUploadSarifPayload { + /** + * 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. + * @format uri + * @example "file:///github/workspace/" + */ + checkout_uri?: string; + /** The commit SHA of the code scanning analysis file. */ + commit_sha: CodeScanningAnalysisCommitSha; + /** The full Git reference of the code scanning analysis file, formatted as \`refs/heads/\`. */ + 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 + */ + started_at?: string; + /** The name of the tool used to generate the code scanning analysis alert. */ + tool_name: CodeScanningAnalysisToolName; +} + +/** + * Code Search Result Item + * Code Search Result Item + */ +export interface CodeSearchResultItem { + file_size?: number; + /** @format uri */ + git_url: string; + /** @format uri */ + html_url: string; + language?: string | null; + /** @format date-time */ + last_modified_at?: string; + /** @example ["73..77","77..78"] */ + line_numbers?: string[]; + name: string; + path: string; + /** Minimal Repository */ + repository: MinimalRepository; + score: number; + sha: string; + text_matches?: SearchResultTextMatches; + /** @format uri */ + url: string; +} + +export type CodesOfConductGetAllCodesOfConductData = CodeOfConduct[]; + +export type CodesOfConductGetConductCodeData = CodeOfConduct; + +export type CodesOfConductGetForRepoData = CodeOfConduct; + +/** + * Collaborator + * Collaborator + */ +export interface Collaborator { + /** + * @format uri + * @example "https://github.com/images/error/octocat_happy.gif" + */ + avatar_url: string; + /** @example "https://api.github.com/users/octocat/events{/privacy}" */ + events_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/followers" + */ + followers_url: string; + /** @example "https://api.github.com/users/octocat/following{/other_user}" */ + following_url: string; + /** @example "https://api.github.com/users/octocat/gists{/gist_id}" */ + gists_url: string; + /** @example "41d064eb2195891e12d0413f63227ea7" */ + gravatar_id: string | null; + /** + * @format uri + * @example "https://github.com/octocat" + */ + html_url: string; + /** @example 1 */ + id: number; + /** @example "octocat" */ + login: string; + /** @example "MDQ6VXNlcjE=" */ + node_id: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/orgs" + */ + organizations_url: string; + permissions?: { + admin: boolean; + pull: boolean; + push: boolean; + }; + /** + * @format uri + * @example "https://api.github.com/users/octocat/received_events" + */ + received_events_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/repos" + */ + repos_url: string; + site_admin: boolean; + /** @example "https://api.github.com/users/octocat/starred{/owner}{/repo}" */ + starred_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/subscriptions" + */ + subscriptions_url: string; + /** @example "User" */ + type: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat" + */ + url: string; +} + +export interface CombinedBillingUsage { + /** Numbers of days left in billing cycle. */ + days_left_in_billing_cycle: number; + /** Estimated storage space (GB) used in billing cycle. */ + estimated_paid_storage_for_month: number; + /** Estimated sum of free and paid storage space (GB) used in billing cycle. */ + estimated_storage_for_month: number; +} + +/** + * Combined Commit Status + * Combined Commit Status + */ +export interface CombinedCommitStatus { + /** @format uri */ + commit_url: string; + /** Minimal Repository */ + repository: MinimalRepository; + sha: string; + state: string; + statuses: SimpleCommitStatus[]; + total_count: number; + /** @format uri */ + url: string; +} + +/** + * Commit + * Commit + */ +export interface Commit { + author: SimpleUser | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments" + */ + comments_url: string; + commit: { + author: GitUser | null; + /** @example 0 */ + comment_count: number; + committer: GitUser | null; + /** @example "Fix all the bugs" */ + message: string; + tree: { + /** @example "827efc6d56897b048c772eb4087f854f46256132" */ + sha: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/tree/827efc6d56897b048c772eb4087f854f46256132" + */ + url: string; + }; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + url: string; + verification?: Verification; + }; + committer: SimpleUser | null; + files?: { + additions?: number; + blob_url?: 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 + * @example "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + html_url: string; + /** @example "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==" */ + node_id: string; + parents: { + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/commit/7638417db6d59f3c431d3e1f261cc637155684cd" + */ + html_url?: string; + /** @example "7638417db6d59f3c431d3e1f261cc637155684cd" */ + sha: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/commits/7638417db6d59f3c431d3e1f261cc637155684cd" + */ + url: string; + }[]; + /** @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" */ + sha: string; + stats?: { + additions?: number; + deletions?: number; + total?: number; + }; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + url: string; +} + +/** + * Commit Activity + * Commit Activity + */ +export interface CommitActivity { + /** @example [0,3,26,20,39,1,0] */ + days: number[]; + /** @example 89 */ + total: number; + /** @example 1336280400 */ + week: number; +} + +/** + * Commit Comment + * Commit Comment + */ +export interface CommitComment { + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + body: string; + commit_id: string; + /** @format date-time */ + created_at: string; + /** @format uri */ + html_url: string; + id: number; + line: number | null; + node_id: string; + path: string | null; + position: number | null; + reactions?: ReactionRollup; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + user: SimpleUser | null; +} + +/** + * Commit Comparison + * Commit Comparison + */ +export interface CommitComparison { + /** @example 4 */ + ahead_by: number; + /** Commit */ + base_commit: Commit; + /** @example 5 */ + behind_by: number; + commits: Commit[]; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/compare/master...topic.diff" + */ + diff_url: string; + files: DiffEntry[]; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/compare/master...topic" + */ + html_url: string; + /** Commit */ + merge_base_commit: Commit; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/compare/master...topic.patch" + */ + patch_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/compare/octocat:bbcd538c8e72b8c175046e27cc8f907076331401...octocat:0328041d1152db8ae77652d1618a02e57f745f17" + */ + permalink_url: string; + /** @example "ahead" */ + status: CommitComparisonStatusEnum; + /** @example 6 */ + total_commits: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/compare/master...topic" + */ + url: string; +} + +/** @example "ahead" */ +export enum CommitComparisonStatusEnum { + Diverged = "diverged", + Ahead = "ahead", + Behind = "behind", + Identical = "identical", +} + +/** + * Commit Search Result Item + * Commit Search Result Item + */ +export interface CommitSearchResultItem { + author: SimpleUser | null; + /** @format uri */ + comments_url: string; + commit: { + author: { + /** @format date-time */ + date: string; + email: string; + name: string; + }; + comment_count: number; + committer: GitUser | null; + message: string; + tree: { + sha: string; + /** @format uri */ + url: string; + }; + /** @format uri */ + url: string; + verification?: Verification; + }; + committer: GitUser | null; + /** @format uri */ + html_url: string; + node_id: string; + parents: { + html_url?: string; + sha?: string; + url?: string; + }[]; + /** Minimal Repository */ + repository: MinimalRepository; + score: number; + sha: string; + text_matches?: SearchResultTextMatches; + /** @format uri */ + url: string; +} + +/** Community Health File */ +export interface CommunityHealthFile { + /** @format uri */ + html_url: string; + /** @format uri */ + url: string; +} + +/** + * Community Profile + * Community Profile + */ +export interface CommunityProfile { + /** @example true */ + content_reports_enabled?: boolean; + /** @example "My first repository on GitHub!" */ + description: string | null; + /** @example "example.com" */ + documentation: string | null; + files: { + code_of_conduct: CodeOfConductSimple | null; + contributing: CommunityHealthFile | null; + issue_template: CommunityHealthFile | null; + license: LicenseSimple | null; + pull_request_template: CommunityHealthFile | null; + readme: CommunityHealthFile | null; + }; + /** @example 100 */ + health_percentage: number; + /** + * @format date-time + * @example "2017-02-28T19:09:29Z" + */ + updated_at: string | null; +} + +/** Conflict */ +export type Conflict = BasicError; + +/** + * Content Directory + * A list of directory items + */ +export type ContentDirectory = { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @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; +}[]; + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ +export enum ContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ +export enum ContentEnum1 { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a commit comment. */ +export enum ContentEnum2 { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue comment. */ +export enum ContentEnum3 { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue. */ +export enum ContentEnum4 { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a pull request review comment. */ +export enum ContentEnum5 { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ +export enum ContentEnum6 { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ +export enum ContentEnum7 { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +/** + * Content File + * Content File + */ +export interface ContentFile { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @format uri */ + self: string; + }; + content: string; + /** @format uri */ + download_url: string | null; + encoding: string; + /** @format uri */ + git_url: string | null; + /** @format uri */ + html_url: string | null; + name: string; + path: string; + sha: string; + size: number; + /** @example ""git://example.com/defunkt/dotjs.git"" */ + submodule_git_url?: string; + /** @example ""actual/actual.md"" */ + target?: string; + type: string; + /** @format uri */ + url: string; +} + +/** + * ContentReferenceAttachment + * Content Reference attachments allow you to provide context around URLs posted in comments + */ +export interface ContentReferenceAttachment { + /** + * The body of the attachment + * @maxLength 262144 + * @example "Body of the attachment" + */ + body: string; + /** + * The ID of the attachment + * @example 21 + */ + id: number; + /** + * The node_id of the content attachment + * @example "MDE3OkNvbnRlbnRBdHRhY2htZW50MjE=" + */ + node_id?: string; + /** + * The title of the attachment + * @maxLength 1024 + * @example "Title of the attachment" + */ + title: string; +} + +/** + * Symlink Content + * An object describing a symlink + */ +export interface ContentSubmodule { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @format uri */ + self: 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; + /** @format uri */ + submodule_git_url: string; + type: string; + /** @format uri */ + url: string; +} + +/** + * Symlink Content + * An object describing a symlink + */ +export interface ContentSymlink { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @format uri */ + self: 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; + target: string; + type: string; + /** @format uri */ + url: string; +} + +/** + * Content Traffic + * Content Traffic + */ +export interface ContentTraffic { + /** @example 3542 */ + count: number; + /** @example "/github/hubot" */ + path: string; + /** @example "github/hubot: A customizable life embetterment robot." */ + title: string; + /** @example 2225 */ + uniques: number; +} + +/** + * Content Tree + * Content Tree + */ +export interface ContentTree { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @format uri */ + self: string; + }; + /** @format uri */ + download_url: string | null; + entries?: { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @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; + /** @format uri */ + html_url: string | null; + name: string; + path: string; + sha: string; + size: number; + type: string; + /** @format uri */ + url: string; +} + +/** + * Contributor + * Contributor + */ +export interface Contributor { + /** @format uri */ + avatar_url?: string; + contributions: number; + email?: string; + events_url?: string; + /** @format uri */ + followers_url?: string; + following_url?: string; + gists_url?: string; + gravatar_id?: string | null; + /** @format uri */ + html_url?: string; + id?: number; + login?: string; + name?: string; + node_id?: string; + /** @format uri */ + organizations_url?: string; + /** @format uri */ + received_events_url?: string; + /** @format uri */ + repos_url?: string; + site_admin?: boolean; + starred_url?: string; + /** @format uri */ + subscriptions_url?: string; + type: string; + /** @format uri */ + url?: string; +} + +/** + * Contributor Activity + * Contributor Activity + */ +export interface ContributorActivity { + author: SimpleUser | null; + /** @example 135 */ + total: number; + /** @example [{"w":"1367712000","a":6898,"d":77,"c":10}] */ + weeks: { + a?: number; + c?: number; + d?: number; + w?: string; + }[]; +} + +/** + * Credential Authorization + * Credential Authorization + */ +export interface CredentialAuthorization { + /** @example 12345678 */ + authorized_credential_id?: number | null; + /** + * The note given to the token. This will only be present when the credential is a token. + * @example "my token" + */ + authorized_credential_note?: string | null; + /** + * The title given to the ssh key. This will only be present when the credential is an ssh key. + * @example "my ssh key" + */ + authorized_credential_title?: string | null; + /** + * Date when the credential was last accessed. May be null if it was never accessed + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + credential_accessed_at?: string | null; + /** + * Date when the credential was authorized for use. + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + credential_authorized_at: string; + /** + * Unique identifier for the credential. + * @example 1 + */ + credential_id: number; + /** + * Human-readable description of the credential type. + * @example "SSH Key" + */ + credential_type: string; + /** + * Unique string to distinguish the credential. Only included in responses with credential_type of SSH Key. + * @example "jklmnop12345678" + */ + fingerprint?: string; + /** + * User login that owns the underlying credential. + * @example "monalisa" + */ + login: string; + /** + * List of oauth scopes the token has been granted. + * @example ["user","repo"] + */ + scopes?: string[]; + /** + * Last eight characters of the credential. Only included in responses with credential_type of personal access token. + * @example "12345678" + */ + token_last_eight?: string; +} + +/** + * Deploy Key + * An SSH key granting access to a single repository. + */ +export interface DeployKey { + created_at: string; + id: number; + key: string; + read_only: boolean; + title: string; + url: string; + verified: boolean; +} + +/** + * Deployment + * A request for a specific ref(branch,sha,tag) to be deployed + */ +export interface Deployment { + /** + * @format date-time + * @example "2012-07-20T01:19:13Z" + */ + created_at: string; + creator: SimpleUser | null; + /** @example "Deploy request from hubot" */ + description: string | null; + /** + * Name for the target deployment environment. + * @example "production" + */ + environment: string; + /** + * Unique identifier of the deployment + * @example 42 + */ + id: number; + /** @example "MDEwOkRlcGxveW1lbnQx" */ + node_id: string; + /** @example "staging" */ + original_environment?: string; + payload: object; + performed_via_github_app?: Integration | null; + /** + * Specifies if the given environment is one that end-users directly interact with. Default: false. + * @example true + */ + production_environment?: boolean; + /** + * The ref to deploy. This can be a branch, tag, or sha. + * @example "topic-branch" + */ + ref: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example" + */ + repository_url: string; + /** @example "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d" */ + sha: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example/deployments/1/statuses" + */ + statuses_url: string; + /** + * Parameter to specify a task to execute + * @example "deploy" + */ + task: string; + /** + * Specifies if the given environment is will no longer exist at some point in the future. Default: false. + * @example true + */ + transient_environment?: boolean; + /** + * @format date-time + * @example "2012-07-20T01:19:13Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example/deployments/1" + */ + url: string; +} + +/** + * Deployment Status + * The status of a deployment. + */ +export interface DeploymentStatus { + /** + * @format date-time + * @example "2012-07-20T01:19:13Z" + */ + created_at: string; + creator: SimpleUser | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example/deployments/42" + */ + deployment_url: string; + /** + * A short description of the status. + * @maxLength 140 + * @default "" + * @example "Deployment finished successfully." + */ + description: string; + /** + * The environment of the deployment that the status is for. + * @default "" + * @example "production" + */ + environment?: string; + /** + * The URL for accessing your environment. + * @format uri + * @default "" + * @example "https://staging.example.com/" + */ + environment_url?: string; + /** @example 1 */ + id: number; + /** + * The URL to associate with this status. + * @format uri + * @default "" + * @example "https://example.com/deployment/42/output" + */ + log_url?: string; + /** @example "MDE2OkRlcGxveW1lbnRTdGF0dXMx" */ + node_id: string; + performed_via_github_app?: Integration | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example" + */ + repository_url: string; + /** + * The state of the status. + * @example "success" + */ + state: DeploymentStatusStateEnum; + /** + * Deprecated: the URL to associate with this status. + * @format uri + * @default "" + * @example "https://example.com/deployment/42/output" + */ + target_url: string; + /** + * @format date-time + * @example "2012-07-20T01:19:13Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example/deployments/42/statuses/1" + */ + url: string; +} + +/** + * The state of the status. + * @example "success" + */ +export enum DeploymentStatusStateEnum { + Error = "error", + Failure = "failure", + Inactive = "inactive", + Pending = "pending", + Success = "success", + Queued = "queued", + InProgress = "in_progress", +} + +/** + * Diff Entry + * Diff Entry + */ +export interface DiffEntry { + /** @example 103 */ + additions: number; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt" + */ + blob_url: string; + /** @example 124 */ + changes: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + contents_url: string; + /** @example 21 */ + deletions: number; + /** @example "file1.txt" */ + filename: string; + /** @example "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test" */ + patch?: string; + /** @example "file.txt" */ + previous_filename?: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt" + */ + raw_url: string; + /** @example "bbcd538c8e72b8c175046e27cc8f907076331401" */ + sha: string; + /** @example "added" */ + status: string; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** To return the oldest accounts first, set to \`asc\`. Can be one of \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ +export enum DirectionEnum1 { + Asc = "asc", + Desc = "desc", +} + +/** The direction of the sort. Can be either \`asc\` or \`desc\`. Default: \`desc\` when sort is \`created\` or sort is not specified, otherwise \`asc\`. */ +export enum DirectionEnum10 { + Asc = "asc", + Desc = "desc", +} + +/** Can be either \`asc\` or \`desc\`. Ignored without \`sort\` parameter. */ +export enum DirectionEnum11 { + Asc = "asc", + Desc = "desc", +} + +/** Can be either \`asc\` or \`desc\`. Ignored without \`sort\` parameter. */ +export enum DirectionEnum12 { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum DirectionEnum13 { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum DirectionEnum14 { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum DirectionEnum15 { + Asc = "asc", + Desc = "desc", +} + +/** Can be one of \`asc\` or \`desc\`. Default: \`asc\` when using \`full_name\`, otherwise \`desc\` */ +export enum DirectionEnum16 { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum DirectionEnum17 { + Asc = "asc", + Desc = "desc", +} + +/** Can be one of \`asc\` or \`desc\`. Default: \`asc\` when using \`full_name\`, otherwise \`desc\` */ +export enum DirectionEnum18 { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum DirectionEnum19 { + Asc = "asc", + Desc = "desc", +} + +/** To return the oldest accounts first, set to \`asc\`. Can be one of \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ +export enum DirectionEnum2 { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum DirectionEnum3 { + Asc = "asc", + Desc = "desc", +} + +/** Can be one of \`asc\` or \`desc\`. Default: when using \`full_name\`: \`asc\`, otherwise \`desc\` */ +export enum DirectionEnum4 { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum DirectionEnum5 { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum DirectionEnum6 { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum DirectionEnum7 { + Asc = "asc", + Desc = "desc", +} + +/** Either \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ +export enum DirectionEnum8 { + Asc = "asc", + Desc = "desc", +} + +/** + * The direction of the sort. Either \`asc\` or \`desc\`. + * @default "asc" + */ +export enum DirectionEnum9 { + Asc = "asc", + Desc = "desc", +} + +/** + * Email + * Email + */ +export interface Email { + /** + * @format email + * @example "octocat@github.com" + */ + email: string; + /** @example true */ + primary: boolean; + /** @example true */ + verified: boolean; + /** @example "public" */ + visibility: string | null; +} + +export type EmojisGetData = Record; + +/** The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ +export enum EnabledOrganizations { + All = "all", + None = "none", + Selected = "selected", +} + +/** The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ +export enum EnabledRepositories { + All = "all", + None = "none", + Selected = "selected", +} + +/** + * Enterprise + * An enterprise account + */ +export interface Enterprise { + /** @format uri */ + avatar_url: string; + /** + * @format date-time + * @example "2019-01-26T19:01:12Z" + */ + created_at: string | null; + /** A short description of the enterprise. */ + description?: string | null; + /** + * @format uri + * @example "https://github.com/enterprises/octo-business" + */ + html_url: string; + /** + * Unique identifier of the enterprise + * @example 42 + */ + id: number; + /** + * The name of the enterprise. + * @example "Octo Business" + */ + name: string; + /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ + node_id: string; + /** + * The slug url identifier for the enterprise. + * @example "octo-business" + */ + slug: string; + /** + * @format date-time + * @example "2019-01-26T19:14:43Z" + */ + updated_at: string | null; + /** + * The enterprise's website URL. + * @format uri + */ + website_url?: string | null; +} + +export type EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseData = any; + +export type EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseData = any; + +export type EnterpriseAdminCreateRegistrationTokenForEnterpriseData = AuthenticationToken; + +export type EnterpriseAdminCreateRemoveTokenForEnterpriseData = AuthenticationToken; + +export type EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseData = RunnerGroupsEnterprise; + +export interface EnterpriseAdminCreateSelfHostedRunnerGroupForEnterprisePayload { + /** Name of the runner group. */ + name: string; + /** List of runner IDs to add to the runner group. */ + runners?: number[]; + /** List of organization IDs that can access the runner group. */ + selected_organization_ids?: number[]; + /** Visibility of a runner group. You can select all organizations or select individual organization. Can be one of: \`all\` or \`selected\` */ + visibility?: EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseVisibilityEnum; +} + +/** Visibility of a runner group. You can select all organizations or select individual organization. Can be one of: \`all\` or \`selected\` */ +export enum EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseVisibilityEnum { + Selected = "selected", + All = "all", +} + +export type EnterpriseAdminDeleteScimGroupFromEnterpriseData = any; + +export type EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseData = any; + +export type EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseData = any; + +export type EnterpriseAdminDeleteUserFromEnterpriseData = any; + +export type EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseData = any; + +export type EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseData = any; + +export type EnterpriseAdminGetAllowedActionsEnterpriseData = SelectedActions; + +export type EnterpriseAdminGetGithubActionsPermissionsEnterpriseData = ActionsEnterprisePermissions; + +export type EnterpriseAdminGetProvisioningInformationForEnterpriseGroupData = ScimEnterpriseGroup; + +export type EnterpriseAdminGetProvisioningInformationForEnterpriseUserData = ScimEnterpriseUser; + +export type EnterpriseAdminGetSelfHostedRunnerForEnterpriseData = Runner; + +export type EnterpriseAdminGetSelfHostedRunnerGroupForEnterpriseData = RunnerGroupsEnterprise; + +export interface EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseData { + organizations: OrganizationSimple[]; + total_count: number; +} + +export interface EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseParams { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; +} + +export type EnterpriseAdminListProvisionedGroupsEnterpriseData = ScimGroupListEnterprise; + +export interface EnterpriseAdminListProvisionedGroupsEnterpriseParams { + /** Used for pagination: the number of results to return. */ + count?: number; + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Used for pagination: the index of the first result to return. */ + startIndex?: number; +} + +export type EnterpriseAdminListProvisionedIdentitiesEnterpriseData = ScimUserListEnterprise; + +export interface EnterpriseAdminListProvisionedIdentitiesEnterpriseParams { + /** Used for pagination: the number of results to return. */ + count?: number; + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Used for pagination: the index of the first result to return. */ + startIndex?: number; +} + +export type EnterpriseAdminListRunnerApplicationsForEnterpriseData = RunnerApplication[]; + +export interface EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseData { + organizations: OrganizationSimple[]; + total_count: number; +} + +export interface EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseParams { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseData { + runner_groups: RunnerGroupsEnterprise[]; + total_count: number; +} + +export interface EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseParams { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface EnterpriseAdminListSelfHostedRunnersForEnterpriseData { + runners?: Runner[]; + total_count?: number; +} + +export interface EnterpriseAdminListSelfHostedRunnersForEnterpriseParams { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseData { + runners: Runner[]; + total_count: number; +} + +export interface EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseParams { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; +} + +export type EnterpriseAdminProvisionAndInviteEnterpriseGroupData = ScimEnterpriseGroup; + +export interface EnterpriseAdminProvisionAndInviteEnterpriseGroupPayload { + /** The name of the SCIM group. This must match the GitHub organization that the group maps to. */ + displayName: string; + members?: { + /** The SCIM user ID for a user. */ + value: string; + }[]; + /** The SCIM schema URIs. */ + schemas: string[]; +} + +export type EnterpriseAdminProvisionAndInviteEnterpriseUserData = ScimEnterpriseUser; + +export interface EnterpriseAdminProvisionAndInviteEnterpriseUserPayload { + /** List of user emails. */ + emails: { + /** Whether this email address is the primary address. */ + primary: boolean; + /** The type of email address. */ + type: string; + /** The email address. */ + value: string; + }[]; + /** List of SCIM group IDs the user is a member of. */ + groups?: { + value?: string; + }[]; + name: { + /** The last name of the user. */ + familyName: string; + /** The first name of the user. */ + givenName: string; + }; + /** The SCIM schema URIs. */ + schemas: string[]; + /** The username for the user. */ + userName: string; +} + +export type EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseData = any; + +export type EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseData = any; + +export type EnterpriseAdminSetAllowedActionsEnterpriseData = any; + +export type EnterpriseAdminSetGithubActionsPermissionsEnterpriseData = any; + +export interface EnterpriseAdminSetGithubActionsPermissionsEnterprisePayload { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions?: AllowedActions; + /** The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ + enabled_organizations: EnabledOrganizations; +} + +export type EnterpriseAdminSetInformationForProvisionedEnterpriseGroupData = ScimEnterpriseGroup; + +export interface EnterpriseAdminSetInformationForProvisionedEnterpriseGroupPayload { + /** The name of the SCIM group. This must match the GitHub organization that the group maps to. */ + displayName: string; + members?: { + /** The SCIM user ID for a user. */ + value: string; + }[]; + /** The SCIM schema URIs. */ + schemas: string[]; +} + +export type EnterpriseAdminSetInformationForProvisionedEnterpriseUserData = ScimEnterpriseUser; + +export interface EnterpriseAdminSetInformationForProvisionedEnterpriseUserPayload { + /** List of user emails. */ + emails: { + /** Whether this email address is the primary address. */ + primary: boolean; + /** The type of email address. */ + type: string; + /** The email address. */ + value: string; + }[]; + /** List of SCIM group IDs the user is a member of. */ + groups?: { + value?: string; + }[]; + name: { + /** The last name of the user. */ + familyName: string; + /** The first name of the user. */ + givenName: string; + }; + /** The SCIM schema URIs. */ + schemas: string[]; + /** The username for the user. */ + userName: string; +} + +export type EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseData = any; + +export interface EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprisePayload { + /** List of organization IDs that can access the runner group. */ + selected_organization_ids: number[]; +} + +export type EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseData = any; + +export interface EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprisePayload { + /** List of organization IDs to enable for GitHub Actions. */ + selected_organization_ids: number[]; +} + +export type EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseData = any; + +export interface EnterpriseAdminSetSelfHostedRunnersInGroupForEnterprisePayload { + /** List of runner IDs to add to the runner group. */ + runners: number[]; +} + +export type EnterpriseAdminUpdateAttributeForEnterpriseGroupData = ScimEnterpriseGroup; + +export interface EnterpriseAdminUpdateAttributeForEnterpriseGroupPayload { + /** Array of [SCIM operations](https://tools.ietf.org/html/rfc7644#section-3.5.2). */ + Operations: object[]; + /** The SCIM schema URIs. */ + schemas: string[]; +} + +export type EnterpriseAdminUpdateAttributeForEnterpriseUserData = ScimEnterpriseUser; + +export interface EnterpriseAdminUpdateAttributeForEnterpriseUserPayload { + /** Array of [SCIM operations](https://tools.ietf.org/html/rfc7644#section-3.5.2). */ + Operations: object[]; + /** The SCIM schema URIs. */ + schemas: string[]; +} + +export type EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseData = RunnerGroupsEnterprise; + +export interface EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprisePayload { + /** Name of the runner group. */ + name?: string; + /** + * Visibility of a runner group. You can select all organizations or select individual organizations. Can be one of: \`all\` or \`selected\` + * @default "all" + */ + visibility?: EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseVisibilityEnum; +} + +/** + * Visibility of a runner group. You can select all organizations or select individual organizations. Can be one of: \`all\` or \`selected\` + * @default "all" + */ +export enum EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseVisibilityEnum { + Selected = "selected", + All = "all", +} + +/** + * Event + * Event + */ +export interface Event { + /** Actor */ + actor: Actor; + /** @format date-time */ + created_at: string | null; + id: string; + /** Actor */ + org?: Actor; + payload: { + action: string; + /** Comments provide a way for people to collaborate on an issue. */ + comment?: IssueComment; + /** Issue Simple */ + issue?: IssueSimple; + pages?: { + action?: string; + html_url?: string; + page_name?: string; + sha?: string; + summary?: string | null; + title?: string; + }[]; + }; + public: boolean; + repo: { + id: number; + name: string; + /** @format uri */ + url: string; + }; + type: string | null; +} + +/** + * Feed + * Feed + */ +export interface Feed { + _links: { + /** Hypermedia Link with Type */ + current_user?: 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; + /** @example "https://github.com/octocat-org" */ + current_user_organization_url?: string; + /** @example ["https://github.com/organizations/github/octocat.private.atom?token=abc123"] */ + current_user_organization_urls?: string[]; + /** @example "https://github.com/octocat" */ + current_user_public_url?: string; + /** @example "https://github.com/octocat.private?token=abc123" */ + current_user_url?: string; + /** @example "https://github.com/security-advisories" */ + security_advisories_url?: string; + /** @example "https://github.com/timeline" */ + timeline_url: string; + /** @example "https://github.com/{user}" */ + user_url: string; +} + +/** + * File Commit + * File Commit + */ +export interface FileCommit { + commit: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + html_url?: string; + message?: string; + node_id?: string; + parents?: { + html_url?: string; + sha?: string; + url?: string; + }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + verification?: { + payload?: string | null; + reason?: string; + signature?: 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; + type?: string; + url?: string; + } | null; +} + +/** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ +export enum FilterEnum { + Assigned = "assigned", + Created = "created", + Mentioned = "mentioned", + Subscribed = "subscribed", + All = "all", +} + +/** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ +export enum FilterEnum1 { + Assigned = "assigned", + Created = "created", + Mentioned = "mentioned", + Subscribed = "subscribed", + All = "all", +} + +/** + * Filter members returned in the list. Can be one of: + * \\* \`2fa_disabled\` - Members without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. Available for organization owners. + * \\* \`all\` - All members the authenticated user can see. + * @default "all" + */ +export enum FilterEnum2 { + Value2FaDisabled = "2fa_disabled", + All = "all", +} + +/** + * Filter the list of outside collaborators. Can be one of: + * \\* \`2fa_disabled\`: Outside collaborators without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. + * \\* \`all\`: All outside collaborators. + * @default "all" + */ +export enum FilterEnum3 { + Value2FaDisabled = "2fa_disabled", + All = "all", +} + +/** + * Filters jobs by their \`completed_at\` timestamp. Can be one of: + * \\* \`latest\`: Returns jobs from the most recent execution of the workflow run. + * \\* \`all\`: Returns all jobs for a workflow run, including from old executions of the workflow run. + * @default "latest" + */ +export enum FilterEnum4 { + Latest = "latest", + All = "all", +} + +/** + * Filters check runs by their \`completed_at\` timestamp. Can be one of \`latest\` (returning the most recent check runs) or \`all\`. + * @default "latest" + */ +export enum FilterEnum5 { + Latest = "latest", + All = "all", +} + +/** + * Filters check runs by their \`completed_at\` timestamp. Can be one of \`latest\` (returning the most recent check runs) or \`all\`. + * @default "latest" + */ +export enum FilterEnum6 { + Latest = "latest", + All = "all", +} + +/** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ +export enum FilterEnum7 { + Assigned = "assigned", + Created = "created", + Mentioned = "mentioned", + Subscribed = "subscribed", + All = "all", +} + +/** Forbidden */ +export type Forbidden = BasicError; + +/** Forbidden Gist */ +export interface ForbiddenGist { + block?: { + created_at?: string; + html_url?: string | null; + reason?: string; + }; + documentation_url?: string; + message?: string; +} + +/** Found */ +export type Found = any; + +/** + * Full Repository + * Full Repository + */ +export interface FullRepository { + /** @example true */ + allow_merge_commit?: boolean; + /** @example true */ + allow_rebase_merge?: boolean; + /** @example true */ + allow_squash_merge?: boolean; + /** + * Whether anonymous git access is allowed. + * @default true + */ + anonymous_access_enabled?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ + archive_url: string; + archived: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ + assignees_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ + blobs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ + branches_url: string; + /** @example "https://github.com/octocat/Hello-World.git" */ + clone_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ + collaborators_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ + comments_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ + commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ + compare_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ + contents_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/contributors" + */ + contributors_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at: string; + /** @example "master" */ + default_branch: string; + /** @example false */ + delete_branch_on_merge?: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/deployments" + */ + deployments_url: string; + /** @example "This your first repo!" */ + description: string | null; + /** Returns whether or not this repository disabled. */ + disabled: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/downloads" + */ + downloads_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/events" + */ + events_url: string; + fork: boolean; + forks: number; + /** @example 9 */ + forks_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/forks" + */ + forks_url: string; + /** @example "octocat/Hello-World" */ + full_name: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ + git_commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ + git_refs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ + git_tags_url: string; + /** @example "git:github.com/octocat/Hello-World.git" */ + git_url: string; + /** @example true */ + has_downloads: boolean; + /** @example true */ + has_issues: boolean; + has_pages: boolean; + /** @example true */ + has_projects: boolean; + /** @example true */ + has_wiki: boolean; + /** + * @format uri + * @example "https://github.com" + */ + homepage: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/hooks" + */ + hooks_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World" + */ + html_url: string; + /** @example 1296269 */ + id: number; + /** @example true */ + is_template?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ + issue_comment_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ + issue_events_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ + issues_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ + keys_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ + labels_url: string; + language: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/languages" + */ + languages_url: string; + license: LicenseSimple | null; + master_branch?: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/merges" + */ + merges_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ + milestones_url: string; + /** + * @format uri + * @example "git:git.example.com/octocat/Hello-World" + */ + mirror_url: string | null; + /** @example "Hello-World" */ + name: string; + /** @example 0 */ + network_count: number; + /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ + node_id: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ + notifications_url: string; + open_issues: number; + /** @example 0 */ + open_issues_count: number; + organization?: SimpleUser | null; + owner: SimpleUser | null; + /** A git repository */ + parent?: Repository; + permissions?: { + admin: boolean; + pull: boolean; + push: boolean; + }; + private: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ + pulls_url: string; + /** + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + pushed_at: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ + releases_url: string; + /** @example 108 */ + size: number; + /** A git repository */ + source?: Repository; + /** @example "git@github.com:octocat/Hello-World.git" */ + ssh_url: string; + /** @example 80 */ + stargazers_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" + */ + stargazers_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ + statuses_url: string; + /** @example 42 */ + subscribers_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" + */ + subscribers_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscription" + */ + subscription_url: string; + /** + * @format uri + * @example "https://svn.github.com/octocat/Hello-World" + */ + svn_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/tags" + */ + tags_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/teams" + */ + teams_url: string; + temp_clone_token?: string | null; + template_repository?: Repository | null; + /** @example ["octocat","atom","electron","API"] */ + topics?: string[]; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ + trees_url: string; + /** + * @format date-time + * @example "2011-01-26T19:14:43Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World" + */ + url: string; + /** + * The repository visibility: public, private, or internal. + * @example "public" + */ + visibility?: string; + watchers: number; + /** @example 80 */ + watchers_count: number; +} + +/** + * Gist Comment + * A comment made to a gist. + */ +export interface GistComment { + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** + * The comment text. + * @maxLength 65535 + * @example "Body of the attachment" + */ + body: string; + /** + * @format date-time + * @example "2011-04-18T23:23:56Z" + */ + created_at: string; + /** @example 1 */ + id: number; + /** @example "MDExOkdpc3RDb21tZW50MQ==" */ + node_id: string; + /** + * @format date-time + * @example "2011-04-18T23:23:56Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/gists/a6db0bec360bb87e9418/comments/1" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Gist Commit + * Gist Commit + */ +export interface GistCommit { + change_status: { + additions?: number; + deletions?: number; + total?: number; + }; + /** + * @format date-time + * @example "2010-04-14T02:15:15Z" + */ + committed_at: string; + /** + * @format uri + * @example "https://api.github.com/gists/aa5a315d61ae9438b18d/57a7f021a713b1c5a6a199b54cc514735d2d462f" + */ + url: string; + user: SimpleUser | null; + /** @example "57a7f021a713b1c5a6a199b54cc514735d2d462f" */ + version: string; +} + +/** + * Gist Simple + * Gist Simple + */ +export interface GistSimple { + comments?: number; + comments_url?: string; + commits_url?: string; + created_at?: string; + description?: string | null; + files?: Record< + string, + { + content?: string; + filename?: string; + language?: string; + raw_url?: string; + size?: number; + truncated?: boolean; + type?: string; + } | null + >; + forks_url?: string; + git_pull_url?: string; + git_push_url?: string; + html_url?: string; + id?: string; + node_id?: string; + /** Simple User */ + owner?: SimpleUser; + public?: boolean; + truncated?: boolean; + updated_at?: string; + url?: string; + user?: string | null; +} + +export type GistsCheckIsStarredData = any; + +export type GistsCheckIsStarredError = object; + +export type GistsCreateCommentData = GistComment; + +export interface GistsCreateCommentPayload { + /** + * The comment text. + * @maxLength 65535 + * @example "Body of the attachment" + */ + body: string; +} + +export type GistsCreateData = GistSimple; + +export interface GistsCreatePayload { + /** + * Description of the gist + * @example "Example Ruby script" + */ + description?: string; + /** + * Names and content for the files that make up the gist + * @example {"hello.rb":{"content":"puts \\"Hello, World!\\""}} + */ + files: Record< + string, + { + /** Content of the file */ + content: string; + } + >; + /** Flag indicating whether the gist is public */ + public?: boolean | GistsCreatePublicEnum; +} + +/** + * @default "false" + * @example "true" + */ +export enum GistsCreatePublicEnum { + True = "true", + False = "false", +} + +export type GistsDeleteCommentData = any; + +export type GistsDeleteData = any; + +export type GistsForkData = BaseGist; + +export type GistsGetCommentData = GistComment; + +export type GistsGetData = GistSimple; + +export type GistsGetRevisionData = GistSimple; + +export type GistsListCommentsData = GistComment[]; + +export interface GistsListCommentsParams { + /** gist_id parameter */ + gistId: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type GistsListCommitsData = GistCommit[]; + +export interface GistsListCommitsParams { + /** gist_id parameter */ + gistId: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type GistsListData = BaseGist[]; + +export type GistsListForUserData = BaseGist[]; + +export interface GistsListForUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + username: string; +} + +export type GistsListForksData = GistSimple[]; + +export interface GistsListForksParams { + /** gist_id parameter */ + gistId: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface GistsListParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; +} + +export type GistsListPublicData = BaseGist[]; + +export interface GistsListPublicParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; +} + +export type GistsListStarredData = BaseGist[]; + +export interface GistsListStarredParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; +} + +export type GistsStarData = any; + +export type GistsUnstarData = any; + +export type GistsUpdateCommentData = GistComment; + +export interface GistsUpdateCommentPayload { + /** + * The comment text. + * @maxLength 65535 + * @example "Body of the attachment" + */ + body: string; +} + +export type GistsUpdateData = GistSimple; + +export type GistsUpdatePayload = null & { + /** + * Description of the gist + * @example "Example Ruby script" + */ + description?: string; + /** + * Names of files to be updated + * @example {"hello.rb":{"content":"blah","filename":"goodbye.rb"}} + */ + files?: Record< + string, + (object | null) & { + /** The new content of the file */ + content?: string; + /** The new filename for the file */ + filename?: string | null; + } + >; +}; + +/** + * Git Commit + * Low-level Git commit operations within a repository + */ +export interface GitCommit { + /** Identifying information for the git-user */ + author: { + /** + * Timestamp of the commit + * @format date-time + * @example "2014-08-09T08:02:04+12:00" + */ + date: string; + /** + * Git email address of the user + * @example "monalisa.octocat@example.com" + */ + email: string; + /** + * Name of the git user + * @example "Monalisa Octocat" + */ + name: string; + }; + /** Identifying information for the git-user */ + committer: { + /** + * Timestamp of the commit + * @format date-time + * @example "2014-08-09T08:02:04+12:00" + */ + date: string; + /** + * Git email address of the user + * @example "monalisa.octocat@example.com" + */ + email: string; + /** + * Name of the git user + * @example "Monalisa Octocat" + */ + name: string; + }; + /** @format uri */ + html_url: string; + /** + * Message describing the purpose of the commit + * @example "Fix #42" + */ + message: string; + node_id: string; + parents: { + /** @format uri */ + html_url: string; + /** + * SHA for the commit + * @example "7638417db6d59f3c431d3e1f261cc637155684cd" + */ + sha: string; + /** @format uri */ + url: string; + }[]; + /** + * SHA for the commit + * @example "7638417db6d59f3c431d3e1f261cc637155684cd" + */ + sha: string; + tree: { + /** + * SHA for the commit + * @example "7638417db6d59f3c431d3e1f261cc637155684cd" + */ + sha: string; + /** @format uri */ + url: string; + }; + /** @format uri */ + url: string; + verification: { + payload: string | null; + reason: string; + signature: string | null; + verified: boolean; + }; +} + +export type GitCreateBlobData = ShortBlob; + +export interface GitCreateBlobPayload { + /** The new blob's content. */ + content: string; + /** + * The encoding used for \`content\`. Currently, \`"utf-8"\` and \`"base64"\` are supported. + * @default "utf-8" + */ + encoding?: string; +} + +export type GitCreateCommitData = GitCommit; + +export interface GitCreateCommitPayload { + /** Information about the author of the commit. By default, the \`author\` will be the authenticated user and the current date. See the \`author\` and \`committer\` object below for details. */ + author?: { + /** Indicates when this commit was authored (or committed). This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + date?: string; + /** The email of the author (or committer) of the commit */ + email?: string; + /** The name of the author (or committer) of the commit */ + name?: string; + }; + /** Information about the person who is making the commit. By default, \`committer\` will use the information set in \`author\`. See the \`author\` and \`committer\` object below for details. */ + committer?: { + /** Indicates when this commit was authored (or committed). This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + date?: string; + /** The email of the author (or committer) of the commit */ + email?: string; + /** The name of the author (or committer) of the commit */ + name?: string; + }; + /** The commit message */ + message: string; + /** The SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided. */ + parents?: string[]; + /** The [PGP signature](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) of the commit. GitHub adds the signature to the \`gpgsig\` header of the created commit. For a commit signature to be verifiable by Git or GitHub, it must be an ASCII-armored detached PGP signature over the string commit as it would be written to the object database. To pass a \`signature\` parameter, you need to first manually create a valid PGP signature, which can be complicated. You may find it easier to [use the command line](https://git-scm.com/book/id/v2/Git-Tools-Signing-Your-Work) to create signed commits. */ + signature?: string; + /** The SHA of the tree object this commit points to */ + tree: string; +} + +export type GitCreateRefData = GitRef; + +export interface GitCreateRefPayload { + /** @example ""refs/heads/newbranch"" */ + key?: string; + /** The name of the fully qualified reference (ie: \`refs/heads/master\`). If it doesn't start with 'refs' and have at least two slashes, it will be rejected. */ + ref: string; + /** The SHA1 value for this reference. */ + sha: string; +} + +export type GitCreateTagData = GitTag; + +export interface GitCreateTagPayload { + /** The tag message. */ + message: string; + /** The SHA of the git object this is tagging. */ + object: string; + /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ + tag: string; + /** An object with information about the individual creating the tag. */ + tagger?: { + /** When this object was tagged. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + date?: string; + /** The email of the author of the tag */ + email?: string; + /** The name of the author of the tag */ + name?: string; + }; + /** The type of the object we're tagging. Normally this is a \`commit\` but it can also be a \`tree\` or a \`blob\`. */ + type: GitCreateTagTypeEnum; +} + +/** The type of the object we're tagging. Normally this is a \`commit\` but it can also be a \`tree\` or a \`blob\`. */ +export enum GitCreateTagTypeEnum { + Commit = "commit", + Tree = "tree", + Blob = "blob", +} + +export type GitCreateTreeData = GitTree; + +/** The file mode; one of \`100644\` for file (blob), \`100755\` for executable (blob), \`040000\` for subdirectory (tree), \`160000\` for submodule (commit), or \`120000\` for a blob that specifies the path of a symlink. */ +export enum GitCreateTreeModeEnum { + Value100644 = "100644", + Value100755 = "100755", + Value040000 = "040000", + Value160000 = "160000", + Value120000 = "120000", +} + +export interface GitCreateTreePayload { + /** + * The SHA1 of an existing Git tree object which will be used as the base for the new tree. If provided, a new Git tree object will be created from entries in the Git tree object pointed to by \`base_tree\` and entries defined in the \`tree\` parameter. Entries defined in the \`tree\` parameter will overwrite items from \`base_tree\` with the same \`path\`. If you're creating new changes on a branch, then normally you'd set \`base_tree\` to the SHA1 of the Git tree object of the current latest commit on the branch you're working on. + * If not provided, GitHub will create a new Git tree object from only the entries defined in the \`tree\` parameter. If you create a new commit pointing to such a tree, then all files which were a part of the parent commit's tree and were not defined in the \`tree\` parameter will be listed as deleted by the new commit. + */ + base_tree?: string; + /** Objects (of \`path\`, \`mode\`, \`type\`, and \`sha\`) specifying a tree structure. */ + tree: { + /** + * The content you want this file to have. GitHub will write this blob out and use that SHA for this entry. Use either this, or \`tree.sha\`. + * + * **Note:** Use either \`tree.sha\` or \`content\` to specify the contents of the entry. Using both \`tree.sha\` and \`content\` will return an error. + */ + content?: string; + /** The file mode; one of \`100644\` for file (blob), \`100755\` for executable (blob), \`040000\` for subdirectory (tree), \`160000\` for submodule (commit), or \`120000\` for a blob that specifies the path of a symlink. */ + mode?: GitCreateTreeModeEnum; + /** The file referenced in the tree. */ + path?: string; + /** + * The SHA1 checksum ID of the object in the tree. Also called \`tree.sha\`. If the value is \`null\` then the file will be deleted. + * + * **Note:** Use either \`tree.sha\` or \`content\` to specify the contents of the entry. Using both \`tree.sha\` and \`content\` will return an error. + */ + sha?: string | null; + /** Either \`blob\`, \`tree\`, or \`commit\`. */ + type?: GitCreateTreeTypeEnum; + }[]; +} + +/** Either \`blob\`, \`tree\`, or \`commit\`. */ +export enum GitCreateTreeTypeEnum { + Blob = "blob", + Tree = "tree", + Commit = "commit", +} + +export type GitDeleteRefData = any; + +export type GitGetBlobData = Blob; + +export type GitGetCommitData = GitCommit; + +export type GitGetRefData = GitRef; + +export type GitGetTagData = GitTag; + +export type GitGetTreeData = GitTree; + +export interface GitGetTreeParams { + owner: string; + /** Setting this parameter to any value returns the objects or subtrees referenced by the tree specified in \`:tree_sha\`. For example, setting \`recursive\` to any of the following will enable returning objects or subtrees: \`0\`, \`1\`, \`"true"\`, and \`"false"\`. Omit this parameter to prevent recursively returning objects or subtrees. */ + recursive?: string; + repo: string; + treeSha: string; +} + +export type GitListMatchingRefsData = GitRef[]; + +export interface GitListMatchingRefsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** ref+ parameter */ + ref: string; + repo: string; +} + +/** + * Git Reference + * Git references within a repository + */ +export interface GitRef { + node_id: string; + object: { + /** + * SHA for the reference + * @minLength 40 + * @maxLength 40 + * @example "7638417db6d59f3c431d3e1f261cc637155684cd" + */ + sha: string; + type: string; + /** @format uri */ + url: string; + }; + ref: string; + /** @format uri */ + url: string; +} + +/** + * Git Tag + * Metadata for a Git tag + */ +export interface GitTag { + /** + * Message describing the purpose of the tag + * @example "Initial public release" + */ + message: string; + /** @example "MDM6VGFnOTQwYmQzMzYyNDhlZmFlMGY5ZWU1YmM3YjJkNWM5ODU4ODdiMTZhYw==" */ + node_id: string; + object: { + sha: string; + type: string; + /** @format uri */ + url: string; + }; + /** @example "940bd336248efae0f9ee5bc7b2d5c985887b16ac" */ + sha: string; + /** + * Name of the tag + * @example "v0.0.1" + */ + tag: string; + tagger: { + date: string; + email: string; + name: string; + }; + /** + * URL for the tag + * @format uri + * @example "https://api.github.com/repositories/42/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac" + */ + url: string; + verification?: Verification; +} + +/** + * Git Tree + * The hierarchy between files in a Git repository. + */ +export interface GitTree { + sha: string; + /** + * Objects specifying a tree structure + * @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 "040000" */ + mode?: 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; + }[]; + truncated: boolean; + /** @format uri */ + url: string; +} + +export type GitUpdateRefData = GitRef; + +export interface GitUpdateRefPayload { + /** + * Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to \`false\` will make sure you're not overwriting work. + * @default false + */ + force?: boolean; + /** The SHA1 value to set this reference to */ + sha: string; +} + +/** + * Git User + * Metaproperties for Git author/committer information. + */ +export interface GitUser { + /** @example ""2007-10-29T02:42:39.000-07:00"" */ + date?: string; + /** @example ""chris@ozmm.org"" */ + email?: string; + /** @example ""Chris Wanstrath"" */ + name?: string; +} + +export type GitignoreGetAllTemplatesData = string[]; + +export type GitignoreGetTemplateData = GitignoreTemplate; + +/** + * Gitignore Template + * Gitignore Template + */ +export interface GitignoreTemplate { + /** @example "C" */ + name: string; + /** + * @example "# Object files + * *.o + * + * # Libraries + * *.lib + * *.a + * + * # Shared objects (inc. Windows DLLs) + * *.dll + * *.so + * *.so.* + * *.dylib + * + * # Executables + * *.exe + * *.out + * *.app + * " + */ + source: string; +} + +/** Gone */ +export type Gone = BasicError; + +/** + * GPG Key + * A unique encryption key + */ +export interface GpgKey { + /** @example true */ + can_certify: boolean; + can_encrypt_comms: boolean; + can_encrypt_storage: boolean; + /** @example true */ + can_sign: boolean; + /** + * @format date-time + * @example "2016-03-24T11:31:04-06:00" + */ + created_at: string; + /** @example [{"email":"mastahyeti@users.noreply.github.com","verified":true}] */ + emails: { + email?: string; + verified?: boolean; + }[]; + /** @format date-time */ + expires_at: string | null; + /** @example 3 */ + id: number; + /** @example "3262EFF25BA0D270" */ + key_id: string; + primary_key_id: number | null; + /** @example "xsBNBFayYZ..." */ + public_key: string; + 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: { + can_certify?: boolean; + can_encrypt_comms?: boolean; + can_encrypt_storage?: 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[]; + }[]; +} + +/** + * GroupMapping + * External Groups to be mapped to a team for membership + */ +export interface GroupMapping { + /** + * 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" + */ + group_id?: string; + /** + * The name of the group + * @example "saml-azuread-test" + */ + group_name?: string; + /** + * Array of groups to be mapped to this team + * @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" + */ + group_id: string; + /** + * The name of the group + * @example "saml-azuread-test" + */ + group_name: string; + }[]; + /** + * synchronization status for this group mapping + * @example "unsynced" + */ + status?: string; + /** + * the time of the last sync for this group-mapping + * @example "2019-06-03 22:27:15:000 -700" + */ + synced_at?: string; +} + +/** + * Webhook + * Webhooks for repositories. + */ +export interface Hook { + /** + * Determines whether the hook is actually triggered on pushes. + * @example true + */ + 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; + /** 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 + * @example "2011-09-06T17:26:27Z" + */ + created_at: string; + /** + * Determines what events the hook is triggered for. Default: ['push']. + * @example ["push","pull_request"] + */ + events: string[]; + /** + * Unique identifier of the webhook. + * @example 42 + */ + id: number; + last_response: HookResponse; + /** + * The name of a valid service, use 'web' for a webhook. + * @example "web" + */ + name: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings" + */ + ping_url: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/hooks/1/test" + */ + test_url: string; + type: string; + /** + * @format date-time + * @example "2011-09-06T20:39:23Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/hooks/1" + */ + url: string; +} + +/** Hook Response */ +export interface HookResponse { + code: number | null; + message: string | null; + status: string | null; +} + +/** + * Hovercard + * Hovercard + */ +export interface Hovercard { + contexts: { + message: string; + octicon: string; + }[]; +} + +/** + * Import + * A repository import from an external source. + */ +export interface Import { + authors_count?: number | null; + /** @format uri */ + authors_url: string; + commit_count?: number | null; + error_message?: string | null; + failed_step?: string | null; + has_large_files?: boolean; + /** @format uri */ + html_url: string; + import_percent?: number | null; + large_files_count?: number; + large_files_size?: number; + message?: string; + project_choices?: { + human_name?: string; + tfvc_project?: string; + vcs?: string; + }[]; + push_percent?: number | null; + /** @format uri */ + repository_url: string; + status: ImportStatusEnum; + status_text?: string | null; + svc_root?: string; + svn_root?: string; + tfvc_project?: string; + /** @format uri */ + url: string; + use_lfs?: string; + vcs: string | null; + /** The URL of the originating repository. */ + vcs_url: string; +} + +export enum ImportStatusEnum { + Auth = "auth", + Error = "error", + None = "none", + Detecting = "detecting", + Choose = "choose", + AuthFailed = "auth_failed", + Importing = "importing", + Mapping = "mapping", + WaitingToPush = "waiting_to_push", + Pushing = "pushing", + Complete = "complete", + Setup = "setup", + Unknown = "unknown", + DetectionFoundMultiple = "detection_found_multiple", + DetectionFoundNothing = "detection_found_nothing", + DetectionNeedsAuth = "detection_needs_auth", +} + +/** + * The event types to include: + * + * - \`web\` - returns web (non-Git) events + * - \`git\` - returns Git events + * - \`all\` - returns both web and Git events + * + * The default is \`web\`. + */ +export enum IncludeEnum { + Web = "web", + Git = "git", + All = "all", +} + +/** + * The event types to include: + * + * - \`web\` - returns web (non-Git) events + * - \`git\` - returns Git events + * - \`all\` - returns both web and Git events + * + * The default is \`web\`. + */ +export enum IncludeEnum1 { + Web = "web", + Git = "git", + All = "all", +} + +/** + * Installation + * Installation + */ +export interface Installation { + /** + * @format uri + * @example "https://api.github.com/installations/1/access_tokens" + */ + access_tokens_url: string; + account: SimpleUser | Enterprise | null; + /** @example 1 */ + app_id: number; + /** @example "github-actions" */ + app_slug: string; + /** @example ""test_13f1e99741e3e004@d7e1eb0bc0a1ba12.com"" */ + contact_email?: string | null; + /** @format date-time */ + created_at: string; + events: string[]; + /** @example true */ + has_multiple_single_files?: boolean; + /** + * @format uri + * @example "https://github.com/organizations/github/settings/installations/1" + */ + html_url: string; + /** + * The ID of the installation. + * @example 1 + */ + id: number; + /** @example {"issues":"read","deployments":"write"} */ + permissions: { + checks?: string; + contents?: string; + deployments?: string; + /** @example ""read"" */ + issues?: string; + metadata?: string; + /** @example ""read"" */ + organization_administration?: string; + pull_requests?: string; + statuses?: string; + }; + /** + * @format uri + * @example "https://api.github.com/installation/repositories" + */ + repositories_url: string; + /** Describe whether all repositories have been selected or there's a selection involved */ + repository_selection: InstallationRepositorySelectionEnum; + /** @example "config.yaml" */ + single_file_name: string | null; + /** @example ["config.yml",".github/issue_TEMPLATE.md"] */ + single_file_paths?: string[]; + /** @format date-time */ + suspended_at?: string | null; + suspended_by?: SimpleUser | null; + /** The ID of the user or organization this token is being scoped to. */ + target_id: number; + /** @example "Organization" */ + target_type: string; + /** @format date-time */ + updated_at: string; +} + +/** Describe whether all repositories have been selected or there's a selection involved */ +export enum InstallationRepositorySelectionEnum { + All = "all", + Selected = "selected", +} + +/** + * Installation Token + * Authentication token for a GitHub App installed on a user or org. + */ +export interface InstallationToken { + expires_at: string; + /** @example true */ + has_multiple_single_files?: boolean; + permissions?: { + contents?: string; + issues?: string; + /** @example "read" */ + metadata?: string; + /** @example "read" */ + single_file?: string; + }; + repositories?: Repository[]; + repository_selection?: InstallationTokenRepositorySelectionEnum; + /** @example "README.md" */ + single_file?: string; + /** @example ["config.yml",".github/issue_TEMPLATE.md"] */ + single_file_paths?: string[]; + token: string; +} + +export enum InstallationTokenRepositorySelectionEnum { + All = "all", + Selected = "selected", +} + +/** + * GitHub app + * GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + */ +export interface Integration { + /** @example ""Iv1.25b5d1e65ffc4022"" */ + client_id?: string; + /** @example ""1d4b2097ac622ba702d19de498f005747a8b21d3"" */ + client_secret?: string; + /** + * @format date-time + * @example "2017-07-08T16:18:44-04:00" + */ + created_at: string; + /** @example "The description of the app." */ + description: string | null; + /** + * The list of events for the GitHub app + * @example ["label","deployment"] + */ + events: string[]; + /** + * @format uri + * @example "https://example.com" + */ + external_url: string; + /** + * @format uri + * @example "https://github.com/apps/super-ci" + */ + html_url: string; + /** + * Unique identifier of the GitHub app + * @example 37 + */ + id: number; + /** + * The number of installations associated with the GitHub app + * @example 5 + */ + installations_count?: number; + /** + * The name of the GitHub app + * @example "Probot Owners" + */ + name: string; + /** @example "MDExOkludGVncmF0aW9uMQ==" */ + node_id: string; + owner: SimpleUser | null; + /** @example ""-----BEGIN RSA PRIVATE KEY-----\\nMIIEogIBAAKCAQEArYxrNYD/iT5CZVpRJu4rBKmmze3PVmT/gCo2ATUvDvZTPTey\\nxcGJ3vvrJXazKk06pN05TN29o98jrYz4cengG3YGsXPNEpKsIrEl8NhbnxapEnM9\\nJCMRe0P5JcPsfZlX6hmiT7136GRWiGOUba2X9+HKh8QJVLG5rM007TBER9/z9mWm\\nrJuNh+m5l320oBQY/Qq3A7wzdEfZw8qm/mIN0FCeoXH1L6B8xXWaAYBwhTEh6SSn\\nZHlO1Xu1JWDmAvBCi0RO5aRSKM8q9QEkvvHP4yweAtK3N8+aAbZ7ovaDhyGz8r6r\\nzhU1b8Uo0Z2ysf503WqzQgIajr7Fry7/kUwpgQIDAQABAoIBADwJp80Ko1xHPZDy\\nfcCKBDfIuPvkmSW6KumbsLMaQv1aGdHDwwTGv3t0ixSay8CGlxMRtRDyZPib6SvQ\\n6OH/lpfpbMdW2ErkksgtoIKBVrDilfrcAvrNZu7NxRNbhCSvN8q0s4ICecjbbVQh\\nnueSdlA6vGXbW58BHMq68uRbHkP+k+mM9U0mDJ1HMch67wlg5GbayVRt63H7R2+r\\nVxcna7B80J/lCEjIYZznawgiTvp3MSanTglqAYi+m1EcSsP14bJIB9vgaxS79kTu\\noiSo93leJbBvuGo8QEiUqTwMw4tDksmkLsoqNKQ1q9P7LZ9DGcujtPy4EZsamSJT\\ny8OJt0ECgYEA2lxOxJsQk2kI325JgKFjo92mQeUObIvPfSNWUIZQDTjniOI6Gv63\\nGLWVFrZcvQBWjMEQraJA9xjPbblV8PtfO87MiJGLWCHFxmPz2dzoedN+2Coxom8m\\nV95CLz8QUShuao6u/RYcvUaZEoYs5bHcTmy5sBK80JyEmafJPtCQVxMCgYEAy3ar\\nZr3yv4xRPEPMat4rseswmuMooSaK3SKub19WFI5IAtB/e7qR1Rj9JhOGcZz+OQrl\\nT78O2OFYlgOIkJPvRMrPpK5V9lslc7tz1FSh3BZMRGq5jSyD7ETSOQ0c8T2O/s7v\\nbeEPbVbDe4mwvM24XByH0GnWveVxaDl51ABD65sCgYB3ZAspUkOA5egVCh8kNpnd\\nSd6SnuQBE3ySRlT2WEnCwP9Ph6oPgn+oAfiPX4xbRqkL8q/k0BdHQ4h+zNwhk7+h\\nWtPYRAP1Xxnc/F+jGjb+DVaIaKGU18MWPg7f+FI6nampl3Q0KvfxwX0GdNhtio8T\\nTj1E+SnFwh56SRQuxSh2gwKBgHKjlIO5NtNSflsUYFM+hyQiPiqnHzddfhSG+/3o\\nm5nNaSmczJesUYreH5San7/YEy2UxAugvP7aSY2MxB+iGsiJ9WD2kZzTUlDZJ7RV\\nUzWsoqBR+eZfVJ2FUWWvy8TpSG6trh4dFxImNtKejCR1TREpSiTV3Zb1dmahK9GV\\nrK9NAoGAbBxRLoC01xfxCTgt5BDiBcFVh4fp5yYKwavJPLzHSpuDOrrI9jDn1oKN\\nonq5sDU1i391zfQvdrbX4Ova48BN+B7p63FocP/MK5tyyBoT8zQEk2+vWDOw7H/Z\\nu5dTCPxTIsoIwUw1I+7yIxqJzLPFgR2gVBwY1ra/8iAqCj+zeBw=\\n-----END RSA PRIVATE KEY-----\\n"" */ + pem?: string; + /** + * The set of permissions for the GitHub app + * @example {"issues":"read","deployments":"write"} + */ + permissions: { + checks?: string; + contents?: string; + deployments?: string; + issues?: string; + metadata?: string; + [key: string]: any; + }; + /** + * The slug name of the GitHub app + * @example "probot-owners" + */ + slug?: string; + /** + * @format date-time + * @example "2017-07-08T16:18:44-04:00" + */ + updated_at: string; + /** @example ""6fba8f2fc8a7e8f2cca5577eddd82ca7586b3b6b"" */ + webhook_secret?: string; + [key: string]: any; +} + +/** + * The duration of the interaction restriction. Can be one of: \`one_day\`, \`three_days\`, \`one_week\`, \`one_month\`, \`six_months\`. Default: \`one_day\`. + * @example "one_month" + */ +export enum InteractionExpiry { + OneDay = "one_day", + ThreeDays = "three_days", + OneWeek = "one_week", + OneMonth = "one_month", + SixMonths = "six_months", +} + +/** + * The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: \`existing_users\`, \`contributors_only\`, \`collaborators_only\`. + * @example "collaborators_only" + */ +export enum InteractionGroup { + ExistingUsers = "existing_users", + ContributorsOnly = "contributors_only", + CollaboratorsOnly = "collaborators_only", +} + +/** + * Interaction Restrictions + * Limit interactions to a specific type of user for a specified duration + */ +export interface InteractionLimit { + /** The duration of the interaction restriction. Can be one of: \`one_day\`, \`three_days\`, \`one_week\`, \`one_month\`, \`six_months\`. Default: \`one_day\`. */ + expiry?: InteractionExpiry; + /** The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: \`existing_users\`, \`contributors_only\`, \`collaborators_only\`. */ + limit: InteractionGroup; +} + +/** + * Interaction Limits + * Interaction limit settings. + */ +export interface InteractionLimitResponse { + /** + * @format date-time + * @example "2018-08-17T04:18:39Z" + */ + expires_at: string; + /** The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: \`existing_users\`, \`contributors_only\`, \`collaborators_only\`. */ + limit: InteractionGroup; + /** @example "repository" */ + origin: string; +} + +export type InteractionsGetRestrictionsForAuthenticatedUserData = InteractionLimitResponse; + +export type InteractionsGetRestrictionsForOrgData = InteractionLimitResponse; + +export type InteractionsGetRestrictionsForRepoData = InteractionLimitResponse; + +export type InteractionsRemoveRestrictionsForAuthenticatedUserData = any; + +export type InteractionsRemoveRestrictionsForOrgData = any; + +export type InteractionsRemoveRestrictionsForRepoData = any; + +export type InteractionsSetRestrictionsForAuthenticatedUserData = InteractionLimitResponse; + +export type InteractionsSetRestrictionsForOrgData = InteractionLimitResponse; + +export type InteractionsSetRestrictionsForRepoData = InteractionLimitResponse; + +/** Internal Error */ +export type InternalError = BasicError; + +/** + * Issue + * Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. + */ +export interface Issue { + active_lock_reason?: string | null; + assignee: SimpleUser | null; + assignees?: SimpleUser[] | null; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** + * Contents of the issue + * @example "It looks like the new widget form is broken on Safari. When I try and create the widget, Safari crashes. This is reproducible on 10.8, but not 10.9. Maybe a browser bug?" + */ + body?: string; + body_html?: string; + body_text?: string; + /** @format date-time */ + closed_at: string | null; + closed_by?: SimpleUser | null; + comments: number; + /** @format uri */ + comments_url: string; + /** @format date-time */ + created_at: string; + /** @format uri */ + events_url: string; + /** @format uri */ + html_url: string; + id: number; + /** + * Labels to associate with this issue; pass one or more label names to replace the set of labels on this issue; send an empty array to clear all labels from the issue; note that the labels are silently dropped for users without push access to the repository + * @example ["bug","registration"] + */ + labels: ( + | string + | { + color?: string | null; + default?: boolean; + description?: string | null; + id?: number; + name?: string; + node_id?: string; + /** @format uri */ + url?: string; + } + )[]; + labels_url: string; + locked: boolean; + milestone: Milestone | null; + node_id: string; + /** + * Number uniquely identifying the issue within its repository + * @example 42 + */ + number: number; + performed_via_github_app?: Integration | null; + pull_request?: { + /** @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 */ + url: string | null; + }; + reactions?: ReactionRollup; + /** A git repository */ + repository?: Repository; + /** @format uri */ + repository_url: string; + /** + * State of the issue; either 'open' or 'closed' + * @example "open" + */ + state: string; + /** @format uri */ + timeline_url?: string; + /** + * Title of the issue + * @example "Widget creation fails in Safari on OS X 10.8" + */ + title: string; + /** @format date-time */ + updated_at: string; + /** + * URL for the issue + * @format uri + * @example "https://api.github.com/repositories/42/issues/1" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Issue Comment + * Comments provide a way for people to collaborate on an issue. + */ +export interface IssueComment { + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** + * Contents of the issue comment + * @example "What version of Safari were you using when you observed this bug?" + */ + body?: string; + body_html?: string; + body_text?: string; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + created_at: string; + /** @format uri */ + html_url: string; + /** + * Unique identifier of the issue comment + * @example 42 + */ + id: number; + /** @format uri */ + issue_url: string; + node_id: string; + performed_via_github_app?: Integration | null; + reactions?: ReactionRollup; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + updated_at: string; + /** + * URL for the issue comment + * @format uri + * @example "https://api.github.com/repositories/42/issues/comments/1" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Issue Event + * Issue Event + */ +export interface IssueEvent { + actor: SimpleUser | null; + assignee?: SimpleUser | null; + assigner?: SimpleUser | null; + /** How the author is associated with the repository. */ + author_association?: AuthorAssociation; + /** @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" */ + commit_id: string | null; + /** @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" */ + commit_url: string | null; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + created_at: string; + dismissed_review?: IssueEventDismissedReview; + /** @example "closed" */ + event: string; + /** @example 1 */ + id: number; + /** Issue Simple */ + issue?: IssueSimple; + /** Issue Event Label */ + label?: IssueEventLabel; + lock_reason?: string | null; + /** Issue Event Milestone */ + milestone?: IssueEventMilestone; + /** @example "MDEwOklzc3VlRXZlbnQx" */ + node_id: string; + /** Issue Event Project Card */ + project_card?: IssueEventProjectCard; + /** Issue Event Rename */ + rename?: IssueEventRename; + requested_reviewer?: SimpleUser | null; + /** Groups of organization members that gives permissions on specified repositories. */ + requested_team?: Team; + review_requester?: SimpleUser | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/events/1" + */ + url: string; +} + +/** Issue Event Dismissed Review */ +export interface IssueEventDismissedReview { + dismissal_commit_id?: string | null; + dismissal_message: string | null; + review_id: number; + state: string; +} + +/** + * Issue Event for Issue + * Issue Event for Issue + */ +export interface IssueEventForIssue { + /** Simple User */ + actor?: SimpleUser; + /** How the author is associated with the repository. */ + author_association?: AuthorAssociation; + /** @example "":+1:"" */ + body?: string; + /** @example ""

Accusantium fugiat cumque. Autem qui nostrum. Atque quae ullam.

"" */ + body_html?: string; + /** @example ""Accusantium fugiat cumque. Autem qui nostrum. Atque quae ullam."" */ + body_text?: string; + commit_id?: string | null; + commit_url?: string | null; + created_at?: string; + event?: string; + /** @example ""https://github.com/owner-3906e11a33a3d55ba449d63f/BBB_Private_Repo/commit/480d4f47447129f015cb327536c522ca683939a1"" */ + html_url?: string; + id?: number; + /** @example ""https://api.github.com/repos/owner-3906e11a33a3d55ba449d63f/AAA_Public_Repo/issues/1"" */ + issue_url?: string; + /** @example ""off-topic"" */ + lock_reason?: string; + /** @example ""add a bunch of files"" */ + message?: string; + node_id?: string; + /** @example ""https://api.github.com/repos/owner-3906e11a33a3d55ba449d63f/AAA_Public_Repo/pulls/2"" */ + pull_request_url?: string; + /** @example ""480d4f47447129f015cb327536c522ca683939a1"" */ + sha?: string; + /** @example ""commented"" */ + state?: string; + /** @example ""2020-07-09T00:17:51Z"" */ + submitted_at?: string; + /** @example ""2020-07-09T00:17:36Z"" */ + updated_at?: string; + url?: string; +} + +/** + * Issue Event Label + * Issue Event Label + */ +export interface IssueEventLabel { + color: string | null; + name: string | null; +} + +/** + * Issue Event Milestone + * Issue Event Milestone + */ +export interface IssueEventMilestone { + title: string; +} + +/** + * Issue Event Project Card + * Issue Event Project Card + */ +export interface IssueEventProjectCard { + column_name: string; + id: number; + previous_column_name?: string; + project_id: number; + /** @format uri */ + project_url: string; + /** @format uri */ + url: string; +} + +/** + * Issue Event Rename + * Issue Event Rename + */ +export interface IssueEventRename { + from: string; + to: string; +} + +/** + * Issue Search Result Item + * Issue Search Result Item + */ +export interface IssueSearchResultItem { + active_lock_reason?: string | null; + assignee: SimpleUser | null; + assignees?: SimpleUser[] | null; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + body?: string; + body_html?: string; + body_text?: string; + /** @format date-time */ + closed_at: string | null; + comments: number; + /** @format uri */ + comments_url: string; + /** @format date-time */ + created_at: string; + draft?: boolean; + /** @format uri */ + events_url: string; + /** @format uri */ + html_url: string; + id: number; + labels: { + color?: string; + default?: boolean; + description?: string | null; + id?: number; + name?: string; + node_id?: string; + url?: string; + }[]; + labels_url: string; + locked: boolean; + milestone: Milestone | null; + node_id: string; + number: number; + performed_via_github_app?: Integration | null; + pull_request?: { + /** @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 */ + url: string | null; + }; + /** A git repository */ + repository?: Repository; + /** @format uri */ + repository_url: string; + score: number; + state: string; + text_matches?: SearchResultTextMatches; + /** @format uri */ + timeline_url?: string; + title: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + user: SimpleUser | null; +} + +/** + * Issue Simple + * Issue Simple + */ +export interface IssueSimple { + /** @example "too heated" */ + active_lock_reason?: string | null; + assignee: SimpleUser | null; + assignees?: SimpleUser[] | null; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** @example "I'm having a problem with this." */ + body?: string; + body_html?: string; + body_text?: string; + /** @format date-time */ + closed_at: string | null; + /** @example 0 */ + comments: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments" + */ + comments_url: string; + /** + * @format date-time + * @example "2011-04-22T13:33:48Z" + */ + created_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/events" + */ + events_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/issues/1347" + */ + html_url: string; + /** @example 1 */ + id: number; + labels: Label[]; + /** @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/labels{/name}" */ + labels_url: string; + /** @example true */ + locked: boolean; + milestone: Milestone | null; + /** @example "MDU6SXNzdWUx" */ + node_id: string; + /** @example 1347 */ + number: number; + performed_via_github_app?: Integration | null; + pull_request?: { + /** @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 */ + url: string | null; + }; + /** A git repository */ + repository?: Repository; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World" + */ + repository_url: string; + /** @example "open" */ + state: string; + /** @format uri */ + timeline_url?: string; + /** @example "Found a bug" */ + title: string; + /** + * @format date-time + * @example "2011-04-22T13:33:48Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347" + */ + url: string; + user: SimpleUser | null; +} + +export type IssuesAddAssigneesData = IssueSimple; + +export interface IssuesAddAssigneesPayload { + /** Usernames of people to assign this issue to. _NOTE: Only users with push access can add assignees to an issue. Assignees are silently ignored otherwise._ */ + assignees?: string[]; +} + +export type IssuesAddLabelsData = Label[]; + +export interface IssuesAddLabelsPayload { + /** The name of the label to add to the issue. Must contain at least one label. **Note:** Alternatively, you can pass a single label as a \`string\` or an \`array\` of labels directly, but GitHub recommends passing an object with the \`labels\` key. */ + labels: string[]; +} + +export type IssuesCheckUserCanBeAssignedData = any; + +export type IssuesCheckUserCanBeAssignedError = BasicError; + +export type IssuesCreateCommentData = IssueComment; + +export interface IssuesCreateCommentPayload { + /** The contents of the comment. */ + body: string; +} + +export type IssuesCreateData = Issue; + +export type IssuesCreateLabelData = Label; + +export interface IssuesCreateLabelPayload { + /** The [hexadecimal color code](http://www.color-hex.com/) for the label, without the leading \`#\`. */ + color?: string; + /** A short description of the label. */ + description?: string; + /** The name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing \`:strawberry:\` will render the emoji ![:strawberry:](https://assets-git.f3mw1.com/images/icons/emoji/unicode/1f353.png ":strawberry:"). For a full list of available emoji and codes, see [emoji-cheat-sheet.com](http://emoji-cheat-sheet.com/). */ + name: string; +} + +export type IssuesCreateMilestoneData = Milestone; + +export interface IssuesCreateMilestonePayload { + /** A description of the milestone. */ + description?: string; + /** The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + due_on?: string; + /** + * The state of the milestone. Either \`open\` or \`closed\`. + * @default "open" + */ + state?: IssuesCreateMilestoneStateEnum; + /** The title of the milestone. */ + title: string; +} + +/** + * The state of the milestone. Either \`open\` or \`closed\`. + * @default "open" + */ +export enum IssuesCreateMilestoneStateEnum { + Open = "open", + Closed = "closed", +} + +export interface IssuesCreatePayload { + /** Login for the user that this issue should be assigned to. _NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise. **This field is deprecated.**_ */ + assignee?: string | null; + /** Logins for Users to assign to this issue. _NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise._ */ + assignees?: string[]; + /** The contents of the issue. */ + body?: string; + /** Labels to associate with this issue. _NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise._ */ + labels?: ( + | string + | { + color?: string | null; + description?: string | null; + id?: number; + name?: string; + } + )[]; + /** The \`number\` of the milestone to associate this issue with. _NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise._ */ + milestone?: string | number | null; + /** The title of the issue. */ + title: string | number; +} + +export type IssuesDeleteCommentData = any; + +export type IssuesDeleteLabelData = any; + +export type IssuesDeleteMilestoneData = any; + +export type IssuesGetCommentData = IssueComment; + +export type IssuesGetData = Issue; + +export type IssuesGetEventData = IssueEvent; + +export type IssuesGetLabelData = Label; + +export type IssuesGetMilestoneData = Milestone; + +export type IssuesListAssigneesData = SimpleUser[]; + +export interface IssuesListAssigneesParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type IssuesListCommentsData = IssueComment[]; + +export type IssuesListCommentsForRepoData = IssueComment[]; + +export interface IssuesListCommentsForRepoParams { + /** Either \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ + direction?: DirectionEnum8; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: SortEnum7; +} + +/** Either \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ +export enum IssuesListCommentsForRepoParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum IssuesListCommentsForRepoParams1SortEnum { + Created = "created", + Updated = "updated", +} + +export interface IssuesListCommentsParams { + /** issue_number parameter */ + issueNumber: number; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; +} + +export type IssuesListData = Issue[]; + +export type IssuesListEventsData = IssueEventForIssue[]; + +export type IssuesListEventsForRepoData = IssueEvent[]; + +export interface IssuesListEventsForRepoParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type IssuesListEventsForTimelineData = IssueEventForIssue[]; + +export interface IssuesListEventsForTimelineParams { + /** issue_number parameter */ + issueNumber: number; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export interface IssuesListEventsParams { + /** issue_number parameter */ + issueNumber: number; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type IssuesListForAuthenticatedUserData = Issue[]; + +export interface IssuesListForAuthenticatedUserParams { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: DirectionEnum15; + /** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ + filter?: FilterEnum7; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: SortEnum18; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: StateEnum8; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum IssuesListForAuthenticatedUserParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ +export enum IssuesListForAuthenticatedUserParams1FilterEnum { + Assigned = "assigned", + Created = "created", + Mentioned = "mentioned", + Subscribed = "subscribed", + All = "all", +} + +/** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ +export enum IssuesListForAuthenticatedUserParams1SortEnum { + Created = "created", + Updated = "updated", + Comments = "comments", +} + +/** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum IssuesListForAuthenticatedUserParams1StateEnum { + Open = "open", + Closed = "closed", + All = "all", +} + +export type IssuesListForOrgData = Issue[]; + +export interface IssuesListForOrgParams { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: DirectionEnum3; + /** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ + filter?: FilterEnum1; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: SortEnum3; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: StateEnum1; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum IssuesListForOrgParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ +export enum IssuesListForOrgParams1FilterEnum { + Assigned = "assigned", + Created = "created", + Mentioned = "mentioned", + Subscribed = "subscribed", + All = "all", +} + +/** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ +export enum IssuesListForOrgParams1SortEnum { + Created = "created", + Updated = "updated", + Comments = "comments", +} + +/** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum IssuesListForOrgParams1StateEnum { + Open = "open", + Closed = "closed", + All = "all", +} + +export type IssuesListForRepoData = IssueSimple[]; + +export interface IssuesListForRepoParams { + /** Can be the name of a user. Pass in \`none\` for issues with no assigned user, and \`*\` for issues assigned to any user. */ + assignee?: string; + /** The user that created the issue. */ + creator?: string; + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: DirectionEnum7; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + /** A user that's mentioned in the issue. */ + mentioned?: string; + /** If an \`integer\` is passed, it should refer to a milestone by its \`number\` field. If the string \`*\` is passed, issues with any milestone are accepted. If the string \`none\` is passed, issues without milestones are returned. */ + milestone?: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: SortEnum6; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: StateEnum3; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum IssuesListForRepoParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ +export enum IssuesListForRepoParams1SortEnum { + Created = "created", + Updated = "updated", + Comments = "comments", +} + +/** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum IssuesListForRepoParams1StateEnum { + Open = "open", + Closed = "closed", + All = "all", +} + +export type IssuesListLabelsForMilestoneData = Label[]; + +export interface IssuesListLabelsForMilestoneParams { + /** milestone_number parameter */ + milestoneNumber: number; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type IssuesListLabelsForRepoData = Label[]; + +export interface IssuesListLabelsForRepoParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type IssuesListLabelsOnIssueData = Label[]; + +export interface IssuesListLabelsOnIssueParams { + /** issue_number parameter */ + issueNumber: number; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type IssuesListMilestonesData = Milestone[]; + +export interface IssuesListMilestonesParams { + /** + * The direction of the sort. Either \`asc\` or \`desc\`. + * @default "asc" + */ + direction?: DirectionEnum9; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** + * What to sort results by. Either \`due_on\` or \`completeness\`. + * @default "due_on" + */ + sort?: SortEnum8; + /** + * The state of the milestone. Either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: StateEnum4; +} + +/** + * The direction of the sort. Either \`asc\` or \`desc\`. + * @default "asc" + */ +export enum IssuesListMilestonesParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * What to sort results by. Either \`due_on\` or \`completeness\`. + * @default "due_on" + */ +export enum IssuesListMilestonesParams1SortEnum { + DueOn = "due_on", + Completeness = "completeness", +} + +/** + * The state of the milestone. Either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum IssuesListMilestonesParams1StateEnum { + Open = "open", + Closed = "closed", + All = "all", +} + +export interface IssuesListParams { + collab?: boolean; + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: DirectionEnum; + /** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ + filter?: FilterEnum; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + orgs?: boolean; + owned?: boolean; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + pulls?: boolean; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: SortEnum; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: StateEnum; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum IssuesListParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ +export enum IssuesListParams1FilterEnum { + Assigned = "assigned", + Created = "created", + Mentioned = "mentioned", + Subscribed = "subscribed", + All = "all", +} + +/** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ +export enum IssuesListParams1SortEnum { + Created = "created", + Updated = "updated", + Comments = "comments", +} + +/** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum IssuesListParams1StateEnum { + Open = "open", + Closed = "closed", + All = "all", +} + +export type IssuesLockData = any; + +/** + * The reason for locking the issue or pull request conversation. Lock will fail if you don't use one of these reasons: + * \\* \`off-topic\` + * \\* \`too heated\` + * \\* \`resolved\` + * \\* \`spam\` + */ +export enum IssuesLockLockReasonEnum { + OffTopic = "off-topic", + TooHeated = "too heated", + Resolved = "resolved", + Spam = "spam", +} + +export type IssuesLockPayload = { + /** + * The reason for locking the issue or pull request conversation. Lock will fail if you don't use one of these reasons: + * \\* \`off-topic\` + * \\* \`too heated\` + * \\* \`resolved\` + * \\* \`spam\` + */ + lock_reason?: IssuesLockLockReasonEnum; +} | null; + +export type IssuesRemoveAllLabelsData = any; + +export type IssuesRemoveAssigneesData = IssueSimple; + +export interface IssuesRemoveAssigneesPayload { + /** Usernames of assignees to remove from an issue. _NOTE: Only users with push access can remove assignees from an issue. Assignees are silently ignored otherwise._ */ + assignees?: string[]; +} + +export type IssuesRemoveLabelData = Label[]; + +export type IssuesSetLabelsData = Label[]; + +export interface IssuesSetLabelsPayload { + /** The names of the labels to add to the issue. You can pass an empty array to remove all labels. **Note:** Alternatively, you can pass a single label as a \`string\` or an \`array\` of labels directly, but GitHub recommends passing an object with the \`labels\` key. */ + labels?: string[]; +} + +export type IssuesUnlockData = any; + +export type IssuesUpdateCommentData = IssueComment; + +export interface IssuesUpdateCommentPayload { + /** The contents of the comment. */ + body: string; +} + +export type IssuesUpdateData = Issue; + +export type IssuesUpdateLabelData = Label; + +export interface IssuesUpdateLabelPayload { + /** The [hexadecimal color code](http://www.color-hex.com/) for the label, without the leading \`#\`. */ + color?: string; + /** A short description of the label. */ + description?: string; + /** The new name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing \`:strawberry:\` will render the emoji ![:strawberry:](https://assets-git.f3mw1.com/images/icons/emoji/unicode/1f353.png ":strawberry:"). For a full list of available emoji and codes, see [emoji-cheat-sheet.com](http://emoji-cheat-sheet.com/). */ + new_name?: string; +} + +export type IssuesUpdateMilestoneData = Milestone; + +export interface IssuesUpdateMilestonePayload { + /** A description of the milestone. */ + description?: string; + /** The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + due_on?: string; + /** + * The state of the milestone. Either \`open\` or \`closed\`. + * @default "open" + */ + state?: IssuesUpdateMilestoneStateEnum; + /** The title of the milestone. */ + title?: string; +} + +/** + * The state of the milestone. Either \`open\` or \`closed\`. + * @default "open" + */ +export enum IssuesUpdateMilestoneStateEnum { + Open = "open", + Closed = "closed", +} + +export interface IssuesUpdatePayload { + /** Login for the user that this issue should be assigned to. **This field is deprecated.** */ + assignee?: string | null; + /** Logins for Users to assign to this issue. Pass one or more user logins to _replace_ the set of assignees on this Issue. Send an empty array (\`[]\`) to clear all assignees from the Issue. _NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise._ */ + assignees?: string[]; + /** The contents of the issue. */ + body?: string; + /** Labels to associate with this issue. Pass one or more Labels to _replace_ the set of Labels on this Issue. Send an empty array (\`[]\`) to clear all Labels from the Issue. _NOTE: Only users with push access can set labels for issues. Labels are silently dropped otherwise._ */ + labels?: ( + | string + | { + color?: string | null; + description?: string | null; + id?: number; + name?: string; + } + )[]; + /** The \`number\` of the milestone to associate this issue with or \`null\` to remove current. _NOTE: Only users with push access can set the milestone for issues. The milestone is silently dropped otherwise._ */ + milestone?: string | number | null; + /** State of the issue. Either \`open\` or \`closed\`. */ + state?: IssuesUpdateStateEnum; + /** The title of the issue. */ + title?: string | number; +} + +/** State of the issue. Either \`open\` or \`closed\`. */ +export enum IssuesUpdateStateEnum { + Open = "open", + Closed = "closed", +} + +/** + * Job + * Information of a job execution in a workflow run + */ +export interface Job { + /** @example "https://api.github.com/repos/github/hello-world/check-runs/4" */ + check_run_url: string; + /** + * The time that the job finished, in ISO 8601 format. + * @format date-time + * @example "2019-08-08T08:00:00-07:00" + */ + completed_at: string | null; + /** + * The outcome of the job. + * @example "success" + */ + conclusion: string | null; + /** + * The SHA of the commit that is being run. + * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" + */ + head_sha: string; + /** @example "https://github.com/github/hello-world/runs/4" */ + html_url: string | null; + /** + * The id of the job. + * @example 21 + */ + id: number; + /** + * The name of the job. + * @example "test-coverage" + */ + name: string; + /** @example "MDg6Q2hlY2tSdW40" */ + node_id: string; + /** + * The id of the associated workflow run. + * @example 5 + */ + run_id: number; + /** @example "https://api.github.com/repos/github/hello-world/actions/runs/5" */ + run_url: string; + /** + * The time that the job started, in ISO 8601 format. + * @format date-time + * @example "2019-08-08T08:00:00-07:00" + */ + started_at: string; + /** + * The phase of the lifecycle that the job is currently in. + * @example "queued" + */ + status: JobStatusEnum; + /** Steps in this job. */ + steps?: { + /** + * The time that the job finished, in ISO 8601 format. + * @format date-time + * @example "2019-08-08T08:00:00-07:00" + */ + completed_at?: string | null; + /** + * The outcome of the job. + * @example "success" + */ + conclusion: string | null; + /** + * The name of the job. + * @example "test-coverage" + */ + name: string; + /** @example 1 */ + number: number; + /** + * The time that the step started, in ISO 8601 format. + * @format date-time + * @example "2019-08-08T08:00:00-07:00" + */ + started_at?: string | null; + /** + * The phase of the lifecycle that the job is currently in. + * @example "queued" + */ + status: JobStatusEnum1; + }[]; + /** @example "https://api.github.com/repos/github/hello-world/actions/jobs/21" */ + url: string; +} + +/** + * The phase of the lifecycle that the job is currently in. + * @example "queued" + */ +export enum JobStatusEnum { + Queued = "queued", + InProgress = "in_progress", + Completed = "completed", +} + +/** + * The phase of the lifecycle that the job is currently in. + * @example "queued" + */ +export enum JobStatusEnum1 { + Queued = "queued", + InProgress = "in_progress", + Completed = "completed", +} + +/** + * Key + * Key + */ +export interface Key { + /** @format date-time */ + created_at: string; + id: number; + key: string; + key_id: string; + read_only: boolean; + title: string; + url: string; + verified: boolean; +} + +/** + * Key Simple + * Key Simple + */ +export interface KeySimple { + id: number; + key: string; +} + +/** + * Label + * Color-coded labels help you categorize and filter your issues (just like labels in Gmail). + */ +export interface Label { + /** + * 6-character hex code, without the leading #, identifying the color + * @example "FFFFFF" + */ + color: string; + /** @example true */ + default: boolean; + /** @example "Something isn't working" */ + description: string | null; + /** @example 208045946 */ + id: number; + /** + * The name of the label. + * @example "bug" + */ + name: string; + /** @example "MDU6TGFiZWwyMDgwNDU5NDY=" */ + node_id: string; + /** + * URL for the label + * @format uri + * @example "https://api.github.com/repositories/42/labels/bug" + */ + url: string; +} + +/** + * Label Search Result Item + * Label Search Result Item + */ +export interface LabelSearchResultItem { + color: string; + default: boolean; + description: string | null; + id: number; + name: string; + node_id: string; + score: number; + text_matches?: SearchResultTextMatches; + /** @format uri */ + url: string; +} + +/** + * Language + * Language + */ +export type Language = Record; + +/** + * License + * License + */ +export interface License { + /** + * @example " + * + * The MIT License (MIT) + * + * Copyright (c) [year] [fullname] + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * " + */ + body: string; + /** @example ["include-copyright"] */ + conditions: string[]; + /** @example "A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty." */ + description: string; + /** @example true */ + featured: boolean; + /** + * @format uri + * @example "http://choosealicense.com/licenses/mit/" + */ + html_url: string; + /** @example "Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders." */ + implementation: string; + /** @example "mit" */ + key: string; + /** @example ["no-liability"] */ + limitations: string[]; + /** @example "MIT License" */ + name: string; + /** @example "MDc6TGljZW5zZW1pdA==" */ + node_id: string; + /** @example ["commercial-use","modifications","distribution","sublicense","private-use"] */ + permissions: string[]; + /** @example "MIT" */ + spdx_id: string | null; + /** + * @format uri + * @example "https://api.github.com/licenses/mit" + */ + url: string | null; +} + +/** + * License Content + * License Content + */ +export interface LicenseContent { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @format uri */ + self: string; + }; + content: string; + /** @format uri */ + download_url: string | null; + encoding: string; + /** @format uri */ + git_url: string | null; + /** @format uri */ + html_url: string | null; + license: LicenseSimple | null; + name: string; + path: string; + sha: string; + size: number; + type: string; + /** @format uri */ + url: string; +} + +/** + * License Simple + * License Simple + */ +export interface LicenseSimple { + /** @format uri */ + html_url?: string; + /** @example "mit" */ + key: string; + /** @example "MIT License" */ + name: string; + /** @example "MDc6TGljZW5zZW1pdA==" */ + node_id: string; + /** @example "MIT" */ + spdx_id: string | null; + /** + * @format uri + * @example "https://api.github.com/licenses/mit" + */ + url: string | null; +} + +export type LicensesGetAllCommonlyUsedData = LicenseSimple[]; + +export interface LicensesGetAllCommonlyUsedParams { + featured?: boolean; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type LicensesGetData = License; + +export type LicensesGetForRepoData = LicenseContent; + +/** + * Link + * Hypermedia Link + */ +export interface Link { + href: string; +} + +/** + * Link With Type + * Hypermedia Link with Type + */ +export interface LinkWithType { + href: string; + type: string; +} + +export type MarkdownRenderData = string; + +/** + * The rendering mode. + * @default "markdown" + * @example "markdown" + */ +export enum MarkdownRenderModeEnum { + Markdown = "markdown", + Gfm = "gfm", +} + +export interface MarkdownRenderPayload { + /** The repository context to use when creating references in \`gfm\` mode. */ + context?: string; + /** + * The rendering mode. + * @default "markdown" + * @example "markdown" + */ + mode?: MarkdownRenderModeEnum; + /** The Markdown text to render in HTML. */ + text: string; +} + +export type MarkdownRenderRawData = string; + +export type MarkdownRenderRawPayload = string; + +/** Marketplace Account */ +export interface MarketplaceAccount { + /** @format email */ + email?: string | null; + id: number; + login: string; + node_id?: string; + /** @format email */ + organization_billing_email?: string | null; + type: string; + /** @format uri */ + url: string; +} + +/** + * Marketplace Listing Plan + * Marketplace Listing Plan + */ +export interface MarketplaceListingPlan { + /** + * @format uri + * @example "https://api.github.com/marketplace_listing/plans/1313/accounts" + */ + accounts_url: string; + /** @example ["Up to 25 private repositories","11 concurrent builds"] */ + bullets: string[]; + /** @example "A professional-grade CI solution" */ + description: string; + /** @example true */ + has_free_trial: boolean; + /** @example 1313 */ + id: number; + /** @example 1099 */ + monthly_price_in_cents: number; + /** @example "Pro" */ + name: string; + /** @example 3 */ + number: number; + /** @example "flat-rate" */ + price_model: string; + /** @example "published" */ + state: string; + unit_name: string | null; + /** + * @format uri + * @example "https://api.github.com/marketplace_listing/plans/1313" + */ + url: string; + /** @example 11870 */ + yearly_price_in_cents: number; +} + +/** + * Marketplace Purchase + * Marketplace Purchase + */ +export interface MarketplacePurchase { + id: number; + login: string; + marketplace_pending_change?: { + effective_date?: string; + id?: number; + is_installed?: boolean; + /** Marketplace Listing Plan */ + plan?: MarketplaceListingPlan; + unit_count?: number | null; + }; + marketplace_purchase: { + billing_cycle?: string; + free_trial_ends_on?: string | null; + is_installed?: boolean; + next_billing_date?: string | null; + on_free_trial?: boolean; + /** Marketplace Listing Plan */ + plan?: MarketplaceListingPlan; + unit_count?: number | null; + updated_at?: string; + }; + organization_billing_email?: string; + type: string; + url: string; +} + +export type MetaGetData = ApiOverview; + +export type MetaGetOctocatData = string; + +export interface MetaGetOctocatParams { + /** The words to show in Octocat's speech bubble */ + s?: string; +} + +export type MetaGetZenData = string; + +export interface MetaRootData { + /** @format uri */ + authorizations_url: string; + /** @format uri */ + code_search_url: string; + /** @format uri */ + commit_search_url: string; + /** @format uri */ + current_user_authorizations_html_url: string; + /** @format uri */ + current_user_repositories_url: string; + /** @format uri */ + current_user_url: string; + /** @format uri */ + emails_url: string; + /** @format uri */ + emojis_url: string; + /** @format uri */ + events_url: string; + /** @format uri */ + feeds_url: string; + /** @format uri */ + followers_url: string; + /** @format uri */ + following_url: string; + /** @format uri */ + gists_url: string; + /** @format uri */ + hub_url: string; + /** @format uri */ + issue_search_url: string; + /** @format uri */ + issues_url: string; + /** @format uri */ + keys_url: string; + /** @format uri */ + label_search_url: string; + /** @format uri */ + notifications_url: string; + /** @format uri */ + organization_repositories_url: string; + /** @format uri */ + organization_teams_url: string; + /** @format uri */ + organization_url: string; + /** @format uri */ + public_gists_url: string; + /** @format uri */ + rate_limit_url: string; + /** @format uri */ + repository_search_url: string; + /** @format uri */ + repository_url: string; + /** @format uri */ + starred_gists_url: string; + /** @format uri */ + starred_url: string; + /** @format uri */ + topic_search_url?: string; + /** @format uri */ + user_organizations_url: string; + /** @format uri */ + user_repositories_url: string; + /** @format uri */ + user_search_url: string; + /** @format uri */ + user_url: string; +} + +/** + * Migration + * A migration. + */ +export interface Migration { + /** @format uri */ + archive_url?: string; + /** + * @format date-time + * @example "2015-07-06T15:33:38-07:00" + */ + created_at: string; + exclude?: any[]; + exclude_attachments: boolean; + /** @example "0b989ba4-242f-11e5-81e1-c7b6966d2516" */ + guid: string; + /** @example 79 */ + id: number; + /** @example true */ + lock_repositories: boolean; + node_id: string; + owner: SimpleUser | null; + repositories: Repository[]; + /** @example "pending" */ + state: string; + /** + * @format date-time + * @example "2015-07-06T15:33:38-07:00" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/orgs/octo-org/migrations/79" + */ + url: string; +} + +export type MigrationsCancelImportData = any; + +export type MigrationsDeleteArchiveForAuthenticatedUserData = any; + +export type MigrationsDeleteArchiveForOrgData = any; + +export type MigrationsGetCommitAuthorsData = PorterAuthor[]; + +export interface MigrationsGetCommitAuthorsParams { + owner: string; + repo: string; + /** A user ID. Only return users with an ID greater than this ID. */ + since?: number; +} + +export type MigrationsGetImportStatusData = Import; + +export type MigrationsGetLargeFilesData = PorterLargeFile[]; + +export type MigrationsGetStatusForAuthenticatedUserData = Migration; + +export interface MigrationsGetStatusForAuthenticatedUserParams { + exclude?: string[]; + /** migration_id parameter */ + migrationId: number; +} + +export type MigrationsGetStatusForOrgData = Migration; + +export type MigrationsListForAuthenticatedUserData = Migration[]; + +export interface MigrationsListForAuthenticatedUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type MigrationsListForOrgData = Migration[]; + +export interface MigrationsListForOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type MigrationsListReposForOrgData = MinimalRepository[]; + +export interface MigrationsListReposForOrgParams { + /** migration_id parameter */ + migrationId: number; + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type MigrationsListReposForUserData = MinimalRepository[]; + +export interface MigrationsListReposForUserParams { + /** migration_id parameter */ + migrationId: number; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type MigrationsMapCommitAuthorData = PorterAuthor; + +export interface MigrationsMapCommitAuthorPayload { + /** The new Git author email. */ + email?: string; + /** The new Git author name. */ + name?: string; + /** @example ""can't touch this"" */ + remote_id?: string; +} + +export type MigrationsSetLfsPreferenceData = Import; + +export interface MigrationsSetLfsPreferencePayload { + /** Can be one of \`opt_in\` (large files will be stored using Git LFS) or \`opt_out\` (large files will be removed during the import). */ + use_lfs: MigrationsSetLfsPreferenceUseLfsEnum; +} + +/** Can be one of \`opt_in\` (large files will be stored using Git LFS) or \`opt_out\` (large files will be removed during the import). */ +export enum MigrationsSetLfsPreferenceUseLfsEnum { + OptIn = "opt_in", + OptOut = "opt_out", +} + +export type MigrationsStartForAuthenticatedUserData = Migration; + +/** + * Allowed values that can be passed to the exclude param. + * @example "repositories" + */ +export enum MigrationsStartForAuthenticatedUserExcludeEnum { + Repositories = "repositories", +} + +export interface MigrationsStartForAuthenticatedUserPayload { + /** + * Exclude attributes from the API response to improve performance + * @example ["repositories"] + */ + exclude?: MigrationsStartForAuthenticatedUserExcludeEnum[]; + /** + * Do not include attachments in the migration + * @example true + */ + exclude_attachments?: boolean; + /** + * Lock the repositories being migrated at the start of the migration + * @example true + */ + lock_repositories?: boolean; + repositories: string[]; +} + +export type MigrationsStartForOrgData = Migration; + +export interface MigrationsStartForOrgPayload { + exclude?: string[]; + /** + * Indicates whether attachments should be excluded from the migration (to reduce migration archive file size). + * @default false + */ + exclude_attachments?: boolean; + /** + * Indicates whether repositories should be locked (to prevent manipulation) while migrating data. + * @default false + */ + lock_repositories?: boolean; + /** A list of arrays indicating which repositories should be migrated. */ + repositories: string[]; +} + +export type MigrationsStartImportData = Import; + +export interface MigrationsStartImportPayload { + /** For a tfvc import, the name of the project that is being imported. */ + tfvc_project?: string; + /** The originating VCS type. Can be one of \`subversion\`, \`git\`, \`mercurial\`, or \`tfvc\`. Please be aware that without this parameter, the import job will take additional time to detect the VCS type before beginning the import. This detection step will be reflected in the response. */ + vcs?: MigrationsStartImportVcsEnum; + /** If authentication is required, the password to provide to \`vcs_url\`. */ + vcs_password?: string; + /** The URL of the originating repository. */ + vcs_url: string; + /** If authentication is required, the username to provide to \`vcs_url\`. */ + vcs_username?: string; +} + +/** The originating VCS type. Can be one of \`subversion\`, \`git\`, \`mercurial\`, or \`tfvc\`. Please be aware that without this parameter, the import job will take additional time to detect the VCS type before beginning the import. This detection step will be reflected in the response. */ +export enum MigrationsStartImportVcsEnum { + Subversion = "subversion", + Git = "git", + Mercurial = "mercurial", + Tfvc = "tfvc", +} + +export type MigrationsUnlockRepoForAuthenticatedUserData = any; + +export type MigrationsUnlockRepoForOrgData = any; + +export type MigrationsUpdateImportData = Import; + +export interface MigrationsUpdateImportPayload { + /** @example ""project1"" */ + tfvc_project?: string; + /** @example ""git"" */ + vcs?: string; + /** The password to provide to the originating repository. */ + vcs_password?: string; + /** The username to provide to the originating repository. */ + vcs_username?: string; +} + +/** + * Milestone + * A collection of related issues and pull requests. + */ +export interface Milestone { + /** + * @format date-time + * @example "2013-02-12T13:22:01Z" + */ + closed_at: string | null; + /** @example 8 */ + closed_issues: number; + /** + * @format date-time + * @example "2011-04-10T20:09:31Z" + */ + created_at: string; + creator: SimpleUser | null; + /** @example "Tracking milestone for version 1.0" */ + description: string | null; + /** + * @format date-time + * @example "2012-10-09T23:39:01Z" + */ + due_on: string | null; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/milestones/v1.0" + */ + html_url: string; + /** @example 1002604 */ + id: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels" + */ + labels_url: string; + /** @example "MDk6TWlsZXN0b25lMTAwMjYwNA==" */ + node_id: string; + /** + * The number of the milestone. + * @example 42 + */ + number: number; + /** @example 4 */ + open_issues: number; + /** + * The state of the milestone. + * @default "open" + * @example "open" + */ + state: MilestoneStateEnum; + /** + * The title of the milestone. + * @example "v1.0" + */ + title: string; + /** + * @format date-time + * @example "2014-03-03T18:58:10Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/milestones/1" + */ + url: string; +} + +/** + * The state of the milestone. + * @default "open" + * @example "open" + */ +export enum MilestoneStateEnum { + Open = "open", + Closed = "closed", +} + +/** + * Minimal Repository + * Minimal Repository + */ +export interface MinimalRepository { + /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ + archive_url: string; + archived?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ + assignees_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ + blobs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ + branches_url: string; + clone_url?: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ + collaborators_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ + comments_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ + commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ + compare_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ + contents_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/contributors" + */ + contributors_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at?: string | null; + default_branch?: string; + delete_branch_on_merge?: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/deployments" + */ + deployments_url: string; + /** @example "This your first repo!" */ + description: string | null; + disabled?: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/downloads" + */ + downloads_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/events" + */ + events_url: string; + fork: boolean; + /** @example 0 */ + forks?: number; + forks_count?: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/forks" + */ + forks_url: string; + /** @example "octocat/Hello-World" */ + full_name: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ + git_commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ + git_refs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ + git_tags_url: string; + git_url?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_pages?: boolean; + has_projects?: boolean; + has_wiki?: boolean; + homepage?: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/hooks" + */ + hooks_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World" + */ + html_url: string; + /** @example 1296269 */ + id: number; + is_template?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ + issue_comment_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ + issue_events_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ + issues_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ + keys_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ + labels_url: string; + language?: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/languages" + */ + languages_url: string; + license?: { + key?: string; + name?: string; + node_id?: string; + spdx_id?: string; + url?: string; + } | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/merges" + */ + merges_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ + milestones_url: string; + mirror_url?: string | null; + /** @example "Hello-World" */ + name: string; + network_count?: number; + /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ + node_id: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ + notifications_url: string; + /** @example 0 */ + open_issues?: number; + open_issues_count?: number; + owner: SimpleUser | null; + permissions?: { + admin?: boolean; + pull?: boolean; + push?: boolean; + }; + private: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ + pulls_url: string; + /** + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + pushed_at?: string | null; + /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ + releases_url: string; + size?: number; + ssh_url?: string; + stargazers_count?: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" + */ + stargazers_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ + statuses_url: string; + subscribers_count?: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" + */ + subscribers_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscription" + */ + subscription_url: string; + svn_url?: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/tags" + */ + tags_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/teams" + */ + teams_url: string; + temp_clone_token?: string; + template_repository?: Repository | null; + topics?: string[]; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ + trees_url: string; + /** + * @format date-time + * @example "2011-01-26T19:14:43Z" + */ + updated_at?: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World" + */ + url: string; + visibility?: string; + /** @example 0 */ + watchers?: number; + watchers_count?: number; +} + +/** Moved Permanently */ +export type MovedPermanently = any; + +/** Resource Not Found */ +export type NotFound = BasicError; + +/** Not Modified */ +export type NotModified = any; + +export type OauthAuthorizationsCreateAuthorizationData = Authorization; + +export interface OauthAuthorizationsCreateAuthorizationPayload { + /** + * The OAuth app client key for which to create the token. + * @maxLength 20 + */ + client_id?: string; + /** + * The OAuth app client secret for which to create the token. + * @maxLength 40 + */ + client_secret?: string; + /** A unique string to distinguish an authorization from others created for the same client ID and user. */ + fingerprint?: string; + /** + * A note to remind you what the OAuth token is for. + * @example "Update all gems" + */ + note?: string; + /** A URL to remind you what app the OAuth token is for. */ + note_url?: string; + /** + * A list of scopes that this authorization is in. + * @example ["public_repo","user"] + */ + scopes?: string[] | null; +} + +export type OauthAuthorizationsDeleteAuthorizationData = any; + +export type OauthAuthorizationsDeleteGrantData = any; + +export type OauthAuthorizationsGetAuthorizationData = Authorization; + +export type OauthAuthorizationsGetGrantData = ApplicationGrant; + +export type OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintData = Authorization; + +export interface OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintPayload { + /** + * The OAuth app client secret for which to create the token. + * @maxLength 40 + */ + client_secret: string; + /** + * A note to remind you what the OAuth token is for. + * @example "Update all gems" + */ + note?: string; + /** A URL to remind you what app the OAuth token is for. */ + note_url?: string; + /** + * A list of scopes that this authorization is in. + * @example ["public_repo","user"] + */ + scopes?: string[] | null; +} + +export type OauthAuthorizationsGetOrCreateAuthorizationForAppData = Authorization; + +export interface OauthAuthorizationsGetOrCreateAuthorizationForAppPayload { + /** + * The OAuth app client secret for which to create the token. + * @maxLength 40 + */ + client_secret: string; + /** A unique string to distinguish an authorization from others created for the same client ID and user. */ + fingerprint?: string; + /** + * A note to remind you what the OAuth token is for. + * @example "Update all gems" + */ + note?: string; + /** A URL to remind you what app the OAuth token is for. */ + note_url?: string; + /** + * A list of scopes that this authorization is in. + * @example ["public_repo","user"] + */ + scopes?: string[] | null; +} + +export type OauthAuthorizationsListAuthorizationsData = Authorization[]; + +export interface OauthAuthorizationsListAuthorizationsParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type OauthAuthorizationsListGrantsData = ApplicationGrant[]; + +export interface OauthAuthorizationsListGrantsParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type OauthAuthorizationsUpdateAuthorizationData = Authorization; + +export interface OauthAuthorizationsUpdateAuthorizationPayload { + /** A list of scopes to add to this authorization. */ + add_scopes?: string[]; + /** A unique string to distinguish an authorization from others created for the same client ID and user. */ + fingerprint?: string; + /** + * A note to remind you what the OAuth token is for. + * @example "Update all gems" + */ + note?: string; + /** A URL to remind you what app the OAuth token is for. */ + note_url?: string; + /** A list of scopes to remove from this authorization. */ + remove_scopes?: string[]; + /** + * A list of scopes that this authorization is in. + * @example ["public_repo","user"] + */ + scopes?: string[] | null; +} + +/** + * The order of audit log events. To list newest events first, specify \`desc\`. To list oldest events first, specify \`asc\`. + * + * The default is \`desc\`. + */ +export enum OrderEnum { + Desc = "desc", + Asc = "asc", +} + +/** + * The order of audit log events. To list newest events first, specify \`desc\`. To list oldest events first, specify \`asc\`. + * + * The default is \`desc\`. + */ +export enum OrderEnum1 { + Desc = "desc", + Asc = "asc", +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum OrderEnum2 { + Desc = "desc", + Asc = "asc", +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum OrderEnum3 { + Desc = "desc", + Asc = "asc", +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum OrderEnum4 { + Desc = "desc", + Asc = "asc", +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum OrderEnum5 { + Desc = "desc", + Asc = "asc", +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum OrderEnum6 { + Desc = "desc", + Asc = "asc", +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum OrderEnum7 { + Desc = "desc", + Asc = "asc", +} + +/** + * Org Hook + * Org Hook + */ +export interface OrgHook { + /** @example true */ + active: boolean; + config: { + /** @example ""form"" */ + content_type?: string; + /** @example ""0"" */ + insecure_ssl?: string; + /** @example ""********"" */ + secret?: string; + /** @example ""http://example.com/2"" */ + url?: string; + }; + /** + * @format date-time + * @example "2011-09-06T17:26:27Z" + */ + created_at: string; + /** @example ["push","pull_request"] */ + events: string[]; + /** @example 1 */ + id: number; + /** @example "web" */ + name: string; + /** + * @format uri + * @example "https://api.github.com/orgs/octocat/hooks/1/pings" + */ + ping_url: string; + type: string; + /** + * @format date-time + * @example "2011-09-06T20:39:23Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/orgs/octocat/hooks/1" + */ + url: string; +} + +/** + * Org Membership + * Org Membership + */ +export interface OrgMembership { + /** Organization Simple */ + organization: OrganizationSimple; + /** + * @format uri + * @example "https://api.github.com/orgs/octocat" + */ + organization_url: string; + permissions?: { + can_create_repository: boolean; + }; + /** @example "admin" */ + role: string; + /** @example "active" */ + state: string; + /** + * @format uri + * @example "https://api.github.com/orgs/octocat/memberships/defunkt" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Actions Secret for an Organization + * Secrets for GitHub Actions for an organization. + */ +export interface OrganizationActionsSecret { + /** @format date-time */ + created_at: string; + /** + * The name of the secret. + * @example "SECRET_TOKEN" + */ + name: string; + /** + * @format uri + * @example "https://api.github.com/organizations/org/secrets/my_secret/repositories" + */ + selected_repositories_url?: string; + /** @format date-time */ + updated_at: string; + /** Visibility of a secret */ + visibility: OrganizationActionsSecretVisibilityEnum; +} + +/** Visibility of a secret */ +export enum OrganizationActionsSecretVisibilityEnum { + All = "all", + Private = "private", + Selected = "selected", +} + +/** + * Organization Full + * Organization Full + */ +export interface OrganizationFull { + /** @example "https://github.com/images/error/octocat_happy.gif" */ + avatar_url: string; + /** + * @format email + * @example "org@example.com" + */ + billing_email?: string | null; + /** + * @format uri + * @example "https://github.com/blog" + */ + blog?: string; + /** @example 8 */ + collaborators?: number | null; + /** @example "GitHub" */ + company?: string; + /** + * @format date-time + * @example "2008-01-14T04:33:35Z" + */ + created_at: string; + default_repository_permission?: string | null; + /** @example "A great organization" */ + description: string | null; + /** @example 10000 */ + disk_usage?: number | null; + /** + * @format email + * @example "octocat@github.com" + */ + email?: string; + /** + * @format uri + * @example "https://api.github.com/orgs/github/events" + */ + events_url: string; + /** @example 20 */ + followers: number; + /** @example 0 */ + following: number; + /** @example true */ + has_organization_projects: boolean; + /** @example true */ + has_repository_projects: boolean; + /** @example "https://api.github.com/orgs/github/hooks" */ + hooks_url: string; + /** + * @format uri + * @example "https://github.com/octocat" + */ + html_url: string; + /** @example 1 */ + id: number; + /** @example true */ + is_verified?: boolean; + /** @example "https://api.github.com/orgs/github/issues" */ + issues_url: string; + /** @example "San Francisco" */ + location?: string; + /** @example "github" */ + login: string; + /** @example "all" */ + members_allowed_repository_creation_type?: string; + /** @example true */ + members_can_create_internal_repositories?: boolean; + /** @example true */ + members_can_create_pages?: boolean; + /** @example true */ + members_can_create_private_repositories?: boolean; + /** @example true */ + members_can_create_public_repositories?: boolean; + /** @example true */ + members_can_create_repositories?: boolean | null; + /** @example "https://api.github.com/orgs/github/members{/member}" */ + members_url: string; + /** @example "github" */ + name?: string; + /** @example "MDEyOk9yZ2FuaXphdGlvbjE=" */ + node_id: string; + /** @example 100 */ + owned_private_repos?: number; + plan?: { + filled_seats?: number; + name: string; + private_repos: number; + seats?: number; + space: number; + }; + /** @example 81 */ + private_gists?: number | null; + /** @example 1 */ + public_gists: number; + /** @example "https://api.github.com/orgs/github/public_members{/member}" */ + public_members_url: string; + /** @example 2 */ + public_repos: number; + /** + * @format uri + * @example "https://api.github.com/orgs/github/repos" + */ + repos_url: string; + /** @example 100 */ + total_private_repos?: number; + /** @example "github" */ + twitter_username?: string | null; + /** @example true */ + two_factor_requirement_enabled?: boolean | null; + /** @example "Organization" */ + type: string; + /** @format date-time */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/orgs/github" + */ + url: string; +} + +/** + * Organization Invitation + * Organization Invitation + */ +export interface OrganizationInvitation { + created_at: string; + email: string | null; + failed_at?: string; + failed_reason?: string; + id: number; + invitation_team_url: string; + /** @example ""https://api.github.com/organizations/16/invitations/1/teams"" */ + invitation_teams_url?: string; + /** Simple User */ + inviter: SimpleUser; + login: string | null; + /** @example ""MDIyOk9yZ2FuaXphdGlvbkludml0YXRpb24x"" */ + node_id: string; + role: string; + team_count: number; +} + +/** + * Organization Simple + * Organization Simple + */ +export interface OrganizationSimple { + /** @example "https://github.com/images/error/octocat_happy.gif" */ + avatar_url: string; + /** @example "A great organization" */ + description: string | null; + /** + * @format uri + * @example "https://api.github.com/orgs/github/events" + */ + events_url: string; + /** @example "https://api.github.com/orgs/github/hooks" */ + hooks_url: string; + /** @example 1 */ + id: number; + /** @example "https://api.github.com/orgs/github/issues" */ + issues_url: string; + /** @example "github" */ + login: string; + /** @example "https://api.github.com/orgs/github/members{/member}" */ + members_url: string; + /** @example "MDEyOk9yZ2FuaXphdGlvbjE=" */ + node_id: string; + /** @example "https://api.github.com/orgs/github/public_members{/member}" */ + public_members_url: string; + /** + * @format uri + * @example "https://api.github.com/orgs/github/repos" + */ + repos_url: string; + /** + * @format uri + * @example "https://api.github.com/orgs/github" + */ + url: string; +} + +export type OrgsBlockUserData = any; + +export type OrgsCancelInvitationData = any; + +export type OrgsCheckBlockedUserData = any; + +export type OrgsCheckBlockedUserError = BasicError; + +export type OrgsCheckMembershipForUserData = any; + +export type OrgsCheckPublicMembershipForUserData = any; + +export type OrgsConvertMemberToOutsideCollaboratorData = any; + +export type OrgsConvertMemberToOutsideCollaboratorError = { + documentation_url?: string; + message?: string; +}; + +export type OrgsCreateInvitationData = OrganizationInvitation; + +export interface OrgsCreateInvitationPayload { + /** **Required unless you provide \`invitee_id\`**. Email address of the person you are inviting, which can be an existing GitHub user. */ + email?: string; + /** **Required unless you provide \`email\`**. GitHub user ID for the person you are inviting. */ + invitee_id?: number; + /** + * Specify role for new member. Can be one of: + * \\* \`admin\` - Organization owners with full administrative rights to the organization and complete access to all repositories and teams. + * \\* \`direct_member\` - Non-owner organization members with ability to see other members and join teams by invitation. + * \\* \`billing_manager\` - Non-owner organization members with ability to manage the billing settings of your organization. + * @default "direct_member" + */ + role?: OrgsCreateInvitationRoleEnum; + /** Specify IDs for the teams you want to invite new members to. */ + team_ids?: number[]; +} + +/** + * Specify role for new member. Can be one of: + * \\* \`admin\` - Organization owners with full administrative rights to the organization and complete access to all repositories and teams. + * \\* \`direct_member\` - Non-owner organization members with ability to see other members and join teams by invitation. + * \\* \`billing_manager\` - Non-owner organization members with ability to manage the billing settings of your organization. + * @default "direct_member" + */ +export enum OrgsCreateInvitationRoleEnum { + Admin = "admin", + DirectMember = "direct_member", + BillingManager = "billing_manager", +} + +export type OrgsCreateWebhookData = OrgHook; + +export interface OrgsCreateWebhookPayload { + /** + * Determines if notifications are sent when the webhook is triggered. Set to \`true\` to send notifications. + * @default true + */ + active?: boolean; + /** Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/orgs#create-hook-config-params). */ + config: { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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 ""password"" */ + password?: 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; + /** The URL to which the payloads will be delivered. */ + url: WebhookConfigUrl; + /** @example ""kdaigle"" */ + username?: string; + }; + /** + * Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. + * @default ["push"] + */ + events?: string[]; + /** Must be passed as "web". */ + name: string; +} + +export type OrgsDeleteWebhookData = any; + +export type OrgsGetAuditLogData = AuditLogEvent[]; + +export interface OrgsGetAuditLogParams { + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor. */ + after?: string; + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor. */ + before?: string; + /** + * The event types to include: + * + * - \`web\` - returns web (non-Git) events + * - \`git\` - returns Git events + * - \`all\` - returns both web and Git events + * + * The default is \`web\`. + */ + include?: IncludeEnum1; + /** + * The order of audit log events. To list newest events first, specify \`desc\`. To list oldest events first, specify \`asc\`. + * + * The default is \`desc\`. + */ + order?: OrderEnum1; + org: string; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** A search phrase. For more information, see [Searching the audit log](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#searching-the-audit-log). */ + phrase?: string; +} + +/** + * The event types to include: + * + * - \`web\` - returns web (non-Git) events + * - \`git\` - returns Git events + * - \`all\` - returns both web and Git events + * + * The default is \`web\`. + */ +export enum OrgsGetAuditLogParams1IncludeEnum { + Web = "web", + Git = "git", + All = "all", +} + +/** + * The order of audit log events. To list newest events first, specify \`desc\`. To list oldest events first, specify \`asc\`. + * + * The default is \`desc\`. + */ +export enum OrgsGetAuditLogParams1OrderEnum { + Desc = "desc", + Asc = "asc", +} + +export type OrgsGetData = OrganizationFull; + +export type OrgsGetMembershipForAuthenticatedUserData = OrgMembership; + +export type OrgsGetMembershipForUserData = OrgMembership; + +export type OrgsGetWebhookConfigForOrgData = WebhookConfig; + +export type OrgsGetWebhookData = OrgHook; + +export interface OrgsListAppInstallationsData { + installations: Installation[]; + total_count: number; +} + +export interface OrgsListAppInstallationsParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type OrgsListBlockedUsersData = SimpleUser[]; + +export type OrgsListData = OrganizationSimple[]; + +export type OrgsListFailedInvitationsData = OrganizationInvitation[]; + +export interface OrgsListFailedInvitationsParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type OrgsListForAuthenticatedUserData = OrganizationSimple[]; + +export interface OrgsListForAuthenticatedUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type OrgsListForUserData = OrganizationSimple[]; + +export interface OrgsListForUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export type OrgsListInvitationTeamsData = Team[]; + +export interface OrgsListInvitationTeamsParams { + /** invitation_id parameter */ + invitationId: number; + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type OrgsListMembersData = SimpleUser[]; + +export interface OrgsListMembersParams { + /** + * Filter members returned in the list. Can be one of: + * \\* \`2fa_disabled\` - Members without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. Available for organization owners. + * \\* \`all\` - All members the authenticated user can see. + * @default "all" + */ + filter?: FilterEnum2; + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Filter members returned by their role. Can be one of: + * \\* \`all\` - All members of the organization, regardless of role. + * \\* \`admin\` - Organization owners. + * \\* \`member\` - Non-owner organization members. + * @default "all" + */ + role?: RoleEnum; +} + +/** + * Filter members returned in the list. Can be one of: + * \\* \`2fa_disabled\` - Members without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. Available for organization owners. + * \\* \`all\` - All members the authenticated user can see. + * @default "all" + */ +export enum OrgsListMembersParams1FilterEnum { + Value2FaDisabled = "2fa_disabled", + All = "all", +} + +/** + * Filter members returned by their role. Can be one of: + * \\* \`all\` - All members of the organization, regardless of role. + * \\* \`admin\` - Organization owners. + * \\* \`member\` - Non-owner organization members. + * @default "all" + */ +export enum OrgsListMembersParams1RoleEnum { + All = "all", + Admin = "admin", + Member = "member", +} + +export type OrgsListMembershipsForAuthenticatedUserData = OrgMembership[]; + +export interface OrgsListMembershipsForAuthenticatedUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Indicates the state of the memberships to return. Can be either \`active\` or \`pending\`. If not specified, the API returns both active and pending memberships. */ + state?: StateEnum9; +} + +/** Indicates the state of the memberships to return. Can be either \`active\` or \`pending\`. If not specified, the API returns both active and pending memberships. */ +export enum OrgsListMembershipsForAuthenticatedUserParams1StateEnum { + Active = "active", + Pending = "pending", +} + +export type OrgsListOutsideCollaboratorsData = SimpleUser[]; + +export interface OrgsListOutsideCollaboratorsParams { + /** + * Filter the list of outside collaborators. Can be one of: + * \\* \`2fa_disabled\`: Outside collaborators without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. + * \\* \`all\`: All outside collaborators. + * @default "all" + */ + filter?: FilterEnum3; + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +/** + * Filter the list of outside collaborators. Can be one of: + * \\* \`2fa_disabled\`: Outside collaborators without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. + * \\* \`all\`: All outside collaborators. + * @default "all" + */ +export enum OrgsListOutsideCollaboratorsParams1FilterEnum { + Value2FaDisabled = "2fa_disabled", + All = "all", +} + +export interface OrgsListParams { + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** An organization ID. Only return organizations with an ID greater than this ID. */ + since?: number; +} + +export type OrgsListPendingInvitationsData = OrganizationInvitation[]; + +export interface OrgsListPendingInvitationsParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type OrgsListPublicMembersData = SimpleUser[]; + +export interface OrgsListPublicMembersParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type OrgsListSamlSsoAuthorizationsData = CredentialAuthorization[]; + +export type OrgsListWebhooksData = OrgHook[]; + +export interface OrgsListWebhooksParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type OrgsPingWebhookData = any; + +export type OrgsRemoveMemberData = any; + +export type OrgsRemoveMembershipForUserData = any; + +export type OrgsRemoveOutsideCollaboratorData = any; + +export type OrgsRemoveOutsideCollaboratorError = { + documentation_url?: string; + message?: string; +}; + +export type OrgsRemovePublicMembershipForAuthenticatedUserData = any; + +export type OrgsRemoveSamlSsoAuthorizationData = any; + +export type OrgsSetMembershipForUserData = OrgMembership; + +export interface OrgsSetMembershipForUserPayload { + /** + * The role to give the user in the organization. Can be one of: + * \\* \`admin\` - The user will become an owner of the organization. + * \\* \`member\` - The user will become a non-owner member of the organization. + * @default "member" + */ + role?: OrgsSetMembershipForUserRoleEnum; +} + +/** + * The role to give the user in the organization. Can be one of: + * \\* \`admin\` - The user will become an owner of the organization. + * \\* \`member\` - The user will become a non-owner member of the organization. + * @default "member" + */ +export enum OrgsSetMembershipForUserRoleEnum { + Admin = "admin", + Member = "member", +} + +export type OrgsSetPublicMembershipForAuthenticatedUserData = any; + +export type OrgsUnblockUserData = any; + +export type OrgsUpdateData = OrganizationFull; + +/** + * Default permission level members have for organization repositories: + * \\* \`read\` - can pull, but not push to or administer this repository. + * \\* \`write\` - can pull and push, but not administer this repository. + * \\* \`admin\` - can pull, push, and administer this repository. + * \\* \`none\` - no permissions granted by default. + * @default "read" + */ +export enum OrgsUpdateDefaultRepositoryPermissionEnum { + Read = "read", + Write = "write", + Admin = "admin", + None = "none", +} + +export type OrgsUpdateError = ValidationError | ValidationErrorSimple; + +/** + * Specifies which types of repositories non-admin organization members can create. Can be one of: + * \\* \`all\` - all organization members can create public and private repositories. + * \\* \`private\` - members can create private repositories. This option is only available to repositories that are part of an organization on GitHub Enterprise Cloud. + * \\* \`none\` - only admin members can create repositories. + * **Note:** This parameter is deprecated and will be removed in the future. Its return value ignores internal repositories. Using this parameter overrides values set in \`members_can_create_repositories\`. See the parameter deprecation notice in the operation description for details. + */ +export enum OrgsUpdateMembersAllowedRepositoryCreationTypeEnum { + All = "all", + Private = "private", + None = "none", +} + +export type OrgsUpdateMembershipForAuthenticatedUserData = OrgMembership; + +export interface OrgsUpdateMembershipForAuthenticatedUserPayload { + /** The state that the membership should be in. Only \`"active"\` will be accepted. */ + state: OrgsUpdateMembershipForAuthenticatedUserStateEnum; +} + +/** The state that the membership should be in. Only \`"active"\` will be accepted. */ +export enum OrgsUpdateMembershipForAuthenticatedUserStateEnum { + Active = "active", +} + +export interface OrgsUpdatePayload { + /** Billing email address. This address is not publicized. */ + billing_email?: string; + /** @example ""http://github.blog"" */ + blog?: string; + /** The company name. */ + company?: string; + /** + * Default permission level members have for organization repositories: + * \\* \`read\` - can pull, but not push to or administer this repository. + * \\* \`write\` - can pull and push, but not administer this repository. + * \\* \`admin\` - can pull, push, and administer this repository. + * \\* \`none\` - no permissions granted by default. + * @default "read" + */ + default_repository_permission?: OrgsUpdateDefaultRepositoryPermissionEnum; + /** The description of the company. */ + description?: string; + /** The publicly visible email address. */ + email?: string; + /** Toggles whether an organization can use organization projects. */ + has_organization_projects?: boolean; + /** Toggles whether repositories that belong to the organization can use repository projects. */ + has_repository_projects?: boolean; + /** The location. */ + location?: string; + /** + * Specifies which types of repositories non-admin organization members can create. Can be one of: + * \\* \`all\` - all organization members can create public and private repositories. + * \\* \`private\` - members can create private repositories. This option is only available to repositories that are part of an organization on GitHub Enterprise Cloud. + * \\* \`none\` - only admin members can create repositories. + * **Note:** This parameter is deprecated and will be removed in the future. Its return value ignores internal repositories. Using this parameter overrides values set in \`members_can_create_repositories\`. See the parameter deprecation notice in the operation description for details. + */ + members_allowed_repository_creation_type?: OrgsUpdateMembersAllowedRepositoryCreationTypeEnum; + /** + * Toggles whether organization members can create internal repositories, which are visible to all enterprise members. You can only allow members to create internal repositories if your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. Can be one of: + * \\* \`true\` - all organization members can create internal repositories. + * \\* \`false\` - only organization owners can create internal repositories. + * Default: \`true\`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation. + */ + members_can_create_internal_repositories?: boolean; + /** + * Toggles whether organization members can create GitHub Pages sites. Can be one of: + * \\* \`true\` - all organization members can create GitHub Pages sites. + * \\* \`false\` - no organization members can create GitHub Pages sites. Existing published sites will not be impacted. + * @default true + */ + members_can_create_pages?: boolean; + /** + * Toggles whether organization members can create private GitHub Pages sites. Can be one of: + * \\* \`true\` - all organization members can create private GitHub Pages sites. + * \\* \`false\` - no organization members can create private GitHub Pages sites. Existing published sites will not be impacted. + * @default true + */ + members_can_create_private_pages?: boolean; + /** + * Toggles whether organization members can create private repositories, which are visible to organization members with permission. Can be one of: + * \\* \`true\` - all organization members can create private repositories. + * \\* \`false\` - only organization owners can create private repositories. + * Default: \`true\`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation. + */ + members_can_create_private_repositories?: boolean; + /** + * Toggles whether organization members can create public GitHub Pages sites. Can be one of: + * \\* \`true\` - all organization members can create public GitHub Pages sites. + * \\* \`false\` - no organization members can create public GitHub Pages sites. Existing published sites will not be impacted. + * @default true + */ + members_can_create_public_pages?: boolean; + /** + * Toggles whether organization members can create public repositories, which are visible to anyone. Can be one of: + * \\* \`true\` - all organization members can create public repositories. + * \\* \`false\` - only organization owners can create public repositories. + * Default: \`true\`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation. + */ + members_can_create_public_repositories?: boolean; + /** + * Toggles the ability of non-admin organization members to create repositories. Can be one of: + * \\* \`true\` - all organization members can create repositories. + * \\* \`false\` - only organization owners can create repositories. + * Default: \`true\` + * **Note:** A parameter can override this parameter. See \`members_allowed_repository_creation_type\` in this table for details. **Note:** A parameter can override this parameter. See \`members_allowed_repository_creation_type\` in this table for details. + * @default true + */ + members_can_create_repositories?: boolean; + /** The shorthand name of the company. */ + name?: string; + /** The Twitter username of the company. */ + twitter_username?: string; +} + +export type OrgsUpdateWebhookConfigForOrgData = WebhookConfig; + +/** @example {"content_type":"json","insecure_ssl":"0","secret":"********","url":"https://example.com/webhook"} */ +export interface OrgsUpdateWebhookConfigForOrgPayload { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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; + /** 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; + /** The URL to which the payloads will be delivered. */ + url?: WebhookConfigUrl; +} + +export type OrgsUpdateWebhookData = OrgHook; + +export interface OrgsUpdateWebhookPayload { + /** + * Determines if notifications are sent when the webhook is triggered. Set to \`true\` to send notifications. + * @default true + */ + active?: boolean; + /** Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/orgs#update-hook-config-params). */ + config?: { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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; + /** 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; + /** The URL to which the payloads will be delivered. */ + url: WebhookConfigUrl; + }; + /** + * Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. + * @default ["push"] + */ + events?: string[]; + /** @example ""web"" */ + name?: string; +} + +export interface PackagesBillingUsage { + /** Free storage space (GB) for GitHub Packages. */ + included_gigabytes_bandwidth: number; + /** Sum of the free and paid storage space (GB) for GitHuub Packages. */ + total_gigabytes_bandwidth_used: number; + /** Total paid storage space (GB) for GitHuub Packages. */ + total_paid_gigabytes_bandwidth_used: number; +} + +/** + * GitHub Pages + * The configuration for GitHub Pages for a repository. + */ +export interface Page { + /** + * Whether the Page has a custom 404 page. + * @default false + * @example false + */ + custom_404: boolean; + /** + * The Pages site's custom domain + * @example "example.com" + */ + cname: string | null; + /** + * The web address the Page can be accessed from. + * @format uri + * @example "https://example.com" + */ + html_url?: string; + /** + * Whether the GitHub Pages site is publicly visible. If set to \`true\`, the site is accessible to anyone on the internet. If set to \`false\`, the site will only be accessible to users who have at least \`read\` access to the repository that published the site. + * @example true + */ + public: boolean; + source?: PagesSourceHash; + /** + * The status of the most recent build of the Page. + * @example "built" + */ + status: PageStatusEnum; + /** + * The API address for accessing this Page resource. + * @format uri + * @example "https://api.github.com/repos/github/hello-world/pages" + */ + url: string; +} + +/** + * Page Build + * Page Build + */ +export interface PageBuild { + commit: string; + /** @format date-time */ + created_at: string; + duration: number; + error: { + message: string | null; + }; + pusher: SimpleUser | null; + status: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; +} + +/** + * Page Build Status + * Page Build Status + */ +export interface PageBuildStatus { + /** @example "queued" */ + status: string; + /** + * @format uri + * @example "https://api.github.com/repos/github/hello-world/pages/builds/latest" + */ + url: string; +} + +/** + * The status of the most recent build of the Page. + * @example "built" + */ +export enum PageStatusEnum { + Built = "built", + Building = "building", + Errored = "errored", +} + +/** Pages Source Hash */ +export interface PagesSourceHash { + branch: string; + path: string; +} + +/** Participation Stats */ +export interface ParticipationStats { + all: number[]; + owner: number[]; +} + +/** + * Must be one of: \`day\`, \`week\`. + * @default "day" + */ +export enum PerEnum { + Day = "day", + Week = "week", +} + +/** + * Must be one of: \`day\`, \`week\`. + * @default "day" + */ +export enum PerEnum1 { + Day = "day", + Week = "week", +} + +/** + * Porter Author + * Porter Author + */ +export interface PorterAuthor { + email: string; + id: number; + /** @format uri */ + import_url: string; + name: string; + remote_id: string; + remote_name: string; + /** @format uri */ + url: string; +} + +/** + * Porter Large File + * Porter Large File + */ +export interface PorterLargeFile { + oid: string; + path: string; + ref_name: string; + size: number; +} + +/** Preview Header Missing */ +export interface PreviewHeaderMissing { + documentation_url: string; + message: string; +} + +/** + * Private User + * Private User + */ +export interface PrivateUser { + /** + * @format uri + * @example "https://github.com/images/error/octocat_happy.gif" + */ + avatar_url: string; + /** @example "There once was..." */ + bio: string | null; + /** @example "https://github.com/blog" */ + blog: string | null; + business_plus?: boolean; + /** @example 8 */ + collaborators: number; + /** @example "GitHub" */ + company: string | null; + /** + * @format date-time + * @example "2008-01-14T04:33:35Z" + */ + created_at: string; + /** @example 10000 */ + disk_usage: number; + /** + * @format email + * @example "octocat@github.com" + */ + email: string | null; + /** @example "https://api.github.com/users/octocat/events{/privacy}" */ + events_url: string; + /** @example 20 */ + followers: number; + /** + * @format uri + * @example "https://api.github.com/users/octocat/followers" + */ + followers_url: string; + /** @example 0 */ + following: number; + /** @example "https://api.github.com/users/octocat/following{/other_user}" */ + following_url: string; + /** @example "https://api.github.com/users/octocat/gists{/gist_id}" */ + gists_url: string; + /** @example "41d064eb2195891e12d0413f63227ea7" */ + gravatar_id: string | null; + hireable: boolean | null; + /** + * @format uri + * @example "https://github.com/octocat" + */ + html_url: string; + /** @example 1 */ + id: number; + ldap_dn?: string; + /** @example "San Francisco" */ + location: string | null; + /** @example "octocat" */ + login: string; + /** @example "monalisa octocat" */ + name: string | null; + /** @example "MDQ6VXNlcjE=" */ + node_id: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/orgs" + */ + organizations_url: string; + /** @example 100 */ + owned_private_repos: number; + plan?: { + collaborators: number; + name: string; + private_repos: number; + space: number; + }; + /** @example 81 */ + private_gists: number; + /** @example 1 */ + public_gists: number; + /** @example 2 */ + public_repos: number; + /** + * @format uri + * @example "https://api.github.com/users/octocat/received_events" + */ + received_events_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/repos" + */ + repos_url: string; + site_admin: boolean; + /** @example "https://api.github.com/users/octocat/starred{/owner}{/repo}" */ + starred_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/subscriptions" + */ + subscriptions_url: string; + /** @format date-time */ + suspended_at?: string | null; + /** @example 100 */ + total_private_repos: number; + /** @example "monalisa" */ + twitter_username?: string | null; + /** @example true */ + two_factor_authentication: boolean; + /** @example "User" */ + type: string; + /** + * @format date-time + * @example "2008-01-14T04:33:35Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat" + */ + url: string; +} + +/** + * Project + * Projects are a way to organize columns and cards of work. + */ +export interface Project { + /** + * Body of the project + * @example "This project represents the sprint of the first week in January" + */ + body: string | null; + /** + * @format uri + * @example "https://api.github.com/projects/1002604/columns" + */ + columns_url: string; + /** + * @format date-time + * @example "2011-04-10T20:09:31Z" + */ + created_at: string; + creator: SimpleUser | null; + /** + * @format uri + * @example "https://github.com/api-playground/projects-test/projects/12" + */ + html_url: string; + /** @example 1002604 */ + id: number; + /** + * Name of the project + * @example "Week One Sprint" + */ + name: string; + /** @example "MDc6UHJvamVjdDEwMDI2MDQ=" */ + node_id: string; + /** @example 1 */ + number: number; + /** The baseline permission that all organization members have on this project. Only present if owner is an organization. */ + organization_permission?: ProjectOrganizationPermissionEnum; + /** + * @format uri + * @example "https://api.github.com/repos/api-playground/projects-test" + */ + owner_url: string; + /** Whether or not this project can be seen by everyone. Only present if owner is an organization. */ + private?: boolean; + /** + * State of the project; either 'open' or 'closed' + * @example "open" + */ + state: string; + /** + * @format date-time + * @example "2014-03-03T18:58:10Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/projects/1002604" + */ + url: string; +} + +/** + * Project Card + * Project cards represent a scope of work. + */ +export interface ProjectCard { + /** + * Whether or not the card is archived + * @example false + */ + archived?: boolean; + /** + * @format uri + * @example "https://api.github.com/projects/columns/367" + */ + column_url: string; + /** + * @format uri + * @example "https://api.github.com/repos/api-playground/projects-test/issues/3" + */ + content_url?: string; + /** + * @format date-time + * @example "2016-09-05T14:21:06Z" + */ + created_at: string; + creator: SimpleUser | null; + /** + * The project card's ID + * @example 42 + */ + id: number; + /** @example "MDExOlByb2plY3RDYXJkMTQ3OA==" */ + node_id: string; + /** @example "Add payload for delete Project column" */ + note: string | null; + /** + * @format uri + * @example "https://api.github.com/projects/120" + */ + project_url: string; + /** + * @format date-time + * @example "2016-09-05T14:20:22Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/projects/columns/cards/1478" + */ + url: string; +} + +/** + * Project Column + * Project columns contain cards of work. + */ +export interface ProjectColumn { + /** + * @format uri + * @example "https://api.github.com/projects/columns/367/cards" + */ + cards_url: string; + /** + * @format date-time + * @example "2016-09-05T14:18:44Z" + */ + created_at: string; + /** + * The unique identifier of the project column + * @example 42 + */ + id: number; + /** + * Name of the project column + * @example "Remaining tasks" + */ + name: string; + /** @example "MDEzOlByb2plY3RDb2x1bW4zNjc=" */ + node_id: string; + /** + * @format uri + * @example "https://api.github.com/projects/120" + */ + project_url: string; + /** + * @format date-time + * @example "2016-09-05T14:22:28Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/projects/columns/367" + */ + url: string; +} + +/** The baseline permission that all organization members have on this project. Only present if owner is an organization. */ +export enum ProjectOrganizationPermissionEnum { + Read = "read", + Write = "write", + Admin = "admin", + None = "none", +} + +export type ProjectsAddCollaboratorData = any; + +export interface ProjectsAddCollaboratorPayload { + /** + * The permission to grant the collaborator. + * @default "write" + * @example "write" + */ + permission?: ProjectsAddCollaboratorPermissionEnum; +} + +/** + * The permission to grant the collaborator. + * @default "write" + * @example "write" + */ +export enum ProjectsAddCollaboratorPermissionEnum { + Read = "read", + Write = "write", + Admin = "admin", +} + +export type ProjectsCreateCardData = ProjectCard; + +export type ProjectsCreateCardError = + | (ValidationError | ValidationErrorSimple) + | { + code?: string; + documentation_url?: string; + errors?: { + code?: string; + message?: string; + }[]; + message?: string; + }; + +export type ProjectsCreateCardPayload = + | { + /** + * The project card's note + * @example "Update all gems" + */ + note: string | null; + } + | { + /** + * The unique identifier of the content associated with the card + * @example 42 + */ + content_id: number; + /** + * The piece of content associated with the card + * @example "PullRequest" + */ + content_type: string; + }; + +export type ProjectsCreateColumnData = ProjectColumn; + +export interface ProjectsCreateColumnPayload { + /** + * Name of the project column + * @example "Remaining tasks" + */ + name: string; +} + +export type ProjectsCreateForAuthenticatedUserData = Project; + +export interface ProjectsCreateForAuthenticatedUserPayload { + /** + * Body of the project + * @example "This project represents the sprint of the first week in January" + */ + body?: string | null; + /** + * Name of the project + * @example "Week One Sprint" + */ + name: string; +} + +export type ProjectsCreateForOrgData = Project; + +export interface ProjectsCreateForOrgPayload { + /** The description of the project. */ + body?: string; + /** The name of the project. */ + name: string; +} + +export type ProjectsCreateForRepoData = Project; + +export interface ProjectsCreateForRepoPayload { + /** The description of the project. */ + body?: string; + /** The name of the project. */ + name: string; +} + +export type ProjectsDeleteCardData = any; + +export type ProjectsDeleteCardError = { + documentation_url?: string; + errors?: string[]; + message?: string; +}; + +export type ProjectsDeleteColumnData = any; + +export type ProjectsDeleteData = any; + +export type ProjectsDeleteError = { + documentation_url?: string; + errors?: string[]; + message?: string; +}; + +export type ProjectsGetCardData = ProjectCard; + +export type ProjectsGetColumnData = ProjectColumn; + +export type ProjectsGetData = Project; + +export type ProjectsGetPermissionForUserData = RepositoryCollaboratorPermission; + +export type ProjectsListCardsData = ProjectCard[]; + +export interface ProjectsListCardsParams { + /** + * Filters the project cards that are returned by the card's state. Can be one of \`all\`,\`archived\`, or \`not_archived\`. + * @default "not_archived" + */ + archived_state?: ArchivedStateEnum; + /** column_id parameter */ + columnId: number; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +/** + * Filters the project cards that are returned by the card's state. Can be one of \`all\`,\`archived\`, or \`not_archived\`. + * @default "not_archived" + */ +export enum ProjectsListCardsParams1ArchivedStateEnum { + All = "all", + Archived = "archived", + NotArchived = "not_archived", +} + +export type ProjectsListCollaboratorsData = SimpleUser[]; + +export interface ProjectsListCollaboratorsParams { + /** + * Filters the collaborators by their affiliation. Can be one of: + * \\* \`outside\`: Outside collaborators of a project that are not a member of the project's organization. + * \\* \`direct\`: Collaborators with permissions to a project, regardless of organization membership status. + * \\* \`all\`: All collaborators the authenticated user can see. + * @default "all" + */ + affiliation?: AffiliationEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + projectId: number; +} + +/** + * Filters the collaborators by their affiliation. Can be one of: + * \\* \`outside\`: Outside collaborators of a project that are not a member of the project's organization. + * \\* \`direct\`: Collaborators with permissions to a project, regardless of organization membership status. + * \\* \`all\`: All collaborators the authenticated user can see. + * @default "all" + */ +export enum ProjectsListCollaboratorsParams1AffiliationEnum { + Outside = "outside", + Direct = "direct", + All = "all", +} + +export type ProjectsListColumnsData = ProjectColumn[]; + +export interface ProjectsListColumnsParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + projectId: number; +} + +export type ProjectsListForOrgData = Project[]; + +export interface ProjectsListForOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: StateEnum2; +} + +/** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum ProjectsListForOrgParams1StateEnum { + Open = "open", + Closed = "closed", + All = "all", +} + +export type ProjectsListForRepoData = Project[]; + +export interface ProjectsListForRepoParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: StateEnum5; +} + +/** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum ProjectsListForRepoParams1StateEnum { + Open = "open", + Closed = "closed", + All = "all", +} + +export type ProjectsListForUserData = Project[]; + +export interface ProjectsListForUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: StateEnum10; + username: string; +} + +/** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum ProjectsListForUserParams1StateEnum { + Open = "open", + Closed = "closed", + All = "all", +} + +export type ProjectsMoveCardData = object; + +export type ProjectsMoveCardError = + | { + documentation_url?: string; + errors?: { + code?: string; + field?: string; + message?: string; + resource?: string; + }[]; + message?: string; + } + | { + code?: string; + documentation_url?: string; + errors?: { + code?: string; + message?: string; + }[]; + message?: string; + }; + +export interface ProjectsMoveCardPayload { + /** + * The unique identifier of the column the card should be moved to + * @example 42 + */ + column_id?: number; + /** + * The position of the card in a column + * @pattern ^(?:top|bottom|after:\\d+)$ + * @example "bottom" + */ + position: string; +} + +export type ProjectsMoveColumnData = object; + +export interface ProjectsMoveColumnPayload { + /** + * The position of the column in a project + * @pattern ^(?:first|last|after:\\d+)$ + * @example "last" + */ + position: string; +} + +export type ProjectsRemoveCollaboratorData = any; + +export type ProjectsUpdateCardData = ProjectCard; + +export interface ProjectsUpdateCardPayload { + /** + * Whether or not the card is archived + * @example false + */ + archived?: boolean; + /** + * The project card's note + * @example "Update all gems" + */ + note?: string | null; +} + +export type ProjectsUpdateColumnData = ProjectColumn; + +export interface ProjectsUpdateColumnPayload { + /** + * Name of the project column + * @example "Remaining tasks" + */ + name: string; +} + +export type ProjectsUpdateData = Project; + +export type ProjectsUpdateError = { + documentation_url?: string; + errors?: string[]; + message?: string; +}; + +/** The baseline permission that all organization members have on this project */ +export enum ProjectsUpdateOrganizationPermissionEnum { + Read = "read", + Write = "write", + Admin = "admin", + None = "none", +} + +export interface ProjectsUpdatePayload { + /** + * Body of the project + * @example "This project represents the sprint of the first week in January" + */ + body?: string | null; + /** + * Name of the project + * @example "Week One Sprint" + */ + name?: string; + /** The baseline permission that all organization members have on this project */ + organization_permission?: ProjectsUpdateOrganizationPermissionEnum; + /** Whether or not this project can be seen by everyone. */ + private?: boolean; + /** + * State of the project; either 'open' or 'closed' + * @example "open" + */ + state?: string; +} + +/** + * Protected Branch + * Branch protections protect branches + */ +export interface ProtectedBranch { + allow_deletions?: { + enabled: boolean; + }; + allow_force_pushes?: { + enabled: boolean; + }; + enforce_admins?: { + enabled: boolean; + /** @format uri */ + url: string; + }; + required_linear_history?: { + enabled: boolean; + }; + required_pull_request_reviews?: { + dismiss_stale_reviews?: boolean; + dismissal_restrictions?: { + teams: Team[]; + /** @format uri */ + teams_url: string; + /** @format uri */ + url: string; + users: SimpleUser[]; + /** @format uri */ + users_url: string; + }; + 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; + }; + /** Status Check Policy */ + required_status_checks?: StatusCheckPolicy; + /** Branch Restriction Policy */ + restrictions?: BranchRestrictionPolicy; + /** @format uri */ + url: string; +} + +/** + * Protected Branch Admin Enforced + * Protected Branch Admin Enforced + */ +export interface ProtectedBranchAdminEnforced { + /** @example true */ + enabled: boolean; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/enforce_admins" + */ + url: string; +} + +/** + * Protected Branch Pull Request Review + * Protected Branch Pull Request Review + */ +export interface ProtectedBranchPullRequestReview { + /** @example true */ + dismiss_stale_reviews: boolean; + dismissal_restrictions?: { + /** 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 true */ + require_code_owner_reviews: boolean; + /** + * @min 1 + * @max 6 + * @example 2 + */ + required_approving_review_count?: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/dismissal_restrictions" + */ + url?: string; +} + +/** + * Public User + * Public User + */ +export interface PublicUser { + /** @format uri */ + avatar_url: string; + bio: string | null; + blog: string | null; + /** @example 3 */ + collaborators?: number; + company: string | null; + /** @format date-time */ + created_at: string; + /** @example 1 */ + disk_usage?: number; + /** @format email */ + email: string | null; + events_url: string; + followers: number; + /** @format uri */ + followers_url: string; + following: number; + following_url: string; + gists_url: string; + gravatar_id: string | null; + hireable: boolean | null; + /** @format uri */ + html_url: string; + id: number; + location: string | null; + login: string; + name: string | null; + node_id: string; + /** @format uri */ + organizations_url: string; + /** @example 2 */ + owned_private_repos?: number; + plan?: { + collaborators: number; + name: string; + private_repos: number; + space: number; + }; + /** @example 1 */ + private_gists?: number; + public_gists: number; + public_repos: number; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + /** @format date-time */ + suspended_at?: string | null; + /** @example 2 */ + total_private_repos?: number; + twitter_username?: string | null; + type: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; +} + +/** + * Pull Request + * Pull requests let you tell others about changes you've pushed to a repository on GitHub. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary. + */ +export interface PullRequest { + _links: { + /** Hypermedia Link */ + comments: Link; + /** Hypermedia Link */ + commits: Link; + /** Hypermedia Link */ + html: Link; + /** Hypermedia Link */ + issue: 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; + /** @example 100 */ + additions: number; + assignee: SimpleUser | null; + assignees?: SimpleUser[] | null; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** The status of auto merging a pull request. */ + auto_merge: AutoMerge; + base: { + 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; + compare_url: string; + 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; + 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; + events_url: string; + /** @format uri */ + followers_url: string; + following_url: string; + gists_url: string; + gravatar_id: string | null; + /** @format uri */ + html_url: string; + id: number; + login: string; + node_id: string; + /** @format uri */ + organizations_url: string; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + type: string; + /** @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; + /** @format uri */ + subscribers_url: string; + /** @format uri */ + subscription_url: string; + /** @format uri */ + svn_url: string; + /** @format uri */ + tags_url: string; + /** @format uri */ + teams_url: string; + temp_clone_token?: string; + topics?: string[]; + trees_url: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + watchers: number; + watchers_count: number; + }; + sha: string; + user: { + /** @format uri */ + avatar_url: string; + events_url: string; + /** @format uri */ + followers_url: string; + following_url: string; + gists_url: string; + gravatar_id: string | null; + /** @format uri */ + html_url: string; + id: number; + login: string; + node_id: string; + /** @format uri */ + organizations_url: string; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + type: string; + /** @format uri */ + url: string; + }; + }; + /** @example "Please pull these awesome changes" */ + body: string | null; + /** @example 5 */ + changed_files: number; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + closed_at: string | null; + /** @example 10 */ + comments: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments" + */ + comments_url: string; + /** @example 3 */ + commits: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits" + */ + commits_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at: string; + /** @example 3 */ + deletions: number; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347.diff" + */ + diff_url: string; + /** + * Indicates whether or not the pull request is a draft. + * @example false + */ + draft?: boolean; + head: { + 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; + compare_url: string; + 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; + 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; + events_url: string; + /** @format uri */ + followers_url: string; + following_url: string; + gists_url: string; + gravatar_id: string | null; + /** @format uri */ + html_url: string; + id: number; + login: string; + node_id: string; + /** @format uri */ + organizations_url: string; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + type: string; + /** @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; + /** @format uri */ + subscribers_url: string; + /** @format uri */ + subscription_url: string; + /** @format uri */ + svn_url: string; + /** @format uri */ + tags_url: string; + /** @format uri */ + teams_url: string; + temp_clone_token?: string; + topics?: string[]; + trees_url: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + watchers: number; + watchers_count: number; + }; + sha: string; + user: { + /** @format uri */ + avatar_url: string; + events_url: string; + /** @format uri */ + followers_url: string; + following_url: string; + gists_url: string; + gravatar_id: string | null; + /** @format uri */ + html_url: string; + id: number; + login: string; + node_id: string; + /** @format uri */ + organizations_url: string; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + type: string; + /** @format uri */ + url: string; + }; + }; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347" + */ + html_url: string; + /** @example 1 */ + id: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347" + */ + issue_url: string; + labels: { + color?: string; + default?: boolean; + description?: string | null; + id?: number; + name?: string; + node_id?: string; + url?: string; + }[]; + /** @example true */ + locked: boolean; + /** + * Indicates whether maintainers can modify the pull request. + * @example true + */ + maintainer_can_modify: boolean; + /** @example "e5bd3914e2e596debea16f433f57875b5b90bcd6" */ + merge_commit_sha: string | null; + /** @example true */ + mergeable: boolean | null; + /** @example "clean" */ + mergeable_state: string; + merged: boolean; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + merged_at: string | null; + merged_by: SimpleUser | null; + milestone: Milestone | null; + /** @example "MDExOlB1bGxSZXF1ZXN0MQ==" */ + node_id: string; + /** + * Number uniquely identifying the pull request within its repository. + * @example 42 + */ + number: number; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347.patch" + */ + patch_url: string; + /** @example true */ + rebaseable?: boolean | null; + requested_reviewers?: SimpleUser[] | null; + requested_teams?: TeamSimple[] | null; + /** @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}" */ + review_comment_url: string; + /** @example 0 */ + review_comments: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments" + */ + review_comments_url: string; + /** + * State of this Pull Request. Either \`open\` or \`closed\`. + * @example "open" + */ + state: PullRequestStateEnum; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + statuses_url: string; + /** + * The title of the pull request. + * @example "Amazing new feature" + */ + title: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Pull Request Merge Result + * Pull Request Merge Result + */ +export interface PullRequestMergeResult { + merged: boolean; + message: string; + sha: string; +} + +/** Pull Request Minimal */ +export interface PullRequestMinimal { + base: { + ref: string; + repo: { + id: number; + name: string; + url: string; + }; + sha: string; + }; + head: { + ref: string; + repo: { + id: number; + name: string; + url: string; + }; + sha: string; + }; + id: number; + number: number; + url: string; +} + +/** + * Pull Request Review + * Pull Request Reviews are reviews on pull requests. + */ +export interface PullRequestReview { + _links: { + html: { + href: string; + }; + pull_request: { + href: string; + }; + }; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** + * The text of the review. + * @example "This looks great." + */ + body: string; + body_html?: string; + body_text?: string; + /** + * A commit SHA for the review. + * @example "54bb654c9e6025347f57900a4a5c2313a96b8035" + */ + commit_id: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" + */ + html_url: string; + /** + * Unique identifier of the review + * @example 42 + */ + id: number; + /** @example "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=" */ + node_id: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/12" + */ + pull_request_url: string; + /** @example "CHANGES_REQUESTED" */ + state: string; + /** @format date-time */ + submitted_at?: string; + user: SimpleUser | null; +} + +/** + * Pull Request Review Comment + * Pull Request Review Comments are comments on a portion of the Pull Request's diff. + */ +export interface PullRequestReviewComment { + _links: { + html: { + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" + */ + href: string; + }; + pull_request: { + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" + */ + href: string; + }; + self: { + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" + */ + href: string; + }; + }; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** + * The text of the comment. + * @example "We should probably include a check for null values here." + */ + body: string; + /** @example ""

comment body

"" */ + body_html?: string; + /** @example ""comment body"" */ + body_text?: string; + /** + * The SHA of the commit to which the comment applies. + * @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + commit_id: string; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + created_at: string; + /** + * The diff of the line that the comment refers to. + * @example "@@ -16,33 +16,40 @@ public class Connection : IConnection..." + */ + diff_hunk: string; + /** + * HTML URL for the pull request review comment. + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" + */ + html_url: string; + /** + * The ID of the pull request review comment. + * @example 1 + */ + id: number; + /** + * The comment ID to reply to. + * @example 8 + */ + in_reply_to_id?: number; + /** + * The line of the blob to which the comment applies. The last line of the range for a multi-line comment + * @example 2 + */ + line?: number; + /** + * The node ID of the pull request review comment. + * @example "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw" + */ + node_id: string; + /** + * The SHA of the original commit to which the comment applies. + * @example "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840" + */ + original_commit_id: string; + /** + * The line of the blob to which the comment applies. The last line of the range for a multi-line comment + * @example 2 + */ + original_line?: number; + /** + * The index of the original line in the diff to which the comment applies. + * @example 4 + */ + original_position: number; + /** + * The first line of the range for a multi-line comment. + * @example 2 + */ + original_start_line?: number | null; + /** + * The relative path of the file to which the comment applies. + * @example "config/database.yaml" + */ + path: string; + /** + * The line index in the diff to which the comment applies. + * @example 1 + */ + position: number; + /** + * The ID of the pull request review to which the comment belongs. + * @example 42 + */ + pull_request_review_id: number | null; + /** + * URL for the pull request that the review comment belongs to. + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" + */ + pull_request_url: string; + reactions?: ReactionRollup; + /** + * The side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment + * @default "RIGHT" + */ + side?: PullRequestReviewCommentSideEnum; + /** + * The first line of the range for a multi-line comment. + * @example 2 + */ + start_line?: number | null; + /** + * The side of the first line of the range for a multi-line comment. + * @default "RIGHT" + */ + start_side?: PullRequestReviewCommentStartSideEnum; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + updated_at: string; + /** + * URL for the pull request review comment + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" + */ + url: string; + /** Simple User */ + user: SimpleUser; +} + +/** + * The side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment + * @default "RIGHT" + */ +export enum PullRequestReviewCommentSideEnum { + LEFT = "LEFT", + RIGHT = "RIGHT", +} + +/** + * The side of the first line of the range for a multi-line comment. + * @default "RIGHT" + */ +export enum PullRequestReviewCommentStartSideEnum { + LEFT = "LEFT", + RIGHT = "RIGHT", +} + +/** + * Pull Request Review Request + * Pull Request Review Request + */ +export interface PullRequestReviewRequest { + teams: TeamSimple[]; + users: SimpleUser[]; +} + +/** + * Pull Request Simple + * Pull Request Simple + */ +export interface PullRequestSimple { + _links: { + /** Hypermedia Link */ + comments: Link; + /** Hypermedia Link */ + commits: Link; + /** Hypermedia Link */ + html: Link; + /** Hypermedia Link */ + issue: 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; + assignee: SimpleUser | null; + assignees?: SimpleUser[] | null; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** The status of auto merging a pull request. */ + auto_merge: AutoMerge; + base: { + label: string; + ref: string; + /** A git repository */ + repo: Repository; + sha: string; + user: SimpleUser | null; + }; + /** @example "Please pull these awesome changes" */ + body: string | null; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + closed_at: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments" + */ + comments_url: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits" + */ + commits_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347.diff" + */ + diff_url: string; + /** + * Indicates whether or not the pull request is a draft. + * @example false + */ + draft?: boolean; + head: { + label: string; + ref: string; + /** A git repository */ + repo: Repository; + sha: string; + user: SimpleUser | null; + }; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347" + */ + html_url: string; + /** @example 1 */ + id: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347" + */ + issue_url: string; + labels: { + color?: string; + default?: boolean; + description?: string; + id?: number; + name?: string; + node_id?: string; + url?: string; + }[]; + /** @example true */ + locked: boolean; + /** @example "e5bd3914e2e596debea16f433f57875b5b90bcd6" */ + merge_commit_sha: string | null; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + merged_at: string | null; + milestone: Milestone | null; + /** @example "MDExOlB1bGxSZXF1ZXN0MQ==" */ + node_id: string; + /** @example 1347 */ + number: number; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347.patch" + */ + patch_url: string; + requested_reviewers?: SimpleUser[] | null; + requested_teams?: TeamSimple[] | null; + /** @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}" */ + review_comment_url: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments" + */ + review_comments_url: string; + /** @example "open" */ + state: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + statuses_url: string; + /** @example "new-feature" */ + title: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347" + */ + url: string; + user: SimpleUser | null; +} + +/** + * State of this Pull Request. Either \`open\` or \`closed\`. + * @example "open" + */ +export enum PullRequestStateEnum { + Open = "open", + Closed = "closed", +} + +export type PullsCheckIfMergedData = any; + +export type PullsCreateData = PullRequest; + +export interface PullsCreatePayload { + /** The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository. */ + base: string; + /** The contents of the pull request. */ + body?: string; + /** Indicates whether the pull request is a draft. See "[Draft Pull Requests](https://help.github.com/en/articles/about-pull-requests#draft-pull-requests)" in the GitHub Help documentation to learn more. */ + draft?: boolean; + /** The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace \`head\` with a user like this: \`username:branch\`. */ + head: string; + /** @example 1 */ + issue?: number; + /** Indicates whether [maintainers can modify](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) the pull request. */ + maintainer_can_modify?: boolean; + /** The title of the new pull request. */ + title?: string; +} + +export type PullsCreateReplyForReviewCommentData = PullRequestReviewComment; + +export interface PullsCreateReplyForReviewCommentPayload { + /** The text of the review comment. */ + body: string; +} + +export type PullsCreateReviewCommentData = PullRequestReviewComment; + +export interface PullsCreateReviewCommentPayload { + /** The text of the review comment. */ + body: string; + /** The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the \`position\`. */ + commit_id?: string; + /** @example 2 */ + in_reply_to?: number; + /** **Required with \`comfort-fade\` preview**. The line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to. */ + line?: number; + /** The relative path to the file that necessitates a comment. */ + path: string; + /** **Required without \`comfort-fade\` preview**. The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note above. */ + position?: number; + /** **Required with \`comfort-fade\` preview**. In a split diff view, the side of the diff that the pull request's changes appear on. Can be \`LEFT\` or \`RIGHT\`. Use \`LEFT\` for deletions that appear in red. Use \`RIGHT\` for additions that appear in green or unchanged lines that appear in white and are shown for context. For a multi-line comment, side represents whether the last line of the comment range is a deletion or addition. For more information, see "[Diff view options](https://help.github.com/en/articles/about-comparing-branches-in-pull-requests#diff-view-options)" in the GitHub Help documentation. */ + side?: PullsCreateReviewCommentSideEnum; + /** **Required when using multi-line comments**. To create multi-line comments, you must use the \`comfort-fade\` preview header. The \`start_line\` is the first line in the pull request diff that your multi-line comment applies to. To learn more about multi-line comments, see "[Commenting on a pull request](https://help.github.com/en/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)" in the GitHub Help documentation. */ + start_line?: number; + /** **Required when using multi-line comments**. To create multi-line comments, you must use the \`comfort-fade\` preview header. The \`start_side\` is the starting side of the diff that the comment applies to. Can be \`LEFT\` or \`RIGHT\`. To learn more about multi-line comments, see "[Commenting on a pull request](https://help.github.com/en/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)" in the GitHub Help documentation. See \`side\` in this table for additional context. */ + start_side?: PullsCreateReviewCommentStartSideEnum; +} + +/** **Required with \`comfort-fade\` preview**. In a split diff view, the side of the diff that the pull request's changes appear on. Can be \`LEFT\` or \`RIGHT\`. Use \`LEFT\` for deletions that appear in red. Use \`RIGHT\` for additions that appear in green or unchanged lines that appear in white and are shown for context. For a multi-line comment, side represents whether the last line of the comment range is a deletion or addition. For more information, see "[Diff view options](https://help.github.com/en/articles/about-comparing-branches-in-pull-requests#diff-view-options)" in the GitHub Help documentation. */ +export enum PullsCreateReviewCommentSideEnum { + LEFT = "LEFT", + RIGHT = "RIGHT", +} + +/** **Required when using multi-line comments**. To create multi-line comments, you must use the \`comfort-fade\` preview header. The \`start_side\` is the starting side of the diff that the comment applies to. Can be \`LEFT\` or \`RIGHT\`. To learn more about multi-line comments, see "[Commenting on a pull request](https://help.github.com/en/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)" in the GitHub Help documentation. See \`side\` in this table for additional context. */ +export enum PullsCreateReviewCommentStartSideEnum { + LEFT = "LEFT", + RIGHT = "RIGHT", + Side = "side", +} + +export type PullsCreateReviewData = PullRequestReview; + +/** The review action you want to perform. The review actions include: \`APPROVE\`, \`REQUEST_CHANGES\`, or \`COMMENT\`. By leaving this blank, you set the review action state to \`PENDING\`, which means you will need to [submit the pull request review](https://docs.github.com/rest/reference/pulls#submit-a-review-for-a-pull-request) when you are ready. */ +export enum PullsCreateReviewEventEnum { + APPROVE = "APPROVE", + REQUEST_CHANGES = "REQUEST_CHANGES", + COMMENT = "COMMENT", +} + +export interface PullsCreateReviewPayload { + /** **Required** when using \`REQUEST_CHANGES\` or \`COMMENT\` for the \`event\` parameter. The body text of the pull request review. */ + body?: string; + /** Use the following table to specify the location, destination, and contents of the draft review comment. */ + comments?: { + /** Text of the review comment. */ + body: string; + /** @example 28 */ + line?: number; + /** The relative path to the file that necessitates a review comment. */ + path: string; + /** The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note below. */ + position?: number; + /** @example "RIGHT" */ + side?: string; + /** @example 26 */ + start_line?: number; + /** @example "LEFT" */ + start_side?: string; + }[]; + /** The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment outdated if a subsequent commit modifies the line you specify as the \`position\`. Defaults to the most recent commit in the pull request when you do not specify a value. */ + commit_id?: string; + /** The review action you want to perform. The review actions include: \`APPROVE\`, \`REQUEST_CHANGES\`, or \`COMMENT\`. By leaving this blank, you set the review action state to \`PENDING\`, which means you will need to [submit the pull request review](https://docs.github.com/rest/reference/pulls#submit-a-review-for-a-pull-request) when you are ready. */ + event?: PullsCreateReviewEventEnum; +} + +export type PullsDeletePendingReviewData = PullRequestReview; + +export type PullsDeleteReviewCommentData = any; + +export type PullsDismissReviewData = PullRequestReview; + +export interface PullsDismissReviewPayload { + /** @example ""APPROVE"" */ + event?: string; + /** The message for the pull request review dismissal */ + message: string; +} + +export type PullsGetData = PullRequest; + +export type PullsGetReviewCommentData = PullRequestReviewComment; + +export type PullsGetReviewData = PullRequestReview; + +export type PullsListCommentsForReviewData = ReviewComment[]; + +export interface PullsListCommentsForReviewParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + pullNumber: number; + repo: string; + /** review_id parameter */ + reviewId: number; +} + +export type PullsListCommitsData = Commit[]; + +export interface PullsListCommitsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + pullNumber: number; + repo: string; +} + +export type PullsListData = PullRequestSimple[]; + +export type PullsListFilesData = DiffEntry[]; + +export interface PullsListFilesParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + pullNumber: number; + repo: string; +} + +export interface PullsListParams { + /** Filter pulls by base branch name. Example: \`gh-pages\`. */ + base?: string; + /** The direction of the sort. Can be either \`asc\` or \`desc\`. Default: \`desc\` when sort is \`created\` or sort is not specified, otherwise \`asc\`. */ + direction?: DirectionEnum10; + /** Filter pulls by head user or head organization and branch name in the format of \`user:ref-name\` or \`organization:ref-name\`. For example: \`github:new-script-format\` or \`octocat:test-branch\`. */ + head?: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`popularity\` (comment count) or \`long-running\` (age, filtering by pulls updated in the last month). + * @default "created" + */ + sort?: SortEnum9; + /** + * Either \`open\`, \`closed\`, or \`all\` to filter by state. + * @default "open" + */ + state?: StateEnum6; +} + +/** The direction of the sort. Can be either \`asc\` or \`desc\`. Default: \`desc\` when sort is \`created\` or sort is not specified, otherwise \`asc\`. */ +export enum PullsListParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * What to sort results by. Can be either \`created\`, \`updated\`, \`popularity\` (comment count) or \`long-running\` (age, filtering by pulls updated in the last month). + * @default "created" + */ +export enum PullsListParams1SortEnum { + Created = "created", + Updated = "updated", + Popularity = "popularity", + LongRunning = "long-running", +} + +/** + * Either \`open\`, \`closed\`, or \`all\` to filter by state. + * @default "open" + */ +export enum PullsListParams1StateEnum { + Open = "open", + Closed = "closed", + All = "all", +} + +export type PullsListRequestedReviewersData = PullRequestReviewRequest; + +export interface PullsListRequestedReviewersParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + pullNumber: number; + repo: string; +} + +export type PullsListReviewCommentsData = PullRequestReviewComment[]; + +export type PullsListReviewCommentsForRepoData = PullRequestReviewComment[]; + +export interface PullsListReviewCommentsForRepoParams { + /** Can be either \`asc\` or \`desc\`. Ignored without \`sort\` parameter. */ + direction?: DirectionEnum11; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: SortEnum10; +} + +/** Can be either \`asc\` or \`desc\`. Ignored without \`sort\` parameter. */ +export enum PullsListReviewCommentsForRepoParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum PullsListReviewCommentsForRepoParams1SortEnum { + Created = "created", + Updated = "updated", +} + +export interface PullsListReviewCommentsParams { + /** Can be either \`asc\` or \`desc\`. Ignored without \`sort\` parameter. */ + direction?: DirectionEnum12; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + pullNumber: number; + repo: string; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: SortEnum11; +} + +/** Can be either \`asc\` or \`desc\`. Ignored without \`sort\` parameter. */ +export enum PullsListReviewCommentsParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum PullsListReviewCommentsParams1SortEnum { + Created = "created", + Updated = "updated", +} + +export type PullsListReviewsData = PullRequestReview[]; + +export interface PullsListReviewsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + pullNumber: number; + repo: string; +} + +export type PullsMergeData = PullRequestMergeResult; + +export type PullsMergeError = { + documentation_url?: string; + message?: string; +}; + +/** Merge method to use. Possible values are \`merge\`, \`squash\` or \`rebase\`. Default is \`merge\`. */ +export enum PullsMergeMergeMethodEnum { + Merge = "merge", + Squash = "squash", + Rebase = "rebase", +} + +export type PullsMergePayload = { + /** Extra detail to append to automatic commit message. */ + commit_message?: string; + /** Title for the automatic commit message. */ + commit_title?: string; + /** Merge method to use. Possible values are \`merge\`, \`squash\` or \`rebase\`. Default is \`merge\`. */ + merge_method?: PullsMergeMergeMethodEnum; + /** SHA that pull request head must match to allow merge. */ + sha?: string; +} | null; + +export type PullsRemoveRequestedReviewersData = any; + +export interface PullsRemoveRequestedReviewersPayload { + /** An array of user \`login\`s that will be removed. */ + reviewers?: string[]; + /** An array of team \`slug\`s that will be removed. */ + team_reviewers?: string[]; +} + +export type PullsRequestReviewersData = PullRequestSimple; + +export interface PullsRequestReviewersPayload { + /** An array of user \`login\`s that will be requested. */ + reviewers?: string[]; + /** An array of team \`slug\`s that will be requested. */ + team_reviewers?: string[]; +} + +export type PullsSubmitReviewData = PullRequestReview; + +/** The review action you want to perform. The review actions include: \`APPROVE\`, \`REQUEST_CHANGES\`, or \`COMMENT\`. When you leave this blank, the API returns _HTTP 422 (Unrecognizable entity)_ and sets the review action state to \`PENDING\`, which means you will need to re-submit the pull request review using a review action. */ +export enum PullsSubmitReviewEventEnum { + APPROVE = "APPROVE", + REQUEST_CHANGES = "REQUEST_CHANGES", + COMMENT = "COMMENT", +} + +export interface PullsSubmitReviewPayload { + /** The body text of the pull request review */ + body?: string; + /** The review action you want to perform. The review actions include: \`APPROVE\`, \`REQUEST_CHANGES\`, or \`COMMENT\`. When you leave this blank, the API returns _HTTP 422 (Unrecognizable entity)_ and sets the review action state to \`PENDING\`, which means you will need to re-submit the pull request review using a review action. */ + event: PullsSubmitReviewEventEnum; +} + +export interface PullsUpdateBranchData { + message?: string; + url?: string; +} + +export type PullsUpdateBranchPayload = { + /** The expected SHA of the pull request's HEAD ref. This is the most recent commit on the pull request's branch. If the expected SHA does not match the pull request's HEAD, you will receive a \`422 Unprocessable Entity\` status. You can use the "[List commits](https://docs.github.com/rest/reference/repos#list-commits)" endpoint to find the most recent commit SHA. Default: SHA of the pull request's current HEAD ref. */ + expected_head_sha?: string; +} | null; + +export type PullsUpdateData = PullRequest; + +export interface PullsUpdatePayload { + /** The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository. */ + base?: string; + /** The contents of the pull request. */ + body?: string; + /** Indicates whether [maintainers can modify](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) the pull request. */ + maintainer_can_modify?: boolean; + /** State of this Pull Request. Either \`open\` or \`closed\`. */ + state?: PullsUpdateStateEnum; + /** The title of the pull request. */ + title?: string; +} + +export type PullsUpdateReviewCommentData = PullRequestReviewComment; + +export interface PullsUpdateReviewCommentPayload { + /** The text of the reply to the review comment. */ + body: string; +} + +export type PullsUpdateReviewData = PullRequestReview; + +export interface PullsUpdateReviewPayload { + /** The body text of the pull request review. */ + body: string; +} + +/** State of this Pull Request. Either \`open\` or \`closed\`. */ +export enum PullsUpdateStateEnum { + Open = "open", + Closed = "closed", +} + +/** Rate Limit */ +export interface RateLimit { + limit: number; + remaining: number; + reset: number; +} + +export type RateLimitGetData = RateLimitOverview; + +/** + * Rate Limit Overview + * Rate Limit Overview + */ +export interface RateLimitOverview { + rate: RateLimit; + resources: { + code_scanning_upload?: RateLimit; + core: RateLimit; + graphql?: RateLimit; + integration_manifest?: RateLimit; + search: RateLimit; + source_import?: RateLimit; + }; +} + +/** + * Reaction + * Reactions to conversations provide a way to help people express their feelings more simply and effectively. + */ +export interface Reaction { + /** + * The reaction to use + * @example "heart" + */ + content: ReactionContentEnum; + /** + * @format date-time + * @example "2016-05-20T20:09:31Z" + */ + created_at: string; + /** @example 1 */ + id: number; + /** @example "MDg6UmVhY3Rpb24x" */ + node_id: string; + user: SimpleUser | null; +} + +/** + * The reaction to use + * @example "heart" + */ +export enum ReactionContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +/** Reaction Rollup */ +export interface ReactionRollup { + "+1": number; + "-1": number; + confused: number; + eyes: number; + heart: number; + hooray: number; + laugh: number; + rocket: number; + total_count: number; + /** @format uri */ + url: string; +} + +/** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the commit comment. */ +export enum ReactionsCreateForCommitCommentContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsCreateForCommitCommentData = Reaction; + +export interface ReactionsCreateForCommitCommentPayload { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the commit comment. */ + content: ReactionsCreateForCommitCommentContentEnum; +} + +/** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the issue comment. */ +export enum ReactionsCreateForIssueCommentContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsCreateForIssueCommentData = Reaction; + +export interface ReactionsCreateForIssueCommentPayload { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the issue comment. */ + content: ReactionsCreateForIssueCommentContentEnum; +} + +/** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the issue. */ +export enum ReactionsCreateForIssueContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsCreateForIssueData = Reaction; + +export interface ReactionsCreateForIssuePayload { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the issue. */ + content: ReactionsCreateForIssueContentEnum; +} + +/** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the pull request review comment. */ +export enum ReactionsCreateForPullRequestReviewCommentContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsCreateForPullRequestReviewCommentData = Reaction; + +export interface ReactionsCreateForPullRequestReviewCommentPayload { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the pull request review comment. */ + content: ReactionsCreateForPullRequestReviewCommentContentEnum; +} + +/** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion comment. */ +export enum ReactionsCreateForTeamDiscussionCommentInOrgContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsCreateForTeamDiscussionCommentInOrgData = Reaction; + +export interface ReactionsCreateForTeamDiscussionCommentInOrgPayload { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion comment. */ + content: ReactionsCreateForTeamDiscussionCommentInOrgContentEnum; +} + +/** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion comment. */ +export enum ReactionsCreateForTeamDiscussionCommentLegacyContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsCreateForTeamDiscussionCommentLegacyData = Reaction; + +export interface ReactionsCreateForTeamDiscussionCommentLegacyPayload { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion comment. */ + content: ReactionsCreateForTeamDiscussionCommentLegacyContentEnum; +} + +/** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion. */ +export enum ReactionsCreateForTeamDiscussionInOrgContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsCreateForTeamDiscussionInOrgData = Reaction; + +export interface ReactionsCreateForTeamDiscussionInOrgPayload { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion. */ + content: ReactionsCreateForTeamDiscussionInOrgContentEnum; +} + +/** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion. */ +export enum ReactionsCreateForTeamDiscussionLegacyContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsCreateForTeamDiscussionLegacyData = Reaction; + +export interface ReactionsCreateForTeamDiscussionLegacyPayload { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion. */ + content: ReactionsCreateForTeamDiscussionLegacyContentEnum; +} + +export type ReactionsDeleteForCommitCommentData = any; + +export type ReactionsDeleteForIssueCommentData = any; + +export type ReactionsDeleteForIssueData = any; + +export type ReactionsDeleteForPullRequestCommentData = any; + +export type ReactionsDeleteForTeamDiscussionCommentData = any; + +export type ReactionsDeleteForTeamDiscussionData = any; + +export type ReactionsDeleteLegacyData = any; + +export type ReactionsListForCommitCommentData = Reaction[]; + +export interface ReactionsListForCommitCommentParams { + /** comment_id parameter */ + commentId: number; + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a commit comment. */ + content?: ContentEnum2; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a commit comment. */ +export enum ReactionsListForCommitCommentParams1ContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsListForIssueCommentData = Reaction[]; + +export interface ReactionsListForIssueCommentParams { + /** comment_id parameter */ + commentId: number; + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue comment. */ + content?: ContentEnum3; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue comment. */ +export enum ReactionsListForIssueCommentParams1ContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsListForIssueData = Reaction[]; + +export interface ReactionsListForIssueParams { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue. */ + content?: ContentEnum4; + /** issue_number parameter */ + issueNumber: number; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue. */ +export enum ReactionsListForIssueParams1ContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsListForPullRequestReviewCommentData = Reaction[]; + +export interface ReactionsListForPullRequestReviewCommentParams { + /** comment_id parameter */ + commentId: number; + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a pull request review comment. */ + content?: ContentEnum5; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a pull request review comment. */ +export enum ReactionsListForPullRequestReviewCommentParams1ContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsListForTeamDiscussionCommentInOrgData = Reaction[]; + +export interface ReactionsListForTeamDiscussionCommentInOrgParams { + commentNumber: number; + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ + content?: ContentEnum; + discussionNumber: number; + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** team_slug parameter */ + teamSlug: string; +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ +export enum ReactionsListForTeamDiscussionCommentInOrgParams1ContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsListForTeamDiscussionCommentLegacyData = Reaction[]; + +export interface ReactionsListForTeamDiscussionCommentLegacyParams { + commentNumber: number; + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ + content?: ContentEnum6; + discussionNumber: number; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + teamId: number; +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ +export enum ReactionsListForTeamDiscussionCommentLegacyParams1ContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsListForTeamDiscussionInOrgData = Reaction[]; + +export interface ReactionsListForTeamDiscussionInOrgParams { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ + content?: ContentEnum1; + discussionNumber: number; + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** team_slug parameter */ + teamSlug: string; +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ +export enum ReactionsListForTeamDiscussionInOrgParams1ContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +export type ReactionsListForTeamDiscussionLegacyData = Reaction[]; + +export interface ReactionsListForTeamDiscussionLegacyParams { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ + content?: ContentEnum7; + discussionNumber: number; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + teamId: number; +} + +/** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ +export enum ReactionsListForTeamDiscussionLegacyParams1ContentEnum { + Value1 = "+1", + Value11 = "-1", + Laugh = "laugh", + Confused = "confused", + Heart = "heart", + Hooray = "hooray", + Rocket = "rocket", + Eyes = "eyes", +} + +/** + * Referrer Traffic + * Referrer Traffic + */ +export interface ReferrerTraffic { + /** @example 4 */ + count: number; + /** @example "Google" */ + referrer: string; + /** @example 3 */ + uniques: number; +} + +/** + * Release + * A release. + */ +export interface Release { + assets: ReleaseAsset[]; + /** @format uri */ + assets_url: string; + /** Simple User */ + author: SimpleUser; + body?: string | null; + body_html?: string; + body_text?: string; + /** @format date-time */ + created_at: string; + /** + * true to create a draft (unpublished) release, false to create a published one. + * @example false + */ + draft: boolean; + /** @format uri */ + html_url: string; + id: number; + name: string | null; + node_id: string; + /** + * Whether to identify the release as a prerelease or a full release. + * @example false + */ + prerelease: boolean; + /** @format date-time */ + published_at: string | null; + /** + * The name of the tag. + * @example "v1.0.0" + */ + tag_name: string; + /** @format uri */ + tarball_url: string | null; + /** + * Specifies the commitish value that determines where the Git tag is created from. + * @example "master" + */ + target_commitish: string; + upload_url: string; + /** @format uri */ + url: string; + /** @format uri */ + zipball_url: string | null; +} + +/** + * Release Asset + * Data related to a release. + */ +export interface ReleaseAsset { + /** @format uri */ + browser_download_url: string; + content_type: string; + /** @format date-time */ + created_at: string; + download_count: number; + id: number; + label: string | null; + /** + * The file name of the asset. + * @example "Team Environment" + */ + name: string; + node_id: string; + size: number; + /** State of the release asset. */ + state: ReleaseAssetStateEnum; + /** @format date-time */ + updated_at: string; + uploader: SimpleUser | null; + /** @format uri */ + url: string; +} + +/** State of the release asset. */ +export enum ReleaseAssetStateEnum { + Uploaded = "uploaded", + Open = "open", +} + +/** + * Repo Search Result Item + * Repo Search Result Item + */ +export interface RepoSearchResultItem { + 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; + /** @format uri */ + contributors_url: string; + /** @format date-time */ + created_at: string; + default_branch: string; + delete_branch_on_merge?: boolean; + /** @format uri */ + deployments_url: string; + description: string | null; + /** Returns whether or not this repository disabled. */ + 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; + 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: SimpleUser | null; + permissions?: { + admin: boolean; + pull: boolean; + push: boolean; + }; + private: boolean; + pulls_url: string; + /** @format date-time */ + pushed_at: string; + releases_url: string; + score: number; + size: number; + ssh_url: string; + stargazers_count: number; + /** @format uri */ + stargazers_url: string; + statuses_url: string; + /** @format uri */ + subscribers_url: string; + /** @format uri */ + subscription_url: string; + /** @format uri */ + svn_url: string; + /** @format uri */ + tags_url: string; + /** @format uri */ + teams_url: string; + temp_clone_token?: string; + text_matches?: SearchResultTextMatches; + topics?: string[]; + trees_url: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + watchers: number; + watchers_count: number; +} + +export type ReposAcceptInvitationData = any; + +export type ReposAddAppAccessRestrictionsData = Integration[]; + +/** @example {"apps":["my-app"]} */ +export interface ReposAddAppAccessRestrictionsPayload { + /** apps parameter */ + apps: string[]; +} + +export type ReposAddCollaboratorData = RepositoryInvitation; + +export interface ReposAddCollaboratorPayload { + /** + * The permission to grant the collaborator. **Only valid on organization-owned repositories.** Can be one of: + * \\* \`pull\` - can pull, but not push to or administer this repository. + * \\* \`push\` - can pull and push, but not administer this repository. + * \\* \`admin\` - can pull, push and administer this repository. + * \\* \`maintain\` - Recommended for project managers who need to manage the repository without access to sensitive or destructive actions. + * \\* \`triage\` - Recommended for contributors who need to proactively manage issues and pull requests without write access. + * @default "push" + */ + permission?: ReposAddCollaboratorPermissionEnum; + /** @example ""push"" */ + permissions?: string; +} + +/** + * The permission to grant the collaborator. **Only valid on organization-owned repositories.** Can be one of: + * \\* \`pull\` - can pull, but not push to or administer this repository. + * \\* \`push\` - can pull and push, but not administer this repository. + * \\* \`admin\` - can pull, push and administer this repository. + * \\* \`maintain\` - Recommended for project managers who need to manage the repository without access to sensitive or destructive actions. + * \\* \`triage\` - Recommended for contributors who need to proactively manage issues and pull requests without write access. + * @default "push" + */ +export enum ReposAddCollaboratorPermissionEnum { + Pull = "pull", + Push = "push", + Admin = "admin", + Maintain = "maintain", + Triage = "triage", +} + +export type ReposAddStatusCheckContextsData = string[]; + +/** @example {"contexts":["contexts"]} */ +export interface ReposAddStatusCheckContextsPayload { + /** contexts parameter */ + contexts: string[]; +} + +export type ReposAddTeamAccessRestrictionsData = Team[]; + +/** @example {"teams":["my-team"]} */ +export interface ReposAddTeamAccessRestrictionsPayload { + /** teams parameter */ + teams: string[]; +} + +export type ReposAddUserAccessRestrictionsData = SimpleUser[]; + +/** @example {"users":["mona"]} */ +export interface ReposAddUserAccessRestrictionsPayload { + /** users parameter */ + users: string[]; +} + +export type ReposCheckCollaboratorData = any; + +export type ReposCheckVulnerabilityAlertsData = any; + +export type ReposCompareCommitsData = CommitComparison; + +export type ReposCreateCommitCommentData = CommitComment; + +export interface ReposCreateCommitCommentPayload { + /** The contents of the comment. */ + body: string; + /** **Deprecated**. Use **position** parameter instead. Line number in the file to comment on. */ + line?: number; + /** Relative path of the file to comment on. */ + path?: string; + /** Line index in the diff to comment on. */ + position?: number; +} + +export type ReposCreateCommitSignatureProtectionData = ProtectedBranchAdminEnforced; + +export type ReposCreateCommitStatusData = Status; + +export interface ReposCreateCommitStatusPayload { + /** + * A string label to differentiate this status from the status of other systems. This field is case-insensitive. + * @default "default" + */ + context?: string; + /** A short description of the status. */ + description?: string; + /** The state of the status. Can be one of \`error\`, \`failure\`, \`pending\`, or \`success\`. */ + state: ReposCreateCommitStatusStateEnum; + /** + * The target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the source of the status. + * For example, if your continuous integration system is posting build status, you would want to provide the deep link for the build output for this specific SHA: + * \`http://ci.example.com/user/repo/build/sha\` + */ + target_url?: string; +} + +/** The state of the status. Can be one of \`error\`, \`failure\`, \`pending\`, or \`success\`. */ +export enum ReposCreateCommitStatusStateEnum { + Error = "error", + Failure = "failure", + Pending = "pending", + Success = "success", +} + +export type ReposCreateDeployKeyData = DeployKey; + +export interface ReposCreateDeployKeyPayload { + /** The contents of the key. */ + key: string; + /** + * If \`true\`, the key will only be able to read repository contents. Otherwise, the key will be able to read and write. + * + * Deploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see "[Repository permission levels for an organization](https://help.github.com/articles/repository-permission-levels-for-an-organization/)" and "[Permission levels for a user account repository](https://help.github.com/articles/permission-levels-for-a-user-account-repository/)." + */ + read_only?: boolean; + /** A name for the key. */ + title?: string; +} + +export type ReposCreateDeploymentData = Deployment; + +export type ReposCreateDeploymentError = { + /** @example ""https://docs.github.com/rest/reference/repos#create-a-deployment"" */ + documentation_url?: string; + message?: string; +}; + +export interface ReposCreateDeploymentPayload { + /** + * Attempts to automatically merge the default branch into the requested ref, if it's behind the default branch. + * @default true + */ + 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; + /** + * 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; + /** 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; +} + +export type ReposCreateDeploymentStatusData = DeploymentStatus; + +/** Name for the target deployment environment, which can be changed when setting a deploy status. For example, \`production\`, \`staging\`, or \`qa\`. **Note:** This parameter requires you to use the [\`application/vnd.github.flash-preview+json\`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) custom media type. */ +export enum ReposCreateDeploymentStatusEnvironmentEnum { + Production = "production", + Staging = "staging", + Qa = "qa", +} + +export interface ReposCreateDeploymentStatusPayload { + /** + * Adds a new \`inactive\` status to all prior non-transient, non-production environment deployments with the same repository and \`environment\` name as the created status's deployment. An \`inactive\` status is only added to deployments that had a \`success\` state. Default: \`true\` + * **Note:** To add an \`inactive\` status to \`production\` environments, you must use the [\`application/vnd.github.flash-preview+json\`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) 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. + */ + auto_inactive?: boolean; + /** + * A short description of the status. The maximum description length is 140 characters. + * @default "" + */ + description?: string; + /** Name for the target deployment environment, which can be changed when setting a deploy status. For example, \`production\`, \`staging\`, or \`qa\`. **Note:** This parameter requires you to use the [\`application/vnd.github.flash-preview+json\`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) custom media type. */ + environment?: ReposCreateDeploymentStatusEnvironmentEnum; + /** + * Sets the URL for accessing your environment. Default: \`""\` + * **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 "" + */ + environment_url?: string; + /** + * The full URL of the deployment's output. This parameter replaces \`target_url\`. We will continue to accept \`target_url\` to support legacy uses, but we recommend replacing \`target_url\` with \`log_url\`. Setting \`log_url\` will automatically set \`target_url\` to the same value. Default: \`""\` + * **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 "" + */ + log_url?: string; + /** The state of the status. Can be one of \`error\`, \`failure\`, \`inactive\`, \`in_progress\`, \`queued\` \`pending\`, or \`success\`. **Note:** To use the \`inactive\` state, you must provide the [\`application/vnd.github.ant-man-preview+json\`](https://docs.github.com/rest/overview/api-previews#enhanced-deployments) custom media type. To use the \`in_progress\` and \`queued\` states, you must provide the [\`application/vnd.github.flash-preview+json\`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) custom media type. When you set a transient deployment to \`inactive\`, the deployment will be shown as \`destroyed\` in GitHub. */ + state: ReposCreateDeploymentStatusStateEnum; + /** + * The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. **Note:** It's recommended to use the \`log_url\` parameter, which replaces \`target_url\`. + * @default "" + */ + target_url?: string; +} + +/** The state of the status. Can be one of \`error\`, \`failure\`, \`inactive\`, \`in_progress\`, \`queued\` \`pending\`, or \`success\`. **Note:** To use the \`inactive\` state, you must provide the [\`application/vnd.github.ant-man-preview+json\`](https://docs.github.com/rest/overview/api-previews#enhanced-deployments) custom media type. To use the \`in_progress\` and \`queued\` states, you must provide the [\`application/vnd.github.flash-preview+json\`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) custom media type. When you set a transient deployment to \`inactive\`, the deployment will be shown as \`destroyed\` in GitHub. */ +export enum ReposCreateDeploymentStatusStateEnum { + Error = "error", + Failure = "failure", + Inactive = "inactive", + InProgress = "in_progress", + Queued = "queued", + Pending = "pending", + Success = "success", +} + +export type ReposCreateDispatchEventData = any; + +export interface ReposCreateDispatchEventPayload { + /** JSON payload with extra information about the webhook event that your action or worklow may use. */ + client_payload?: Record; + /** A custom webhook event name. */ + event_type: string; +} + +export type ReposCreateForAuthenticatedUserData = Repository; + +export interface ReposCreateForAuthenticatedUserPayload { + /** + * Whether to allow merge commits for pull requests. + * @default true + * @example true + */ + allow_merge_commit?: boolean; + /** + * Whether to allow rebase merges for pull requests. + * @default true + * @example true + */ + allow_rebase_merge?: boolean; + /** + * Whether to allow squash merges for pull requests. + * @default true + * @example true + */ + allow_squash_merge?: boolean; + /** + * Whether the repository is initialized with a minimal README. + * @default false + */ + auto_init?: boolean; + /** + * Whether to delete head branches when pull requests are merged + * @default false + * @example false + */ + delete_branch_on_merge?: boolean; + /** A short description of the repository. */ + description?: string; + /** + * The desired language or platform to apply to the .gitignore. + * @example "Haskell" + */ + gitignore_template?: string; + /** + * Whether downloads are enabled. + * @default true + * @example true + */ + has_downloads?: boolean; + /** + * Whether issues are enabled. + * @default true + * @example true + */ + has_issues?: boolean; + /** + * Whether projects are enabled. + * @default true + * @example true + */ + has_projects?: boolean; + /** + * Whether the wiki is enabled. + * @default true + * @example true + */ + has_wiki?: boolean; + /** A URL with more information about the repository. */ + homepage?: string; + /** + * Whether this repository acts as a template that can be used to generate new repositories. + * @default false + * @example true + */ + is_template?: boolean; + /** + * The license keyword of the open source license for this repository. + * @example "mit" + */ + license_template?: string; + /** + * The name of the repository. + * @example "Team Environment" + */ + name: string; + /** + * Whether the repository is private or public. + * @default false + */ + private?: boolean; + /** The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization. */ + team_id?: number; +} + +export type ReposCreateForkData = Repository; + +export interface ReposCreateForkPayload { + /** Optional parameter to specify the organization name if forking into an organization. */ + organization?: string; +} + +export type ReposCreateInOrgData = Repository; + +export interface ReposCreateInOrgPayload { + /** + * Either \`true\` to allow merging pull requests with a merge commit, or \`false\` to prevent merging pull requests with merge commits. + * @default true + */ + allow_merge_commit?: boolean; + /** + * Either \`true\` to allow rebase-merging pull requests, or \`false\` to prevent rebase-merging. + * @default true + */ + allow_rebase_merge?: boolean; + /** + * Either \`true\` to allow squash-merging pull requests, or \`false\` to prevent squash-merging. + * @default true + */ + allow_squash_merge?: boolean; + /** + * Pass \`true\` to create an initial commit with empty README. + * @default false + */ + auto_init?: boolean; + /** + * Either \`true\` to allow automatically deleting head branches when pull requests are merged, or \`false\` to prevent automatic deletion. + * @default false + */ + delete_branch_on_merge?: boolean; + /** A short description of the repository. */ + description?: string; + /** Desired language or platform [.gitignore template](https://github.com/github/gitignore) to apply. Use the name of the template without the extension. For example, "Haskell". */ + gitignore_template?: string; + /** + * Either \`true\` to enable issues for this repository or \`false\` to disable them. + * @default true + */ + has_issues?: boolean; + /** + * Either \`true\` to enable projects for this repository or \`false\` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is \`false\`, and if you pass \`true\`, the API returns an error. + * @default true + */ + has_projects?: boolean; + /** + * Either \`true\` to enable the wiki for this repository or \`false\` to disable it. + * @default true + */ + has_wiki?: boolean; + /** A URL with more information about the repository. */ + homepage?: string; + /** + * Either \`true\` to make this repo available as a template repository or \`false\` to prevent it. + * @default false + */ + is_template?: boolean; + /** Choose an [open source license template](https://choosealicense.com/) that best suits your needs, and then use the [license keyword](https://help.github.com/articles/licensing-a-repository/#searching-github-by-license-type) as the \`license_template\` string. For example, "mit" or "mpl-2.0". */ + license_template?: string; + /** The name of the repository. */ + name: string; + /** + * Either \`true\` to create a private repository or \`false\` to create a public one. + * @default false + */ + private?: boolean; + /** The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization. */ + team_id?: number; + /** + * Can be \`public\` or \`private\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`visibility\` can also be \`internal\`. For more information, see "[Creating an internal repository](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-repository-visibility#about-internal-repositories)" in the GitHub Help documentation. + * The \`visibility\` parameter overrides the \`private\` parameter when you use both parameters with the \`nebula-preview\` preview header. + */ + visibility?: ReposCreateInOrgVisibilityEnum; +} + +/** + * Can be \`public\` or \`private\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`visibility\` can also be \`internal\`. For more information, see "[Creating an internal repository](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-repository-visibility#about-internal-repositories)" in the GitHub Help documentation. + * The \`visibility\` parameter overrides the \`private\` parameter when you use both parameters with the \`nebula-preview\` preview header. + */ +export enum ReposCreateInOrgVisibilityEnum { + Public = "public", + Private = "private", + Visibility = "visibility", + Internal = "internal", +} + +export type ReposCreateOrUpdateFileContentsData = FileCommit; + +export interface ReposCreateOrUpdateFileContentsPayload { + /** The author of the file. Default: The \`committer\` or the authenticated user if you omit \`committer\`. */ + author?: { + /** @example ""2013-01-15T17:13:22+05:00"" */ + date?: string; + /** The email of the author or committer of the commit. You'll receive a \`422\` status code if \`email\` is omitted. */ + email: string; + /** The name of the author or committer of the commit. You'll receive a \`422\` status code if \`name\` is omitted. */ + name: string; + }; + /** The branch name. Default: the repository’s default branch (usually \`master\`) */ + branch?: string; + /** The person that committed the file. Default: the authenticated user. */ + committer?: { + /** @example ""2013-01-05T13:13:22+05:00"" */ + date?: string; + /** The email of the author or committer of the commit. You'll receive a \`422\` status code if \`email\` is omitted. */ + email: string; + /** The name of the author or committer of the commit. You'll receive a \`422\` status code if \`name\` is omitted. */ + name: string; + }; + /** The new file content, using Base64 encoding. */ + content: string; + /** The commit message. */ + message: string; + /** **Required if you are updating a file**. The blob SHA of the file being replaced. */ + sha?: string; +} + +export type ReposCreatePagesSiteData = Page; + +/** + * The repository directory that includes the source files for the Pages site. Allowed paths are \`/\` or \`/docs\`. Default: \`/\` + * @default "/" + */ +export enum ReposCreatePagesSitePathEnum { + Value = "/", + ValueDocs = "/docs", +} + +/** The source branch and directory used to publish your Pages site. */ +export interface ReposCreatePagesSitePayload { + /** The source branch and directory used to publish your Pages site. */ + source: { + /** The repository branch used to publish your site's source files. */ + branch: string; + /** + * The repository directory that includes the source files for the Pages site. Allowed paths are \`/\` or \`/docs\`. Default: \`/\` + * @default "/" + */ + path?: ReposCreatePagesSitePathEnum; + }; +} + +export type ReposCreateReleaseData = Release; + +export interface ReposCreateReleasePayload { + /** Text describing the contents of the tag. */ + body?: string; + /** + * \`true\` to create a draft (unpublished) release, \`false\` to create a published one. + * @default false + */ + draft?: boolean; + /** The name of the release. */ + name?: string; + /** + * \`true\` to identify the release as a prerelease. \`false\` to identify the release as a full release. + * @default false + */ + prerelease?: boolean; + /** The name of the tag. */ + tag_name: string; + /** Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually \`master\`). */ + target_commitish?: string; +} + +export type ReposCreateUsingTemplateData = Repository; + +export interface ReposCreateUsingTemplatePayload { + /** A short description of the new repository. */ + description?: string; + /** + * Set to \`true\` to include the directory structure and files from all branches in the template repository, and not just the default branch. Default: \`false\`. + * @default false + */ + include_all_branches?: boolean; + /** The name of the new repository. */ + name: string; + /** The organization or person who will own the new repository. To create a new repository in an organization, the authenticated user must be a member of the specified organization. */ + owner?: string; + /** + * Either \`true\` to create a new private repository or \`false\` to create a new public one. + * @default false + */ + private?: boolean; +} + +export type ReposCreateWebhookData = Hook; + +export interface ReposCreateWebhookPayload { + /** + * Determines if notifications are sent when the webhook is triggered. Set to \`true\` to send notifications. + * @default true + */ + active?: boolean; + /** Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/repos#create-hook-config-params). */ + 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; + /** 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; + /** 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 ""abc"" */ + token?: string; + /** The URL to which the payloads will be delivered. */ + url: WebhookConfigUrl; + }; + /** + * Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. + * @default ["push"] + */ + events?: string[]; + /** Use \`web\` to create a webhook. Default: \`web\`. This parameter only accepts the value \`web\`. */ + name?: string; +} + +export type ReposDeclineInvitationData = any; + +export type ReposDeleteAccessRestrictionsData = any; + +export type ReposDeleteAdminBranchProtectionData = any; + +export type ReposDeleteBranchProtectionData = any; + +export type ReposDeleteCommitCommentData = any; + +export type ReposDeleteCommitSignatureProtectionData = any; + +export type ReposDeleteData = any; + +export type ReposDeleteDeployKeyData = any; + +export type ReposDeleteDeploymentData = any; + +export type ReposDeleteError = { + documentation_url?: string; + message?: string; +}; + +export type ReposDeleteFileData = FileCommit; + +export interface ReposDeleteFilePayload { + /** object containing information about the author. */ + author?: { + /** The email of the author (or committer) of the commit */ + email?: string; + /** The name of the author (or committer) of the commit */ + name?: string; + }; + /** The branch name. Default: the repository’s default branch (usually \`master\`) */ + branch?: string; + /** object containing information about the committer. */ + committer?: { + /** The email of the author (or committer) of the commit */ + email?: string; + /** The name of the author (or committer) of the commit */ + name?: string; + }; + /** The commit message. */ + message: string; + /** The blob SHA of the file being replaced. */ + sha: string; +} + +export type ReposDeleteInvitationData = any; + +export type ReposDeletePagesSiteData = any; + +export type ReposDeletePullRequestReviewProtectionData = any; + +export type ReposDeleteReleaseAssetData = any; + +export type ReposDeleteReleaseData = any; + +export type ReposDeleteWebhookData = any; + +export type ReposDisableAutomatedSecurityFixesData = any; + +export type ReposDisableVulnerabilityAlertsData = any; + +export type ReposEnableAutomatedSecurityFixesData = any; + +export type ReposEnableVulnerabilityAlertsData = any; + +export type ReposGetAccessRestrictionsData = BranchRestrictionPolicy; + +export type ReposGetAdminBranchProtectionData = ProtectedBranchAdminEnforced; + +export type ReposGetAllStatusCheckContextsData = string[]; + +export type ReposGetAllTopicsData = Topic; + +export type ReposGetAppsWithAccessToProtectedBranchData = Integration[]; + +export type ReposGetBranchData = BranchWithProtection; + +export type ReposGetBranchProtectionData = BranchProtection; + +export type ReposGetClonesData = CloneTraffic; + +export interface ReposGetClonesParams { + owner: string; + /** + * Must be one of: \`day\`, \`week\`. + * @default "day" + */ + per?: PerEnum; + repo: string; +} + +/** + * Must be one of: \`day\`, \`week\`. + * @default "day" + */ +export enum ReposGetClonesParams1PerEnum { + Day = "day", + Week = "week", +} + +export type ReposGetCodeFrequencyStatsData = CodeFrequencyStat[]; + +export type ReposGetCollaboratorPermissionLevelData = RepositoryCollaboratorPermission; + +export type ReposGetCombinedStatusForRefData = CombinedCommitStatus; + +export type ReposGetCommitActivityStatsData = CommitActivity[]; + +export type ReposGetCommitCommentData = CommitComment; + +export type ReposGetCommitData = Commit; + +export type ReposGetCommitSignatureProtectionData = ProtectedBranchAdminEnforced; + +export type ReposGetCommunityProfileMetricsData = CommunityProfile; + +export type ReposGetContentData = ContentTree; + +export interface ReposGetContentParams { + owner: string; + /** path+ parameter */ + path: string; + /** The name of the commit/branch/tag. Default: the repository’s default branch (usually \`master\`) */ + ref?: string; + repo: string; +} + +export type ReposGetContributorsStatsData = ContributorActivity[]; + +export type ReposGetData = FullRepository; + +export type ReposGetDeployKeyData = DeployKey; + +export type ReposGetDeploymentData = Deployment; + +export type ReposGetDeploymentStatusData = DeploymentStatus; + +export type ReposGetLatestPagesBuildData = PageBuild; + +export type ReposGetLatestReleaseData = Release; + +export type ReposGetPagesBuildData = PageBuild; + +export type ReposGetPagesData = Page; + +export type ReposGetParticipationStatsData = ParticipationStats; + +export type ReposGetPullRequestReviewProtectionData = ProtectedBranchPullRequestReview; + +export type ReposGetPunchCardStatsData = CodeFrequencyStat[]; + +export type ReposGetReadmeData = ContentFile; + +export interface ReposGetReadmeParams { + owner: string; + /** The name of the commit/branch/tag. Default: the repository’s default branch (usually \`master\`) */ + ref?: string; + repo: string; +} + +export type ReposGetReleaseAssetData = ReleaseAsset; + +export type ReposGetReleaseByTagData = Release; + +export type ReposGetReleaseData = Release; + +export type ReposGetStatusChecksProtectionData = StatusCheckPolicy; + +export type ReposGetTeamsWithAccessToProtectedBranchData = Team[]; + +export type ReposGetTopPathsData = ContentTraffic[]; + +export type ReposGetTopReferrersData = ReferrerTraffic[]; + +export type ReposGetUsersWithAccessToProtectedBranchData = SimpleUser[]; + +export type ReposGetViewsData = ViewTraffic; + +export interface ReposGetViewsParams { + owner: string; + /** + * Must be one of: \`day\`, \`week\`. + * @default "day" + */ + per?: PerEnum1; + repo: string; +} + +/** + * Must be one of: \`day\`, \`week\`. + * @default "day" + */ +export enum ReposGetViewsParams1PerEnum { + Day = "day", + Week = "week", +} + +export type ReposGetWebhookConfigForRepoData = WebhookConfig; + +export type ReposGetWebhookData = Hook; + +export type ReposListBranchesData = ShortBranch[]; + +export type ReposListBranchesForHeadCommitData = BranchShort[]; + +export interface ReposListBranchesParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Setting to \`true\` returns only protected branches. When set to \`false\`, only unprotected branches are returned. Omitting this parameter returns all branches. */ + protected?: boolean; + repo: string; +} + +export type ReposListCollaboratorsData = Collaborator[]; + +export interface ReposListCollaboratorsParams { + /** + * Filter collaborators returned by their affiliation. Can be one of: + * \\* \`outside\`: All outside collaborators of an organization-owned repository. + * \\* \`direct\`: All collaborators with permissions to an organization-owned repository, regardless of organization membership status. + * \\* \`all\`: All collaborators the authenticated user can see. + * @default "all" + */ + affiliation?: AffiliationEnum1; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +/** + * Filter collaborators returned by their affiliation. Can be one of: + * \\* \`outside\`: All outside collaborators of an organization-owned repository. + * \\* \`direct\`: All collaborators with permissions to an organization-owned repository, regardless of organization membership status. + * \\* \`all\`: All collaborators the authenticated user can see. + * @default "all" + */ +export enum ReposListCollaboratorsParams1AffiliationEnum { + Outside = "outside", + Direct = "direct", + All = "all", +} + +export type ReposListCommentsForCommitData = CommitComment[]; + +export interface ReposListCommentsForCommitParams { + /** commit_sha parameter */ + commitSha: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListCommitCommentsForRepoData = CommitComment[]; + +export interface ReposListCommitCommentsForRepoParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListCommitStatusesForRefData = Status[]; + +export interface ReposListCommitStatusesForRefParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** ref+ parameter */ + ref: string; + repo: string; +} + +export type ReposListCommitsData = Commit[]; + +export interface ReposListCommitsParams { + /** GitHub login or email address by which to filter by commit author. */ + author?: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** Only commits containing this file path will be returned. */ + path?: string; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** SHA or branch to start listing commits from. Default: the repository’s default branch (usually \`master\`). */ + sha?: string; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** Only commits before this date will be returned. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + until?: string; +} + +export type ReposListContributorsData = Contributor[]; + +export interface ReposListContributorsParams { + /** Set to \`1\` or \`true\` to include anonymous contributors in results. */ + anon?: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListDeployKeysData = DeployKey[]; + +export interface ReposListDeployKeysParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListDeploymentStatusesData = DeploymentStatus[]; + +export interface ReposListDeploymentStatusesParams { + /** deployment_id parameter */ + deploymentId: number; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListDeploymentsData = Deployment[]; + +export interface ReposListDeploymentsParams { + /** + * The name of the environment that was deployed to (e.g., \`staging\` or \`production\`). + * @default "none" + */ + environment?: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * The name of the ref. This can be a branch, tag, or SHA. + * @default "none" + */ + ref?: string; + repo: string; + /** + * The SHA recorded at creation time. + * @default "none" + */ + sha?: string; + /** + * The name of the task for the deployment (e.g., \`deploy\` or \`deploy:migrations\`). + * @default "none" + */ + task?: string; +} + +export type ReposListForAuthenticatedUserData = Repository[]; + +export interface ReposListForAuthenticatedUserParams { + /** + * Comma-separated list of values. Can include: + * \\* \`owner\`: Repositories that are owned by the authenticated user. + * \\* \`collaborator\`: Repositories that the user has been added to as a collaborator. + * \\* \`organization_member\`: Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on. + * @default "owner,collaborator,organization_member" + */ + affiliation?: string; + /** Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + before?: string; + /** Can be one of \`asc\` or \`desc\`. Default: \`asc\` when using \`full_name\`, otherwise \`desc\` */ + direction?: DirectionEnum16; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "full_name" + */ + sort?: SortEnum19; + /** + * Can be one of \`all\`, \`owner\`, \`public\`, \`private\`, \`member\`. Default: \`all\` + * + * Will cause a \`422\` error if used in the same request as **visibility** or **affiliation**. Will cause a \`422\` error if used in the same request as **visibility** or **affiliation**. + * @default "all" + */ + type?: TypeEnum1; + /** + * Can be one of \`all\`, \`public\`, or \`private\`. + * @default "all" + */ + visibility?: VisibilityEnum; +} + +/** Can be one of \`asc\` or \`desc\`. Default: \`asc\` when using \`full_name\`, otherwise \`desc\` */ +export enum ReposListForAuthenticatedUserParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "full_name" + */ +export enum ReposListForAuthenticatedUserParams1SortEnum { + Created = "created", + Updated = "updated", + Pushed = "pushed", + FullName = "full_name", +} + +/** + * Can be one of \`all\`, \`owner\`, \`public\`, \`private\`, \`member\`. Default: \`all\` + * + * Will cause a \`422\` error if used in the same request as **visibility** or **affiliation**. Will cause a \`422\` error if used in the same request as **visibility** or **affiliation**. + * @default "all" + */ +export enum ReposListForAuthenticatedUserParams1TypeEnum { + All = "all", + Owner = "owner", + Public = "public", + Private = "private", + Member = "member", +} + +/** + * Can be one of \`all\`, \`public\`, or \`private\`. + * @default "all" + */ +export enum ReposListForAuthenticatedUserParams1VisibilityEnum { + All = "all", + Public = "public", + Private = "private", +} + +export type ReposListForOrgData = MinimalRepository[]; + +export interface ReposListForOrgParams { + /** Can be one of \`asc\` or \`desc\`. Default: when using \`full_name\`: \`asc\`, otherwise \`desc\` */ + direction?: DirectionEnum4; + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "created" + */ + sort?: SortEnum4; + /** Specifies the types of repositories you want returned. Can be one of \`all\`, \`public\`, \`private\`, \`forks\`, \`sources\`, \`member\`, \`internal\`. Default: \`all\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`type\` can also be \`internal\`. */ + type?: TypeEnum; +} + +/** Can be one of \`asc\` or \`desc\`. Default: when using \`full_name\`: \`asc\`, otherwise \`desc\` */ +export enum ReposListForOrgParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "created" + */ +export enum ReposListForOrgParams1SortEnum { + Created = "created", + Updated = "updated", + Pushed = "pushed", + FullName = "full_name", +} + +/** Specifies the types of repositories you want returned. Can be one of \`all\`, \`public\`, \`private\`, \`forks\`, \`sources\`, \`member\`, \`internal\`. Default: \`all\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`type\` can also be \`internal\`. */ +export enum ReposListForOrgParams1TypeEnum { + All = "all", + Public = "public", + Private = "private", + Forks = "forks", + Sources = "sources", + Member = "member", + Internal = "internal", +} + +export type ReposListForUserData = MinimalRepository[]; + +export interface ReposListForUserParams { + /** Can be one of \`asc\` or \`desc\`. Default: \`asc\` when using \`full_name\`, otherwise \`desc\` */ + direction?: DirectionEnum18; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "full_name" + */ + sort?: SortEnum21; + /** + * Can be one of \`all\`, \`owner\`, \`member\`. + * @default "owner" + */ + type?: TypeEnum2; + username: string; +} + +/** Can be one of \`asc\` or \`desc\`. Default: \`asc\` when using \`full_name\`, otherwise \`desc\` */ +export enum ReposListForUserParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +/** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "full_name" + */ +export enum ReposListForUserParams1SortEnum { + Created = "created", + Updated = "updated", + Pushed = "pushed", + FullName = "full_name", +} + +/** + * Can be one of \`all\`, \`owner\`, \`member\`. + * @default "owner" + */ +export enum ReposListForUserParams1TypeEnum { + All = "all", + Owner = "owner", + Member = "member", +} + +export type ReposListForksData = MinimalRepository[]; + +export interface ReposListForksParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** + * The sort order. Can be either \`newest\`, \`oldest\`, or \`stargazers\`. + * @default "newest" + */ + sort?: SortEnum5; +} + +/** + * The sort order. Can be either \`newest\`, \`oldest\`, or \`stargazers\`. + * @default "newest" + */ +export enum ReposListForksParams1SortEnum { + Newest = "newest", + Oldest = "oldest", + Stargazers = "stargazers", +} + +export type ReposListInvitationsData = RepositoryInvitation[]; + +export type ReposListInvitationsForAuthenticatedUserData = RepositoryInvitation[]; + +export interface ReposListInvitationsForAuthenticatedUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export interface ReposListInvitationsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListLanguagesData = Language; + +export type ReposListPagesBuildsData = PageBuild[]; + +export interface ReposListPagesBuildsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListPublicData = MinimalRepository[]; + +export interface ReposListPublicParams { + /** A repository ID. Only return repositories with an ID greater than this ID. */ + since?: number; +} + +export type ReposListPullRequestsAssociatedWithCommitData = PullRequestSimple[]; + +export interface ReposListPullRequestsAssociatedWithCommitParams { + /** commit_sha parameter */ + commitSha: string; + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListReleaseAssetsData = ReleaseAsset[]; + +export interface ReposListReleaseAssetsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** release_id parameter */ + releaseId: number; + repo: string; +} + +export type ReposListReleasesData = Release[]; + +export interface ReposListReleasesParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListTagsData = Tag[]; + +export interface ReposListTagsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListTeamsData = Team[]; + +export interface ReposListTeamsParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposListWebhooksData = Hook[]; + +export interface ReposListWebhooksParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; +} + +export type ReposMergeData = Commit; + +export type ReposMergeError = { + /** @example ""https://docs.github.com/rest/reference/repos#perform-a-merge"" */ + documentation_url?: string; + message?: string; +}; + +export interface ReposMergePayload { + /** The name of the base branch that the head will be merged into. */ + base: string; + /** Commit message to use for the merge commit. If omitted, a default message will be used. */ + commit_message?: string; + /** The head to merge. This can be a branch name or a commit SHA1. */ + head: string; +} + +export type ReposPingWebhookData = any; + +export type ReposRemoveAppAccessRestrictionsData = Integration[]; + +/** @example {"apps":["my-app"]} */ +export interface ReposRemoveAppAccessRestrictionsPayload { + /** apps parameter */ + apps: string[]; +} + +export type ReposRemoveCollaboratorData = any; + +export type ReposRemoveStatusCheckContextsData = string[]; + +/** @example {"contexts":["contexts"]} */ +export interface ReposRemoveStatusCheckContextsPayload { + /** contexts parameter */ + contexts: string[]; +} + +export type ReposRemoveStatusCheckProtectionData = any; + +export type ReposRemoveTeamAccessRestrictionsData = Team[]; + +/** @example {"teams":["my-team"]} */ +export interface ReposRemoveTeamAccessRestrictionsPayload { + /** teams parameter */ + teams: string[]; +} + +export type ReposRemoveUserAccessRestrictionsData = SimpleUser[]; + +/** @example {"users":["mona"]} */ +export interface ReposRemoveUserAccessRestrictionsPayload { + /** users parameter */ + users: string[]; +} + +export type ReposRenameBranchData = BranchWithProtection; + +export interface ReposRenameBranchPayload { + /** The new name of the branch. */ + new_name: string; +} + +export type ReposReplaceAllTopicsData = Topic; + +export interface ReposReplaceAllTopicsPayload { + /** An array of topics to add to the repository. Pass one or more topics to _replace_ the set of existing topics. Send an empty array (\`[]\`) to clear all topics from the repository. **Note:** Topic \`names\` cannot contain uppercase letters. */ + names: string[]; +} + +export type ReposRequestPagesBuildData = PageBuildStatus; + +export type ReposSetAdminBranchProtectionData = ProtectedBranchAdminEnforced; + +export type ReposSetAppAccessRestrictionsData = Integration[]; + +/** @example {"apps":["my-app"]} */ +export interface ReposSetAppAccessRestrictionsPayload { + /** apps parameter */ + apps: string[]; +} + +export type ReposSetStatusCheckContextsData = string[]; + +/** @example {"contexts":["contexts"]} */ +export interface ReposSetStatusCheckContextsPayload { + /** contexts parameter */ + contexts: string[]; +} + +export type ReposSetTeamAccessRestrictionsData = Team[]; + +/** @example {"teams":["my-team"]} */ +export interface ReposSetTeamAccessRestrictionsPayload { + /** teams parameter */ + teams: string[]; +} + +export type ReposSetUserAccessRestrictionsData = SimpleUser[]; + +/** @example {"users":["mona"]} */ +export interface ReposSetUserAccessRestrictionsPayload { + /** users parameter */ + users: string[]; +} + +export type ReposTestPushWebhookData = any; + +export type ReposTransferData = Repository; + +export interface ReposTransferPayload { + /** The username or organization name the repository will be transferred to. */ + new_owner: string; + /** ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories. */ + team_ids?: number[]; +} + +export type ReposUpdateBranchProtectionData = ProtectedBranch; + +export interface ReposUpdateBranchProtectionPayload { + /** Allows deletion of the protected branch by anyone with write access to the repository. Set to \`false\` to prevent deletion of the protected branch. Default: \`false\`. For more information, see "[Enabling force pushes to a protected branch](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)" in the GitHub Help documentation. */ + allow_deletions?: boolean; + /** Permits force pushes to the protected branch by anyone with write access to the repository. Set to \`true\` to allow force pushes. Set to \`false\` or \`null\` to block force pushes. Default: \`false\`. For more information, see "[Enabling force pushes to a protected branch](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)" in the GitHub Help documentation." */ + allow_force_pushes?: boolean | null; + /** Enforce all configured restrictions for administrators. Set to \`true\` to enforce required status checks for repository administrators. Set to \`null\` to disable. */ + enforce_admins: boolean | null; + /** Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Set to \`true\` to enforce a linear commit history. Set to \`false\` to disable a linear commit Git history. Your repository must allow squash merging or rebase merging before you can enable a linear commit history. Default: \`false\`. For more information, see "[Requiring a linear commit history](https://help.github.com/github/administering-a-repository/requiring-a-linear-commit-history)" in the GitHub Help documentation. */ + required_linear_history?: boolean; + /** Require at least one approving review on a pull request, before merging. Set to \`null\` to disable. */ + required_pull_request_reviews: { + /** Set to \`true\` if you want to automatically dismiss approving reviews when someone pushes a new commit. */ + dismiss_stale_reviews?: boolean; + /** Specify which users and teams can dismiss pull request reviews. Pass an empty \`dismissal_restrictions\` object to disable. User and team \`dismissal_restrictions\` are only available for organization-owned repositories. Omit this parameter for personal repositories. */ + dismissal_restrictions?: { + /** The list of team \`slug\`s with dismissal access */ + teams?: string[]; + /** The list of user \`login\`s with dismissal access */ + users?: string[]; + }; + /** Blocks merging pull requests until [code owners](https://help.github.com/articles/about-code-owners/) review them. */ + require_code_owner_reviews?: boolean; + /** Specify the number of reviewers required to approve pull requests. Use a number between 1 and 6. */ + required_approving_review_count?: number; + } | null; + /** Require status checks to pass before merging. Set to \`null\` to disable. */ + required_status_checks: { + /** The list of status checks to require in order to merge into this branch */ + contexts: string[]; + /** Require branches to be up to date before merging. */ + strict: boolean; + } | null; + /** Restrict who can push to the protected branch. User, app, and team \`restrictions\` are only available for organization-owned repositories. Set to \`null\` to disable. */ + restrictions: { + /** The list of app \`slug\`s with push access */ + apps?: string[]; + /** The list of team \`slug\`s with push access */ + teams: string[]; + /** The list of user \`login\`s with push access */ + users: string[]; + } | null; +} + +export type ReposUpdateCommitCommentData = CommitComment; + +export interface ReposUpdateCommitCommentPayload { + /** The contents of the comment */ + body: string; +} + +export type ReposUpdateData = FullRepository; + +export type ReposUpdateInformationAboutPagesSiteData = any; + +/** The repository directory that includes the source files for the Pages site. Allowed paths are \`/\` or \`/docs\`. */ +export enum ReposUpdateInformationAboutPagesSitePathEnum { + Value = "/", + ValueDocs = "/docs", +} + +export interface ReposUpdateInformationAboutPagesSitePayload { + /** Specify a custom domain for the repository. Sending a \`null\` value will remove the custom domain. For more about custom domains, see "[Using a custom domain with GitHub Pages](https://help.github.com/articles/using-a-custom-domain-with-github-pages/)." */ + cname?: string | null; + /** Configures access controls for the GitHub Pages site. If public is set to \`true\`, the site is accessible to anyone on the internet. If set to \`false\`, the site will only be accessible to users who have at least \`read\` access to the repository that published the site. This includes anyone in your Enterprise if the repository is set to \`internal\` visibility. This feature is only available to repositories in an organization on an Enterprise plan. */ + public?: boolean; + /** Update the source for the repository. Must include the branch name, and may optionally specify the subdirectory \`/docs\`. Possible values are \`"gh-pages"\`, \`"master"\`, and \`"master /docs"\`. */ + source: + | ReposUpdateInformationAboutPagesSiteSourceEnum + | { + /** The repository branch used to publish your site's source files. */ + branch: string; + /** The repository directory that includes the source files for the Pages site. Allowed paths are \`/\` or \`/docs\`. */ + path: ReposUpdateInformationAboutPagesSitePathEnum; + }; +} + +/** Update the source for the repository. Must include the branch name, and may optionally specify the subdirectory \`/docs\`. Possible values are \`"gh-pages"\`, \`"master"\`, and \`"master /docs"\`. */ +export enum ReposUpdateInformationAboutPagesSiteSourceEnum { + GhPages = "gh-pages", + Master = "master", + MasterDocs = "master /docs", +} + +export type ReposUpdateInvitationData = RepositoryInvitation; + +export interface ReposUpdateInvitationPayload { + /** The permissions that the associated user will have on the repository. Valid values are \`read\`, \`write\`, \`maintain\`, \`triage\`, and \`admin\`. */ + permissions?: ReposUpdateInvitationPermissionsEnum; +} + +/** The permissions that the associated user will have on the repository. Valid values are \`read\`, \`write\`, \`maintain\`, \`triage\`, and \`admin\`. */ +export enum ReposUpdateInvitationPermissionsEnum { + Read = "read", + Write = "write", + Maintain = "maintain", + Triage = "triage", + Admin = "admin", +} + +export interface ReposUpdatePayload { + /** + * Either \`true\` to allow merging pull requests with a merge commit, or \`false\` to prevent merging pull requests with merge commits. + * @default true + */ + allow_merge_commit?: boolean; + /** + * Either \`true\` to allow rebase-merging pull requests, or \`false\` to prevent rebase-merging. + * @default true + */ + allow_rebase_merge?: boolean; + /** + * Either \`true\` to allow squash-merging pull requests, or \`false\` to prevent squash-merging. + * @default true + */ + allow_squash_merge?: boolean; + /** + * \`true\` to archive this repository. **Note**: You cannot unarchive repositories through the API. + * @default false + */ + archived?: boolean; + /** Updates the default branch for this repository. */ + default_branch?: string; + /** + * Either \`true\` to allow automatically deleting head branches when pull requests are merged, or \`false\` to prevent automatic deletion. + * @default false + */ + delete_branch_on_merge?: boolean; + /** A short description of the repository. */ + description?: string; + /** + * Either \`true\` to enable issues for this repository or \`false\` to disable them. + * @default true + */ + has_issues?: boolean; + /** + * Either \`true\` to enable projects for this repository or \`false\` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is \`false\`, and if you pass \`true\`, the API returns an error. + * @default true + */ + has_projects?: boolean; + /** + * Either \`true\` to enable the wiki for this repository or \`false\` to disable it. + * @default true + */ + has_wiki?: boolean; + /** A URL with more information about the repository. */ + homepage?: string; + /** + * Either \`true\` to make this repo available as a template repository or \`false\` to prevent it. + * @default false + */ + is_template?: boolean; + /** The name of the repository. */ + name?: string; + /** + * Either \`true\` to make the repository private or \`false\` to make it public. Default: \`false\`. + * **Note**: You will get a \`422\` error if the organization restricts [changing repository visibility](https://help.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of private. **Note**: You will get a \`422\` error if the organization restricts [changing repository visibility](https://help.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of private. + * @default false + */ + private?: boolean; + /** Can be \`public\` or \`private\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`visibility\` can also be \`internal\`. The \`visibility\` parameter overrides the \`private\` parameter when you use both along with the \`nebula-preview\` preview header. */ + visibility?: ReposUpdateVisibilityEnum; +} + +export type ReposUpdatePullRequestReviewProtectionData = ProtectedBranchPullRequestReview; + +export interface ReposUpdatePullRequestReviewProtectionPayload { + /** Set to \`true\` if you want to automatically dismiss approving reviews when someone pushes a new commit. */ + dismiss_stale_reviews?: boolean; + /** Specify which users and teams can dismiss pull request reviews. Pass an empty \`dismissal_restrictions\` object to disable. User and team \`dismissal_restrictions\` are only available for organization-owned repositories. Omit this parameter for personal repositories. */ + dismissal_restrictions?: { + /** The list of team \`slug\`s with dismissal access */ + teams?: string[]; + /** The list of user \`login\`s with dismissal access */ + users?: string[]; + }; + /** Blocks merging pull requests until [code owners](https://help.github.com/articles/about-code-owners/) have reviewed. */ + require_code_owner_reviews?: boolean; + /** Specifies the number of reviewers required to approve pull requests. Use a number between 1 and 6. */ + required_approving_review_count?: number; +} + +export type ReposUpdateReleaseAssetData = ReleaseAsset; + +export interface ReposUpdateReleaseAssetPayload { + /** An alternate short description of the asset. Used in place of the filename. */ + label?: string; + /** The file name of the asset. */ + name?: string; + /** @example ""uploaded"" */ + state?: string; +} + +export type ReposUpdateReleaseData = Release; + +export interface ReposUpdateReleasePayload { + /** Text describing the contents of the tag. */ + body?: string; + /** \`true\` makes the release a draft, and \`false\` publishes the release. */ + draft?: boolean; + /** The name of the release. */ + name?: string; + /** \`true\` to identify the release as a prerelease, \`false\` to identify the release as a full release. */ + prerelease?: boolean; + /** The name of the tag. */ + tag_name?: string; + /** Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually \`master\`). */ + target_commitish?: string; +} + +export type ReposUpdateStatusCheckProtectionData = StatusCheckPolicy; + +export interface ReposUpdateStatusCheckProtectionPayload { + /** The list of status checks to require in order to merge into this branch */ + contexts?: string[]; + /** Require branches to be up to date before merging. */ + strict?: boolean; +} + +/** Can be \`public\` or \`private\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`visibility\` can also be \`internal\`. The \`visibility\` parameter overrides the \`private\` parameter when you use both along with the \`nebula-preview\` preview header. */ +export enum ReposUpdateVisibilityEnum { + Public = "public", + Private = "private", + Visibility = "visibility", + Internal = "internal", +} + +export type ReposUpdateWebhookConfigForRepoData = WebhookConfig; + +/** @example {"content_type":"json","insecure_ssl":"0","secret":"********","url":"https://example.com/webhook"} */ +export interface ReposUpdateWebhookConfigForRepoPayload { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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; + /** 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; + /** The URL to which the payloads will be delivered. */ + url?: WebhookConfigUrl; +} + +export type ReposUpdateWebhookData = Hook; + +export interface ReposUpdateWebhookPayload { + /** + * Determines if notifications are sent when the webhook is triggered. Set to \`true\` to send notifications. + * @default true + */ + active?: boolean; + /** Determines a list of events to be added to the list of events that the Hook triggers for. */ + add_events?: string[]; + /** Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/repos#create-hook-config-params). */ + config?: { + /** @example ""bar@example.com"" */ + address?: string; + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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 ""The Serious Room"" */ + room?: 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; + /** The URL to which the payloads will be delivered. */ + url: WebhookConfigUrl; + }; + /** + * Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. This replaces the entire array of events. + * @default ["push"] + */ + events?: string[]; + /** Determines a list of events to be removed from the list of events that the Hook triggers for. */ + remove_events?: string[]; +} + +export type ReposUploadReleaseAssetData = ReleaseAsset; + +export interface ReposUploadReleaseAssetParams { + label?: string; + name?: string; + owner: string; + /** release_id parameter */ + releaseId: number; + repo: string; +} + +/** The raw file data */ +export type ReposUploadReleaseAssetPayload = string; + +/** + * Repository + * A git repository + */ +export interface Repository { + /** + * Whether to allow merge commits for pull requests. + * @default true + * @example true + */ + allow_merge_commit?: boolean; + /** + * Whether to allow rebase merges for pull requests. + * @default true + * @example true + */ + allow_rebase_merge?: boolean; + /** + * Whether to allow squash merges for pull requests. + * @default true + * @example true + */ + allow_squash_merge?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ + archive_url: string; + /** + * Whether the repository is archived. + * @default false + */ + archived: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ + assignees_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ + blobs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ + branches_url: string; + /** @example "https://github.com/octocat/Hello-World.git" */ + clone_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ + collaborators_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ + comments_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ + commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ + compare_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ + contents_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/contributors" + */ + contributors_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at: string | null; + /** + * The default branch of the repository. + * @example "master" + */ + default_branch: string; + /** + * Whether to delete head branches when pull requests are merged + * @default false + * @example false + */ + delete_branch_on_merge?: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/deployments" + */ + deployments_url: string; + /** @example "This your first repo!" */ + description: string | null; + /** Returns whether or not this repository disabled. */ + disabled: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/downloads" + */ + downloads_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/events" + */ + events_url: string; + fork: boolean; + forks: number; + /** @example 9 */ + forks_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/forks" + */ + forks_url: string; + /** @example "octocat/Hello-World" */ + full_name: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ + git_commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ + git_refs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ + git_tags_url: string; + /** @example "git:github.com/octocat/Hello-World.git" */ + git_url: string; + /** + * Whether downloads are enabled. + * @default true + * @example true + */ + has_downloads: boolean; + /** + * Whether issues are enabled. + * @default true + * @example true + */ + has_issues: boolean; + has_pages: boolean; + /** + * Whether projects are enabled. + * @default true + * @example true + */ + has_projects: boolean; + /** + * Whether the wiki is enabled. + * @default true + * @example true + */ + has_wiki: boolean; + /** + * @format uri + * @example "https://github.com" + */ + homepage: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/hooks" + */ + hooks_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World" + */ + html_url: string; + /** + * Unique identifier of the repository + * @example 42 + */ + id: number; + /** + * Whether this repository acts as a template that can be used to generate new repositories. + * @default false + * @example true + */ + is_template?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ + issue_comment_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ + issue_events_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ + issues_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ + keys_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ + labels_url: string; + language: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/languages" + */ + languages_url: string; + license: LicenseSimple | null; + master_branch?: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/merges" + */ + merges_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ + milestones_url: string; + /** + * @format uri + * @example "git:git.example.com/octocat/Hello-World" + */ + mirror_url: string | null; + /** + * The name of the repository. + * @example "Team Environment" + */ + name: string; + network_count?: number; + /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ + node_id: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ + notifications_url: string; + open_issues: number; + /** @example 0 */ + open_issues_count: number; + owner: SimpleUser | null; + permissions?: { + admin: boolean; + maintain?: boolean; + pull: boolean; + push: boolean; + triage?: boolean; + }; + /** + * Whether the repository is private or public. + * @default false + */ + private: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ + pulls_url: string; + /** + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + pushed_at: string | null; + /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ + releases_url: string; + /** @example 108 */ + size: number; + /** @example "git@github.com:octocat/Hello-World.git" */ + ssh_url: string; + /** @example 80 */ + stargazers_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" + */ + stargazers_url: string; + /** @example ""2020-07-09T00:17:42Z"" */ + starred_at?: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ + statuses_url: string; + subscribers_count?: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" + */ + subscribers_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscription" + */ + subscription_url: string; + /** + * @format uri + * @example "https://svn.github.com/octocat/Hello-World" + */ + svn_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/tags" + */ + tags_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/teams" + */ + teams_url: string; + temp_clone_token?: string; + template_repository?: { + 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; + temp_clone_token?: string; + topics?: string[]; + trees_url?: string; + updated_at?: string; + url?: string; + visibility?: string; + watchers_count?: number; + } | null; + topics?: string[]; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ + trees_url: string; + /** + * @format date-time + * @example "2011-01-26T19:14:43Z" + */ + updated_at: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World" + */ + url: string; + /** + * The repository visibility: public, private, or internal. + * @default "public" + */ + visibility?: string; + watchers: number; + /** @example 80 */ + watchers_count: number; +} + +/** + * Repository Collaborator Permission + * Repository Collaborator Permission + */ +export interface RepositoryCollaboratorPermission { + permission: string; + user: SimpleUser | null; +} + +/** + * Repository Invitation + * Repository invitations let you manage who you collaborate with. + */ +export interface RepositoryInvitation { + /** + * @format date-time + * @example "2016-06-13T14:52:50-05:00" + */ + created_at: string; + /** Whether or not the invitation has expired */ + expired?: boolean; + /** @example "https://github.com/octocat/Hello-World/invitations" */ + html_url: string; + /** + * Unique identifier of the repository invitation. + * @example 42 + */ + id: number; + invitee: SimpleUser | null; + inviter: SimpleUser | null; + node_id: string; + /** + * The permission associated with the invitation. + * @example "read" + */ + permissions: RepositoryInvitationPermissionsEnum; + /** Minimal Repository */ + repository: MinimalRepository; + /** + * URL for the repository invitation + * @example "https://api.github.com/user/repository-invitations/1" + */ + url: string; +} + +/** + * The permission associated with the invitation. + * @example "read" + */ +export enum RepositoryInvitationPermissionsEnum { + Read = "read", + Write = "write", + Admin = "admin", +} + +/** + * Repository Invitation + * Repository invitations let you manage who you collaborate with. + */ +export interface RepositorySubscription { + /** + * @format date-time + * @example "2012-10-06T21:34:12Z" + */ + created_at: string; + /** Determines if all notifications should be blocked from this repository. */ + ignored: boolean; + reason: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example" + */ + repository_url: string; + /** + * Determines if notifications should be received from this repository. + * @example true + */ + subscribed: boolean; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example/subscription" + */ + url: string; +} + +/** Requires Authentication */ +export type RequiresAuthentication = BasicError; + +/** + * Legacy Review Comment + * Legacy Review Comment + */ +export interface ReviewComment { + _links: { + /** Hypermedia Link */ + html: Link; + /** Hypermedia Link */ + pull_request: Link; + /** Hypermedia Link */ + self: Link; + }; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** @example "Great stuff" */ + body: string; + body_html?: string; + body_text?: string; + /** @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" */ + commit_id: string; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + created_at: string; + /** @example "@@ -16,33 +16,40 @@ public class Connection : IConnection..." */ + diff_hunk: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" + */ + html_url: string; + /** @example 10 */ + id: number; + /** @example 8 */ + in_reply_to_id?: number; + /** + * The line of the blob to which the comment applies. The last line of the range for a multi-line comment + * @example 2 + */ + line?: number; + /** @example "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw" */ + node_id: string; + /** @example "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840" */ + original_commit_id: string; + /** + * The original line of the blob to which the comment applies. The last line of the range for a multi-line comment + * @example 2 + */ + original_line?: number; + /** @example 4 */ + original_position: number; + /** + * The original first line of the range for a multi-line comment. + * @example 2 + */ + original_start_line?: number | null; + /** @example "file1.txt" */ + path: string; + /** @example 1 */ + position: number | null; + /** @example 42 */ + pull_request_review_id: number | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" + */ + pull_request_url: string; + /** + * The side of the first line of the range for a multi-line comment. + * @default "RIGHT" + */ + side?: ReviewCommentSideEnum; + /** + * The first line of the range for a multi-line comment. + * @example 2 + */ + start_line?: number | null; + /** + * The side of the first line of the range for a multi-line comment. + * @default "RIGHT" + */ + start_side?: ReviewCommentStartSideEnum; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" + */ + url: string; + user: SimpleUser | null; +} + +/** + * The side of the first line of the range for a multi-line comment. + * @default "RIGHT" + */ +export enum ReviewCommentSideEnum { + LEFT = "LEFT", + RIGHT = "RIGHT", +} + +/** + * The side of the first line of the range for a multi-line comment. + * @default "RIGHT" + */ +export enum ReviewCommentStartSideEnum { + LEFT = "LEFT", + RIGHT = "RIGHT", +} + +/** + * Filter members returned by their role. Can be one of: + * \\* \`all\` - All members of the organization, regardless of role. + * \\* \`admin\` - Organization owners. + * \\* \`member\` - Non-owner organization members. + * @default "all" + */ +export enum RoleEnum { + All = "all", + Admin = "admin", + Member = "member", +} + +/** + * Filters members returned by their role in the team. Can be one of: + * \\* \`member\` - normal members of the team. + * \\* \`maintainer\` - team maintainers. + * \\* \`all\` - all members of the team. + * @default "all" + */ +export enum RoleEnum1 { + Member = "member", + Maintainer = "maintainer", + All = "all", +} + +/** + * Filters members returned by their role in the team. Can be one of: + * \\* \`member\` - normal members of the team. + * \\* \`maintainer\` - team maintainers. + * \\* \`all\` - all members of the team. + * @default "all" + */ +export enum RoleEnum2 { + Member = "member", + Maintainer = "maintainer", + All = "all", +} + +/** + * Self hosted runners + * A self hosted runner + */ +export interface Runner { + busy: boolean; + /** + * The id of the runner. + * @example 5 + */ + id: number; + labels: { + /** Unique identifier of the label. */ + id?: number; + /** Name of the label. */ + name?: string; + /** The type of label. Read-only labels are applied automatically when the runner is configured. */ + type?: RunnerTypeEnum; + }[]; + /** + * The name of the runner. + * @example "iMac" + */ + name: string; + /** + * The Operating System of the runner. + * @example "macos" + */ + os: string; + /** + * The status of the runner. + * @example "online" + */ + status: string; +} + +/** + * Runner Application + * Runner Application + */ +export interface RunnerApplication { + architecture: string; + download_url: string; + filename: string; + os: string; +} + +export interface RunnerGroupsEnterprise { + allows_public_repositories: boolean; + default: boolean; + id: number; + name: string; + runners_url: string; + selected_organizations_url?: string; + visibility: string; +} + +export interface RunnerGroupsOrg { + allows_public_repositories: boolean; + default: boolean; + id: number; + inherited: boolean; + inherited_allows_public_repositories?: boolean; + name: string; + runners_url: string; + /** Link to the selected repositories resource for this runner group. Not present unless visibility was set to \`selected\` */ + selected_repositories_url?: string; + visibility: string; +} + +/** The type of label. Read-only labels are applied automatically when the runner is configured. */ +export enum RunnerTypeEnum { + ReadOnly = "read-only", + Custom = "custom", +} + +/** Bad Request */ +export type ScimBadRequest = ScimError; + +/** Conflict */ +export type ScimConflict = ScimError; + +export type ScimDeleteUserFromOrgData = any; + +export interface ScimEnterpriseGroup { + displayName?: string; + externalId?: string | null; + id: string; + members?: { + $ref?: string; + display?: string; + value?: string; + }[]; + meta?: { + created?: string; + lastModified?: string; + location?: string; + resourceType?: string; + }; + schemas: string[]; +} + +export interface ScimEnterpriseUser { + active?: boolean; + emails?: { + primary?: boolean; + type?: string; + value?: string; + }[]; + externalId?: string; + groups?: { + value?: string; + }[]; + id: string; + meta?: { + created?: string; + lastModified?: string; + location?: string; + resourceType?: string; + }; + name?: { + familyName?: string; + givenName?: string; + }; + schemas: string[]; + userName?: string; +} + +/** + * Scim Error + * Scim Error + */ +export interface ScimError { + detail?: string | null; + documentation_url?: string | null; + message?: string | null; + schemas?: string[]; + scimType?: string | null; + status?: number; +} + +/** Forbidden */ +export type ScimForbidden = ScimError; + +export type ScimGetProvisioningInformationForUserData = ScimUser; + +export interface ScimGroupListEnterprise { + Resources: { + displayName?: string; + externalId?: string | null; + id: string; + members?: { + $ref?: string; + display?: string; + value?: string; + }[]; + meta?: { + created?: string; + lastModified?: string; + location?: string; + resourceType?: string; + }; + schemas: string[]; + }[]; + itemsPerPage: number; + schemas: string[]; + startIndex: number; + totalResults: number; +} + +/** Internal Error */ +export type ScimInternalError = ScimError; + +export type ScimListProvisionedIdentitiesData = ScimUserList; + +export interface ScimListProvisionedIdentitiesParams { + /** Used for pagination: the number of results to return. */ + count?: number; + /** + * Filters results using the equals query parameter operator (\`eq\`). You can filter results that are equal to \`id\`, \`userName\`, \`emails\`, and \`external_id\`. For example, to search for an identity with the \`userName\` Octocat, you would use this query: + * + * \`?filter=userName%20eq%20\\"Octocat\\"\`. + * + * To filter results for the identity with the email \`octocat@github.com\`, you would use this query: + * + * \`?filter=emails%20eq%20\\"octocat@github.com\\"\`. + */ + filter?: string; + org: string; + /** Used for pagination: the index of the first result to return. */ + startIndex?: number; +} + +/** Resource Not Found */ +export type ScimNotFound = ScimError; + +export type ScimProvisionAndInviteUserData = ScimUser; + +export interface ScimProvisionAndInviteUserPayload { + active?: boolean; + /** + * The name of the user, suitable for display to end-users + * @example "Jon Doe" + */ + displayName?: string; + /** + * user emails + * @minItems 1 + * @example [{"value":"someone@example.com","primary":true},{"value":"another@example.com","primary":false}] + */ + emails: { + primary?: boolean; + type?: string; + value: string; + }[]; + externalId?: string; + groups?: string[]; + /** @example {"givenName":"Jane","familyName":"User"} */ + name: { + familyName: string; + formatted?: string; + givenName: string; + }; + schemas?: string[]; + /** + * Configured by the admin. Could be an email, login, or username + * @example "someone@example.com" + */ + userName: string; +} + +export type ScimSetInformationForProvisionedUserData = ScimUser; + +export interface ScimSetInformationForProvisionedUserPayload { + active?: boolean; + /** + * The name of the user, suitable for display to end-users + * @example "Jon Doe" + */ + displayName?: string; + /** + * user emails + * @minItems 1 + * @example [{"value":"someone@example.com","primary":true},{"value":"another@example.com","primary":false}] + */ + emails: { + primary?: boolean; + type?: string; + value: string; + }[]; + externalId?: string; + groups?: string[]; + /** @example {"givenName":"Jane","familyName":"User"} */ + name: { + familyName: string; + formatted?: string; + givenName: string; + }; + schemas?: string[]; + /** + * Configured by the admin. Could be an email, login, or username + * @example "someone@example.com" + */ + userName: string; +} + +export type ScimUpdateAttributeForUserData = ScimUser; + +export type ScimUpdateAttributeForUserError = BasicError; + +export enum ScimUpdateAttributeForUserOpEnum { + Add = "add", + Remove = "remove", + Replace = "replace", +} + +export interface ScimUpdateAttributeForUserPayload { + /** + * Set of operations to be performed + * @minItems 1 + * @example [{"op":"replace","value":{"active":false}}] + */ + Operations: { + op: ScimUpdateAttributeForUserOpEnum; + path?: string; + value?: + | { + active?: boolean | null; + externalId?: string | null; + familyName?: string | null; + givenName?: string | null; + userName?: string | null; + } + | { + primary?: boolean; + value?: string; + }[] + | string; + }[]; + schemas?: string[]; +} + +/** + * SCIM /Users + * SCIM /Users provisioning endpoints + */ +export interface ScimUser { + /** + * The active status of the User. + * @example true + */ + active: boolean; + /** + * The name of the user, suitable for display to end-users + * @example "Jon Doe" + */ + displayName?: string | null; + /** + * user emails + * @minItems 1 + * @example [{"value":"someone@example.com","primary":true},{"value":"another@example.com","primary":false}] + */ + emails: { + primary?: boolean; + value: string; + }[]; + /** + * The ID of the User. + * @example "a7b0f98395" + */ + externalId: string | null; + /** associated groups */ + groups?: { + display?: string; + value?: string; + }[]; + /** + * Unique identifier of an external identity + * @example "1b78eada-9baa-11e6-9eb6-a431576d590e" + */ + id: string; + meta: { + /** + * @format date-time + * @example "2019-01-24T22:45:36.000Z" + */ + created?: string; + /** + * @format date-time + * @example "2019-01-24T22:45:36.000Z" + */ + lastModified?: string; + /** + * @format uri + * @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: { + familyName: string | null; + formatted?: string | null; + givenName: string | null; + }; + /** + * Set of operations to be performed + * @minItems 1 + * @example [{"op":"replace","value":{"active":false}}] + */ + operations?: { + op: ScimUserOpEnum; + path?: string; + value?: string | object | any[]; + }[]; + /** The ID of the organization. */ + organization_id?: number; + /** + * SCIM schema used. + * @minItems 1 + */ + schemas: string[]; + /** + * Configured by the admin. Could be an email, login, or username + * @example "someone@example.com" + */ + userName: string | null; +} + +/** + * SCIM User List + * SCIM User List + */ +export interface ScimUserList { + Resources: ScimUser[]; + /** @example 10 */ + itemsPerPage: number; + /** + * SCIM schema used. + * @minItems 1 + */ + schemas: string[]; + /** @example 1 */ + startIndex: number; + /** @example 3 */ + totalResults: number; +} + +export interface ScimUserListEnterprise { + Resources: { + active?: boolean; + emails?: { + primary?: boolean; + type?: string; + value?: string; + }[]; + externalId?: string; + groups?: { + value?: string; + }[]; + id: string; + meta?: { + created?: string; + lastModified?: string; + location?: string; + resourceType?: string; + }; + name?: { + familyName?: string; + givenName?: string; + }; + schemas: string[]; + userName?: string; + }[]; + itemsPerPage: number; + schemas: string[]; + startIndex: number; + totalResults: number; +} + +export enum ScimUserOpEnum { + Add = "add", + Remove = "remove", + Replace = "replace", +} + +/** Scoped Installation */ +export interface ScopedInstallation { + /** Simple User */ + account: SimpleUser; + /** @example true */ + has_multiple_single_files?: boolean; + /** The permissions granted to the user-to-server access token. */ + permissions: AppPermissions; + /** + * @format uri + * @example "https://api.github.com/users/octocat/repos" + */ + repositories_url: string; + /** Describe whether all repositories have been selected or there's a selection involved */ + repository_selection: ScopedInstallationRepositorySelectionEnum; + /** @example "config.yaml" */ + single_file_name: string | null; + /** @example ["config.yml",".github/issue_TEMPLATE.md"] */ + single_file_paths?: string[]; +} + +/** Describe whether all repositories have been selected or there's a selection involved */ +export enum ScopedInstallationRepositorySelectionEnum { + All = "all", + Selected = "selected", +} + +export interface SearchCodeData { + incomplete_results: boolean; + items: CodeSearchResultItem[]; + total_count: number; +} + +export interface SearchCodeParams { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: OrderEnum2; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching code](https://help.github.com/articles/searching-code/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query. Can only be \`indexed\`, which indicates how recently a file has been indexed by the GitHub search infrastructure. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SortEnum12; +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum SearchCodeParams1OrderEnum { + Desc = "desc", + Asc = "asc", +} + +/** Sorts the results of your query. Can only be \`indexed\`, which indicates how recently a file has been indexed by the GitHub search infrastructure. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SearchCodeParams1SortEnum { + Indexed = "indexed", +} + +export interface SearchCommitsData { + incomplete_results: boolean; + items: CommitSearchResultItem[]; + total_count: number; +} + +export interface SearchCommitsParams { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: OrderEnum3; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching commits](https://help.github.com/articles/searching-commits/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query by \`author-date\` or \`committer-date\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SortEnum13; +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum SearchCommitsParams1OrderEnum { + Desc = "desc", + Asc = "asc", +} + +/** Sorts the results of your query by \`author-date\` or \`committer-date\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SearchCommitsParams1SortEnum { + AuthorDate = "author-date", + CommitterDate = "committer-date", +} + +export interface SearchIssuesAndPullRequestsData { + incomplete_results: boolean; + items: IssueSearchResultItem[]; + total_count: number; +} + +export interface SearchIssuesAndPullRequestsParams { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: OrderEnum4; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching issues and pull requests](https://help.github.com/articles/searching-issues-and-pull-requests/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query by the number of \`comments\`, \`reactions\`, \`reactions-+1\`, \`reactions--1\`, \`reactions-smile\`, \`reactions-thinking_face\`, \`reactions-heart\`, \`reactions-tada\`, or \`interactions\`. You can also sort results by how recently the items were \`created\` or \`updated\`, Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SortEnum14; +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum SearchIssuesAndPullRequestsParams1OrderEnum { + Desc = "desc", + Asc = "asc", +} + +/** Sorts the results of your query by the number of \`comments\`, \`reactions\`, \`reactions-+1\`, \`reactions--1\`, \`reactions-smile\`, \`reactions-thinking_face\`, \`reactions-heart\`, \`reactions-tada\`, or \`interactions\`. You can also sort results by how recently the items were \`created\` or \`updated\`, Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SearchIssuesAndPullRequestsParams1SortEnum { + Comments = "comments", + Reactions = "reactions", + Reactions1 = "reactions-+1", + Reactions11 = "reactions--1", + ReactionsSmile = "reactions-smile", + ReactionsThinkingFace = "reactions-thinking_face", + ReactionsHeart = "reactions-heart", + ReactionsTada = "reactions-tada", + Interactions = "interactions", + Created = "created", + Updated = "updated", +} + +export interface SearchLabelsData { + incomplete_results: boolean; + items: LabelSearchResultItem[]; + total_count: number; +} + +export interface SearchLabelsParams { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: OrderEnum5; + /** The search keywords. This endpoint does not accept qualifiers in the query. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). */ + q: string; + /** The id of the repository. */ + repository_id: number; + /** Sorts the results of your query by when the label was \`created\` or \`updated\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SortEnum15; +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum SearchLabelsParams1OrderEnum { + Desc = "desc", + Asc = "asc", +} + +/** Sorts the results of your query by when the label was \`created\` or \`updated\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SearchLabelsParams1SortEnum { + Created = "created", + Updated = "updated", +} + +export interface SearchReposData { + incomplete_results: boolean; + items: RepoSearchResultItem[]; + total_count: number; +} + +export interface SearchReposParams { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: OrderEnum6; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching for repositories](https://help.github.com/articles/searching-for-repositories/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query by number of \`stars\`, \`forks\`, or \`help-wanted-issues\` or how recently the items were \`updated\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SortEnum16; +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum SearchReposParams1OrderEnum { + Desc = "desc", + Asc = "asc", +} + +/** Sorts the results of your query by number of \`stars\`, \`forks\`, or \`help-wanted-issues\` or how recently the items were \`updated\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SearchReposParams1SortEnum { + Stars = "stars", + Forks = "forks", + HelpWantedIssues = "help-wanted-issues", + Updated = "updated", +} + +/** Search Result Text Matches */ +export type SearchResultTextMatches = { + fragment?: string; + matches?: { + indices?: number[]; + text?: string; + }[]; + object_type?: string | null; + object_url?: string; + property?: string; +}[]; + +export interface SearchTopicsData { + incomplete_results: boolean; + items: TopicSearchResultItem[]; + total_count: number; +} + +export interface SearchTopicsParams { + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). */ + q: string; +} + +export interface SearchUsersData { + incomplete_results: boolean; + items: UserSearchResultItem[]; + total_count: number; +} + +export interface SearchUsersParams { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: OrderEnum7; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching users](https://help.github.com/articles/searching-users/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query by number of \`followers\` or \`repositories\`, or when the person \`joined\` GitHub. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SortEnum17; +} + +/** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ +export enum SearchUsersParams1OrderEnum { + Desc = "desc", + Asc = "asc", +} + +/** Sorts the results of your query by number of \`followers\` or \`repositories\`, or when the person \`joined\` GitHub. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SearchUsersParams1SortEnum { + Followers = "followers", + Repositories = "repositories", + Joined = "joined", +} + +export interface SecretScanningAlert { + /** The time that the alert was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + created_at?: AlertCreatedAt; + /** The GitHub URL of the alert resource. */ + html_url?: AlertHtmlUrl; + /** The security alert number. */ + number?: AlertNumber; + /** **Required when the \`state\` is \`resolved\`.** The reason for resolving the alert. Can be one of \`false_positive\`, \`wont_fix\`, \`revoked\`, or \`used_in_tests\`. */ + resolution?: SecretScanningAlertResolution; + /** + * The time that the alert was resolved in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. + * @format date-time + */ + resolved_at?: string | null; + /** Simple User */ + resolved_by?: SimpleUser; + /** The secret that was detected. */ + secret?: string; + /** The type of secret that secret scanning detected. */ + secret_type?: string; + /** Sets the state of the secret scanning alert. Can be either \`open\` or \`resolved\`. You must provide \`resolution\` when you set the state to \`resolved\`. */ + state?: SecretScanningAlertState; + /** The REST API URL of the alert resource. */ + url?: AlertUrl; +} + +/** **Required when the \`state\` is \`resolved\`.** The reason for resolving the alert. Can be one of \`false_positive\`, \`wont_fix\`, \`revoked\`, or \`used_in_tests\`. */ +export type SecretScanningAlertResolution = SecretScanningAlertResolutionEnum | null; + +export enum SecretScanningAlertResolutionEnum { + FalsePositive = "false_positive", + WontFix = "wont_fix", + Revoked = "revoked", + UsedInTests = "used_in_tests", +} + +/** Sets the state of the secret scanning alert. Can be either \`open\` or \`resolved\`. You must provide \`resolution\` when you set the state to \`resolved\`. */ +export enum SecretScanningAlertState { + Open = "open", + Resolved = "resolved", +} + +export type SecretScanningGetAlertData = SecretScanningAlert; + +export type SecretScanningListAlertsForRepoData = SecretScanningAlert[]; + +export interface SecretScanningListAlertsForRepoParams { + owner: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + repo: string; + /** Set to \`open\` or \`resolved\` to only list secret scanning alerts in a specific state. */ + state?: StateEnum7; +} + +/** Set to \`open\` or \`resolved\` to only list secret scanning alerts in a specific state. */ +export enum SecretScanningListAlertsForRepoParams1StateEnum { + Open = "open", + Resolved = "resolved", +} + +export type SecretScanningUpdateAlertData = SecretScanningAlert; + +export interface SecretScanningUpdateAlertPayload { + /** **Required when the \`state\` is \`resolved\`.** The reason for resolving the alert. Can be one of \`false_positive\`, \`wont_fix\`, \`revoked\`, or \`used_in_tests\`. */ + resolution?: SecretScanningAlertResolution; + /** Sets the state of the secret scanning alert. Can be either \`open\` or \`resolved\`. You must provide \`resolution\` when you set the state to \`resolved\`. */ + state: SecretScanningAlertState; +} + +export interface SelectedActions { + /** Whether GitHub-owned actions are allowed. For example, this includes the actions in the \`actions\` organization. */ + github_owned_allowed: boolean; + /** Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, \`monalisa/octocat@*\`, \`monalisa/octocat@v2\`, \`monalisa/*\`." */ + patterns_allowed: string[]; + /** Whether actions in GitHub Marketplace from verified creators are allowed. Set to \`true\` to allow all GitHub Marketplace actions by verified creators. */ + verified_allowed: boolean; +} + +/** The API URL to use to get or set the actions that are allowed to run, when \`allowed_actions\` is set to \`selected\`. */ +export type SelectedActionsUrl = string; + +/** Service Unavailable */ +export interface ServiceUnavailable { + code?: string; + documentation_url?: string; + message?: string; +} + +/** + * Short Blob + * Short Blob + */ +export interface ShortBlob { + sha: string; + url: string; +} + +/** + * Short Branch + * Short Branch + */ +export interface ShortBranch { + commit: { + sha: string; + /** @format uri */ + url: string; + }; + name: string; + protected: boolean; + /** Branch Protection */ + protection?: BranchProtection; + /** @format uri */ + protection_url?: string; +} + +/** + * Simple Commit + * Simple Commit + */ +export interface SimpleCommit { + author: { + email: string; + name: string; + } | null; + committer: { + email: string; + name: string; + } | null; + id: string; + message: string; + /** @format date-time */ + timestamp: string; + tree_id: string; +} + +/** Simple Commit Status */ +export interface SimpleCommitStatus { + /** @format uri */ + avatar_url: string | null; + context: string; + /** @format date-time */ + created_at: string; + description: string | null; + id: number; + node_id: string; + required?: boolean | null; + state: string; + /** @format uri */ + target_url: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; +} + +/** + * Simple User + * Simple User + */ +export type SimpleUser = { + /** + * @format uri + * @example "https://github.com/images/error/octocat_happy.gif" + */ + avatar_url: string; + /** @example "https://api.github.com/users/octocat/events{/privacy}" */ + events_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/followers" + */ + followers_url: string; + /** @example "https://api.github.com/users/octocat/following{/other_user}" */ + following_url: string; + /** @example "https://api.github.com/users/octocat/gists{/gist_id}" */ + gists_url: string; + /** @example "41d064eb2195891e12d0413f63227ea7" */ + gravatar_id: string | null; + /** + * @format uri + * @example "https://github.com/octocat" + */ + html_url: string; + /** @example 1 */ + id: number; + /** @example "octocat" */ + login: string; + /** @example "MDQ6VXNlcjE=" */ + node_id: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/orgs" + */ + organizations_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/received_events" + */ + received_events_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/repos" + */ + repos_url: string; + site_admin: boolean; + /** @example ""2020-07-09T00:17:55Z"" */ + starred_at?: string; + /** @example "https://api.github.com/users/octocat/starred{/owner}{/repo}" */ + starred_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/subscriptions" + */ + subscriptions_url: string; + /** @example "User" */ + type: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat" + */ + url: string; +}; + +/** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ +export enum SortEnum { + Created = "created", + Updated = "updated", + Comments = "comments", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum SortEnum1 { + Created = "created", + Updated = "updated", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum SortEnum10 { + Created = "created", + Updated = "updated", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum SortEnum11 { + Created = "created", + Updated = "updated", +} + +/** Sorts the results of your query. Can only be \`indexed\`, which indicates how recently a file has been indexed by the GitHub search infrastructure. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SortEnum12 { + Indexed = "indexed", +} + +/** Sorts the results of your query by \`author-date\` or \`committer-date\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SortEnum13 { + AuthorDate = "author-date", + CommitterDate = "committer-date", +} + +/** Sorts the results of your query by the number of \`comments\`, \`reactions\`, \`reactions-+1\`, \`reactions--1\`, \`reactions-smile\`, \`reactions-thinking_face\`, \`reactions-heart\`, \`reactions-tada\`, or \`interactions\`. You can also sort results by how recently the items were \`created\` or \`updated\`, Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SortEnum14 { + Comments = "comments", + Reactions = "reactions", + Reactions1 = "reactions-+1", + Reactions11 = "reactions--1", + ReactionsSmile = "reactions-smile", + ReactionsThinkingFace = "reactions-thinking_face", + ReactionsHeart = "reactions-heart", + ReactionsTada = "reactions-tada", + Interactions = "interactions", + Created = "created", + Updated = "updated", +} + +/** Sorts the results of your query by when the label was \`created\` or \`updated\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SortEnum15 { + Created = "created", + Updated = "updated", +} + +/** Sorts the results of your query by number of \`stars\`, \`forks\`, or \`help-wanted-issues\` or how recently the items were \`updated\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SortEnum16 { + Stars = "stars", + Forks = "forks", + HelpWantedIssues = "help-wanted-issues", + Updated = "updated", +} + +/** Sorts the results of your query by number of \`followers\` or \`repositories\`, or when the person \`joined\` GitHub. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ +export enum SortEnum17 { + Followers = "followers", + Repositories = "repositories", + Joined = "joined", +} + +/** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ +export enum SortEnum18 { + Created = "created", + Updated = "updated", + Comments = "comments", +} + +/** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "full_name" + */ +export enum SortEnum19 { + Created = "created", + Updated = "updated", + Pushed = "pushed", + FullName = "full_name", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum SortEnum2 { + Created = "created", + Updated = "updated", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum SortEnum20 { + Created = "created", + Updated = "updated", +} + +/** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "full_name" + */ +export enum SortEnum21 { + Created = "created", + Updated = "updated", + Pushed = "pushed", + FullName = "full_name", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum SortEnum22 { + Created = "created", + Updated = "updated", +} + +/** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ +export enum SortEnum3 { + Created = "created", + Updated = "updated", + Comments = "comments", +} + +/** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "created" + */ +export enum SortEnum4 { + Created = "created", + Updated = "updated", + Pushed = "pushed", + FullName = "full_name", +} + +/** + * The sort order. Can be either \`newest\`, \`oldest\`, or \`stargazers\`. + * @default "newest" + */ +export enum SortEnum5 { + Newest = "newest", + Oldest = "oldest", + Stargazers = "stargazers", +} + +/** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ +export enum SortEnum6 { + Created = "created", + Updated = "updated", + Comments = "comments", +} + +/** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ +export enum SortEnum7 { + Created = "created", + Updated = "updated", +} + +/** + * What to sort results by. Either \`due_on\` or \`completeness\`. + * @default "due_on" + */ +export enum SortEnum8 { + DueOn = "due_on", + Completeness = "completeness", +} + +/** + * What to sort results by. Can be either \`created\`, \`updated\`, \`popularity\` (comment count) or \`long-running\` (age, filtering by pulls updated in the last month). + * @default "created" + */ +export enum SortEnum9 { + Created = "created", + Updated = "updated", + Popularity = "popularity", + LongRunning = "long-running", +} + +/** + * Stargazer + * Stargazer + */ +export interface Stargazer { + /** @format date-time */ + starred_at: string; + user: SimpleUser | null; +} + +/** + * Starred Repository + * Starred Repository + */ +export interface StarredRepository { + /** A git repository */ + repo: Repository; + /** @format date-time */ + starred_at: string; +} + +/** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum StateEnum { + Open = "open", + Closed = "closed", + All = "all", +} + +/** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum StateEnum1 { + Open = "open", + Closed = "closed", + All = "all", +} + +/** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum StateEnum10 { + Open = "open", + Closed = "closed", + All = "all", +} + +/** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum StateEnum2 { + Open = "open", + Closed = "closed", + All = "all", +} + +/** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum StateEnum3 { + Open = "open", + Closed = "closed", + All = "all", +} + +/** + * The state of the milestone. Either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum StateEnum4 { + Open = "open", + Closed = "closed", + All = "all", +} + +/** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum StateEnum5 { + Open = "open", + Closed = "closed", + All = "all", +} + +/** + * Either \`open\`, \`closed\`, or \`all\` to filter by state. + * @default "open" + */ +export enum StateEnum6 { + Open = "open", + Closed = "closed", + All = "all", +} + +/** Set to \`open\` or \`resolved\` to only list secret scanning alerts in a specific state. */ +export enum StateEnum7 { + Open = "open", + Resolved = "resolved", +} + +/** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ +export enum StateEnum8 { + Open = "open", + Closed = "closed", + All = "all", +} + +/** Indicates the state of the memberships to return. Can be either \`active\` or \`pending\`. If not specified, the API returns both active and pending memberships. */ +export enum StateEnum9 { + Active = "active", + Pending = "pending", +} + +/** + * Status + * The status of a commit. + */ +export interface Status { + avatar_url: string | null; + context: string; + created_at: string; + /** Simple User */ + creator: SimpleUser; + description: string; + id: number; + node_id: string; + state: string; + target_url: string; + updated_at: string; + url: string; +} + +/** + * Status Check Policy + * Status Check Policy + */ +export interface StatusCheckPolicy { + /** @example ["continuous-integration/travis-ci"] */ + contexts: string[]; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks/contexts" + */ + contexts_url: string; + /** @example true */ + strict: boolean; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks" + */ + url: string; +} + +/** Returns workflow runs associated with the check run \`status\` or \`conclusion\` you specify. For example, a conclusion can be \`success\` or a status can be \`completed\`. For more information, see the \`status\` and \`conclusion\` options available in "[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run)." */ +export enum StatusEnum { + Completed = "completed", + Status = "status", + Conclusion = "conclusion", +} + +/** Returns workflow runs associated with the check run \`status\` or \`conclusion\` you specify. For example, a conclusion can be \`success\` or a status can be \`completed\`. For more information, see the \`status\` and \`conclusion\` options available in "[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run)." */ +export enum StatusEnum1 { + Completed = "completed", + Status = "status", + Conclusion = "conclusion", +} + +/** Returns check runs with the specified \`status\`. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ +export enum StatusEnum2 { + Queued = "queued", + InProgress = "in_progress", + Completed = "completed", +} + +/** Returns check runs with the specified \`status\`. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ +export enum StatusEnum3 { + Queued = "queued", + InProgress = "in_progress", + Completed = "completed", +} + +/** Identifies which additional information you'd like to receive about the person's hovercard. Can be \`organization\`, \`repository\`, \`issue\`, \`pull_request\`. **Required** when using \`subject_id\`. */ +export enum SubjectTypeEnum { + Organization = "organization", + Repository = "repository", + Issue = "issue", + PullRequest = "pull_request", +} + +/** + * Tag + * Tag + */ +export interface Tag { + commit: { + sha: string; + /** @format uri */ + url: string; + }; + /** @example "v0.1" */ + name: string; + node_id: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/tarball/v0.1" + */ + tarball_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/zipball/v0.1" + */ + zipball_url: string; +} + +/** + * Team + * Groups of organization members that gives permissions on specified repositories. + */ +export interface Team { + description: string | null; + /** + * @format uri + * @example "https://github.com/orgs/rails/teams/core" + */ + html_url: string; + id: number; + members_url: string; + name: string; + node_id: string; + parent?: TeamSimple | null; + permission: string; + privacy?: string; + /** @format uri */ + repositories_url: string; + slug: string; + /** @format uri */ + url: string; +} + +/** + * Team Discussion + * A team discussion is a persistent record of a free-form conversation within a team. + */ +export interface TeamDiscussion { + author: SimpleUser | null; + /** + * The main text of the discussion. + * @example "Please suggest improvements to our workflow in comments." + */ + body: string; + /** @example "

Hi! This is an area for us to collaborate as a team

" */ + body_html: string; + /** + * The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. + * @example "0307116bbf7ced493b8d8a346c650b71" + */ + body_version: string; + /** @example 0 */ + comments_count: number; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/2343027/discussions/1/comments" + */ + comments_url: string; + /** + * @format date-time + * @example "2018-01-25T18:56:31Z" + */ + created_at: string; + /** + * @format uri + * @example "https://github.com/orgs/github/teams/justice-league/discussions/1" + */ + html_url: string; + /** @format date-time */ + last_edited_at: string | null; + /** @example "MDE0OlRlYW1EaXNjdXNzaW9uMQ==" */ + node_id: string; + /** + * The unique sequence number of a team discussion. + * @example 42 + */ + number: number; + /** + * Whether or not this discussion should be pinned for easy retrieval. + * @example true + */ + pinned: boolean; + /** + * Whether or not this discussion should be restricted to team members and organization administrators. + * @example true + */ + private: boolean; + reactions?: ReactionRollup; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/2343027" + */ + team_url: string; + /** + * The title of the discussion. + * @example "How can we improve our workflow?" + */ + title: string; + /** + * @format date-time + * @example "2018-01-25T18:56:31Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/2343027/discussions/1" + */ + url: string; +} + +/** + * Team Discussion Comment + * A reply to a discussion within a team. + */ +export interface TeamDiscussionComment { + author: SimpleUser | null; + /** + * The main text of the comment. + * @example "I agree with this suggestion." + */ + body: string; + /** @example "

Do you like apples?

" */ + body_html: string; + /** + * The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. + * @example "0307116bbf7ced493b8d8a346c650b71" + */ + body_version: string; + /** + * @format date-time + * @example "2018-01-15T23:53:58Z" + */ + created_at: string; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/2403582/discussions/1" + */ + discussion_url: string; + /** + * @format uri + * @example "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1" + */ + html_url: string; + /** @format date-time */ + last_edited_at: string | null; + /** @example "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=" */ + node_id: string; + /** + * The unique sequence number of a team discussion comment. + * @example 42 + */ + number: number; + reactions?: ReactionRollup; + /** + * @format date-time + * @example "2018-01-15T23:53:58Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/2403582/discussions/1/comments/1" + */ + url: string; +} + +/** + * Full Team + * Groups of organization members that gives permissions on specified repositories. + */ +export interface TeamFull { + /** + * @format date-time + * @example "2017-07-14T16:53:42Z" + */ + created_at: string; + /** @example "A great team." */ + description: string | null; + /** + * @format uri + * @example "https://github.com/orgs/rails/teams/core" + */ + html_url: string; + /** + * Unique identifier of the team + * @example 42 + */ + id: number; + /** + * Distinguished Name (DN) that team maps to within LDAP environment + * @example "uid=example,ou=users,dc=github,dc=com" + */ + ldap_dn?: string; + /** @example 3 */ + members_count: number; + /** @example "https://api.github.com/organizations/1/team/1/members{/member}" */ + members_url: string; + /** + * Name of the team + * @example "Developers" + */ + name: string; + /** @example "MDQ6VGVhbTE=" */ + node_id: string; + /** Organization Full */ + organization: OrganizationFull; + parent?: TeamSimple | null; + /** + * Permission that the team will have for its repositories + * @example "push" + */ + permission: string; + /** + * The level of privacy this team should have + * @example "closed" + */ + privacy?: TeamFullPrivacyEnum; + /** @example 10 */ + repos_count: number; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/1/repos" + */ + repositories_url: string; + /** @example "justice-league" */ + slug: string; + /** + * @format date-time + * @example "2017-08-17T12:37:15Z" + */ + updated_at: string; + /** + * URL for the team + * @format uri + * @example "https://api.github.com/organizations/1/team/1" + */ + url: string; +} + +/** + * The level of privacy this team should have + * @example "closed" + */ +export enum TeamFullPrivacyEnum { + Closed = "closed", + Secret = "secret", +} + +/** + * Team Membership + * Team Membership + */ +export interface TeamMembership { + /** + * The role of the user in the team. + * @default "member" + * @example "member" + */ + role: TeamMembershipRoleEnum; + state: string; + /** @format uri */ + url: string; +} + +/** + * The role of the user in the team. + * @default "member" + * @example "member" + */ +export enum TeamMembershipRoleEnum { + Member = "member", + Maintainer = "maintainer", +} + +/** + * Team Project + * A team's access to a project. + */ +export interface TeamProject { + body: string | null; + columns_url: string; + created_at: string; + /** Simple User */ + creator: SimpleUser; + html_url: string; + id: number; + name: string; + node_id: string; + number: number; + /** The organization permission for this project. Only present when owner is an organization. */ + organization_permission?: string; + owner_url: string; + permissions: { + admin: boolean; + read: boolean; + write: boolean; + }; + /** Whether the project is private or not. Only present when owner is an organization. */ + private?: boolean; + state: string; + updated_at: string; + url: string; +} + +/** + * Team Repository + * A team's access to a repository. + */ +export interface TeamRepository { + /** + * Whether to allow merge commits for pull requests. + * @default true + * @example true + */ + allow_merge_commit?: boolean; + /** + * Whether to allow rebase merges for pull requests. + * @default true + * @example true + */ + allow_rebase_merge?: boolean; + /** + * Whether to allow squash merges for pull requests. + * @default true + * @example true + */ + allow_squash_merge?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ + archive_url: string; + /** + * Whether the repository is archived. + * @default false + */ + archived: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ + assignees_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ + blobs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ + branches_url: string; + /** @example "https://github.com/octocat/Hello-World.git" */ + clone_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ + collaborators_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ + comments_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ + commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ + compare_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ + contents_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/contributors" + */ + contributors_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at: string | null; + /** + * The default branch of the repository. + * @example "master" + */ + default_branch: string; + /** + * Whether to delete head branches when pull requests are merged + * @default false + * @example false + */ + delete_branch_on_merge?: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/deployments" + */ + deployments_url: string; + /** @example "This your first repo!" */ + description: string | null; + /** Returns whether or not this repository disabled. */ + disabled: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/downloads" + */ + downloads_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/events" + */ + events_url: string; + fork: boolean; + forks: number; + /** @example 9 */ + forks_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/forks" + */ + forks_url: string; + /** @example "octocat/Hello-World" */ + full_name: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ + git_commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ + git_refs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ + git_tags_url: string; + /** @example "git:github.com/octocat/Hello-World.git" */ + git_url: string; + /** + * Whether downloads are enabled. + * @default true + * @example true + */ + has_downloads: boolean; + /** + * Whether issues are enabled. + * @default true + * @example true + */ + has_issues: boolean; + has_pages: boolean; + /** + * Whether projects are enabled. + * @default true + * @example true + */ + has_projects: boolean; + /** + * Whether the wiki is enabled. + * @default true + * @example true + */ + has_wiki: boolean; + /** + * @format uri + * @example "https://github.com" + */ + homepage: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/hooks" + */ + hooks_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World" + */ + html_url: string; + /** + * Unique identifier of the repository + * @example 42 + */ + id: number; + /** + * Whether this repository acts as a template that can be used to generate new repositories. + * @default false + * @example true + */ + is_template?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ + issue_comment_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ + issue_events_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ + issues_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ + keys_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ + labels_url: string; + language: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/languages" + */ + languages_url: string; + license: LicenseSimple | null; + master_branch?: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/merges" + */ + merges_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ + milestones_url: string; + /** + * @format uri + * @example "git:git.example.com/octocat/Hello-World" + */ + mirror_url: string | null; + /** + * The name of the repository. + * @example "Team Environment" + */ + name: string; + network_count?: number; + /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ + node_id: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ + notifications_url: string; + open_issues: number; + /** @example 0 */ + open_issues_count: number; + owner: SimpleUser | null; + permissions?: { + admin: boolean; + maintain?: boolean; + pull: boolean; + push: boolean; + triage?: boolean; + }; + /** + * Whether the repository is private or public. + * @default false + */ + private: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ + pulls_url: string; + /** + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + pushed_at: string | null; + /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ + releases_url: string; + /** @example 108 */ + size: number; + /** @example "git@github.com:octocat/Hello-World.git" */ + ssh_url: string; + /** @example 80 */ + stargazers_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" + */ + stargazers_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ + statuses_url: string; + subscribers_count?: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" + */ + subscribers_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscription" + */ + subscription_url: string; + /** + * @format uri + * @example "https://svn.github.com/octocat/Hello-World" + */ + svn_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/tags" + */ + tags_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/teams" + */ + teams_url: string; + temp_clone_token?: string; + template_repository?: Repository | null; + topics?: string[]; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ + trees_url: string; + /** + * @format date-time + * @example "2011-01-26T19:14:43Z" + */ + updated_at: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World" + */ + url: string; + /** + * The repository visibility: public, private, or internal. + * @default "public" + */ + visibility?: string; + watchers: number; + /** @example 80 */ + watchers_count: number; +} + +/** + * Team Simple + * Groups of organization members that gives permissions on specified repositories. + */ +export type TeamSimple = { + /** + * Description of the team + * @example "A great team." + */ + description: string | null; + /** + * @format uri + * @example "https://github.com/orgs/rails/teams/core" + */ + html_url: string; + /** + * Unique identifier of the team + * @example 1 + */ + id: number; + /** + * Distinguished Name (DN) that team maps to within LDAP environment + * @example "uid=example,ou=users,dc=github,dc=com" + */ + ldap_dn?: string; + /** @example "https://api.github.com/organizations/1/team/1/members{/member}" */ + members_url: string; + /** + * Name of the team + * @example "Justice League" + */ + name: string; + /** @example "MDQ6VGVhbTE=" */ + node_id: string; + /** + * Permission that the team will have for its repositories + * @example "admin" + */ + permission: string; + /** + * The level of privacy this team should have + * @example "closed" + */ + privacy?: string; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/1/repos" + */ + repositories_url: string; + /** @example "justice-league" */ + slug: string; + /** + * URL for the team + * @format uri + * @example "https://api.github.com/organizations/1/team/1" + */ + url: string; +}; + +export type TeamsAddMemberLegacyData = any; + +export type TeamsAddMemberLegacyError = { + /** @example ""https://docs.github.com/rest"" */ + documentation_url?: string; + errors?: { + code?: string; + field?: string; + resource?: string; + }[]; + message?: string; +}; + +export type TeamsAddOrUpdateMembershipForUserInOrgData = TeamMembership; + +export type TeamsAddOrUpdateMembershipForUserInOrgError = { + errors?: { + code?: string; + field?: string; + resource?: string; + }[]; + message?: string; +}; + +export interface TeamsAddOrUpdateMembershipForUserInOrgPayload { + /** + * The role that this user should have in the team. Can be one of: + * \\* \`member\` - a normal member of the team. + * \\* \`maintainer\` - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description. + * @default "member" + */ + role?: TeamsAddOrUpdateMembershipForUserInOrgRoleEnum; +} + +/** + * The role that this user should have in the team. Can be one of: + * \\* \`member\` - a normal member of the team. + * \\* \`maintainer\` - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description. + * @default "member" + */ +export enum TeamsAddOrUpdateMembershipForUserInOrgRoleEnum { + Member = "member", + Maintainer = "maintainer", +} + +export type TeamsAddOrUpdateMembershipForUserLegacyData = TeamMembership; + +export type TeamsAddOrUpdateMembershipForUserLegacyError = { + /** @example ""https://help.github.com/articles/github-and-trade-controls"" */ + documentation_url?: string; + errors?: { + code?: string; + field?: string; + resource?: string; + }[]; + message?: string; +}; + +export interface TeamsAddOrUpdateMembershipForUserLegacyPayload { + /** + * The role that this user should have in the team. Can be one of: + * \\* \`member\` - a normal member of the team. + * \\* \`maintainer\` - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description. + * @default "member" + */ + role?: TeamsAddOrUpdateMembershipForUserLegacyRoleEnum; +} + +/** + * The role that this user should have in the team. Can be one of: + * \\* \`member\` - a normal member of the team. + * \\* \`maintainer\` - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description. + * @default "member" + */ +export enum TeamsAddOrUpdateMembershipForUserLegacyRoleEnum { + Member = "member", + Maintainer = "maintainer", +} + +export type TeamsAddOrUpdateProjectPermissionsInOrgData = any; + +export type TeamsAddOrUpdateProjectPermissionsInOrgError = { + documentation_url?: string; + message?: string; +}; + +export interface TeamsAddOrUpdateProjectPermissionsInOrgPayload { + /** + * The permission to grant to the team for this project. Can be one of: + * \\* \`read\` - team members can read, but not write to or administer this project. + * \\* \`write\` - team members can read and write, but not administer this project. + * \\* \`admin\` - team members can read, write and administer this project. + * Default: the team's \`permission\` attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + */ + permission?: TeamsAddOrUpdateProjectPermissionsInOrgPermissionEnum; +} + +/** + * The permission to grant to the team for this project. Can be one of: + * \\* \`read\` - team members can read, but not write to or administer this project. + * \\* \`write\` - team members can read and write, but not administer this project. + * \\* \`admin\` - team members can read, write and administer this project. + * Default: the team's \`permission\` attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + */ +export enum TeamsAddOrUpdateProjectPermissionsInOrgPermissionEnum { + Read = "read", + Write = "write", + Admin = "admin", +} + +export type TeamsAddOrUpdateProjectPermissionsLegacyData = any; + +export type TeamsAddOrUpdateProjectPermissionsLegacyError = { + documentation_url?: string; + message?: string; +}; + +export interface TeamsAddOrUpdateProjectPermissionsLegacyPayload { + /** + * The permission to grant to the team for this project. Can be one of: + * \\* \`read\` - team members can read, but not write to or administer this project. + * \\* \`write\` - team members can read and write, but not administer this project. + * \\* \`admin\` - team members can read, write and administer this project. + * Default: the team's \`permission\` attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + */ + permission?: TeamsAddOrUpdateProjectPermissionsLegacyPermissionEnum; +} + +/** + * The permission to grant to the team for this project. Can be one of: + * \\* \`read\` - team members can read, but not write to or administer this project. + * \\* \`write\` - team members can read and write, but not administer this project. + * \\* \`admin\` - team members can read, write and administer this project. + * Default: the team's \`permission\` attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + */ +export enum TeamsAddOrUpdateProjectPermissionsLegacyPermissionEnum { + Read = "read", + Write = "write", + Admin = "admin", +} + +export type TeamsAddOrUpdateRepoPermissionsInOrgData = any; + +export interface TeamsAddOrUpdateRepoPermissionsInOrgPayload { + /** + * The permission to grant the team on this repository. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer this repository. + * \\* \`push\` - team members can pull and push, but not administer this repository. + * \\* \`admin\` - team members can pull, push and administer this repository. + * \\* \`maintain\` - team members can manage the repository without access to sensitive or destructive actions. Recommended for project managers. Only applies to repositories owned by organizations. + * \\* \`triage\` - team members can proactively manage issues and pull requests without write access. Recommended for contributors who triage a repository. Only applies to repositories owned by organizations. + * + * If no permission is specified, the team's \`permission\` attribute will be used to determine what permission to grant the team on this repository. + */ + permission?: TeamsAddOrUpdateRepoPermissionsInOrgPermissionEnum; +} + +/** + * The permission to grant the team on this repository. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer this repository. + * \\* \`push\` - team members can pull and push, but not administer this repository. + * \\* \`admin\` - team members can pull, push and administer this repository. + * \\* \`maintain\` - team members can manage the repository without access to sensitive or destructive actions. Recommended for project managers. Only applies to repositories owned by organizations. + * \\* \`triage\` - team members can proactively manage issues and pull requests without write access. Recommended for contributors who triage a repository. Only applies to repositories owned by organizations. + * + * If no permission is specified, the team's \`permission\` attribute will be used to determine what permission to grant the team on this repository. + */ +export enum TeamsAddOrUpdateRepoPermissionsInOrgPermissionEnum { + Pull = "pull", + Push = "push", + Admin = "admin", + Maintain = "maintain", + Triage = "triage", +} + +export type TeamsAddOrUpdateRepoPermissionsLegacyData = any; + +export interface TeamsAddOrUpdateRepoPermissionsLegacyPayload { + /** + * The permission to grant the team on this repository. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer this repository. + * \\* \`push\` - team members can pull and push, but not administer this repository. + * \\* \`admin\` - team members can pull, push and administer this repository. + * + * If no permission is specified, the team's \`permission\` attribute will be used to determine what permission to grant the team on this repository. + */ + permission?: TeamsAddOrUpdateRepoPermissionsLegacyPermissionEnum; +} + +/** + * The permission to grant the team on this repository. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer this repository. + * \\* \`push\` - team members can pull and push, but not administer this repository. + * \\* \`admin\` - team members can pull, push and administer this repository. + * + * If no permission is specified, the team's \`permission\` attribute will be used to determine what permission to grant the team on this repository. + */ +export enum TeamsAddOrUpdateRepoPermissionsLegacyPermissionEnum { + Pull = "pull", + Push = "push", + Admin = "admin", +} + +export type TeamsCheckPermissionsForProjectInOrgData = TeamProject; + +export type TeamsCheckPermissionsForProjectLegacyData = TeamProject; + +export type TeamsCheckPermissionsForRepoInOrgData = TeamRepository; + +export type TeamsCheckPermissionsForRepoLegacyData = TeamRepository; + +export type TeamsCreateData = TeamFull; + +export type TeamsCreateDiscussionCommentInOrgData = TeamDiscussionComment; + +export interface TeamsCreateDiscussionCommentInOrgPayload { + /** The discussion comment's body text. */ + body: string; +} + +export type TeamsCreateDiscussionCommentLegacyData = TeamDiscussionComment; + +export interface TeamsCreateDiscussionCommentLegacyPayload { + /** The discussion comment's body text. */ + body: string; +} + +export type TeamsCreateDiscussionInOrgData = TeamDiscussion; + +export interface TeamsCreateDiscussionInOrgPayload { + /** The discussion post's body text. */ + body: string; + /** + * Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to \`true\` to create a private post. + * @default false + */ + private?: boolean; + /** The discussion post's title. */ + title: string; +} + +export type TeamsCreateDiscussionLegacyData = TeamDiscussion; + +export interface TeamsCreateDiscussionLegacyPayload { + /** The discussion post's body text. */ + body: string; + /** + * Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to \`true\` to create a private post. + * @default false + */ + private?: boolean; + /** The discussion post's title. */ + title: string; +} + +export type TeamsCreateOrUpdateIdpGroupConnectionsInOrgData = GroupMapping; + +export interface TeamsCreateOrUpdateIdpGroupConnectionsInOrgPayload { + /** The IdP groups you want to connect to a GitHub team. When updating, the new \`groups\` object will replace the original one. You must include any existing groups that you don't want to remove. */ + groups: { + /** Description of the IdP group. */ + group_description: string; + /** ID of the IdP group. */ + group_id: string; + /** Name of the IdP group. */ + group_name: string; + }[]; +} + +export type TeamsCreateOrUpdateIdpGroupConnectionsLegacyData = GroupMapping; + +export interface TeamsCreateOrUpdateIdpGroupConnectionsLegacyPayload { + /** The IdP groups you want to connect to a GitHub team. When updating, the new \`groups\` object will replace the original one. You must include any existing groups that you don't want to remove. */ + groups: { + /** @example ""moar cheese pleese"" */ + description?: string; + /** Description of the IdP group. */ + group_description: string; + /** ID of the IdP group. */ + group_id: string; + /** Name of the IdP group. */ + group_name: string; + /** @example ""caceab43fc9ffa20081c"" */ + id?: string; + /** @example ""external-team-6c13e7288ef7"" */ + name?: string; + }[]; + /** @example ""I am not a timestamp"" */ + synced_at?: string; +} + +export interface TeamsCreatePayload { + /** The description of the team. */ + description?: string; + /** List GitHub IDs for organization members who will become team maintainers. */ + maintainers?: string[]; + /** The name of the team. */ + name: string; + /** The ID of a team to set as the parent team. */ + parent_team_id?: number; + /** + * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer newly-added repositories. + * \\* \`push\` - team members can pull and push, but not administer newly-added repositories. + * \\* \`admin\` - team members can pull, push and administer newly-added repositories. + * @default "pull" + */ + permission?: TeamsCreatePermissionEnum; + /** + * The level of privacy this team should have. The options are: + * **For a non-nested team:** + * \\* \`secret\` - only visible to organization owners and members of this team. + * \\* \`closed\` - visible to all members of this organization. + * Default: \`secret\` + * **For a parent or child team:** + * \\* \`closed\` - visible to all members of this organization. + * Default for child team: \`closed\` + */ + privacy?: TeamsCreatePrivacyEnum; + /** The full name (e.g., "organization-name/repository-name") of repositories to add the team to. */ + repo_names?: string[]; +} + +/** + * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer newly-added repositories. + * \\* \`push\` - team members can pull and push, but not administer newly-added repositories. + * \\* \`admin\` - team members can pull, push and administer newly-added repositories. + * @default "pull" + */ +export enum TeamsCreatePermissionEnum { + Pull = "pull", + Push = "push", + Admin = "admin", +} + +/** + * The level of privacy this team should have. The options are: + * **For a non-nested team:** + * \\* \`secret\` - only visible to organization owners and members of this team. + * \\* \`closed\` - visible to all members of this organization. + * Default: \`secret\` + * **For a parent or child team:** + * \\* \`closed\` - visible to all members of this organization. + * Default for child team: \`closed\` + */ +export enum TeamsCreatePrivacyEnum { + Secret = "secret", + Closed = "closed", +} + +export type TeamsDeleteDiscussionCommentInOrgData = any; + +export type TeamsDeleteDiscussionCommentLegacyData = any; + +export type TeamsDeleteDiscussionInOrgData = any; + +export type TeamsDeleteDiscussionLegacyData = any; + +export type TeamsDeleteInOrgData = any; + +export type TeamsDeleteLegacyData = any; + +export type TeamsGetByNameData = TeamFull; + +export type TeamsGetDiscussionCommentInOrgData = TeamDiscussionComment; + +export type TeamsGetDiscussionCommentLegacyData = TeamDiscussionComment; + +export type TeamsGetDiscussionInOrgData = TeamDiscussion; + +export type TeamsGetDiscussionLegacyData = TeamDiscussion; + +export type TeamsGetLegacyData = TeamFull; + +export type TeamsGetMemberLegacyData = any; + +export type TeamsGetMembershipForUserInOrgData = TeamMembership; + +export type TeamsGetMembershipForUserLegacyData = TeamMembership; + +export type TeamsListChildInOrgData = Team[]; + +export interface TeamsListChildInOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** team_slug parameter */ + teamSlug: string; +} + +export type TeamsListChildLegacyData = Team[]; + +export interface TeamsListChildLegacyParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + teamId: number; +} + +export type TeamsListData = Team[]; + +export type TeamsListDiscussionCommentsInOrgData = TeamDiscussionComment[]; + +export interface TeamsListDiscussionCommentsInOrgParams { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: DirectionEnum6; + discussionNumber: number; + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** team_slug parameter */ + teamSlug: string; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum TeamsListDiscussionCommentsInOrgParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +export type TeamsListDiscussionCommentsLegacyData = TeamDiscussionComment[]; + +export interface TeamsListDiscussionCommentsLegacyParams { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: DirectionEnum14; + discussionNumber: number; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + teamId: number; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum TeamsListDiscussionCommentsLegacyParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +export type TeamsListDiscussionsInOrgData = TeamDiscussion[]; + +export interface TeamsListDiscussionsInOrgParams { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: DirectionEnum5; + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** team_slug parameter */ + teamSlug: string; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum TeamsListDiscussionsInOrgParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +export type TeamsListDiscussionsLegacyData = TeamDiscussion[]; + +export interface TeamsListDiscussionsLegacyParams { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: DirectionEnum13; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + teamId: number; +} + +/** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ +export enum TeamsListDiscussionsLegacyParams1DirectionEnum { + Asc = "asc", + Desc = "desc", +} + +export type TeamsListForAuthenticatedUserData = TeamFull[]; + +export interface TeamsListForAuthenticatedUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type TeamsListIdpGroupsForLegacyData = GroupMapping; + +export type TeamsListIdpGroupsForOrgData = GroupMapping; + +export interface TeamsListIdpGroupsForOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type TeamsListIdpGroupsInOrgData = GroupMapping; + +export type TeamsListMembersInOrgData = SimpleUser[]; + +export interface TeamsListMembersInOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Filters members returned by their role in the team. Can be one of: + * \\* \`member\` - normal members of the team. + * \\* \`maintainer\` - team maintainers. + * \\* \`all\` - all members of the team. + * @default "all" + */ + role?: RoleEnum1; + /** team_slug parameter */ + teamSlug: string; +} + +/** + * Filters members returned by their role in the team. Can be one of: + * \\* \`member\` - normal members of the team. + * \\* \`maintainer\` - team maintainers. + * \\* \`all\` - all members of the team. + * @default "all" + */ +export enum TeamsListMembersInOrgParams1RoleEnum { + Member = "member", + Maintainer = "maintainer", + All = "all", +} + +export type TeamsListMembersLegacyData = SimpleUser[]; + +export interface TeamsListMembersLegacyParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Filters members returned by their role in the team. Can be one of: + * \\* \`member\` - normal members of the team. + * \\* \`maintainer\` - team maintainers. + * \\* \`all\` - all members of the team. + * @default "all" + */ + role?: RoleEnum2; + teamId: number; +} + +/** + * Filters members returned by their role in the team. Can be one of: + * \\* \`member\` - normal members of the team. + * \\* \`maintainer\` - team maintainers. + * \\* \`all\` - all members of the team. + * @default "all" + */ +export enum TeamsListMembersLegacyParams1RoleEnum { + Member = "member", + Maintainer = "maintainer", + All = "all", +} + +export interface TeamsListParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type TeamsListPendingInvitationsInOrgData = OrganizationInvitation[]; + +export interface TeamsListPendingInvitationsInOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** team_slug parameter */ + teamSlug: string; +} + +export type TeamsListPendingInvitationsLegacyData = OrganizationInvitation[]; + +export interface TeamsListPendingInvitationsLegacyParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + teamId: number; +} + +export type TeamsListProjectsInOrgData = TeamProject[]; + +export interface TeamsListProjectsInOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** team_slug parameter */ + teamSlug: string; +} + +export type TeamsListProjectsLegacyData = TeamProject[]; + +export interface TeamsListProjectsLegacyParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + teamId: number; +} + +export type TeamsListReposInOrgData = MinimalRepository[]; + +export interface TeamsListReposInOrgParams { + org: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** team_slug parameter */ + teamSlug: string; +} + +export type TeamsListReposLegacyData = MinimalRepository[]; + +export interface TeamsListReposLegacyParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + teamId: number; +} + +export type TeamsRemoveMemberLegacyData = any; + +export type TeamsRemoveMembershipForUserInOrgData = any; + +export type TeamsRemoveMembershipForUserLegacyData = any; + +export type TeamsRemoveProjectInOrgData = any; + +export type TeamsRemoveProjectLegacyData = any; + +export type TeamsRemoveRepoInOrgData = any; + +export type TeamsRemoveRepoLegacyData = any; + +export type TeamsUpdateDiscussionCommentInOrgData = TeamDiscussionComment; + +export interface TeamsUpdateDiscussionCommentInOrgPayload { + /** The discussion comment's body text. */ + body: string; +} + +export type TeamsUpdateDiscussionCommentLegacyData = TeamDiscussionComment; + +export interface TeamsUpdateDiscussionCommentLegacyPayload { + /** The discussion comment's body text. */ + body: string; +} + +export type TeamsUpdateDiscussionInOrgData = TeamDiscussion; + +export interface TeamsUpdateDiscussionInOrgPayload { + /** The discussion post's body text. */ + body?: string; + /** The discussion post's title. */ + title?: string; +} + +export type TeamsUpdateDiscussionLegacyData = TeamDiscussion; + +export interface TeamsUpdateDiscussionLegacyPayload { + /** The discussion post's body text. */ + body?: string; + /** The discussion post's title. */ + title?: string; +} + +export type TeamsUpdateInOrgData = TeamFull; + +export interface TeamsUpdateInOrgPayload { + /** The description of the team. */ + description?: string; + /** The name of the team. */ + name: string; + /** The ID of a team to set as the parent team. */ + parent_team_id?: number; + /** + * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer newly-added repositories. + * \\* \`push\` - team members can pull and push, but not administer newly-added repositories. + * \\* \`admin\` - team members can pull, push and administer newly-added repositories. + * @default "pull" + */ + permission?: TeamsUpdateInOrgPermissionEnum; + /** + * The level of privacy this team should have. Editing teams without specifying this parameter leaves \`privacy\` intact. When a team is nested, the \`privacy\` for parent teams cannot be \`secret\`. The options are: + * **For a non-nested team:** + * \\* \`secret\` - only visible to organization owners and members of this team. + * \\* \`closed\` - visible to all members of this organization. + * **For a parent or child team:** + * \\* \`closed\` - visible to all members of this organization. + */ + privacy?: TeamsUpdateInOrgPrivacyEnum; +} + +/** + * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer newly-added repositories. + * \\* \`push\` - team members can pull and push, but not administer newly-added repositories. + * \\* \`admin\` - team members can pull, push and administer newly-added repositories. + * @default "pull" + */ +export enum TeamsUpdateInOrgPermissionEnum { + Pull = "pull", + Push = "push", + Admin = "admin", +} + +/** + * The level of privacy this team should have. Editing teams without specifying this parameter leaves \`privacy\` intact. When a team is nested, the \`privacy\` for parent teams cannot be \`secret\`. The options are: + * **For a non-nested team:** + * \\* \`secret\` - only visible to organization owners and members of this team. + * \\* \`closed\` - visible to all members of this organization. + * **For a parent or child team:** + * \\* \`closed\` - visible to all members of this organization. + */ +export enum TeamsUpdateInOrgPrivacyEnum { + Secret = "secret", + Closed = "closed", +} + +export type TeamsUpdateLegacyData = TeamFull; + +export interface TeamsUpdateLegacyPayload { + /** The description of the team. */ + description?: string; + /** The name of the team. */ + name: string; + /** The ID of a team to set as the parent team. */ + parent_team_id?: number | null; + /** + * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer newly-added repositories. + * \\* \`push\` - team members can pull and push, but not administer newly-added repositories. + * \\* \`admin\` - team members can pull, push and administer newly-added repositories. + * @default "pull" + */ + permission?: TeamsUpdateLegacyPermissionEnum; + /** + * The level of privacy this team should have. Editing teams without specifying this parameter leaves \`privacy\` intact. The options are: + * **For a non-nested team:** + * \\* \`secret\` - only visible to organization owners and members of this team. + * \\* \`closed\` - visible to all members of this organization. + * **For a parent or child team:** + * \\* \`closed\` - visible to all members of this organization. + */ + privacy?: TeamsUpdateLegacyPrivacyEnum; +} + +/** + * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer newly-added repositories. + * \\* \`push\` - team members can pull and push, but not administer newly-added repositories. + * \\* \`admin\` - team members can pull, push and administer newly-added repositories. + * @default "pull" + */ +export enum TeamsUpdateLegacyPermissionEnum { + Pull = "pull", + Push = "push", + Admin = "admin", +} + +/** + * The level of privacy this team should have. Editing teams without specifying this parameter leaves \`privacy\` intact. The options are: + * **For a non-nested team:** + * \\* \`secret\` - only visible to organization owners and members of this team. + * \\* \`closed\` - visible to all members of this organization. + * **For a parent or child team:** + * \\* \`closed\` - visible to all members of this organization. + */ +export enum TeamsUpdateLegacyPrivacyEnum { + Secret = "secret", + Closed = "closed", +} + +/** + * Thread + * Thread + */ +export interface Thread { + id: string; + last_read_at: string | null; + reason: string; + /** Minimal Repository */ + repository: MinimalRepository; + subject: { + latest_comment_url: string; + title: string; + type: string; + url: string; + }; + /** @example "https://api.github.com/notifications/threads/2/subscription" */ + subscription_url: string; + unread: boolean; + updated_at: string; + url: string; +} + +/** + * Thread Subscription + * Thread Subscription + */ +export interface ThreadSubscription { + /** + * @format date-time + * @example "2012-10-06T21:34:12Z" + */ + created_at: string | null; + ignored: boolean; + reason: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/1" + */ + repository_url?: string; + /** @example true */ + subscribed: boolean; + /** + * @format uri + * @example "https://api.github.com/notifications/threads/1" + */ + thread_url?: string; + /** + * @format uri + * @example "https://api.github.com/notifications/threads/1/subscription" + */ + url: string; +} + +/** + * Topic + * A topic aggregates entities that are related to a subject. + */ +export interface Topic { + names: string[]; +} + +/** + * Topic Search Result Item + * Topic Search Result Item + */ +export interface TopicSearchResultItem { + aliases?: + | { + topic_relation?: { + id?: number; + name?: string; + relation_type?: string; + topic_id?: number; + }; + }[] + | null; + /** @format date-time */ + created_at: string; + created_by: string | null; + curated: boolean; + description: string | null; + display_name: string | null; + featured: boolean; + /** @format uri */ + logo_url?: string | null; + name: string; + related?: + | { + topic_relation?: { + id?: number; + name?: string; + relation_type?: string; + topic_id?: number; + }; + }[] + | null; + released: string | null; + repository_count?: number | null; + score: number; + short_description: string | null; + text_matches?: SearchResultTextMatches; + /** @format date-time */ + updated_at: string; +} + +/** Traffic */ +export interface Traffic { + count: number; + /** @format date-time */ + timestamp: string; + uniques: number; +} + +/** Specifies the types of repositories you want returned. Can be one of \`all\`, \`public\`, \`private\`, \`forks\`, \`sources\`, \`member\`, \`internal\`. Default: \`all\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`type\` can also be \`internal\`. */ +export enum TypeEnum { + All = "all", + Public = "public", + Private = "private", + Forks = "forks", + Sources = "sources", + Member = "member", + Internal = "internal", +} + +/** + * Can be one of \`all\`, \`owner\`, \`public\`, \`private\`, \`member\`. Default: \`all\` + * + * Will cause a \`422\` error if used in the same request as **visibility** or **affiliation**. Will cause a \`422\` error if used in the same request as **visibility** or **affiliation**. + * @default "all" + */ +export enum TypeEnum1 { + All = "all", + Owner = "owner", + Public = "public", + Private = "private", + Member = "member", +} + +/** + * Can be one of \`all\`, \`owner\`, \`member\`. + * @default "owner" + */ +export enum TypeEnum2 { + All = "all", + Owner = "owner", + Member = "member", +} + +/** + * User Marketplace Purchase + * User Marketplace Purchase + */ +export interface UserMarketplacePurchase { + account: MarketplaceAccount; + /** @example "monthly" */ + billing_cycle: string; + /** + * @format date-time + * @example "2017-11-11T00:00:00Z" + */ + free_trial_ends_on: string | null; + /** + * @format date-time + * @example "2017-11-11T00:00:00Z" + */ + next_billing_date: string | null; + /** @example true */ + on_free_trial: boolean; + /** Marketplace Listing Plan */ + plan: MarketplaceListingPlan; + unit_count: number | null; + /** + * @format date-time + * @example "2017-11-02T01:12:12Z" + */ + updated_at: string | null; +} + +/** + * User Search Result Item + * User Search Result Item + */ +export interface UserSearchResultItem { + /** @format uri */ + avatar_url: string; + bio?: string | null; + blog?: string | null; + company?: string | null; + /** @format date-time */ + created_at?: string; + /** @format email */ + email?: string | null; + events_url: string; + followers?: number; + /** @format uri */ + followers_url: string; + following?: number; + following_url: string; + gists_url: string; + gravatar_id: string | null; + hireable?: boolean | null; + /** @format uri */ + html_url: string; + id: number; + location?: string | null; + login: string; + name?: string | null; + node_id: string; + /** @format uri */ + organizations_url: string; + public_gists?: number; + public_repos?: number; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + score: number; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + /** @format date-time */ + suspended_at?: string | null; + text_matches?: SearchResultTextMatches; + type: string; + /** @format date-time */ + updated_at?: string; + /** @format uri */ + url: string; +} + +export type UsersAddEmailForAuthenticatedData = Email[]; + +export type UsersAddEmailForAuthenticatedPayload = + | { + /** + * Adds one or more email addresses to your GitHub account. Must contain at least one email address. **Note:** Alternatively, you can pass a single email address or an \`array\` of emails addresses directly, but we recommend that you pass an object using the \`emails\` key. + * @example [] + */ + emails: string[]; + } + | string[] + | string; + +export type UsersBlockData = any; + +export type UsersCheckBlockedData = any; + +export type UsersCheckBlockedError = BasicError; + +export type UsersCheckFollowingForUserData = any; + +export type UsersCheckPersonIsFollowedByAuthenticatedData = any; + +export type UsersCheckPersonIsFollowedByAuthenticatedError = BasicError; + +export type UsersCreateGpgKeyForAuthenticatedData = GpgKey; + +export interface UsersCreateGpgKeyForAuthenticatedPayload { + /** A GPG key in ASCII-armored format. */ + armored_public_key: string; +} + +export type UsersCreatePublicSshKeyForAuthenticatedData = Key; + +export interface UsersCreatePublicSshKeyForAuthenticatedPayload { + /** + * The public SSH key to add to your GitHub account. + * @pattern ^ssh-(rsa|dss|ed25519) |^ecdsa-sha2-nistp(256|384|521) + */ + key: string; + /** + * A descriptive name for the new key. + * @example "Personal MacBook Air" + */ + title?: string; +} + +export type UsersDeleteEmailForAuthenticatedData = any; + +/** Deletes one or more email addresses from your GitHub account. Must contain at least one email address. **Note:** Alternatively, you can pass a single email address or an \`array\` of emails addresses directly, but we recommend that you pass an object using the \`emails\` key. */ +export type UsersDeleteEmailForAuthenticatedPayload = + | { + /** Email addresses associated with the GitHub user account. */ + emails: string[]; + } + | string[] + | string; + +export type UsersDeleteGpgKeyForAuthenticatedData = any; + +export type UsersDeletePublicSshKeyForAuthenticatedData = any; + +export type UsersFollowData = any; + +export type UsersGetAuthenticatedData = PrivateUser | PublicUser; + +export type UsersGetByUsernameData = PrivateUser | PublicUser; + +export type UsersGetContextForUserData = Hovercard; + +export interface UsersGetContextForUserParams { + /** Uses the ID for the \`subject_type\` you specified. **Required** when using \`subject_type\`. */ + subject_id?: string; + /** Identifies which additional information you'd like to receive about the person's hovercard. Can be \`organization\`, \`repository\`, \`issue\`, \`pull_request\`. **Required** when using \`subject_id\`. */ + subject_type?: SubjectTypeEnum; + username: string; +} + +/** Identifies which additional information you'd like to receive about the person's hovercard. Can be \`organization\`, \`repository\`, \`issue\`, \`pull_request\`. **Required** when using \`subject_id\`. */ +export enum UsersGetContextForUserParams1SubjectTypeEnum { + Organization = "organization", + Repository = "repository", + Issue = "issue", + PullRequest = "pull_request", +} + +export type UsersGetGpgKeyForAuthenticatedData = GpgKey; + +export type UsersGetPublicSshKeyForAuthenticatedData = Key; + +export type UsersListBlockedByAuthenticatedData = SimpleUser[]; + +export type UsersListData = SimpleUser[]; + +export type UsersListEmailsForAuthenticatedData = Email[]; + +export interface UsersListEmailsForAuthenticatedParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type UsersListFollowedByAuthenticatedData = SimpleUser[]; + +export interface UsersListFollowedByAuthenticatedParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type UsersListFollowersForAuthenticatedUserData = SimpleUser[]; + +export interface UsersListFollowersForAuthenticatedUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type UsersListFollowersForUserData = SimpleUser[]; + +export interface UsersListFollowersForUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export type UsersListFollowingForUserData = SimpleUser[]; + +export interface UsersListFollowingForUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export type UsersListGpgKeysForAuthenticatedData = GpgKey[]; + +export interface UsersListGpgKeysForAuthenticatedParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type UsersListGpgKeysForUserData = GpgKey[]; + +export interface UsersListGpgKeysForUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export interface UsersListParams { + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** A user ID. Only return users with an ID greater than this ID. */ + since?: number; +} + +export type UsersListPublicEmailsForAuthenticatedData = Email[]; + +export interface UsersListPublicEmailsForAuthenticatedParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type UsersListPublicKeysForUserData = KeySimple[]; + +export interface UsersListPublicKeysForUserParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + username: string; +} + +export type UsersListPublicSshKeysForAuthenticatedData = Key[]; + +export interface UsersListPublicSshKeysForAuthenticatedParams { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; +} + +export type UsersSetPrimaryEmailVisibilityForAuthenticatedData = Email[]; + +export interface UsersSetPrimaryEmailVisibilityForAuthenticatedPayload { + /** + * An email address associated with the GitHub user account to manage. + * @example "org@example.com" + */ + email: string; + /** Denotes whether an email is publically visible. */ + visibility: UsersSetPrimaryEmailVisibilityForAuthenticatedVisibilityEnum; +} + +/** Denotes whether an email is publically visible. */ +export enum UsersSetPrimaryEmailVisibilityForAuthenticatedVisibilityEnum { + Public = "public", + Private = "private", +} + +export type UsersUnblockData = any; + +export type UsersUnfollowData = any; + +export type UsersUpdateAuthenticatedData = PrivateUser; + +export interface UsersUpdateAuthenticatedPayload { + /** The new short biography of the user. */ + bio?: string; + /** + * The new blog URL of the user. + * @example "blog.example.com" + */ + blog?: string; + /** + * The new company of the user. + * @example "Acme corporation" + */ + company?: string; + /** + * The publicly visible email address of the user. + * @example "omar@example.com" + */ + email?: string; + /** The new hiring availability of the user. */ + hireable?: boolean; + /** + * The new location of the user. + * @example "Berlin, Germany" + */ + location?: string; + /** + * The new name of the user. + * @example "Omar Jahandar" + */ + name?: string; + /** + * The new Twitter username of the user. + * @example "therealomarj" + */ + twitter_username?: string | null; +} + +/** + * Validation Error + * Validation Error + */ +export interface ValidationError { + documentation_url: string; + errors?: { + code: string; + field?: string; + index?: number; + message?: string; + resource?: string; + value?: string | null | number | null | string[] | null; + }[]; + message: string; +} + +/** + * Validation Error Simple + * Validation Error Simple + */ +export interface ValidationErrorSimple { + documentation_url: string; + errors?: string[]; + message: string; +} + +/** Validation Failed */ +export type ValidationFailed = ValidationError; + +/** Validation Failed */ +export type ValidationFailedSimple = ValidationErrorSimple; + +/** Verification */ +export interface Verification { + payload: string | null; + reason: string; + signature: string | null; + verified: boolean; +} + +/** + * View Traffic + * View Traffic + */ +export interface ViewTraffic { + /** @example 14850 */ + count: number; + /** @example 3782 */ + uniques: number; + views: Traffic[]; +} + +/** + * Can be one of \`all\`, \`public\`, or \`private\`. + * @default "all" + */ +export enum VisibilityEnum { + All = "all", + Public = "public", + Private = "private", +} + +/** + * Webhook Configuration + * Configuration object of the webhook + */ +export interface WebhookConfig { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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; + /** 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; + /** The URL to which the payloads will be delivered. */ + url?: WebhookConfigUrl; +} + +/** + * The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. + * @example ""json"" + */ +export type WebhookConfigContentType = 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.** + * @example ""0"" + */ +export type WebhookConfigInsecureSsl = 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). + * @example ""********"" + */ +export type WebhookConfigSecret = string; + +/** + * The URL to which the payloads will be delivered. + * @format uri + * @example "https://example.com/webhook" + */ +export type WebhookConfigUrl = string; + +/** + * Workflow + * A GitHub Actions workflow + */ +export interface Workflow { + /** @example "https://github.com/actions/setup-ruby/workflows/CI/badge.svg" */ + badge_url: string; + /** + * @format date-time + * @example "2019-12-06T14:20:20.000Z" + */ + created_at: string; + /** + * @format date-time + * @example "2019-12-06T14:20:20.000Z" + */ + deleted_at?: string; + /** @example "https://github.com/actions/setup-ruby/blob/master/.github/workflows/ruby.yaml" */ + html_url: string; + /** @example 5 */ + id: number; + /** @example "CI" */ + name: string; + /** @example "MDg6V29ya2Zsb3cxMg==" */ + node_id: string; + /** @example "ruby.yaml" */ + path: string; + /** @example "active" */ + state: WorkflowStateEnum; + /** + * @format date-time + * @example "2019-12-06T14:20:20.000Z" + */ + updated_at: string; + /** @example "https://api.github.com/repos/actions/setup-ruby/workflows/5" */ + url: string; +} + +/** + * Workflow Run + * An invocation of a workflow + */ +export interface WorkflowRun { + /** + * The URL to the artifacts for the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/rerun/artifacts" + */ + artifacts_url: string; + /** + * The URL to cancel the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/cancel" + */ + cancel_url: string; + /** + * The URL to the associated check suite. + * @example "https://api.github.com/repos/github/hello-world/check-suites/12" + */ + check_suite_url: string; + /** @example "neutral" */ + conclusion: string | null; + /** @format date-time */ + created_at: string; + /** @example "push" */ + event: string; + /** @example "master" */ + head_branch: string | null; + /** Simple Commit */ + head_commit: SimpleCommit; + /** Minimal Repository */ + head_repository: MinimalRepository; + /** @example 5 */ + head_repository_id?: number; + /** + * The SHA of the head commit that points to the version of the worflow being run. + * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" + */ + head_sha: string; + /** @example "https://github.com/github/hello-world/suites/4" */ + html_url: string; + /** + * The ID of the workflow run. + * @example 5 + */ + id: number; + /** + * The URL to the jobs for the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/jobs" + */ + jobs_url: string; + /** + * The URL to download the logs for the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/logs" + */ + logs_url: string; + /** + * The name of the workflow run. + * @example "Build" + */ + name?: string; + /** @example "MDEwOkNoZWNrU3VpdGU1" */ + node_id: string; + pull_requests: PullRequestMinimal[] | null; + /** Minimal Repository */ + repository: MinimalRepository; + /** + * The URL to rerun the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/rerun" + */ + rerun_url: string; + /** + * The auto incrementing run number for the workflow run. + * @example 106 + */ + run_number: number; + /** @example "completed" */ + status: string | null; + /** @format date-time */ + updated_at: string; + /** + * The URL to the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5" + */ + url: string; + /** + * The ID of the parent workflow. + * @example 5 + */ + workflow_id: number; + /** + * The URL to the workflow. + * @example "https://api.github.com/repos/github/hello-world/actions/workflows/main.yaml" + */ + workflow_url: string; +} + +/** + * Workflow Run Usage + * Workflow Run Usage + */ +export interface WorkflowRunUsage { + billable: { + MACOS?: { + jobs: number; + total_ms: number; + }; + UBUNTU?: { + jobs: number; + total_ms: number; + }; + WINDOWS?: { + jobs: number; + total_ms: number; + }; + }; + run_duration_ms: number; +} + +/** @example "active" */ +export enum WorkflowStateEnum { + Active = "active", + Deleted = "deleted", +} + +/** + * Workflow Usage + * Workflow Usage + */ +export interface WorkflowUsage { + billable: { + MACOS?: { + total_ms?: number; + }; + UBUNTU?: { + total_ms?: number; + }; + WINDOWS?: { + total_ms?: number; + }; + }; +} + +export namespace App { + /** + * @description Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of \`401 - Unauthorized\`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. To restrict the access to specific repositories, you can provide the \`repository_ids\` when creating the token. When you omit \`repository_ids\`, the response does not contain the \`repositories\` key. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsCreateInstallationAccessToken + * @summary Create an installation access token for an app + * @request POST:/app/installations/{installation_id}/access_tokens + */ + export namespace AppsCreateInstallationAccessToken { + export type RequestParams = { + /** installation_id parameter */ + installationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = AppsCreateInstallationAccessTokenPayload; + export type RequestHeaders = {}; + export type ResponseBody = AppsCreateInstallationAccessTokenData; + } + /** + * @description Uninstalls a GitHub App on a user, organization, or business account. If you prefer to temporarily suspend an app's access to your account's resources, then we recommend the "[Suspend an app installation](https://docs.github.com/v3/apps/#suspend-an-app-installation)" endpoint. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsDeleteInstallation + * @summary Delete an installation for the authenticated app + * @request DELETE:/app/installations/{installation_id} + */ + export namespace AppsDeleteInstallation { + export type RequestParams = { + /** installation_id parameter */ + installationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsDeleteInstallationData; + } + /** + * @description Returns the GitHub App associated with the authentication credentials used. To see how many app installations are associated with this GitHub App, see the \`installations_count\` in the response. For more details about your app's installations, see the "[List installations for the authenticated app](https://docs.github.com/rest/reference/apps#list-installations-for-the-authenticated-app)" endpoint. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsGetAuthenticated + * @summary Get the authenticated app + * @request GET:/app + */ + export namespace AppsGetAuthenticated { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsGetAuthenticatedData; + } + /** + * @description Enables an authenticated GitHub App to find an installation's information using the installation id. The installation's account type (\`target_type\`) will be either an organization or a user account, depending which account the repository belongs to. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsGetInstallation + * @summary Get an installation for the authenticated app + * @request GET:/app/installations/{installation_id} + */ + export namespace AppsGetInstallation { + export type RequestParams = { + /** installation_id parameter */ + installationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsGetInstallationData; + } + /** + * @description Returns the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)." You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsGetWebhookConfigForApp + * @summary Get a webhook configuration for an app + * @request GET:/app/hook/config + */ + export namespace AppsGetWebhookConfigForApp { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsGetWebhookConfigForAppData; + } + /** + * @description You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. The permissions the installation has are included under the \`permissions\` key. + * @tags apps + * @name AppsListInstallations + * @summary List installations for the authenticated app + * @request GET:/app/installations + */ + export namespace AppsListInstallations { + export type RequestParams = {}; + export type RequestQuery = { + outdated?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsListInstallationsData; + } + /** + * @description **Note:** Suspending a GitHub App installation is currently in beta and subject to change. Before you can suspend a GitHub App, the app owner must enable suspending installations for the app by opting-in to the beta. For more information, see "[Suspending a GitHub App installation](https://docs.github.com/apps/managing-github-apps/suspending-a-github-app-installation/)." Suspends a GitHub App on a user, organization, or business account, which blocks the app from accessing the account's resources. When a GitHub App is suspended, the app's access to the GitHub API or webhook events is blocked for that account. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsSuspendInstallation + * @summary Suspend an app installation + * @request PUT:/app/installations/{installation_id}/suspended + */ + export namespace AppsSuspendInstallation { + export type RequestParams = { + /** installation_id parameter */ + installationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsSuspendInstallationData; + } + /** + * @description **Note:** Suspending a GitHub App installation is currently in beta and subject to change. Before you can suspend a GitHub App, the app owner must enable suspending installations for the app by opting-in to the beta. For more information, see "[Suspending a GitHub App installation](https://docs.github.com/apps/managing-github-apps/suspending-a-github-app-installation/)." Removes a GitHub App installation suspension. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsUnsuspendInstallation + * @summary Unsuspend an app installation + * @request DELETE:/app/installations/{installation_id}/suspended + */ + export namespace AppsUnsuspendInstallation { + export type RequestParams = { + /** installation_id parameter */ + installationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsUnsuspendInstallationData; + } + /** + * @description Updates the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)." You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsUpdateWebhookConfigForApp + * @summary Update a webhook configuration for an app + * @request PATCH:/app/hook/config + */ + export namespace AppsUpdateWebhookConfigForApp { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = AppsUpdateWebhookConfigForAppPayload; + export type RequestHeaders = {}; + export type ResponseBody = AppsUpdateWebhookConfigForAppData; + } +} + +export namespace AppManifests { + /** + * @description Use this endpoint to complete the handshake necessary when implementing the [GitHub App Manifest flow](https://docs.github.com/apps/building-github-apps/creating-github-apps-from-a-manifest/). When you create a GitHub App with the manifest flow, you receive a temporary \`code\` used to retrieve the GitHub App's \`id\`, \`pem\` (private key), and \`webhook_secret\`. + * @tags apps + * @name AppsCreateFromManifest + * @summary Create a GitHub App from a manifest + * @request POST:/app-manifests/{code}/conversions + */ + export namespace AppsCreateFromManifest { + export type RequestParams = { + code: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsCreateFromManifestData; + } +} + +export namespace Applications { + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * @tags apps + * @name AppsCheckAuthorization + * @summary Check an authorization + * @request GET:/applications/{client_id}/tokens/{access_token} + * @deprecated + */ + export namespace AppsCheckAuthorization { + export type RequestParams = { + accessToken: string; + /** The client ID of your GitHub app. */ + clientId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsCheckAuthorizationData; + } + /** + * @description OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) to use this endpoint, where the username is the OAuth application \`client_id\` and the password is its \`client_secret\`. Invalid tokens will return \`404 NOT FOUND\`. + * @tags apps + * @name AppsCheckToken + * @summary Check a token + * @request POST:/applications/{client_id}/token + */ + export namespace AppsCheckToken { + export type RequestParams = { + /** The client ID of your GitHub app. */ + clientId: string; + }; + export type RequestQuery = {}; + export type RequestBody = AppsCheckTokenPayload; + export type RequestHeaders = {}; + export type ResponseBody = AppsCheckTokenData; + } + /** + * @description OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. You must also provide a valid OAuth \`access_token\` as an input parameter and the grant for the token's owner will be deleted. Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). + * @tags apps + * @name AppsDeleteAuthorization + * @summary Delete an app authorization + * @request DELETE:/applications/{client_id}/grant + */ + export namespace AppsDeleteAuthorization { + export type RequestParams = { + /** The client ID of your GitHub app. */ + clientId: string; + }; + export type RequestQuery = {}; + export type RequestBody = AppsDeleteAuthorizationPayload; + export type RequestHeaders = {}; + export type ResponseBody = AppsDeleteAuthorizationData; + } + /** + * @description OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. + * @tags apps + * @name AppsDeleteToken + * @summary Delete an app token + * @request DELETE:/applications/{client_id}/token + */ + export namespace AppsDeleteToken { + export type RequestParams = { + /** The client ID of your GitHub app. */ + clientId: string; + }; + export type RequestQuery = {}; + export type RequestBody = AppsDeleteTokenPayload; + export type RequestHeaders = {}; + export type ResponseBody = AppsDeleteTokenData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * @tags apps + * @name AppsResetAuthorization + * @summary Reset an authorization + * @request POST:/applications/{client_id}/tokens/{access_token} + * @deprecated + */ + export namespace AppsResetAuthorization { + export type RequestParams = { + accessToken: string; + /** The client ID of your GitHub app. */ + clientId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsResetAuthorizationData; + } + /** + * @description OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * @tags apps + * @name AppsResetToken + * @summary Reset a token + * @request PATCH:/applications/{client_id}/token + */ + export namespace AppsResetToken { + export type RequestParams = { + /** The client ID of your GitHub app. */ + clientId: string; + }; + export type RequestQuery = {}; + export type RequestBody = AppsResetTokenPayload; + export type RequestHeaders = {}; + export type ResponseBody = AppsResetTokenData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. + * @tags apps + * @name AppsRevokeAuthorizationForApplication + * @summary Revoke an authorization for an application + * @request DELETE:/applications/{client_id}/tokens/{access_token} + * @deprecated + */ + export namespace AppsRevokeAuthorizationForApplication { + export type RequestParams = { + accessToken: string; + /** The client ID of your GitHub app. */ + clientId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsRevokeAuthorizationForApplicationData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. You must also provide a valid token as \`:access_token\` and the grant for the token's owner will be deleted. Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the Applications settings page under "Authorized OAuth Apps" on GitHub](https://github.com/settings/applications#authorized). + * @tags apps + * @name AppsRevokeGrantForApplication + * @summary Revoke a grant for an application + * @request DELETE:/applications/{client_id}/grants/{access_token} + * @deprecated + */ + export namespace AppsRevokeGrantForApplication { + export type RequestParams = { + accessToken: string; + /** The client ID of your GitHub app. */ + clientId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsRevokeGrantForApplicationData; + } + /** + * @description Exchanges a non-repository scoped user-to-server OAuth access token for a repository scoped user-to-server OAuth access token. You can specify which repositories the token can access and which permissions are granted to the token. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * @tags apps + * @name AppsScopeToken + * @summary Create a scoped access token + * @request POST:/applications/{client_id}/token/scoped + */ + export namespace AppsScopeToken { + export type RequestParams = { + /** The client ID of your GitHub app. */ + clientId: string; + }; + export type RequestQuery = {}; + export type RequestBody = AppsScopeTokenPayload; + export type RequestHeaders = {}; + export type ResponseBody = AppsScopeTokenData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user. Once deleted, the application has no access to your account and is no longer listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). + * @tags oauth-authorizations + * @name OauthAuthorizationsDeleteGrant + * @summary Delete a grant + * @request DELETE:/applications/grants/{grant_id} + * @deprecated + */ + export namespace OauthAuthorizationsDeleteGrant { + export type RequestParams = { + /** grant_id parameter */ + grantId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OauthAuthorizationsDeleteGrantData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * @tags oauth-authorizations + * @name OauthAuthorizationsGetGrant + * @summary Get a single grant + * @request GET:/applications/grants/{grant_id} + * @deprecated + */ + export namespace OauthAuthorizationsGetGrant { + export type RequestParams = { + /** grant_id parameter */ + grantId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OauthAuthorizationsGetGrantData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the [list your authorizations](https://docs.github.com/rest/reference/oauth-authorizations#list-your-authorizations) API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). The \`scopes\` returned are the union of scopes authorized for the application. For example, if an application has one token with \`repo\` scope and another token with \`user\` scope, the grant will return \`["repo", "user"]\`. + * @tags oauth-authorizations + * @name OauthAuthorizationsListGrants + * @summary List your grants + * @request GET:/applications/grants + * @deprecated + */ + export namespace OauthAuthorizationsListGrants { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OauthAuthorizationsListGrantsData; + } +} + +export namespace Apps { + /** + * @description **Note**: The \`:app_slug\` is just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., \`https://github.com/settings/apps/:app_slug\`). If the GitHub App you specify is public, you can access this endpoint without authenticating. If the GitHub App you specify is private, you must authenticate with a [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) or an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * @tags apps + * @name AppsGetBySlug + * @summary Get an app + * @request GET:/apps/{app_slug} + */ + export namespace AppsGetBySlug { + export type RequestParams = { + appSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsGetBySlugData; + } +} + +export namespace Authorizations { + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). Creates OAuth tokens using [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication). If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." To create tokens for a particular OAuth application using this endpoint, you must authenticate as the user you want to create an authorization for and provide the app's client ID and secret, found on your OAuth application's settings page. If your OAuth application intends to create multiple tokens for one user, use \`fingerprint\` to differentiate between them. You can also create tokens on GitHub from the [personal access tokens settings](https://github.com/settings/tokens) page. Read more about these tokens in [the GitHub Help documentation](https://help.github.com/articles/creating-an-access-token-for-command-line-use). Organizations that enforce SAML SSO require personal access tokens to be allowed. Read more about allowing tokens in [the GitHub Help documentation](https://help.github.com/articles/about-identity-and-access-management-with-saml-single-sign-on). + * @tags oauth-authorizations + * @name OauthAuthorizationsCreateAuthorization + * @summary Create a new authorization + * @request POST:/authorizations + * @deprecated + */ + export namespace OauthAuthorizationsCreateAuthorization { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = OauthAuthorizationsCreateAuthorizationPayload; + export type RequestHeaders = {}; + export type ResponseBody = OauthAuthorizationsCreateAuthorizationData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * @tags oauth-authorizations + * @name OauthAuthorizationsDeleteAuthorization + * @summary Delete an authorization + * @request DELETE:/authorizations/{authorization_id} + * @deprecated + */ + export namespace OauthAuthorizationsDeleteAuthorization { + export type RequestParams = { + /** authorization_id parameter */ + authorizationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OauthAuthorizationsDeleteAuthorizationData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * @tags oauth-authorizations + * @name OauthAuthorizationsGetAuthorization + * @summary Get a single authorization + * @request GET:/authorizations/{authorization_id} + * @deprecated + */ + export namespace OauthAuthorizationsGetAuthorization { + export type RequestParams = { + /** authorization_id parameter */ + authorizationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OauthAuthorizationsGetAuthorizationData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). Creates a new authorization for the specified OAuth application, only if an authorization for that application doesn't already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one. If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * @tags oauth-authorizations + * @name OauthAuthorizationsGetOrCreateAuthorizationForApp + * @summary Get-or-create an authorization for a specific app + * @request PUT:/authorizations/clients/{client_id} + * @deprecated + */ + export namespace OauthAuthorizationsGetOrCreateAuthorizationForApp { + export type RequestParams = { + /** The client ID of your GitHub app. */ + clientId: string; + }; + export type RequestQuery = {}; + export type RequestBody = OauthAuthorizationsGetOrCreateAuthorizationForAppPayload; + export type RequestHeaders = {}; + export type ResponseBody = OauthAuthorizationsGetOrCreateAuthorizationForAppData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). This method will create a new authorization for the specified OAuth application, only if an authorization for that application and fingerprint do not already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. \`fingerprint\` is a unique string to distinguish an authorization from others created for the same client ID and user. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one. If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." + * @tags oauth-authorizations + * @name OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint + * @summary Get-or-create an authorization for a specific app and fingerprint + * @request PUT:/authorizations/clients/{client_id}/{fingerprint} + * @deprecated + */ + export namespace OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint { + export type RequestParams = { + /** The client ID of your GitHub app. */ + clientId: string; + fingerprint: string; + }; + export type RequestQuery = {}; + export type RequestBody = OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintPayload; + export type RequestHeaders = {}; + export type ResponseBody = OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * @tags oauth-authorizations + * @name OauthAuthorizationsListAuthorizations + * @summary List your authorizations + * @request GET:/authorizations + * @deprecated + */ + export namespace OauthAuthorizationsListAuthorizations { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OauthAuthorizationsListAuthorizationsData; + } + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." You can only send one of these scope keys at a time. + * @tags oauth-authorizations + * @name OauthAuthorizationsUpdateAuthorization + * @summary Update an existing authorization + * @request PATCH:/authorizations/{authorization_id} + * @deprecated + */ + export namespace OauthAuthorizationsUpdateAuthorization { + export type RequestParams = { + /** authorization_id parameter */ + authorizationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = OauthAuthorizationsUpdateAuthorizationPayload; + export type RequestHeaders = {}; + export type ResponseBody = OauthAuthorizationsUpdateAuthorizationData; + } +} + +export namespace CodesOfConduct { + /** + * No description + * @tags codes-of-conduct + * @name CodesOfConductGetAllCodesOfConduct + * @summary Get all codes of conduct + * @request GET:/codes_of_conduct + */ + export namespace CodesOfConductGetAllCodesOfConduct { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CodesOfConductGetAllCodesOfConductData; + } + /** + * No description + * @tags codes-of-conduct + * @name CodesOfConductGetConductCode + * @summary Get a code of conduct + * @request GET:/codes_of_conduct/{key} + */ + export namespace CodesOfConductGetConductCode { + export type RequestParams = { + key: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CodesOfConductGetConductCodeData; + } +} + +export namespace ContentReferences { + /** + * @description Creates an attachment under a content reference URL in the body or comment of an issue or pull request. Use the \`id\` of the content reference from the [\`content_reference\` event](https://docs.github.com/webhooks/event-payloads/#content_reference) to create an attachment. The app must create a content attachment within six hours of the content reference URL being posted. See "[Using content attachments](https://docs.github.com/apps/using-content-attachments/)" for details about content attachments. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * @tags apps + * @name AppsCreateContentAttachment + * @summary Create a content attachment + * @request POST:/content_references/{content_reference_id}/attachments + */ + export namespace AppsCreateContentAttachment { + export type RequestParams = { + contentReferenceId: number; + }; + export type RequestQuery = {}; + export type RequestBody = AppsCreateContentAttachmentPayload; + export type RequestHeaders = {}; + export type ResponseBody = AppsCreateContentAttachmentData; + } +} + +export namespace Emojis { + /** + * @description Lists all the emojis available to use on GitHub. + * @tags emojis + * @name EmojisGet + * @summary Get emojis + * @request GET:/emojis + */ + export namespace EmojisGet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EmojisGetData; + } +} + +export namespace Enterprises { + /** + * @description **Note:** The audit log REST API is currently in beta and is subject to change. Gets the audit log for an enterprise. To use this endpoint, you must be an enterprise admin, and you must use an access token with the \`admin:enterprise\` scope. + * @tags audit-log + * @name AuditLogGetAuditLog + * @summary Get the audit log for an enterprise + * @request GET:/enterprises/{enterprise}/audit-log + */ + export namespace AuditLogGetAuditLog { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = { + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor. */ + after?: string; + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor. */ + before?: string; + /** + * The event types to include: + * + * - \`web\` - returns web (non-Git) events + * - \`git\` - returns Git events + * - \`all\` - returns both web and Git events + * + * The default is \`web\`. + */ + include?: AuditLogGetAuditLogParams1IncludeEnum; + /** + * The order of audit log events. To list newest events first, specify \`desc\`. To list oldest events first, specify \`asc\`. + * + * The default is \`desc\`. + */ + order?: AuditLogGetAuditLogParams1OrderEnum; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** A search phrase. For more information, see [Searching the audit log](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#searching-the-audit-log). */ + phrase?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AuditLogGetAuditLogData; + } + /** + * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". The authenticated user must be an enterprise admin. + * @tags billing + * @name BillingGetGithubActionsBillingGhe + * @summary Get GitHub Actions billing for an enterprise + * @request GET:/enterprises/{enterprise}/settings/billing/actions + */ + export namespace BillingGetGithubActionsBillingGhe { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = BillingGetGithubActionsBillingGheData; + } + /** + * @description Gets the free and paid storage used for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." The authenticated user must be an enterprise admin. + * @tags billing + * @name BillingGetGithubPackagesBillingGhe + * @summary Get GitHub Packages billing for an enterprise + * @request GET:/enterprises/{enterprise}/settings/billing/packages + */ + export namespace BillingGetGithubPackagesBillingGhe { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = BillingGetGithubPackagesBillingGheData; + } + /** + * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." The authenticated user must be an enterprise admin. + * @tags billing + * @name BillingGetSharedStorageBillingGhe + * @summary Get shared storage billing for an enterprise + * @request GET:/enterprises/{enterprise}/settings/billing/shared-storage + */ + export namespace BillingGetSharedStorageBillingGhe { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = BillingGetSharedStorageBillingGheData; + } + /** + * @description Adds an organization to the list of selected organizations that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary Add organization access to a self-hosted runner group in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} + */ + export namespace EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of an organization. */ + orgId: number; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterpriseData; + } + /** + * @description Adds a self-hosted runner to a runner group configured in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminAddSelfHostedRunnerToGroupForEnterprise + * @summary Add a self-hosted runner to a group for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + export namespace EnterpriseAdminAddSelfHostedRunnerToGroupForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + /** Unique identifier of the self-hosted runner. */ + runnerId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminAddSelfHostedRunnerToGroupForEnterpriseData; + } + /** + * @description Returns a token that you can pass to the \`config\` script. The token expires after one hour. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing \`TOKEN\` with the registration token provided by this endpoint. \`\`\` ./config.sh --url https://github.com/enterprises/octo-enterprise --token TOKEN \`\`\` + * @tags enterprise-admin + * @name EnterpriseAdminCreateRegistrationTokenForEnterprise + * @summary Create a registration token for an enterprise + * @request POST:/enterprises/{enterprise}/actions/runners/registration-token + */ + export namespace EnterpriseAdminCreateRegistrationTokenForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminCreateRegistrationTokenForEnterpriseData; + } + /** + * @description Returns a token that you can pass to the \`config\` script to remove a self-hosted runner from an enterprise. The token expires after one hour. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from an enterprise, replace \`TOKEN\` with the remove token provided by this endpoint. \`\`\` ./config.sh remove --token TOKEN \`\`\` + * @tags enterprise-admin + * @name EnterpriseAdminCreateRemoveTokenForEnterprise + * @summary Create a remove token for an enterprise + * @request POST:/enterprises/{enterprise}/actions/runners/remove-token + */ + export namespace EnterpriseAdminCreateRemoveTokenForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminCreateRemoveTokenForEnterpriseData; + } + /** + * @description Creates a new self-hosted runner group for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminCreateSelfHostedRunnerGroupForEnterprise + * @summary Create a self-hosted runner group for an enterprise + * @request POST:/enterprises/{enterprise}/actions/runner-groups + */ + export namespace EnterpriseAdminCreateSelfHostedRunnerGroupForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminCreateSelfHostedRunnerGroupForEnterprisePayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminCreateSelfHostedRunnerGroupForEnterpriseData; + } + /** + * @description Forces the removal of a self-hosted runner from an enterprise. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminDeleteSelfHostedRunnerFromEnterprise + * @summary Delete a self-hosted runner from an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runners/{runner_id} + */ + export namespace EnterpriseAdminDeleteSelfHostedRunnerFromEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner. */ + runnerId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminDeleteSelfHostedRunnerFromEnterpriseData; + } + /** + * @description Deletes a self-hosted runner group for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise + * @summary Delete a self-hosted runner group from an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + */ + export namespace EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterpriseData; + } + /** + * @description Removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise + * @summary Disable a selected organization for GitHub Actions in an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/permissions/organizations/{org_id} + */ + export namespace EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of an organization. */ + orgId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterpriseData; + } + /** + * @description Adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise + * @summary Enable a selected organization for GitHub Actions in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions/organizations/{org_id} + */ + export namespace EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of an organization. */ + orgId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterpriseData; + } + /** + * @description Gets the selected actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminGetAllowedActionsEnterprise + * @summary Get allowed actions for an enterprise + * @request GET:/enterprises/{enterprise}/actions/permissions/selected-actions + */ + export namespace EnterpriseAdminGetAllowedActionsEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminGetAllowedActionsEnterpriseData; + } + /** + * @description Gets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminGetGithubActionsPermissionsEnterprise + * @summary Get GitHub Actions permissions for an enterprise + * @request GET:/enterprises/{enterprise}/actions/permissions + */ + export namespace EnterpriseAdminGetGithubActionsPermissionsEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminGetGithubActionsPermissionsEnterpriseData; + } + /** + * @description Gets a specific self-hosted runner configured in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminGetSelfHostedRunnerForEnterprise + * @summary Get a self-hosted runner for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runners/{runner_id} + */ + export namespace EnterpriseAdminGetSelfHostedRunnerForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner. */ + runnerId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminGetSelfHostedRunnerForEnterpriseData; + } + /** + * @description Gets a specific self-hosted runner group for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminGetSelfHostedRunnerGroupForEnterprise + * @summary Get a self-hosted runner group for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + */ + export namespace EnterpriseAdminGetSelfHostedRunnerGroupForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminGetSelfHostedRunnerGroupForEnterpriseData; + } + /** + * @description Lists the organizations with access to a self-hosted runner group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary List organization access to a self-hosted runner group in an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations + */ + export namespace EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseData; + } + /** + * @description Lists binaries for the runner application that you can download and run. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminListRunnerApplicationsForEnterprise + * @summary List runner applications for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runners/downloads + */ + export namespace EnterpriseAdminListRunnerApplicationsForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminListRunnerApplicationsForEnterpriseData; + } + /** + * @description Lists the organizations that are selected to have GitHub Actions enabled in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise + * @summary List selected organizations enabled for GitHub Actions in an enterprise + * @request GET:/enterprises/{enterprise}/actions/permissions/organizations + */ + export namespace EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseData; + } + /** + * @description Lists all self-hosted runner groups for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminListSelfHostedRunnerGroupsForEnterprise + * @summary List self-hosted runner groups for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups + */ + export namespace EnterpriseAdminListSelfHostedRunnerGroupsForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseData; + } + /** + * @description Lists all self-hosted runners configured for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminListSelfHostedRunnersForEnterprise + * @summary List self-hosted runners for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runners + */ + export namespace EnterpriseAdminListSelfHostedRunnersForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminListSelfHostedRunnersForEnterpriseData; + } + /** + * @description Lists the self-hosted runners that are in a specific enterprise group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminListSelfHostedRunnersInGroupForEnterprise + * @summary List self-hosted runners in a group for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners + */ + export namespace EnterpriseAdminListSelfHostedRunnersInGroupForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseData; + } + /** + * @description Removes an organization from the list of selected organizations that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary Remove organization access to a self-hosted runner group in an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} + */ + export namespace EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of an organization. */ + orgId: number; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterpriseData; + } + /** + * @description Removes a self-hosted runner from a group configured in an enterprise. The runner is then returned to the default group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise + * @summary Remove a self-hosted runner from a group for an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + export namespace EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + /** Unique identifier of the self-hosted runner. */ + runnerId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterpriseData; + } + /** + * @description Sets the actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminSetAllowedActionsEnterprise + * @summary Set allowed actions for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions/selected-actions + */ + export namespace EnterpriseAdminSetAllowedActionsEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = SelectedActions; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminSetAllowedActionsEnterpriseData; + } + /** + * @description Sets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminSetGithubActionsPermissionsEnterprise + * @summary Set GitHub Actions permissions for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions + */ + export namespace EnterpriseAdminSetGithubActionsPermissionsEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminSetGithubActionsPermissionsEnterprisePayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminSetGithubActionsPermissionsEnterpriseData; + } + /** + * @description Replaces the list of organizations that have access to a self-hosted runner configured in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary Set organization access for a self-hosted runner group in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations + */ + export namespace EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprisePayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterpriseData; + } + /** + * @description Replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise + * @summary Set selected organizations enabled for GitHub Actions in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions/organizations + */ + export namespace EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprisePayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterpriseData; + } + /** + * @description Replaces the list of self-hosted runners that are part of an enterprise runner group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminSetSelfHostedRunnersInGroupForEnterprise + * @summary Set self-hosted runners in a group for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners + */ + export namespace EnterpriseAdminSetSelfHostedRunnersInGroupForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminSetSelfHostedRunnersInGroupForEnterprisePayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminSetSelfHostedRunnersInGroupForEnterpriseData; + } + /** + * @description Updates the \`name\` and \`visibility\` of a self-hosted runner group in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * @tags enterprise-admin + * @name EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise + * @summary Update a self-hosted runner group for an enterprise + * @request PATCH:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + */ + export namespace EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprisePayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterpriseData; + } +} + +export namespace Events { + /** + * @description We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago. + * @tags activity + * @name ActivityListPublicEvents + * @summary List public events + * @request GET:/events + */ + export namespace ActivityListPublicEvents { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListPublicEventsData; + } +} + +export namespace Feeds { + /** + * @description GitHub provides several timeline resources in [Atom](http://en.wikipedia.org/wiki/Atom_(standard)) format. The Feeds API lists all the feeds available to the authenticated user: * **Timeline**: The GitHub global public timeline * **User**: The public timeline for any user, using [URI template](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia) * **Current user public**: The public timeline for the authenticated user * **Current user**: The private timeline for the authenticated user * **Current user actor**: The private timeline for activity created by the authenticated user * **Current user organizations**: The private timeline for the organizations the authenticated user is a member of. * **Security advisories**: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub. **Note**: Private feeds are only returned when [authenticating via Basic Auth](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) since current feed URIs use the older, non revocable auth tokens. + * @tags activity + * @name ActivityGetFeeds + * @summary Get feeds + * @request GET:/feeds + */ + export namespace ActivityGetFeeds { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityGetFeedsData; + } +} + +export namespace Gists { + /** + * No description + * @tags gists + * @name GistsCheckIsStarred + * @summary Check if a gist is starred + * @request GET:/gists/{gist_id}/star + */ + export namespace GistsCheckIsStarred { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsCheckIsStarredData; + } + /** + * @description Allows you to add a new gist with one or more files. **Note:** Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally. + * @tags gists + * @name GistsCreate + * @summary Create a gist + * @request POST:/gists + */ + export namespace GistsCreate { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = GistsCreatePayload; + export type RequestHeaders = {}; + export type ResponseBody = GistsCreateData; + } + /** + * No description + * @tags gists + * @name GistsCreateComment + * @summary Create a gist comment + * @request POST:/gists/{gist_id}/comments + */ + export namespace GistsCreateComment { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = GistsCreateCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = GistsCreateCommentData; + } + /** + * No description + * @tags gists + * @name GistsDelete + * @summary Delete a gist + * @request DELETE:/gists/{gist_id} + */ + export namespace GistsDelete { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsDeleteData; + } + /** + * No description + * @tags gists + * @name GistsDeleteComment + * @summary Delete a gist comment + * @request DELETE:/gists/{gist_id}/comments/{comment_id} + */ + export namespace GistsDeleteComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsDeleteCommentData; + } + /** + * @description **Note**: This was previously \`/gists/:gist_id/fork\`. + * @tags gists + * @name GistsFork + * @summary Fork a gist + * @request POST:/gists/{gist_id}/forks + */ + export namespace GistsFork { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsForkData; + } + /** + * No description + * @tags gists + * @name GistsGet + * @summary Get a gist + * @request GET:/gists/{gist_id} + */ + export namespace GistsGet { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsGetData; + } + /** + * No description + * @tags gists + * @name GistsGetComment + * @summary Get a gist comment + * @request GET:/gists/{gist_id}/comments/{comment_id} + */ + export namespace GistsGetComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsGetCommentData; + } + /** + * No description + * @tags gists + * @name GistsGetRevision + * @summary Get a gist revision + * @request GET:/gists/{gist_id}/{sha} + */ + export namespace GistsGetRevision { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + sha: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsGetRevisionData; + } + /** + * @description Lists the authenticated user's gists or if called anonymously, this endpoint returns all public gists: + * @tags gists + * @name GistsList + * @summary List gists for the authenticated user + * @request GET:/gists + */ + export namespace GistsList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsListData; + } + /** + * No description + * @tags gists + * @name GistsListComments + * @summary List gist comments + * @request GET:/gists/{gist_id}/comments + */ + export namespace GistsListComments { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsListCommentsData; + } + /** + * No description + * @tags gists + * @name GistsListCommits + * @summary List gist commits + * @request GET:/gists/{gist_id}/commits + */ + export namespace GistsListCommits { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsListCommitsData; + } + /** + * No description + * @tags gists + * @name GistsListForks + * @summary List gist forks + * @request GET:/gists/{gist_id}/forks + */ + export namespace GistsListForks { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsListForksData; + } + /** + * @description List public gists sorted by most recently updated to least recently updated. Note: With [pagination](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination), you can fetch up to 3000 gists. For example, you can fetch 100 pages with 30 gists per page or 30 pages with 100 gists per page. + * @tags gists + * @name GistsListPublic + * @summary List public gists + * @request GET:/gists/public + */ + export namespace GistsListPublic { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsListPublicData; + } + /** + * @description List the authenticated user's starred gists: + * @tags gists + * @name GistsListStarred + * @summary List starred gists + * @request GET:/gists/starred + */ + export namespace GistsListStarred { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsListStarredData; + } + /** + * @description Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * @tags gists + * @name GistsStar + * @summary Star a gist + * @request PUT:/gists/{gist_id}/star + */ + export namespace GistsStar { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsStarData; + } + /** + * No description + * @tags gists + * @name GistsUnstar + * @summary Unstar a gist + * @request DELETE:/gists/{gist_id}/star + */ + export namespace GistsUnstar { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsUnstarData; + } + /** + * @description Allows you to update or delete a gist file and rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged. + * @tags gists + * @name GistsUpdate + * @summary Update a gist + * @request PATCH:/gists/{gist_id} + */ + export namespace GistsUpdate { + export type RequestParams = { + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = GistsUpdatePayload; + export type RequestHeaders = {}; + export type ResponseBody = GistsUpdateData; + } + /** + * No description + * @tags gists + * @name GistsUpdateComment + * @summary Update a gist comment + * @request PATCH:/gists/{gist_id}/comments/{comment_id} + */ + export namespace GistsUpdateComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + /** gist_id parameter */ + gistId: string; + }; + export type RequestQuery = {}; + export type RequestBody = GistsUpdateCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = GistsUpdateCommentData; + } +} + +export namespace Gitignore { + /** + * @description List all templates available to pass as an option when [creating a repository](https://docs.github.com/rest/reference/repos#create-a-repository-for-the-authenticated-user). + * @tags gitignore + * @name GitignoreGetAllTemplates + * @summary Get all gitignore templates + * @request GET:/gitignore/templates + */ + export namespace GitignoreGetAllTemplates { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GitignoreGetAllTemplatesData; + } + /** + * @description The API also allows fetching the source of a single template. Use the raw [media type](https://docs.github.com/rest/overview/media-types/) to get the raw contents. + * @tags gitignore + * @name GitignoreGetTemplate + * @summary Get a gitignore template + * @request GET:/gitignore/templates/{name} + */ + export namespace GitignoreGetTemplate { + export type RequestParams = { + name: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GitignoreGetTemplateData; + } +} + +export namespace Installation { + /** + * @description List repositories that an app installation can access. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * @tags apps + * @name AppsListReposAccessibleToInstallation + * @summary List repositories accessible to the app installation + * @request GET:/installation/repositories + */ + export namespace AppsListReposAccessibleToInstallation { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsListReposAccessibleToInstallationData; + } + /** + * @description Revokes the installation token you're using to authenticate as an installation and access this endpoint. Once an installation token is revoked, the token is invalidated and cannot be used. Other endpoints that require the revoked installation token must have a new installation token to work. You can create a new token using the "[Create an installation access token for an app](https://docs.github.com/rest/reference/apps#create-an-installation-access-token-for-an-app)" endpoint. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * @tags apps + * @name AppsRevokeInstallationAccessToken + * @summary Revoke an installation access token + * @request DELETE:/installation/token + */ + export namespace AppsRevokeInstallationAccessToken { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsRevokeInstallationAccessTokenData; + } +} + +export namespace Issues { + /** + * @description List issues assigned to the authenticated user across all visible repositories including owned repositories, member repositories, and organization repositories. You can use the \`filter\` query parameter to fetch issues that are not necessarily assigned to you. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * @tags issues + * @name IssuesList + * @summary List issues assigned to the authenticated user + * @request GET:/issues + */ + export namespace IssuesList { + export type RequestParams = {}; + export type RequestQuery = { + collab?: boolean; + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: IssuesListParams1DirectionEnum; + /** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ + filter?: IssuesListParams1FilterEnum; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + orgs?: boolean; + owned?: boolean; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + pulls?: boolean; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: IssuesListParams1SortEnum; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: IssuesListParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListData; + } +} + +export namespace Licenses { + /** + * No description + * @tags licenses + * @name LicensesGet + * @summary Get a license + * @request GET:/licenses/{license} + */ + export namespace LicensesGet { + export type RequestParams = { + license: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = LicensesGetData; + } + /** + * No description + * @tags licenses + * @name LicensesGetAllCommonlyUsed + * @summary Get all commonly used licenses + * @request GET:/licenses + */ + export namespace LicensesGetAllCommonlyUsed { + export type RequestParams = {}; + export type RequestQuery = { + featured?: boolean; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = LicensesGetAllCommonlyUsedData; + } +} + +export namespace Markdown { + /** + * No description + * @tags markdown + * @name MarkdownRender + * @summary Render a Markdown document + * @request POST:/markdown + */ + export namespace MarkdownRender { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = MarkdownRenderPayload; + export type RequestHeaders = {}; + export type ResponseBody = MarkdownRenderData; + } + /** + * @description You must send Markdown as plain text (using a \`Content-Type\` header of \`text/plain\` or \`text/x-markdown\`) to this endpoint, rather than using JSON format. In raw mode, [GitHub Flavored Markdown](https://github.github.com/gfm/) is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less. + * @tags markdown + * @name MarkdownRenderRaw + * @summary Render a Markdown document in raw mode + * @request POST:/markdown/raw + */ + export namespace MarkdownRenderRaw { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = MarkdownRenderRawPayload; + export type RequestHeaders = {}; + export type ResponseBody = MarkdownRenderRawData; + } +} + +export namespace MarketplaceListing { + /** + * @description Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * @tags apps + * @name AppsGetSubscriptionPlanForAccount + * @summary Get a subscription plan for an account + * @request GET:/marketplace_listing/accounts/{account_id} + */ + export namespace AppsGetSubscriptionPlanForAccount { + export type RequestParams = { + /** account_id parameter */ + accountId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsGetSubscriptionPlanForAccountData; + } + /** + * @description Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * @tags apps + * @name AppsGetSubscriptionPlanForAccountStubbed + * @summary Get a subscription plan for an account (stubbed) + * @request GET:/marketplace_listing/stubbed/accounts/{account_id} + */ + export namespace AppsGetSubscriptionPlanForAccountStubbed { + export type RequestParams = { + /** account_id parameter */ + accountId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsGetSubscriptionPlanForAccountStubbedData; + } + /** + * @description Returns user and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * @tags apps + * @name AppsListAccountsForPlan + * @summary List accounts for a plan + * @request GET:/marketplace_listing/plans/{plan_id}/accounts + */ + export namespace AppsListAccountsForPlan { + export type RequestParams = { + /** plan_id parameter */ + planId: number; + }; + export type RequestQuery = { + /** To return the oldest accounts first, set to \`asc\`. Can be one of \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ + direction?: AppsListAccountsForPlanParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: AppsListAccountsForPlanParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsListAccountsForPlanData; + } + /** + * @description Returns repository and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * @tags apps + * @name AppsListAccountsForPlanStubbed + * @summary List accounts for a plan (stubbed) + * @request GET:/marketplace_listing/stubbed/plans/{plan_id}/accounts + */ + export namespace AppsListAccountsForPlanStubbed { + export type RequestParams = { + /** plan_id parameter */ + planId: number; + }; + export type RequestQuery = { + /** To return the oldest accounts first, set to \`asc\`. Can be one of \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ + direction?: AppsListAccountsForPlanStubbedParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: AppsListAccountsForPlanStubbedParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsListAccountsForPlanStubbedData; + } + /** + * @description Lists all plans that are part of your GitHub Marketplace listing. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * @tags apps + * @name AppsListPlans + * @summary List plans + * @request GET:/marketplace_listing/plans + */ + export namespace AppsListPlans { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsListPlansData; + } + /** + * @description Lists all plans that are part of your GitHub Marketplace listing. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * @tags apps + * @name AppsListPlansStubbed + * @summary List plans (stubbed) + * @request GET:/marketplace_listing/stubbed/plans + */ + export namespace AppsListPlansStubbed { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsListPlansStubbedData; + } +} + +export namespace Meta { + /** + * @description Returns meta information about GitHub, including a list of GitHub's IP addresses. For more information, see "[About GitHub's IP addresses](https://help.github.com/articles/about-github-s-ip-addresses/)." **Note:** The IP addresses shown in the documentation's response are only example values. You must always query the API directly to get the latest list of IP addresses. + * @tags meta + * @name MetaGet + * @summary Get GitHub meta information + * @request GET:/meta + */ + export namespace MetaGet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MetaGetData; + } +} + +export namespace Networks { + /** + * No description + * @tags activity + * @name ActivityListPublicEventsForRepoNetwork + * @summary List public events for a network of repositories + * @request GET:/networks/{owner}/{repo}/events + */ + export namespace ActivityListPublicEventsForRepoNetwork { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListPublicEventsForRepoNetworkData; + } +} + +export namespace Notifications { + /** + * @description Mutes all future notifications for a conversation until you comment on the thread or get an **@mention**. If you are watching the repository of the thread, you will still receive notifications. To ignore future notifications for a repository you are watching, use the [Set a thread subscription](https://docs.github.com/rest/reference/activity#set-a-thread-subscription) endpoint and set \`ignore\` to \`true\`. + * @tags activity + * @name ActivityDeleteThreadSubscription + * @summary Delete a thread subscription + * @request DELETE:/notifications/threads/{thread_id}/subscription + */ + export namespace ActivityDeleteThreadSubscription { + export type RequestParams = { + /** thread_id parameter */ + threadId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityDeleteThreadSubscriptionData; + } + /** + * No description + * @tags activity + * @name ActivityGetThread + * @summary Get a thread + * @request GET:/notifications/threads/{thread_id} + */ + export namespace ActivityGetThread { + export type RequestParams = { + /** thread_id parameter */ + threadId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityGetThreadData; + } + /** + * @description This checks to see if the current user is subscribed to a thread. You can also [get a repository subscription](https://docs.github.com/rest/reference/activity#get-a-repository-subscription). Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were **@mentioned**, or manually subscribe to a thread. + * @tags activity + * @name ActivityGetThreadSubscriptionForAuthenticatedUser + * @summary Get a thread subscription for the authenticated user + * @request GET:/notifications/threads/{thread_id}/subscription + */ + export namespace ActivityGetThreadSubscriptionForAuthenticatedUser { + export type RequestParams = { + /** thread_id parameter */ + threadId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityGetThreadSubscriptionForAuthenticatedUserData; + } + /** + * @description List all notifications for the current user, sorted by most recently updated. + * @tags activity + * @name ActivityListNotificationsForAuthenticatedUser + * @summary List notifications for the authenticated user + * @request GET:/notifications + */ + export namespace ActivityListNotificationsForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * If \`true\`, show notifications marked as read. + * @default false + */ + all?: boolean; + /** Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + before?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * If \`true\`, only shows notifications in which the user is directly participating or mentioned. + * @default false + */ + participating?: boolean; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListNotificationsForAuthenticatedUserData; + } + /** + * @description Marks all notifications as "read" removes it from the [default view on GitHub](https://github.com/notifications). If the number of notifications is too large to complete in one request, you will receive a \`202 Accepted\` status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the [List notifications for the authenticated user](https://docs.github.com/rest/reference/activity#list-notifications-for-the-authenticated-user) endpoint and pass the query parameter \`all=false\`. + * @tags activity + * @name ActivityMarkNotificationsAsRead + * @summary Mark notifications as read + * @request PUT:/notifications + */ + export namespace ActivityMarkNotificationsAsRead { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = ActivityMarkNotificationsAsReadPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActivityMarkNotificationsAsReadData; + } + /** + * No description + * @tags activity + * @name ActivityMarkThreadAsRead + * @summary Mark a thread as read + * @request PATCH:/notifications/threads/{thread_id} + */ + export namespace ActivityMarkThreadAsRead { + export type RequestParams = { + /** thread_id parameter */ + threadId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityMarkThreadAsReadData; + } + /** + * @description If you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an **@mention**. You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored. Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the [Delete a thread subscription](https://docs.github.com/rest/reference/activity#delete-a-thread-subscription) endpoint. + * @tags activity + * @name ActivitySetThreadSubscription + * @summary Set a thread subscription + * @request PUT:/notifications/threads/{thread_id}/subscription + */ + export namespace ActivitySetThreadSubscription { + export type RequestParams = { + /** thread_id parameter */ + threadId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ActivitySetThreadSubscriptionPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActivitySetThreadSubscriptionData; + } +} + +export namespace Octocat { + /** + * @description Get the octocat as ASCII art + * @tags meta + * @name MetaGetOctocat + * @summary Get Octocat + * @request GET:/octocat + */ + export namespace MetaGetOctocat { + export type RequestParams = {}; + export type RequestQuery = { + /** The words to show in Octocat's speech bubble */ + s?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MetaGetOctocatData; + } +} + +export namespace Organizations { + /** + * @description Lists all organizations, in the order that they were created on GitHub. **Note:** Pagination is powered exclusively by the \`since\` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of organizations. + * @tags orgs + * @name OrgsList + * @summary List organizations + * @request GET:/organizations + */ + export namespace OrgsList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** An organization ID. Only return organizations with an ID greater than this ID. */ + since?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListData; + } +} + +export namespace Orgs { + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Adds a repository to the list of selected repositories that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsAddRepoAccessToSelfHostedRunnerGroupInOrg + * @summary Add repository access to a self-hosted runner group in an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} + */ + export namespace ActionsAddRepoAccessToSelfHostedRunnerGroupInOrg { + export type RequestParams = { + org: string; + repositoryId: number; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsAddRepoAccessToSelfHostedRunnerGroupInOrgData; + } + /** + * @description Adds a repository to an organization secret when the \`visibility\` for repository access is set to \`selected\`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * @tags actions + * @name ActionsAddSelectedRepoToOrgSecret + * @summary Add selected repository to an organization secret + * @request PUT:/orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} + */ + export namespace ActionsAddSelectedRepoToOrgSecret { + export type RequestParams = { + org: string; + repositoryId: number; + /** secret_name parameter */ + secretName: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsAddSelectedRepoToOrgSecretData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Adds a self-hosted runner to a runner group configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsAddSelfHostedRunnerToGroupForOrg + * @summary Add a self-hosted runner to a group for an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + export namespace ActionsAddSelfHostedRunnerToGroupForOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + /** Unique identifier of the self-hosted runner. */ + runnerId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsAddSelfHostedRunnerToGroupForOrgData; + } + /** + * @description Creates or updates an organization secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. #### Example encrypting a secret using Node.js Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library. \`\`\` const sodium = require('tweetsodium'); const key = "base64-encoded-public-key"; const value = "plain-text-secret"; // Convert the message and key to Uint8Array's (Buffer implements that interface) const messageBytes = Buffer.from(value); const keyBytes = Buffer.from(key, 'base64'); // Encrypt using LibSodium. const encryptedBytes = sodium.seal(messageBytes, keyBytes); // Base64 the encrypted secret const encrypted = Buffer.from(encryptedBytes).toString('base64'); console.log(encrypted); \`\`\` #### Example encrypting a secret using Python Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3. \`\`\` from base64 import b64encode from nacl import encoding, public def encrypt(public_key: str, secret_value: str) -> str: """Encrypt a Unicode string using the public key.""" public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder()) sealed_box = public.SealedBox(public_key) encrypted = sealed_box.encrypt(secret_value.encode("utf-8")) return b64encode(encrypted).decode("utf-8") \`\`\` #### Example encrypting a secret using C# Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package. \`\`\` var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret"); var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU="); var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey); Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox)); \`\`\` #### Example encrypting a secret using Ruby Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem. \`\`\`ruby require "rbnacl" require "base64" key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=") public_key = RbNaCl::PublicKey.new(key) box = RbNaCl::Boxes::Sealed.from_public_key(public_key) encrypted_secret = box.encrypt("my_secret") # Print the base64 encoded secret puts Base64.strict_encode64(encrypted_secret) \`\`\` + * @tags actions + * @name ActionsCreateOrUpdateOrgSecret + * @summary Create or update an organization secret + * @request PUT:/orgs/{org}/actions/secrets/{secret_name} + */ + export namespace ActionsCreateOrUpdateOrgSecret { + export type RequestParams = { + org: string; + /** secret_name parameter */ + secretName: string; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsCreateOrUpdateOrgSecretPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsCreateOrUpdateOrgSecretData; + } + /** + * @description Returns a token that you can pass to the \`config\` script. The token expires after one hour. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing \`TOKEN\` with the registration token provided by this endpoint. \`\`\` ./config.sh --url https://github.com/octo-org --token TOKEN \`\`\` + * @tags actions + * @name ActionsCreateRegistrationTokenForOrg + * @summary Create a registration token for an organization + * @request POST:/orgs/{org}/actions/runners/registration-token + */ + export namespace ActionsCreateRegistrationTokenForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsCreateRegistrationTokenForOrgData; + } + /** + * @description Returns a token that you can pass to the \`config\` script to remove a self-hosted runner from an organization. The token expires after one hour. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from an organization, replace \`TOKEN\` with the remove token provided by this endpoint. \`\`\` ./config.sh remove --token TOKEN \`\`\` + * @tags actions + * @name ActionsCreateRemoveTokenForOrg + * @summary Create a remove token for an organization + * @request POST:/orgs/{org}/actions/runners/remove-token + */ + export namespace ActionsCreateRemoveTokenForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsCreateRemoveTokenForOrgData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Creates a new self-hosted runner group for an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsCreateSelfHostedRunnerGroupForOrg + * @summary Create a self-hosted runner group for an organization + * @request POST:/orgs/{org}/actions/runner-groups + */ + export namespace ActionsCreateSelfHostedRunnerGroupForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsCreateSelfHostedRunnerGroupForOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsCreateSelfHostedRunnerGroupForOrgData; + } + /** + * @description Deletes a secret in an organization using the secret name. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * @tags actions + * @name ActionsDeleteOrgSecret + * @summary Delete an organization secret + * @request DELETE:/orgs/{org}/actions/secrets/{secret_name} + */ + export namespace ActionsDeleteOrgSecret { + export type RequestParams = { + org: string; + /** secret_name parameter */ + secretName: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsDeleteOrgSecretData; + } + /** + * @description Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsDeleteSelfHostedRunnerFromOrg + * @summary Delete a self-hosted runner from an organization + * @request DELETE:/orgs/{org}/actions/runners/{runner_id} + */ + export namespace ActionsDeleteSelfHostedRunnerFromOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner. */ + runnerId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsDeleteSelfHostedRunnerFromOrgData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Deletes a self-hosted runner group for an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsDeleteSelfHostedRunnerGroupFromOrg + * @summary Delete a self-hosted runner group from an organization + * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id} + */ + export namespace ActionsDeleteSelfHostedRunnerGroupFromOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsDeleteSelfHostedRunnerGroupFromOrgData; + } + /** + * @description Removes a repository from the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * @tags actions + * @name ActionsDisableSelectedRepositoryGithubActionsOrganization + * @summary Disable a selected repository for GitHub Actions in an organization + * @request DELETE:/orgs/{org}/actions/permissions/repositories/{repository_id} + */ + export namespace ActionsDisableSelectedRepositoryGithubActionsOrganization { + export type RequestParams = { + org: string; + repositoryId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsDisableSelectedRepositoryGithubActionsOrganizationData; + } + /** + * @description Adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * @tags actions + * @name ActionsEnableSelectedRepositoryGithubActionsOrganization + * @summary Enable a selected repository for GitHub Actions in an organization + * @request PUT:/orgs/{org}/actions/permissions/repositories/{repository_id} + */ + export namespace ActionsEnableSelectedRepositoryGithubActionsOrganization { + export type RequestParams = { + org: string; + repositoryId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsEnableSelectedRepositoryGithubActionsOrganizationData; + } + /** + * @description Gets the selected actions that are allowed in an organization. To use this endpoint, the organization permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."" You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * @tags actions + * @name ActionsGetAllowedActionsOrganization + * @summary Get allowed actions for an organization + * @request GET:/orgs/{org}/actions/permissions/selected-actions + */ + export namespace ActionsGetAllowedActionsOrganization { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetAllowedActionsOrganizationData; + } + /** + * @description Gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * @tags actions + * @name ActionsGetGithubActionsPermissionsOrganization + * @summary Get GitHub Actions permissions for an organization + * @request GET:/orgs/{org}/actions/permissions + */ + export namespace ActionsGetGithubActionsPermissionsOrganization { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetGithubActionsPermissionsOrganizationData; + } + /** + * @description Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * @tags actions + * @name ActionsGetOrgPublicKey + * @summary Get an organization public key + * @request GET:/orgs/{org}/actions/secrets/public-key + */ + export namespace ActionsGetOrgPublicKey { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetOrgPublicKeyData; + } + /** + * @description Gets a single organization secret without revealing its encrypted value. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * @tags actions + * @name ActionsGetOrgSecret + * @summary Get an organization secret + * @request GET:/orgs/{org}/actions/secrets/{secret_name} + */ + export namespace ActionsGetOrgSecret { + export type RequestParams = { + org: string; + /** secret_name parameter */ + secretName: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetOrgSecretData; + } + /** + * @description Gets a specific self-hosted runner configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsGetSelfHostedRunnerForOrg + * @summary Get a self-hosted runner for an organization + * @request GET:/orgs/{org}/actions/runners/{runner_id} + */ + export namespace ActionsGetSelfHostedRunnerForOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner. */ + runnerId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetSelfHostedRunnerForOrgData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Gets a specific self-hosted runner group for an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsGetSelfHostedRunnerGroupForOrg + * @summary Get a self-hosted runner group for an organization + * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id} + */ + export namespace ActionsGetSelfHostedRunnerGroupForOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetSelfHostedRunnerGroupForOrgData; + } + /** + * @description Lists all secrets available in an organization without revealing their encrypted values. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * @tags actions + * @name ActionsListOrgSecrets + * @summary List organization secrets + * @request GET:/orgs/{org}/actions/secrets + */ + export namespace ActionsListOrgSecrets { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListOrgSecretsData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists the repositories with access to a self-hosted runner group configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsListRepoAccessToSelfHostedRunnerGroupInOrg + * @summary List repository access to a self-hosted runner group in an organization + * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories + */ + export namespace ActionsListRepoAccessToSelfHostedRunnerGroupInOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListRepoAccessToSelfHostedRunnerGroupInOrgData; + } + /** + * @description Lists binaries for the runner application that you can download and run. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsListRunnerApplicationsForOrg + * @summary List runner applications for an organization + * @request GET:/orgs/{org}/actions/runners/downloads + */ + export namespace ActionsListRunnerApplicationsForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListRunnerApplicationsForOrgData; + } + /** + * @description Lists all repositories that have been selected when the \`visibility\` for repository access to a secret is set to \`selected\`. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * @tags actions + * @name ActionsListSelectedReposForOrgSecret + * @summary List selected repositories for an organization secret + * @request GET:/orgs/{org}/actions/secrets/{secret_name}/repositories + */ + export namespace ActionsListSelectedReposForOrgSecret { + export type RequestParams = { + org: string; + /** secret_name parameter */ + secretName: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListSelectedReposForOrgSecretData; + } + /** + * @description Lists the selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * @tags actions + * @name ActionsListSelectedRepositoriesEnabledGithubActionsOrganization + * @summary List selected repositories enabled for GitHub Actions in an organization + * @request GET:/orgs/{org}/actions/permissions/repositories + */ + export namespace ActionsListSelectedRepositoriesEnabledGithubActionsOrganization { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists all self-hosted runner groups configured in an organization and inherited from an enterprise. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsListSelfHostedRunnerGroupsForOrg + * @summary List self-hosted runner groups for an organization + * @request GET:/orgs/{org}/actions/runner-groups + */ + export namespace ActionsListSelfHostedRunnerGroupsForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListSelfHostedRunnerGroupsForOrgData; + } + /** + * @description Lists all self-hosted runners configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsListSelfHostedRunnersForOrg + * @summary List self-hosted runners for an organization + * @request GET:/orgs/{org}/actions/runners + */ + export namespace ActionsListSelfHostedRunnersForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListSelfHostedRunnersForOrgData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists self-hosted runners that are in a specific organization group. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsListSelfHostedRunnersInGroupForOrg + * @summary List self-hosted runners in a group for an organization + * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners + */ + export namespace ActionsListSelfHostedRunnersInGroupForOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListSelfHostedRunnersInGroupForOrgData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Removes a repository from the list of selected repositories that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg + * @summary Remove repository access to a self-hosted runner group in an organization + * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} + */ + export namespace ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg { + export type RequestParams = { + org: string; + repositoryId: number; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrgData; + } + /** + * @description Removes a repository from an organization secret when the \`visibility\` for repository access is set to \`selected\`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * @tags actions + * @name ActionsRemoveSelectedRepoFromOrgSecret + * @summary Remove selected repository from an organization secret + * @request DELETE:/orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} + */ + export namespace ActionsRemoveSelectedRepoFromOrgSecret { + export type RequestParams = { + org: string; + repositoryId: number; + /** secret_name parameter */ + secretName: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsRemoveSelectedRepoFromOrgSecretData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Removes a self-hosted runner from a group configured in an organization. The runner is then returned to the default group. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsRemoveSelfHostedRunnerFromGroupForOrg + * @summary Remove a self-hosted runner from a group for an organization + * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + export namespace ActionsRemoveSelfHostedRunnerFromGroupForOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + /** Unique identifier of the self-hosted runner. */ + runnerId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsRemoveSelfHostedRunnerFromGroupForOrgData; + } + /** + * @description Sets the actions that are allowed in an organization. To use this endpoint, the organization permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." If the organization belongs to an enterprise that has \`selected\` actions set at the enterprise level, then you cannot override any of the enterprise's allowed actions settings. To use the \`patterns_allowed\` setting for private repositories, the organization must belong to an enterprise. If the organization does not belong to an enterprise, then the \`patterns_allowed\` setting only applies to public repositories in the organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * @tags actions + * @name ActionsSetAllowedActionsOrganization + * @summary Set allowed actions for an organization + * @request PUT:/orgs/{org}/actions/permissions/selected-actions + */ + export namespace ActionsSetAllowedActionsOrganization { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = SelectedActions; + export type RequestHeaders = {}; + export type ResponseBody = ActionsSetAllowedActionsOrganizationData; + } + /** + * @description Sets the GitHub Actions permissions policy for repositories and allowed actions in an organization. If the organization belongs to an enterprise that has set restrictive permissions at the enterprise level, such as \`allowed_actions\` to \`selected\` actions, then you cannot override them for the organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * @tags actions + * @name ActionsSetGithubActionsPermissionsOrganization + * @summary Set GitHub Actions permissions for an organization + * @request PUT:/orgs/{org}/actions/permissions + */ + export namespace ActionsSetGithubActionsPermissionsOrganization { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsSetGithubActionsPermissionsOrganizationPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsSetGithubActionsPermissionsOrganizationData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Replaces the list of repositories that have access to a self-hosted runner group configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsSetRepoAccessToSelfHostedRunnerGroupInOrg + * @summary Set repository access for a self-hosted runner group in an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories + */ + export namespace ActionsSetRepoAccessToSelfHostedRunnerGroupInOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgData; + } + /** + * @description Replaces all repositories for an organization secret when the \`visibility\` for repository access is set to \`selected\`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * @tags actions + * @name ActionsSetSelectedReposForOrgSecret + * @summary Set selected repositories for an organization secret + * @request PUT:/orgs/{org}/actions/secrets/{secret_name}/repositories + */ + export namespace ActionsSetSelectedReposForOrgSecret { + export type RequestParams = { + org: string; + /** secret_name parameter */ + secretName: string; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsSetSelectedReposForOrgSecretPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsSetSelectedReposForOrgSecretData; + } + /** + * @description Replaces the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * @tags actions + * @name ActionsSetSelectedRepositoriesEnabledGithubActionsOrganization + * @summary Set selected repositories enabled for GitHub Actions in an organization + * @request PUT:/orgs/{org}/actions/permissions/repositories + */ + export namespace ActionsSetSelectedRepositoriesEnabledGithubActionsOrganization { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Replaces the list of self-hosted runners that are part of an organization runner group. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsSetSelfHostedRunnersInGroupForOrg + * @summary Set self-hosted runners in a group for an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners + */ + export namespace ActionsSetSelfHostedRunnersInGroupForOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsSetSelfHostedRunnersInGroupForOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsSetSelfHostedRunnersInGroupForOrgData; + } + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Updates the \`name\` and \`visibility\` of a self-hosted runner group in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * @tags actions + * @name ActionsUpdateSelfHostedRunnerGroupForOrg + * @summary Update a self-hosted runner group for an organization + * @request PATCH:/orgs/{org}/actions/runner-groups/{runner_group_id} + */ + export namespace ActionsUpdateSelfHostedRunnerGroupForOrg { + export type RequestParams = { + org: string; + /** Unique identifier of the self-hosted runner group. */ + runnerGroupId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsUpdateSelfHostedRunnerGroupForOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsUpdateSelfHostedRunnerGroupForOrgData; + } + /** + * No description + * @tags activity + * @name ActivityListPublicOrgEvents + * @summary List public organization events + * @request GET:/orgs/{org}/events + */ + export namespace ActivityListPublicOrgEvents { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListPublicOrgEventsData; + } + /** + * @description Enables an authenticated GitHub App to find the organization's installation information. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsGetOrgInstallation + * @summary Get an organization installation for the authenticated app + * @request GET:/orgs/{org}/installation + */ + export namespace AppsGetOrgInstallation { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsGetOrgInstallationData; + } + /** + * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Access tokens must have the \`repo\` or \`admin:org\` scope. + * @tags billing + * @name BillingGetGithubActionsBillingOrg + * @summary Get GitHub Actions billing for an organization + * @request GET:/orgs/{org}/settings/billing/actions + */ + export namespace BillingGetGithubActionsBillingOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = BillingGetGithubActionsBillingOrgData; + } + /** + * @description Gets the free and paid storage usued for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`repo\` or \`admin:org\` scope. + * @tags billing + * @name BillingGetGithubPackagesBillingOrg + * @summary Get GitHub Packages billing for an organization + * @request GET:/orgs/{org}/settings/billing/packages + */ + export namespace BillingGetGithubPackagesBillingOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = BillingGetGithubPackagesBillingOrgData; + } + /** + * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`repo\` or \`admin:org\` scope. + * @tags billing + * @name BillingGetSharedStorageBillingOrg + * @summary Get shared storage billing for an organization + * @request GET:/orgs/{org}/settings/billing/shared-storage + */ + export namespace BillingGetSharedStorageBillingOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = BillingGetSharedStorageBillingOrgData; + } + /** + * @description Shows which type of GitHub user can interact with this organization and when the restriction expires. If there is no restrictions, you will see an empty response. + * @tags interactions + * @name InteractionsGetRestrictionsForOrg + * @summary Get interaction restrictions for an organization + * @request GET:/orgs/{org}/interaction-limits + */ + export namespace InteractionsGetRestrictionsForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = InteractionsGetRestrictionsForOrgData; + } + /** + * @description Removes all interaction restrictions from public repositories in the given organization. You must be an organization owner to remove restrictions. + * @tags interactions + * @name InteractionsRemoveRestrictionsForOrg + * @summary Remove interaction restrictions for an organization + * @request DELETE:/orgs/{org}/interaction-limits + */ + export namespace InteractionsRemoveRestrictionsForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = InteractionsRemoveRestrictionsForOrgData; + } + /** + * @description Temporarily restricts interactions to a certain type of GitHub user in any public repository in the given organization. You must be an organization owner to set these restrictions. Setting the interaction limit at the organization level will overwrite any interaction limits that are set for individual repositories owned by the organization. + * @tags interactions + * @name InteractionsSetRestrictionsForOrg + * @summary Set interaction restrictions for an organization + * @request PUT:/orgs/{org}/interaction-limits + */ + export namespace InteractionsSetRestrictionsForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = InteractionLimit; + export type RequestHeaders = {}; + export type ResponseBody = InteractionsSetRestrictionsForOrgData; + } + /** + * @description List issues in an organization assigned to the authenticated user. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * @tags issues + * @name IssuesListForOrg + * @summary List organization issues assigned to the authenticated user + * @request GET:/orgs/{org}/issues + */ + export namespace IssuesListForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: IssuesListForOrgParams1DirectionEnum; + /** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ + filter?: IssuesListForOrgParams1FilterEnum; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: IssuesListForOrgParams1SortEnum; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: IssuesListForOrgParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListForOrgData; + } + /** + * @description Deletes a previous migration archive. Migration archives are automatically deleted after seven days. + * @tags migrations + * @name MigrationsDeleteArchiveForOrg + * @summary Delete an organization migration archive + * @request DELETE:/orgs/{org}/migrations/{migration_id}/archive + */ + export namespace MigrationsDeleteArchiveForOrg { + export type RequestParams = { + /** migration_id parameter */ + migrationId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsDeleteArchiveForOrgData; + } + /** + * @description Fetches the URL to a migration archive. + * @tags migrations + * @name MigrationsDownloadArchiveForOrg + * @summary Download an organization migration archive + * @request GET:/orgs/{org}/migrations/{migration_id}/archive + */ + export namespace MigrationsDownloadArchiveForOrg { + export type RequestParams = { + /** migration_id parameter */ + migrationId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description Fetches the status of a migration. The \`state\` of a migration can be one of the following values: * \`pending\`, which means the migration hasn't started yet. * \`exporting\`, which means the migration is in progress. * \`exported\`, which means the migration finished successfully. * \`failed\`, which means the migration failed. + * @tags migrations + * @name MigrationsGetStatusForOrg + * @summary Get an organization migration status + * @request GET:/orgs/{org}/migrations/{migration_id} + */ + export namespace MigrationsGetStatusForOrg { + export type RequestParams = { + /** migration_id parameter */ + migrationId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsGetStatusForOrgData; + } + /** + * @description Lists the most recent migrations. + * @tags migrations + * @name MigrationsListForOrg + * @summary List organization migrations + * @request GET:/orgs/{org}/migrations + */ + export namespace MigrationsListForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsListForOrgData; + } + /** + * @description List all the repositories for this organization migration. + * @tags migrations + * @name MigrationsListReposForOrg + * @summary List repositories in an organization migration + * @request GET:/orgs/{org}/migrations/{migration_id}/repositories + */ + export namespace MigrationsListReposForOrg { + export type RequestParams = { + /** migration_id parameter */ + migrationId: number; + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsListReposForOrgData; + } + /** + * @description Initiates the generation of a migration archive. + * @tags migrations + * @name MigrationsStartForOrg + * @summary Start an organization migration + * @request POST:/orgs/{org}/migrations + */ + export namespace MigrationsStartForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = MigrationsStartForOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsStartForOrgData; + } + /** + * @description Unlocks a repository that was locked for migration. You should unlock each migrated repository and [delete them](https://docs.github.com/rest/reference/repos#delete-a-repository) when the migration is complete and you no longer need the source data. + * @tags migrations + * @name MigrationsUnlockRepoForOrg + * @summary Unlock an organization repository + * @request DELETE:/orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock + */ + export namespace MigrationsUnlockRepoForOrg { + export type RequestParams = { + /** migration_id parameter */ + migrationId: number; + org: string; + /** repo_name parameter */ + repoName: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsUnlockRepoForOrgData; + } + /** + * No description + * @tags orgs + * @name OrgsBlockUser + * @summary Block a user from an organization + * @request PUT:/orgs/{org}/blocks/{username} + */ + export namespace OrgsBlockUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsBlockUserData; + } + /** + * @description Cancel an organization invitation. In order to cancel an organization invitation, the authenticated user must be an organization owner. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). + * @tags orgs + * @name OrgsCancelInvitation + * @summary Cancel an organization invitation + * @request DELETE:/orgs/{org}/invitations/{invitation_id} + */ + export namespace OrgsCancelInvitation { + export type RequestParams = { + /** invitation_id parameter */ + invitationId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsCancelInvitationData; + } + /** + * No description + * @tags orgs + * @name OrgsCheckBlockedUser + * @summary Check if a user is blocked by an organization + * @request GET:/orgs/{org}/blocks/{username} + */ + export namespace OrgsCheckBlockedUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsCheckBlockedUserData; + } + /** + * @description Check if a user is, publicly or privately, a member of the organization. + * @tags orgs + * @name OrgsCheckMembershipForUser + * @summary Check organization membership for a user + * @request GET:/orgs/{org}/members/{username} + */ + export namespace OrgsCheckMembershipForUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsCheckMembershipForUserData; + } + /** + * No description + * @tags orgs + * @name OrgsCheckPublicMembershipForUser + * @summary Check public organization membership for a user + * @request GET:/orgs/{org}/public_members/{username} + */ + export namespace OrgsCheckPublicMembershipForUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsCheckPublicMembershipForUserData; + } + /** + * @description When an organization member is converted to an outside collaborator, they'll only have access to the repositories that their current team membership allows. The user will no longer be a member of the organization. For more information, see "[Converting an organization member to an outside collaborator](https://help.github.com/articles/converting-an-organization-member-to-an-outside-collaborator/)". + * @tags orgs + * @name OrgsConvertMemberToOutsideCollaborator + * @summary Convert an organization member to outside collaborator + * @request PUT:/orgs/{org}/outside_collaborators/{username} + */ + export namespace OrgsConvertMemberToOutsideCollaborator { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsConvertMemberToOutsideCollaboratorData; + } + /** + * @description Invite people to an organization by using their GitHub user ID or their email address. In order to create invitations in an organization, the authenticated user must be an organization owner. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @tags orgs + * @name OrgsCreateInvitation + * @summary Create an organization invitation + * @request POST:/orgs/{org}/invitations + */ + export namespace OrgsCreateInvitation { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = OrgsCreateInvitationPayload; + export type RequestHeaders = {}; + export type ResponseBody = OrgsCreateInvitationData; + } + /** + * @description Here's how you can create a hook that posts payloads in JSON format: + * @tags orgs + * @name OrgsCreateWebhook + * @summary Create an organization webhook + * @request POST:/orgs/{org}/hooks + */ + export namespace OrgsCreateWebhook { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = OrgsCreateWebhookPayload; + export type RequestHeaders = {}; + export type ResponseBody = OrgsCreateWebhookData; + } + /** + * No description + * @tags orgs + * @name OrgsDeleteWebhook + * @summary Delete an organization webhook + * @request DELETE:/orgs/{org}/hooks/{hook_id} + */ + export namespace OrgsDeleteWebhook { + export type RequestParams = { + hookId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsDeleteWebhookData; + } + /** + * @description To see many of the organization response values, you need to be an authenticated organization owner with the \`admin:org\` scope. When the value of \`two_factor_requirement_enabled\` is \`true\`, the organization requires all members, billing managers, and outside collaborators to enable [two-factor authentication](https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/). GitHub Apps with the \`Organization plan\` permission can use this endpoint to retrieve information about an organization's GitHub plan. See "[Authenticating with GitHub Apps](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/)" for details. For an example response, see 'Response with GitHub plan information' below." + * @tags orgs + * @name OrgsGet + * @summary Get an organization + * @request GET:/orgs/{org} + */ + export namespace OrgsGet { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsGetData; + } + /** + * @description **Note:** The audit log REST API is currently in beta and is subject to change. Gets the audit log for an organization. For more information, see "[Reviewing the audit log for your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization)." To use this endpoint, you must be an organization owner, and you must use an access token with the \`admin:org\` scope. GitHub Apps must have the \`organization_administration\` read permission to use this endpoint. + * @tags orgs + * @name OrgsGetAuditLog + * @summary Get the audit log for an organization + * @request GET:/orgs/{org}/audit-log + */ + export namespace OrgsGetAuditLog { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor. */ + after?: string; + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor. */ + before?: string; + /** + * The event types to include: + * + * - \`web\` - returns web (non-Git) events + * - \`git\` - returns Git events + * - \`all\` - returns both web and Git events + * + * The default is \`web\`. + */ + include?: OrgsGetAuditLogParams1IncludeEnum; + /** + * The order of audit log events. To list newest events first, specify \`desc\`. To list oldest events first, specify \`asc\`. + * + * The default is \`desc\`. + */ + order?: OrgsGetAuditLogParams1OrderEnum; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** A search phrase. For more information, see [Searching the audit log](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#searching-the-audit-log). */ + phrase?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsGetAuditLogData; + } + /** + * @description In order to get a user's membership with an organization, the authenticated user must be an organization member. + * @tags orgs + * @name OrgsGetMembershipForUser + * @summary Get organization membership for a user + * @request GET:/orgs/{org}/memberships/{username} + */ + export namespace OrgsGetMembershipForUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsGetMembershipForUserData; + } + /** + * @description Returns a webhook configured in an organization. To get only the webhook \`config\` properties, see "[Get a webhook configuration for an organization](/rest/reference/orgs#get-a-webhook-configuration-for-an-organization)." + * @tags orgs + * @name OrgsGetWebhook + * @summary Get an organization webhook + * @request GET:/orgs/{org}/hooks/{hook_id} + */ + export namespace OrgsGetWebhook { + export type RequestParams = { + hookId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsGetWebhookData; + } + /** + * @description Returns the webhook configuration for an organization. To get more information about the webhook, including the \`active\` state and \`events\`, use "[Get an organization webhook ](/rest/reference/orgs#get-an-organization-webhook)." Access tokens must have the \`admin:org_hook\` scope, and GitHub Apps must have the \`organization_hooks:read\` permission. + * @tags orgs + * @name OrgsGetWebhookConfigForOrg + * @summary Get a webhook configuration for an organization + * @request GET:/orgs/{org}/hooks/{hook_id}/config + */ + export namespace OrgsGetWebhookConfigForOrg { + export type RequestParams = { + hookId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsGetWebhookConfigForOrgData; + } + /** + * @description Lists all GitHub Apps in an organization. The installation count includes all GitHub Apps installed on repositories in the organization. You must be an organization owner with \`admin:read\` scope to use this endpoint. + * @tags orgs + * @name OrgsListAppInstallations + * @summary List app installations for an organization + * @request GET:/orgs/{org}/installations + */ + export namespace OrgsListAppInstallations { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListAppInstallationsData; + } + /** + * @description List the users blocked by an organization. + * @tags orgs + * @name OrgsListBlockedUsers + * @summary List users blocked by an organization + * @request GET:/orgs/{org}/blocks + */ + export namespace OrgsListBlockedUsers { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListBlockedUsersData; + } + /** + * @description The return hash contains \`failed_at\` and \`failed_reason\` fields which represent the time at which the invitation failed and the reason for the failure. + * @tags orgs + * @name OrgsListFailedInvitations + * @summary List failed organization invitations + * @request GET:/orgs/{org}/failed_invitations + */ + export namespace OrgsListFailedInvitations { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListFailedInvitationsData; + } + /** + * @description List all teams associated with an invitation. In order to see invitations in an organization, the authenticated user must be an organization owner. + * @tags orgs + * @name OrgsListInvitationTeams + * @summary List organization invitation teams + * @request GET:/orgs/{org}/invitations/{invitation_id}/teams + */ + export namespace OrgsListInvitationTeams { + export type RequestParams = { + /** invitation_id parameter */ + invitationId: number; + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListInvitationTeamsData; + } + /** + * @description List all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned. + * @tags orgs + * @name OrgsListMembers + * @summary List organization members + * @request GET:/orgs/{org}/members + */ + export namespace OrgsListMembers { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Filter members returned in the list. Can be one of: + * \\* \`2fa_disabled\` - Members without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. Available for organization owners. + * \\* \`all\` - All members the authenticated user can see. + * @default "all" + */ + filter?: OrgsListMembersParams1FilterEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Filter members returned by their role. Can be one of: + * \\* \`all\` - All members of the organization, regardless of role. + * \\* \`admin\` - Organization owners. + * \\* \`member\` - Non-owner organization members. + * @default "all" + */ + role?: OrgsListMembersParams1RoleEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListMembersData; + } + /** + * @description List all users who are outside collaborators of an organization. + * @tags orgs + * @name OrgsListOutsideCollaborators + * @summary List outside collaborators for an organization + * @request GET:/orgs/{org}/outside_collaborators + */ + export namespace OrgsListOutsideCollaborators { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Filter the list of outside collaborators. Can be one of: + * \\* \`2fa_disabled\`: Outside collaborators without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. + * \\* \`all\`: All outside collaborators. + * @default "all" + */ + filter?: OrgsListOutsideCollaboratorsParams1FilterEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListOutsideCollaboratorsData; + } + /** + * @description The return hash contains a \`role\` field which refers to the Organization Invitation role and will be one of the following values: \`direct_member\`, \`admin\`, \`billing_manager\`, \`hiring_manager\`, or \`reinstate\`. If the invitee is not a GitHub member, the \`login\` field in the return hash will be \`null\`. + * @tags orgs + * @name OrgsListPendingInvitations + * @summary List pending organization invitations + * @request GET:/orgs/{org}/invitations + */ + export namespace OrgsListPendingInvitations { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListPendingInvitationsData; + } + /** + * @description Members of an organization can choose to have their membership publicized or not. + * @tags orgs + * @name OrgsListPublicMembers + * @summary List public organization members + * @request GET:/orgs/{org}/public_members + */ + export namespace OrgsListPublicMembers { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListPublicMembersData; + } + /** + * @description Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products). An authenticated organization owner with the \`read:org\` scope can list all credential authorizations for an organization that uses SAML single sign-on (SSO). The credentials are either personal access tokens or SSH keys that organization members have authorized for the organization. For more information, see [About authentication with SAML single sign-on](https://help.github.com/en/articles/about-authentication-with-saml-single-sign-on). + * @tags orgs + * @name OrgsListSamlSsoAuthorizations + * @summary List SAML SSO authorizations for an organization + * @request GET:/orgs/{org}/credential-authorizations + */ + export namespace OrgsListSamlSsoAuthorizations { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListSamlSsoAuthorizationsData; + } + /** + * No description + * @tags orgs + * @name OrgsListWebhooks + * @summary List organization webhooks + * @request GET:/orgs/{org}/hooks + */ + export namespace OrgsListWebhooks { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListWebhooksData; + } + /** + * @description This will trigger a [ping event](https://docs.github.com/webhooks/#ping-event) to be sent to the hook. + * @tags orgs + * @name OrgsPingWebhook + * @summary Ping an organization webhook + * @request POST:/orgs/{org}/hooks/{hook_id}/pings + */ + export namespace OrgsPingWebhook { + export type RequestParams = { + hookId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsPingWebhookData; + } + /** + * @description Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. + * @tags orgs + * @name OrgsRemoveMember + * @summary Remove an organization member + * @request DELETE:/orgs/{org}/members/{username} + */ + export namespace OrgsRemoveMember { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsRemoveMemberData; + } + /** + * @description In order to remove a user's membership with an organization, the authenticated user must be an organization owner. If the specified user is an active member of the organization, this will remove them from the organization. If the specified user has been invited to the organization, this will cancel their invitation. The specified user will receive an email notification in both cases. + * @tags orgs + * @name OrgsRemoveMembershipForUser + * @summary Remove organization membership for a user + * @request DELETE:/orgs/{org}/memberships/{username} + */ + export namespace OrgsRemoveMembershipForUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsRemoveMembershipForUserData; + } + /** + * @description Removing a user from this list will remove them from all the organization's repositories. + * @tags orgs + * @name OrgsRemoveOutsideCollaborator + * @summary Remove outside collaborator from an organization + * @request DELETE:/orgs/{org}/outside_collaborators/{username} + */ + export namespace OrgsRemoveOutsideCollaborator { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsRemoveOutsideCollaboratorData; + } + /** + * No description + * @tags orgs + * @name OrgsRemovePublicMembershipForAuthenticatedUser + * @summary Remove public organization membership for the authenticated user + * @request DELETE:/orgs/{org}/public_members/{username} + */ + export namespace OrgsRemovePublicMembershipForAuthenticatedUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsRemovePublicMembershipForAuthenticatedUserData; + } + /** + * @description Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products). An authenticated organization owner with the \`admin:org\` scope can remove a credential authorization for an organization that uses SAML SSO. Once you remove someone's credential authorization, they will need to create a new personal access token or SSH key and authorize it for the organization they want to access. + * @tags orgs + * @name OrgsRemoveSamlSsoAuthorization + * @summary Remove a SAML SSO authorization for an organization + * @request DELETE:/orgs/{org}/credential-authorizations/{credential_id} + */ + export namespace OrgsRemoveSamlSsoAuthorization { + export type RequestParams = { + credentialId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsRemoveSamlSsoAuthorizationData; + } + /** + * @description Only authenticated organization owners can add a member to the organization or update the member's role. * If the authenticated user is _adding_ a member to the organization, the invited user will receive an email inviting them to the organization. The user's [membership status](https://docs.github.com/rest/reference/orgs#get-organization-membership-for-a-user) will be \`pending\` until they accept the invitation. * Authenticated users can _update_ a user's membership by passing the \`role\` parameter. If the authenticated user changes a member's role to \`admin\`, the affected user will receive an email notifying them that they've been made an organization owner. If the authenticated user changes an owner's role to \`member\`, no email will be sent. **Rate limits** To prevent abuse, the authenticated user is limited to 50 organization invitations per 24 hour period. If the organization is more than one month old or on a paid plan, the limit is 500 invitations per 24 hour period. + * @tags orgs + * @name OrgsSetMembershipForUser + * @summary Set organization membership for a user + * @request PUT:/orgs/{org}/memberships/{username} + */ + export namespace OrgsSetMembershipForUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = OrgsSetMembershipForUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = OrgsSetMembershipForUserData; + } + /** + * @description The user can publicize their own membership. (A user cannot publicize the membership for another user.) Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * @tags orgs + * @name OrgsSetPublicMembershipForAuthenticatedUser + * @summary Set public organization membership for the authenticated user + * @request PUT:/orgs/{org}/public_members/{username} + */ + export namespace OrgsSetPublicMembershipForAuthenticatedUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsSetPublicMembershipForAuthenticatedUserData; + } + /** + * No description + * @tags orgs + * @name OrgsUnblockUser + * @summary Unblock a user from an organization + * @request DELETE:/orgs/{org}/blocks/{username} + */ + export namespace OrgsUnblockUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsUnblockUserData; + } + /** + * @description **Parameter Deprecation Notice:** GitHub will replace and discontinue \`members_allowed_repository_creation_type\` in favor of more granular permissions. The new input parameters are \`members_can_create_public_repositories\`, \`members_can_create_private_repositories\` for all organizations and \`members_can_create_internal_repositories\` for organizations associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see the [blog post](https://developer.github.com/changes/2019-12-03-internal-visibility-changes). Enables an authenticated organization owner with the \`admin:org\` scope to update the organization's profile and member privileges. + * @tags orgs + * @name OrgsUpdate + * @summary Update an organization + * @request PATCH:/orgs/{org} + */ + export namespace OrgsUpdate { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = OrgsUpdatePayload; + export type RequestHeaders = {}; + export type ResponseBody = OrgsUpdateData; + } + /** + * @description Updates a webhook configured in an organization. When you update a webhook, the \`secret\` will be overwritten. If you previously had a \`secret\` set, you must provide the same \`secret\` or set a new \`secret\` or the secret will be removed. If you are only updating individual webhook \`config\` properties, use "[Update a webhook configuration for an organization](/rest/reference/orgs#update-a-webhook-configuration-for-an-organization)." + * @tags orgs + * @name OrgsUpdateWebhook + * @summary Update an organization webhook + * @request PATCH:/orgs/{org}/hooks/{hook_id} + */ + export namespace OrgsUpdateWebhook { + export type RequestParams = { + hookId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = OrgsUpdateWebhookPayload; + export type RequestHeaders = {}; + export type ResponseBody = OrgsUpdateWebhookData; + } + /** + * @description Updates the webhook configuration for an organization. To update more information about the webhook, including the \`active\` state and \`events\`, use "[Update an organization webhook ](/rest/reference/orgs#update-an-organization-webhook)." Access tokens must have the \`admin:org_hook\` scope, and GitHub Apps must have the \`organization_hooks:write\` permission. + * @tags orgs + * @name OrgsUpdateWebhookConfigForOrg + * @summary Update a webhook configuration for an organization + * @request PATCH:/orgs/{org}/hooks/{hook_id}/config + */ + export namespace OrgsUpdateWebhookConfigForOrg { + export type RequestParams = { + hookId: number; + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = OrgsUpdateWebhookConfigForOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = OrgsUpdateWebhookConfigForOrgData; + } + /** + * @description Creates an organization project board. Returns a \`404 Not Found\` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * @tags projects + * @name ProjectsCreateForOrg + * @summary Create an organization project + * @request POST:/orgs/{org}/projects + */ + export namespace ProjectsCreateForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectsCreateForOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsCreateForOrgData; + } + /** + * @description Lists the projects in an organization. Returns a \`404 Not Found\` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * @tags projects + * @name ProjectsListForOrg + * @summary List organization projects + * @request GET:/orgs/{org}/projects + */ + export namespace ProjectsListForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: ProjectsListForOrgParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsListForOrgData; + } + /** + * @description Create a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion comment. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions\`. + * @tags reactions + * @name ReactionsCreateForTeamDiscussionCommentInOrg + * @summary Create reaction for a team discussion comment + * @request POST:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions + */ + export namespace ReactionsCreateForTeamDiscussionCommentInOrg { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReactionsCreateForTeamDiscussionCommentInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsCreateForTeamDiscussionCommentInOrgData; + } + /** + * @description Create a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions\`. + * @tags reactions + * @name ReactionsCreateForTeamDiscussionInOrg + * @summary Create reaction for a team discussion + * @request POST:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions + */ + export namespace ReactionsCreateForTeamDiscussionInOrg { + export type RequestParams = { + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReactionsCreateForTeamDiscussionInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsCreateForTeamDiscussionInOrgData; + } + /** + * @description **Note:** You can also specify a team or organization with \`team_id\` and \`org_id\` using the route \`DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions/:reaction_id\`. Delete a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags reactions + * @name ReactionsDeleteForTeamDiscussion + * @summary Delete team discussion reaction + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id} + */ + export namespace ReactionsDeleteForTeamDiscussion { + export type RequestParams = { + discussionNumber: number; + org: string; + reactionId: number; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsDeleteForTeamDiscussionData; + } + /** + * @description **Note:** You can also specify a team or organization with \`team_id\` and \`org_id\` using the route \`DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id\`. Delete a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags reactions + * @name ReactionsDeleteForTeamDiscussionComment + * @summary Delete team discussion comment reaction + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id} + */ + export namespace ReactionsDeleteForTeamDiscussionComment { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + org: string; + reactionId: number; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsDeleteForTeamDiscussionCommentData; + } + /** + * @description List the reactions to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments/). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions\`. + * @tags reactions + * @name ReactionsListForTeamDiscussionCommentInOrg + * @summary List reactions for a team discussion comment + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions + */ + export namespace ReactionsListForTeamDiscussionCommentInOrg { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ + content?: ReactionsListForTeamDiscussionCommentInOrgParams1ContentEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsListForTeamDiscussionCommentInOrgData; + } + /** + * @description List the reactions to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions\`. + * @tags reactions + * @name ReactionsListForTeamDiscussionInOrg + * @summary List reactions for a team discussion + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions + */ + export namespace ReactionsListForTeamDiscussionInOrg { + export type RequestParams = { + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ + content?: ReactionsListForTeamDiscussionInOrgParams1ContentEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsListForTeamDiscussionInOrgData; + } + /** + * @description Creates a new repository in the specified organization. The authenticated user must be a member of the organization. **OAuth scope requirements** When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include: * \`public_repo\` scope or \`repo\` scope to create a public repository * \`repo\` scope to create a private repository + * @tags repos + * @name ReposCreateInOrg + * @summary Create an organization repository + * @request POST:/orgs/{org}/repos + */ + export namespace ReposCreateInOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateInOrgData; + } + /** + * @description Lists repositories for the specified organization. + * @tags repos + * @name ReposListForOrg + * @summary List organization repositories + * @request GET:/orgs/{org}/repos + */ + export namespace ReposListForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** Can be one of \`asc\` or \`desc\`. Default: when using \`full_name\`: \`asc\`, otherwise \`desc\` */ + direction?: ReposListForOrgParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "created" + */ + sort?: ReposListForOrgParams1SortEnum; + /** Specifies the types of repositories you want returned. Can be one of \`all\`, \`public\`, \`private\`, \`forks\`, \`sources\`, \`member\`, \`internal\`. Default: \`all\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`type\` can also be \`internal\`. */ + type?: ReposListForOrgParams1TypeEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListForOrgData; + } + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Adds an organization member to a team. An authenticated organization owner or team maintainer can add organization members to a team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." An organization owner can add someone who is not part of the team's organization to a team. When an organization owner adds someone to a team who is not an organization member, this endpoint will send an invitation to the person via email. This newly-created membership will be in the "pending" state until the person accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PUT /organizations/{org_id}/team/{team_id}/memberships/{username}\`. + * @tags teams + * @name TeamsAddOrUpdateMembershipForUserInOrg + * @summary Add or update team membership for a user + * @request PUT:/orgs/{org}/teams/{team_slug}/memberships/{username} + */ + export namespace TeamsAddOrUpdateMembershipForUserInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsAddOrUpdateMembershipForUserInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsAddOrUpdateMembershipForUserInOrgData; + } + /** + * @description Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have \`admin\` permissions for the project. The project and team must be part of the same organization. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PUT /organizations/{org_id}/team/{team_id}/projects/{project_id}\`. + * @tags teams + * @name TeamsAddOrUpdateProjectPermissionsInOrg + * @summary Add or update team project permissions + * @request PUT:/orgs/{org}/teams/{team_slug}/projects/{project_id} + */ + export namespace TeamsAddOrUpdateProjectPermissionsInOrg { + export type RequestParams = { + org: string; + projectId: number; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsAddOrUpdateProjectPermissionsInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsAddOrUpdateProjectPermissionsInOrgData; + } + /** + * @description To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a \`422 Unprocessable Entity\` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PUT /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}\`. For more information about the permission levels, see "[Repository permission levels for an organization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)". + * @tags teams + * @name TeamsAddOrUpdateRepoPermissionsInOrg + * @summary Add or update team repository permissions + * @request PUT:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + */ + export namespace TeamsAddOrUpdateRepoPermissionsInOrg { + export type RequestParams = { + org: string; + owner: string; + repo: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsAddOrUpdateRepoPermissionsInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsAddOrUpdateRepoPermissionsInOrgData; + } + /** + * @description Checks whether a team has \`read\`, \`write\`, or \`admin\` permissions for an organization project. The response includes projects inherited from a parent team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/projects/{project_id}\`. + * @tags teams + * @name TeamsCheckPermissionsForProjectInOrg + * @summary Check team permissions for a project + * @request GET:/orgs/{org}/teams/{team_slug}/projects/{project_id} + */ + export namespace TeamsCheckPermissionsForProjectInOrg { + export type RequestParams = { + org: string; + projectId: number; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCheckPermissionsForProjectInOrgData; + } + /** + * @description Checks whether a team has \`admin\`, \`push\`, \`maintain\`, \`triage\`, or \`pull\` permission for a repository. Repositories inherited through a parent team will also be checked. You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`application/vnd.github.v3.repository+json\` accept header. If a team doesn't have permission for the repository, you will receive a \`404 Not Found\` response status. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}\`. + * @tags teams + * @name TeamsCheckPermissionsForRepoInOrg + * @summary Check team permissions for a repository + * @request GET:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + */ + export namespace TeamsCheckPermissionsForRepoInOrg { + export type RequestParams = { + org: string; + owner: string; + repo: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCheckPermissionsForRepoInOrgData; + } + /** + * @description To create a team, the authenticated user must be a member or owner of \`{org}\`. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see "[Setting team creation permissions](https://help.github.com/en/articles/setting-team-creation-permissions-in-your-organization)." When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of \`maintainers\`. For more information, see "[About teams](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/about-teams)". + * @tags teams + * @name TeamsCreate + * @summary Create a team + * @request POST:/orgs/{org}/teams + */ + export namespace TeamsCreate { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsCreatePayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCreateData; + } + /** + * @description Creates a new comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments\`. + * @tags teams + * @name TeamsCreateDiscussionCommentInOrg + * @summary Create a discussion comment + * @request POST:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments + */ + export namespace TeamsCreateDiscussionCommentInOrg { + export type RequestParams = { + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsCreateDiscussionCommentInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCreateDiscussionCommentInOrgData; + } + /** + * @description Creates a new discussion post on a team's page. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/{org_id}/team/{team_id}/discussions\`. + * @tags teams + * @name TeamsCreateDiscussionInOrg + * @summary Create a discussion + * @request POST:/orgs/{org}/teams/{team_slug}/discussions + */ + export namespace TeamsCreateDiscussionInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsCreateDiscussionInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCreateDiscussionInOrgData; + } + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty \`groups\` array will remove all connections for a team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}/team-sync/group-mappings\`. + * @tags teams + * @name TeamsCreateOrUpdateIdpGroupConnectionsInOrg + * @summary Create or update IdP group connections + * @request PATCH:/orgs/{org}/teams/{team_slug}/team-sync/group-mappings + */ + export namespace TeamsCreateOrUpdateIdpGroupConnectionsInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsCreateOrUpdateIdpGroupConnectionsInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCreateOrUpdateIdpGroupConnectionsInOrgData; + } + /** + * @description Deletes a comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}\`. + * @tags teams + * @name TeamsDeleteDiscussionCommentInOrg + * @summary Delete a discussion comment + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + */ + export namespace TeamsDeleteDiscussionCommentInOrg { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsDeleteDiscussionCommentInOrgData; + } + /** + * @description Delete a discussion from a team's page. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}\`. + * @tags teams + * @name TeamsDeleteDiscussionInOrg + * @summary Delete a discussion + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + */ + export namespace TeamsDeleteDiscussionInOrg { + export type RequestParams = { + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsDeleteDiscussionInOrgData; + } + /** + * @description To delete a team, the authenticated user must be an organization owner or team maintainer. If you are an organization owner, deleting a parent team will delete all of its child teams as well. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}\`. + * @tags teams + * @name TeamsDeleteInOrg + * @summary Delete a team + * @request DELETE:/orgs/{org}/teams/{team_slug} + */ + export namespace TeamsDeleteInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsDeleteInOrgData; + } + /** + * @description Gets a team using the team's \`slug\`. GitHub generates the \`slug\` from the team \`name\`. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}\`. + * @tags teams + * @name TeamsGetByName + * @summary Get a team by name + * @request GET:/orgs/{org}/teams/{team_slug} + */ + export namespace TeamsGetByName { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsGetByNameData; + } + /** + * @description Get a specific comment on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}\`. + * @tags teams + * @name TeamsGetDiscussionCommentInOrg + * @summary Get a discussion comment + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + */ + export namespace TeamsGetDiscussionCommentInOrg { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsGetDiscussionCommentInOrgData; + } + /** + * @description Get a specific discussion on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}\`. + * @tags teams + * @name TeamsGetDiscussionInOrg + * @summary Get a discussion + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + */ + export namespace TeamsGetDiscussionInOrg { + export type RequestParams = { + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsGetDiscussionInOrgData; + } + /** + * @description Team members will include the members of child teams. To get a user's membership with a team, the team must be visible to the authenticated user. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/memberships/{username}\`. **Note:** The \`role\` for organization owners returns as \`maintainer\`. For more information about \`maintainer\` roles, see [Create a team](https://docs.github.com/rest/reference/teams#create-a-team). + * @tags teams + * @name TeamsGetMembershipForUserInOrg + * @summary Get team membership for a user + * @request GET:/orgs/{org}/teams/{team_slug}/memberships/{username} + */ + export namespace TeamsGetMembershipForUserInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsGetMembershipForUserInOrgData; + } + /** + * @description Lists all teams in an organization that are visible to the authenticated user. + * @tags teams + * @name TeamsList + * @summary List teams + * @request GET:/orgs/{org}/teams + */ + export namespace TeamsList { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListData; + } + /** + * @description Lists the child teams of the team specified by \`{team_slug}\`. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/teams\`. + * @tags teams + * @name TeamsListChildInOrg + * @summary List child teams + * @request GET:/orgs/{org}/teams/{team_slug}/teams + */ + export namespace TeamsListChildInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListChildInOrgData; + } + /** + * @description List all comments on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments\`. + * @tags teams + * @name TeamsListDiscussionCommentsInOrg + * @summary List discussion comments + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments + */ + export namespace TeamsListDiscussionCommentsInOrg { + export type RequestParams = { + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: TeamsListDiscussionCommentsInOrgParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListDiscussionCommentsInOrgData; + } + /** + * @description List all discussions on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions\`. + * @tags teams + * @name TeamsListDiscussionsInOrg + * @summary List discussions + * @request GET:/orgs/{org}/teams/{team_slug}/discussions + */ + export namespace TeamsListDiscussionsInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: TeamsListDiscussionsInOrgParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListDiscussionsInOrgData; + } + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups available in an organization. You can limit your page results using the \`per_page\` parameter. GitHub generates a url-encoded \`page\` token using a cursor value for where the next page begins. For more information on cursor pagination, see "[Offset and Cursor Pagination explained](https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89)." The \`per_page\` parameter provides pagination for a list of IdP groups the authenticated user can access in an organization. For example, if the user \`octocat\` wants to see two groups per page in \`octo-org\` via cURL, it would look like this: + * @tags teams + * @name TeamsListIdpGroupsForOrg + * @summary List IdP groups for an organization + * @request GET:/orgs/{org}/team-sync/groups + */ + export namespace TeamsListIdpGroupsForOrg { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListIdpGroupsForOrgData; + } + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups connected to a team on GitHub. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/team-sync/group-mappings\`. + * @tags teams + * @name TeamsListIdpGroupsInOrg + * @summary List IdP groups for a team + * @request GET:/orgs/{org}/teams/{team_slug}/team-sync/group-mappings + */ + export namespace TeamsListIdpGroupsInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListIdpGroupsInOrgData; + } + /** + * @description Team members will include the members of child teams. To list members in a team, the team must be visible to the authenticated user. + * @tags teams + * @name TeamsListMembersInOrg + * @summary List team members + * @request GET:/orgs/{org}/teams/{team_slug}/members + */ + export namespace TeamsListMembersInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Filters members returned by their role in the team. Can be one of: + * \\* \`member\` - normal members of the team. + * \\* \`maintainer\` - team maintainers. + * \\* \`all\` - all members of the team. + * @default "all" + */ + role?: TeamsListMembersInOrgParams1RoleEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListMembersInOrgData; + } + /** + * @description The return hash contains a \`role\` field which refers to the Organization Invitation role and will be one of the following values: \`direct_member\`, \`admin\`, \`billing_manager\`, \`hiring_manager\`, or \`reinstate\`. If the invitee is not a GitHub member, the \`login\` field in the return hash will be \`null\`. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/invitations\`. + * @tags teams + * @name TeamsListPendingInvitationsInOrg + * @summary List pending team invitations + * @request GET:/orgs/{org}/teams/{team_slug}/invitations + */ + export namespace TeamsListPendingInvitationsInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListPendingInvitationsInOrgData; + } + /** + * @description Lists the organization projects for a team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/projects\`. + * @tags teams + * @name TeamsListProjectsInOrg + * @summary List team projects + * @request GET:/orgs/{org}/teams/{team_slug}/projects + */ + export namespace TeamsListProjectsInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListProjectsInOrgData; + } + /** + * @description Lists a team's repositories visible to the authenticated user. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/repos\`. + * @tags teams + * @name TeamsListReposInOrg + * @summary List team repositories + * @request GET:/orgs/{org}/teams/{team_slug}/repos + */ + export namespace TeamsListReposInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListReposInOrgData; + } + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/memberships/{username}\`. + * @tags teams + * @name TeamsRemoveMembershipForUserInOrg + * @summary Remove team membership for a user + * @request DELETE:/orgs/{org}/teams/{team_slug}/memberships/{username} + */ + export namespace TeamsRemoveMembershipForUserInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsRemoveMembershipForUserInOrgData; + } + /** + * @description Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have \`read\` access to both the team and project, or \`admin\` access to the team or project. This endpoint removes the project from the team, but does not delete the project. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/projects/{project_id}\`. + * @tags teams + * @name TeamsRemoveProjectInOrg + * @summary Remove a project from a team + * @request DELETE:/orgs/{org}/teams/{team_slug}/projects/{project_id} + */ + export namespace TeamsRemoveProjectInOrg { + export type RequestParams = { + org: string; + projectId: number; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsRemoveProjectInOrgData; + } + /** + * @description If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. This does not delete the repository, it just removes it from the team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}\`. + * @tags teams + * @name TeamsRemoveRepoInOrg + * @summary Remove a repository from a team + * @request DELETE:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + */ + export namespace TeamsRemoveRepoInOrg { + export type RequestParams = { + org: string; + owner: string; + repo: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsRemoveRepoInOrgData; + } + /** + * @description Edits the body text of a discussion comment. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}\`. + * @tags teams + * @name TeamsUpdateDiscussionCommentInOrg + * @summary Update a discussion comment + * @request PATCH:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + */ + export namespace TeamsUpdateDiscussionCommentInOrg { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsUpdateDiscussionCommentInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsUpdateDiscussionCommentInOrgData; + } + /** + * @description Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}\`. + * @tags teams + * @name TeamsUpdateDiscussionInOrg + * @summary Update a discussion + * @request PATCH:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + */ + export namespace TeamsUpdateDiscussionInOrg { + export type RequestParams = { + discussionNumber: number; + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsUpdateDiscussionInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsUpdateDiscussionInOrgData; + } + /** + * @description To edit a team, the authenticated user must either be an organization owner or a team maintainer. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}\`. + * @tags teams + * @name TeamsUpdateInOrg + * @summary Update a team + * @request PATCH:/orgs/{org}/teams/{team_slug} + */ + export namespace TeamsUpdateInOrg { + export type RequestParams = { + org: string; + /** team_slug parameter */ + teamSlug: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsUpdateInOrgPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsUpdateInOrgData; + } +} + +export namespace Projects { + /** + * @description Adds a collaborator to an organization project and sets their permission level. You must be an organization owner or a project \`admin\` to add a collaborator. + * @tags projects + * @name ProjectsAddCollaborator + * @summary Add project collaborator + * @request PUT:/projects/{project_id}/collaborators/{username} + */ + export namespace ProjectsAddCollaborator { + export type RequestParams = { + projectId: number; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectsAddCollaboratorPayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsAddCollaboratorData; + } + /** + * @description **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * @tags projects + * @name ProjectsCreateCard + * @summary Create a project card + * @request POST:/projects/columns/{column_id}/cards + */ + export namespace ProjectsCreateCard { + export type RequestParams = { + /** column_id parameter */ + columnId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectsCreateCardPayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsCreateCardData; + } + /** + * No description + * @tags projects + * @name ProjectsCreateColumn + * @summary Create a project column + * @request POST:/projects/{project_id}/columns + */ + export namespace ProjectsCreateColumn { + export type RequestParams = { + projectId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectsCreateColumnPayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsCreateColumnData; + } + /** + * @description Deletes a project board. Returns a \`404 Not Found\` status if projects are disabled. + * @tags projects + * @name ProjectsDelete + * @summary Delete a project + * @request DELETE:/projects/{project_id} + */ + export namespace ProjectsDelete { + export type RequestParams = { + projectId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsDeleteData; + } + /** + * No description + * @tags projects + * @name ProjectsDeleteCard + * @summary Delete a project card + * @request DELETE:/projects/columns/cards/{card_id} + */ + export namespace ProjectsDeleteCard { + export type RequestParams = { + /** card_id parameter */ + cardId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsDeleteCardData; + } + /** + * No description + * @tags projects + * @name ProjectsDeleteColumn + * @summary Delete a project column + * @request DELETE:/projects/columns/{column_id} + */ + export namespace ProjectsDeleteColumn { + export type RequestParams = { + /** column_id parameter */ + columnId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsDeleteColumnData; + } + /** + * @description Gets a project by its \`id\`. Returns a \`404 Not Found\` status if projects are disabled. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * @tags projects + * @name ProjectsGet + * @summary Get a project + * @request GET:/projects/{project_id} + */ + export namespace ProjectsGet { + export type RequestParams = { + projectId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsGetData; + } + /** + * No description + * @tags projects + * @name ProjectsGetCard + * @summary Get a project card + * @request GET:/projects/columns/cards/{card_id} + */ + export namespace ProjectsGetCard { + export type RequestParams = { + /** card_id parameter */ + cardId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsGetCardData; + } + /** + * No description + * @tags projects + * @name ProjectsGetColumn + * @summary Get a project column + * @request GET:/projects/columns/{column_id} + */ + export namespace ProjectsGetColumn { + export type RequestParams = { + /** column_id parameter */ + columnId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsGetColumnData; + } + /** + * @description Returns the collaborator's permission level for an organization project. Possible values for the \`permission\` key: \`admin\`, \`write\`, \`read\`, \`none\`. You must be an organization owner or a project \`admin\` to review a user's permission level. + * @tags projects + * @name ProjectsGetPermissionForUser + * @summary Get project permission for a user + * @request GET:/projects/{project_id}/collaborators/{username}/permission + */ + export namespace ProjectsGetPermissionForUser { + export type RequestParams = { + projectId: number; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsGetPermissionForUserData; + } + /** + * No description + * @tags projects + * @name ProjectsListCards + * @summary List project cards + * @request GET:/projects/columns/{column_id}/cards + */ + export namespace ProjectsListCards { + export type RequestParams = { + /** column_id parameter */ + columnId: number; + }; + export type RequestQuery = { + /** + * Filters the project cards that are returned by the card's state. Can be one of \`all\`,\`archived\`, or \`not_archived\`. + * @default "not_archived" + */ + archived_state?: ProjectsListCardsParams1ArchivedStateEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsListCardsData; + } + /** + * @description Lists the collaborators for an organization project. For a project, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. You must be an organization owner or a project \`admin\` to list collaborators. + * @tags projects + * @name ProjectsListCollaborators + * @summary List project collaborators + * @request GET:/projects/{project_id}/collaborators + */ + export namespace ProjectsListCollaborators { + export type RequestParams = { + projectId: number; + }; + export type RequestQuery = { + /** + * Filters the collaborators by their affiliation. Can be one of: + * \\* \`outside\`: Outside collaborators of a project that are not a member of the project's organization. + * \\* \`direct\`: Collaborators with permissions to a project, regardless of organization membership status. + * \\* \`all\`: All collaborators the authenticated user can see. + * @default "all" + */ + affiliation?: ProjectsListCollaboratorsParams1AffiliationEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsListCollaboratorsData; + } + /** + * No description + * @tags projects + * @name ProjectsListColumns + * @summary List project columns + * @request GET:/projects/{project_id}/columns + */ + export namespace ProjectsListColumns { + export type RequestParams = { + projectId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsListColumnsData; + } + /** + * No description + * @tags projects + * @name ProjectsMoveCard + * @summary Move a project card + * @request POST:/projects/columns/cards/{card_id}/moves + */ + export namespace ProjectsMoveCard { + export type RequestParams = { + /** card_id parameter */ + cardId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectsMoveCardPayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsMoveCardData; + } + /** + * No description + * @tags projects + * @name ProjectsMoveColumn + * @summary Move a project column + * @request POST:/projects/columns/{column_id}/moves + */ + export namespace ProjectsMoveColumn { + export type RequestParams = { + /** column_id parameter */ + columnId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectsMoveColumnPayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsMoveColumnData; + } + /** + * @description Removes a collaborator from an organization project. You must be an organization owner or a project \`admin\` to remove a collaborator. + * @tags projects + * @name ProjectsRemoveCollaborator + * @summary Remove user as a collaborator + * @request DELETE:/projects/{project_id}/collaborators/{username} + */ + export namespace ProjectsRemoveCollaborator { + export type RequestParams = { + projectId: number; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsRemoveCollaboratorData; + } + /** + * @description Updates a project board's information. Returns a \`404 Not Found\` status if projects are disabled. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * @tags projects + * @name ProjectsUpdate + * @summary Update a project + * @request PATCH:/projects/{project_id} + */ + export namespace ProjectsUpdate { + export type RequestParams = { + projectId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectsUpdatePayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsUpdateData; + } + /** + * No description + * @tags projects + * @name ProjectsUpdateCard + * @summary Update an existing project card + * @request PATCH:/projects/columns/cards/{card_id} + */ + export namespace ProjectsUpdateCard { + export type RequestParams = { + /** card_id parameter */ + cardId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectsUpdateCardPayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsUpdateCardData; + } + /** + * No description + * @tags projects + * @name ProjectsUpdateColumn + * @summary Update an existing project column + * @request PATCH:/projects/columns/{column_id} + */ + export namespace ProjectsUpdateColumn { + export type RequestParams = { + /** column_id parameter */ + columnId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectsUpdateColumnPayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsUpdateColumnData; + } +} + +export namespace RateLimit { + /** + * @description **Note:** Accessing this endpoint does not count against your REST API rate limit. **Note:** The \`rate\` object is deprecated. If you're writing new API client code or updating existing code, you should use the \`core\` object instead of the \`rate\` object. The \`core\` object contains the same information that is present in the \`rate\` object. + * @tags rate-limit + * @name RateLimitGet + * @summary Get rate limit status for the authenticated user + * @request GET:/rate_limit + */ + export namespace RateLimitGet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = RateLimitGetData; + } +} + +export namespace Reactions { + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Reactions API. We recommend migrating your existing code to use the new delete reactions endpoints. For more information, see this [blog post](https://developer.github.com/changes/2020-02-26-new-delete-reactions-endpoints/). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), when deleting a [team discussion](https://docs.github.com/rest/reference/teams#discussions) or [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). + * @tags reactions + * @name ReactionsDeleteLegacy + * @summary Delete a reaction (Legacy) + * @request DELETE:/reactions/{reaction_id} + * @deprecated + */ + export namespace ReactionsDeleteLegacy { + export type RequestParams = { + reactionId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsDeleteLegacyData; + } +} + +export namespace Repos { + /** + * @description Cancels a workflow run using its \`id\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * @tags actions + * @name ActionsCancelWorkflowRun + * @summary Cancel a workflow run + * @request POST:/repos/{owner}/{repo}/actions/runs/{run_id}/cancel + */ + export namespace ActionsCancelWorkflowRun { + export type RequestParams = { + owner: string; + repo: string; + runId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsCancelWorkflowRunData; + } + /** + * @description Creates or updates a repository secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. #### Example encrypting a secret using Node.js Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library. \`\`\` const sodium = require('tweetsodium'); const key = "base64-encoded-public-key"; const value = "plain-text-secret"; // Convert the message and key to Uint8Array's (Buffer implements that interface) const messageBytes = Buffer.from(value); const keyBytes = Buffer.from(key, 'base64'); // Encrypt using LibSodium. const encryptedBytes = sodium.seal(messageBytes, keyBytes); // Base64 the encrypted secret const encrypted = Buffer.from(encryptedBytes).toString('base64'); console.log(encrypted); \`\`\` #### Example encrypting a secret using Python Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3. \`\`\` from base64 import b64encode from nacl import encoding, public def encrypt(public_key: str, secret_value: str) -> str: """Encrypt a Unicode string using the public key.""" public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder()) sealed_box = public.SealedBox(public_key) encrypted = sealed_box.encrypt(secret_value.encode("utf-8")) return b64encode(encrypted).decode("utf-8") \`\`\` #### Example encrypting a secret using C# Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package. \`\`\` var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret"); var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU="); var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey); Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox)); \`\`\` #### Example encrypting a secret using Ruby Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem. \`\`\`ruby require "rbnacl" require "base64" key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=") public_key = RbNaCl::PublicKey.new(key) box = RbNaCl::Boxes::Sealed.from_public_key(public_key) encrypted_secret = box.encrypt("my_secret") # Print the base64 encoded secret puts Base64.strict_encode64(encrypted_secret) \`\`\` + * @tags actions + * @name ActionsCreateOrUpdateRepoSecret + * @summary Create or update a repository secret + * @request PUT:/repos/{owner}/{repo}/actions/secrets/{secret_name} + */ + export namespace ActionsCreateOrUpdateRepoSecret { + export type RequestParams = { + owner: string; + repo: string; + /** secret_name parameter */ + secretName: string; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsCreateOrUpdateRepoSecretPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsCreateOrUpdateRepoSecretData; + } + /** + * @description Returns a token that you can pass to the \`config\` script. The token expires after one hour. You must authenticate using an access token with the \`repo\` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing \`TOKEN\` with the registration token provided by this endpoint. \`\`\` ./config.sh --url https://github.com/octo-org/octo-repo-artifacts --token TOKEN \`\`\` + * @tags actions + * @name ActionsCreateRegistrationTokenForRepo + * @summary Create a registration token for a repository + * @request POST:/repos/{owner}/{repo}/actions/runners/registration-token + */ + export namespace ActionsCreateRegistrationTokenForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsCreateRegistrationTokenForRepoData; + } + /** + * @description Returns a token that you can pass to remove a self-hosted runner from a repository. The token expires after one hour. You must authenticate using an access token with the \`repo\` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from a repository, replace TOKEN with the remove token provided by this endpoint. \`\`\` ./config.sh remove --token TOKEN \`\`\` + * @tags actions + * @name ActionsCreateRemoveTokenForRepo + * @summary Create a remove token for a repository + * @request POST:/repos/{owner}/{repo}/actions/runners/remove-token + */ + export namespace ActionsCreateRemoveTokenForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsCreateRemoveTokenForRepoData; + } + /** + * @description You can use this endpoint to manually trigger a GitHub Actions workflow run. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You must configure your GitHub Actions workflow to run when the [\`workflow_dispatch\` webhook](/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch) event occurs. The \`inputs\` are configured in the workflow file. For more information about how to configure the \`workflow_dispatch\` event in the workflow file, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)." You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. For more information, see "[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line)." + * @tags actions + * @name ActionsCreateWorkflowDispatch + * @summary Create a workflow dispatch event + * @request POST:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches + */ + export namespace ActionsCreateWorkflowDispatch { + export type RequestParams = { + owner: string; + repo: string; + /** The ID of the workflow. You can also pass the workflow file name as a string. */ + workflowId: number | string; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsCreateWorkflowDispatchPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsCreateWorkflowDispatchData; + } + /** + * @description Deletes an artifact for a workflow run. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * @tags actions + * @name ActionsDeleteArtifact + * @summary Delete an artifact + * @request DELETE:/repos/{owner}/{repo}/actions/artifacts/{artifact_id} + */ + export namespace ActionsDeleteArtifact { + export type RequestParams = { + /** artifact_id parameter */ + artifactId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsDeleteArtifactData; + } + /** + * @description Deletes a secret in a repository using the secret name. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. + * @tags actions + * @name ActionsDeleteRepoSecret + * @summary Delete a repository secret + * @request DELETE:/repos/{owner}/{repo}/actions/secrets/{secret_name} + */ + export namespace ActionsDeleteRepoSecret { + export type RequestParams = { + owner: string; + repo: string; + /** secret_name parameter */ + secretName: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsDeleteRepoSecretData; + } + /** + * @description Forces the removal of a self-hosted runner from a repository. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the \`repo\` scope to use this endpoint. + * @tags actions + * @name ActionsDeleteSelfHostedRunnerFromRepo + * @summary Delete a self-hosted runner from a repository + * @request DELETE:/repos/{owner}/{repo}/actions/runners/{runner_id} + */ + export namespace ActionsDeleteSelfHostedRunnerFromRepo { + export type RequestParams = { + owner: string; + repo: string; + /** Unique identifier of the self-hosted runner. */ + runnerId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsDeleteSelfHostedRunnerFromRepoData; + } + /** + * @description Delete a specific workflow run. Anyone with write access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * @tags actions + * @name ActionsDeleteWorkflowRun + * @summary Delete a workflow run + * @request DELETE:/repos/{owner}/{repo}/actions/runs/{run_id} + */ + export namespace ActionsDeleteWorkflowRun { + export type RequestParams = { + owner: string; + repo: string; + runId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsDeleteWorkflowRunData; + } + /** + * @description Deletes all logs for a workflow run. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * @tags actions + * @name ActionsDeleteWorkflowRunLogs + * @summary Delete workflow run logs + * @request DELETE:/repos/{owner}/{repo}/actions/runs/{run_id}/logs + */ + export namespace ActionsDeleteWorkflowRunLogs { + export type RequestParams = { + owner: string; + repo: string; + runId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsDeleteWorkflowRunLogsData; + } + /** + * @description Disables a workflow and sets the \`state\` of the workflow to \`disabled_manually\`. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * @tags actions + * @name ActionsDisableWorkflow + * @summary Disable a workflow + * @request PUT:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable + */ + export namespace ActionsDisableWorkflow { + export type RequestParams = { + owner: string; + repo: string; + /** The ID of the workflow. You can also pass the workflow file name as a string. */ + workflowId: number | string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsDisableWorkflowData; + } + /** + * @description Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for \`Location:\` in the response header to find the URL for the download. The \`:archive_format\` must be \`zip\`. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsDownloadArtifact + * @summary Download an artifact + * @request GET:/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format} + */ + export namespace ActionsDownloadArtifact { + export type RequestParams = { + archiveFormat: string; + /** artifact_id parameter */ + artifactId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look for \`Location:\` in the response header to find the URL for the download. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsDownloadJobLogsForWorkflowRun + * @summary Download job logs for a workflow run + * @request GET:/repos/{owner}/{repo}/actions/jobs/{job_id}/logs + */ + export namespace ActionsDownloadJobLogsForWorkflowRun { + export type RequestParams = { + /** job_id parameter */ + jobId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description Gets a redirect URL to download an archive of log files for a workflow run. This link expires after 1 minute. Look for \`Location:\` in the response header to find the URL for the download. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsDownloadWorkflowRunLogs + * @summary Download workflow run logs + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/logs + */ + export namespace ActionsDownloadWorkflowRunLogs { + export type RequestParams = { + owner: string; + repo: string; + runId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description Enables a workflow and sets the \`state\` of the workflow to \`active\`. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * @tags actions + * @name ActionsEnableWorkflow + * @summary Enable a workflow + * @request PUT:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable + */ + export namespace ActionsEnableWorkflow { + export type RequestParams = { + owner: string; + repo: string; + /** The ID of the workflow. You can also pass the workflow file name as a string. */ + workflowId: number | string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsEnableWorkflowData; + } + /** + * @description Gets the settings for selected actions that are allowed in a repository. To use this endpoint, the repository policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)." You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. + * @tags actions + * @name ActionsGetAllowedActionsRepository + * @summary Get allowed actions for a repository + * @request GET:/repos/{owner}/{repo}/actions/permissions/selected-actions + */ + export namespace ActionsGetAllowedActionsRepository { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetAllowedActionsRepositoryData; + } + /** + * @description Gets a specific artifact for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsGetArtifact + * @summary Get an artifact + * @request GET:/repos/{owner}/{repo}/actions/artifacts/{artifact_id} + */ + export namespace ActionsGetArtifact { + export type RequestParams = { + /** artifact_id parameter */ + artifactId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetArtifactData; + } + /** + * @description Gets the GitHub Actions permissions policy for a repository, including whether GitHub Actions is enabled and the actions allowed to run in the repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. + * @tags actions + * @name ActionsGetGithubActionsPermissionsRepository + * @summary Get GitHub Actions permissions for a repository + * @request GET:/repos/{owner}/{repo}/actions/permissions + */ + export namespace ActionsGetGithubActionsPermissionsRepository { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetGithubActionsPermissionsRepositoryData; + } + /** + * @description Gets a specific job in a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsGetJobForWorkflowRun + * @summary Get a job for a workflow run + * @request GET:/repos/{owner}/{repo}/actions/jobs/{job_id} + */ + export namespace ActionsGetJobForWorkflowRun { + export type RequestParams = { + /** job_id parameter */ + jobId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetJobForWorkflowRunData; + } + /** + * @description Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. + * @tags actions + * @name ActionsGetRepoPublicKey + * @summary Get a repository public key + * @request GET:/repos/{owner}/{repo}/actions/secrets/public-key + */ + export namespace ActionsGetRepoPublicKey { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetRepoPublicKeyData; + } + /** + * @description Gets a single repository secret without revealing its encrypted value. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. + * @tags actions + * @name ActionsGetRepoSecret + * @summary Get a repository secret + * @request GET:/repos/{owner}/{repo}/actions/secrets/{secret_name} + */ + export namespace ActionsGetRepoSecret { + export type RequestParams = { + owner: string; + repo: string; + /** secret_name parameter */ + secretName: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetRepoSecretData; + } + /** + * @description Gets a specific self-hosted runner configured in a repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. + * @tags actions + * @name ActionsGetSelfHostedRunnerForRepo + * @summary Get a self-hosted runner for a repository + * @request GET:/repos/{owner}/{repo}/actions/runners/{runner_id} + */ + export namespace ActionsGetSelfHostedRunnerForRepo { + export type RequestParams = { + owner: string; + repo: string; + /** Unique identifier of the self-hosted runner. */ + runnerId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetSelfHostedRunnerForRepoData; + } + /** + * @description Gets a specific workflow. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsGetWorkflow + * @summary Get a workflow + * @request GET:/repos/{owner}/{repo}/actions/workflows/{workflow_id} + */ + export namespace ActionsGetWorkflow { + export type RequestParams = { + owner: string; + repo: string; + /** The ID of the workflow. You can also pass the workflow file name as a string. */ + workflowId: number | string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetWorkflowData; + } + /** + * @description Gets a specific workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsGetWorkflowRun + * @summary Get a workflow run + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id} + */ + export namespace ActionsGetWorkflowRun { + export type RequestParams = { + owner: string; + repo: string; + runId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetWorkflowRunData; + } + /** + * @description Gets the number of billable minutes and total run time for a specific workflow run. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsGetWorkflowRunUsage + * @summary Get workflow run usage + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/timing + */ + export namespace ActionsGetWorkflowRunUsage { + export type RequestParams = { + owner: string; + repo: string; + runId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetWorkflowRunUsageData; + } + /** + * @description Gets the number of billable minutes used by a specific workflow during the current billing cycle. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsGetWorkflowUsage + * @summary Get workflow usage + * @request GET:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing + */ + export namespace ActionsGetWorkflowUsage { + export type RequestParams = { + owner: string; + repo: string; + /** The ID of the workflow. You can also pass the workflow file name as a string. */ + workflowId: number | string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsGetWorkflowUsageData; + } + /** + * @description Lists all artifacts for a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsListArtifactsForRepo + * @summary List artifacts for a repository + * @request GET:/repos/{owner}/{repo}/actions/artifacts + */ + export namespace ActionsListArtifactsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListArtifactsForRepoData; + } + /** + * @description Lists jobs for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). + * @tags actions + * @name ActionsListJobsForWorkflowRun + * @summary List jobs for a workflow run + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/jobs + */ + export namespace ActionsListJobsForWorkflowRun { + export type RequestParams = { + owner: string; + repo: string; + runId: number; + }; + export type RequestQuery = { + /** + * Filters jobs by their \`completed_at\` timestamp. Can be one of: + * \\* \`latest\`: Returns jobs from the most recent execution of the workflow run. + * \\* \`all\`: Returns all jobs for a workflow run, including from old executions of the workflow run. + * @default "latest" + */ + filter?: ActionsListJobsForWorkflowRunParams1FilterEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListJobsForWorkflowRunData; + } + /** + * @description Lists all secrets available in a repository without revealing their encrypted values. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. + * @tags actions + * @name ActionsListRepoSecrets + * @summary List repository secrets + * @request GET:/repos/{owner}/{repo}/actions/secrets + */ + export namespace ActionsListRepoSecrets { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListRepoSecretsData; + } + /** + * @description Lists the workflows in a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsListRepoWorkflows + * @summary List repository workflows + * @request GET:/repos/{owner}/{repo}/actions/workflows + */ + export namespace ActionsListRepoWorkflows { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListRepoWorkflowsData; + } + /** + * @description Lists binaries for the runner application that you can download and run. You must authenticate using an access token with the \`repo\` scope to use this endpoint. + * @tags actions + * @name ActionsListRunnerApplicationsForRepo + * @summary List runner applications for a repository + * @request GET:/repos/{owner}/{repo}/actions/runners/downloads + */ + export namespace ActionsListRunnerApplicationsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListRunnerApplicationsForRepoData; + } + /** + * @description Lists all self-hosted runners configured in a repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. + * @tags actions + * @name ActionsListSelfHostedRunnersForRepo + * @summary List self-hosted runners for a repository + * @request GET:/repos/{owner}/{repo}/actions/runners + */ + export namespace ActionsListSelfHostedRunnersForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListSelfHostedRunnersForRepoData; + } + /** + * @description Lists artifacts for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsListWorkflowRunArtifacts + * @summary List workflow run artifacts + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/artifacts + */ + export namespace ActionsListWorkflowRunArtifacts { + export type RequestParams = { + owner: string; + repo: string; + runId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListWorkflowRunArtifactsData; + } + /** + * @description List all workflow runs for a workflow. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. + * @tags actions + * @name ActionsListWorkflowRuns + * @summary List workflow runs + * @request GET:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs + */ + export namespace ActionsListWorkflowRuns { + export type RequestParams = { + owner: string; + repo: string; + /** The ID of the workflow. You can also pass the workflow file name as a string. */ + workflowId: number | string; + }; + export type RequestQuery = { + /** Returns someone's workflow runs. Use the login for the user who created the \`push\` associated with the check suite or workflow run. */ + actor?: string; + /** Returns workflow runs associated with a branch. Use the name of the branch of the \`push\`. */ + branch?: string; + /** Returns workflow run triggered by the event you specify. For example, \`push\`, \`pull_request\` or \`issue\`. For more information, see "[Events that trigger workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." */ + event?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Returns workflow runs associated with the check run \`status\` or \`conclusion\` you specify. For example, a conclusion can be \`success\` or a status can be \`completed\`. For more information, see the \`status\` and \`conclusion\` options available in "[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run)." */ + status?: ActionsListWorkflowRunsParams1StatusEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListWorkflowRunsData; + } + /** + * @description Lists all workflow runs for a repository. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * @tags actions + * @name ActionsListWorkflowRunsForRepo + * @summary List workflow runs for a repository + * @request GET:/repos/{owner}/{repo}/actions/runs + */ + export namespace ActionsListWorkflowRunsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Returns someone's workflow runs. Use the login for the user who created the \`push\` associated with the check suite or workflow run. */ + actor?: string; + /** Returns workflow runs associated with a branch. Use the name of the branch of the \`push\`. */ + branch?: string; + /** Returns workflow run triggered by the event you specify. For example, \`push\`, \`pull_request\` or \`issue\`. For more information, see "[Events that trigger workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." */ + event?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Returns workflow runs associated with the check run \`status\` or \`conclusion\` you specify. For example, a conclusion can be \`success\` or a status can be \`completed\`. For more information, see the \`status\` and \`conclusion\` options available in "[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run)." */ + status?: ActionsListWorkflowRunsForRepoParams1StatusEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsListWorkflowRunsForRepoData; + } + /** + * @description Re-runs your workflow run using its \`id\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * @tags actions + * @name ActionsReRunWorkflow + * @summary Re-run a workflow + * @request POST:/repos/{owner}/{repo}/actions/runs/{run_id}/rerun + */ + export namespace ActionsReRunWorkflow { + export type RequestParams = { + owner: string; + repo: string; + runId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActionsReRunWorkflowData; + } + /** + * @description Sets the actions that are allowed in a repository. To use this endpoint, the repository permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)." If the repository belongs to an organization or enterprise that has \`selected\` actions set at the organization or enterprise levels, then you cannot override any of the allowed actions settings. To use the \`patterns_allowed\` setting for private repositories, the repository must belong to an enterprise. If the repository does not belong to an enterprise, then the \`patterns_allowed\` setting only applies to public repositories. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. + * @tags actions + * @name ActionsSetAllowedActionsRepository + * @summary Set allowed actions for a repository + * @request PUT:/repos/{owner}/{repo}/actions/permissions/selected-actions + */ + export namespace ActionsSetAllowedActionsRepository { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = SelectedActions; + export type RequestHeaders = {}; + export type ResponseBody = ActionsSetAllowedActionsRepositoryData; + } + /** + * @description Sets the GitHub Actions permissions policy for enabling GitHub Actions and allowed actions in the repository. If the repository belongs to an organization or enterprise that has set restrictive permissions at the organization or enterprise levels, such as \`allowed_actions\` to \`selected\` actions, then you cannot override them for the repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. + * @tags actions + * @name ActionsSetGithubActionsPermissionsRepository + * @summary Set GitHub Actions permissions for a repository + * @request PUT:/repos/{owner}/{repo}/actions/permissions + */ + export namespace ActionsSetGithubActionsPermissionsRepository { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ActionsSetGithubActionsPermissionsRepositoryPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActionsSetGithubActionsPermissionsRepositoryData; + } + /** + * @description This endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, [set the repository's subscription manually](https://docs.github.com/rest/reference/activity#set-a-repository-subscription). + * @tags activity + * @name ActivityDeleteRepoSubscription + * @summary Delete a repository subscription + * @request DELETE:/repos/{owner}/{repo}/subscription + */ + export namespace ActivityDeleteRepoSubscription { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityDeleteRepoSubscriptionData; + } + /** + * No description + * @tags activity + * @name ActivityGetRepoSubscription + * @summary Get a repository subscription + * @request GET:/repos/{owner}/{repo}/subscription + */ + export namespace ActivityGetRepoSubscription { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityGetRepoSubscriptionData; + } + /** + * No description + * @tags activity + * @name ActivityListRepoEvents + * @summary List repository events + * @request GET:/repos/{owner}/{repo}/events + */ + export namespace ActivityListRepoEvents { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListRepoEventsData; + } + /** + * @description List all notifications for the current user. + * @tags activity + * @name ActivityListRepoNotificationsForAuthenticatedUser + * @summary List repository notifications for the authenticated user + * @request GET:/repos/{owner}/{repo}/notifications + */ + export namespace ActivityListRepoNotificationsForAuthenticatedUser { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * If \`true\`, show notifications marked as read. + * @default false + */ + all?: boolean; + /** Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + before?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * If \`true\`, only shows notifications in which the user is directly participating or mentioned. + * @default false + */ + participating?: boolean; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListRepoNotificationsForAuthenticatedUserData; + } + /** + * @description Lists the people that have starred the repository. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: + * @tags activity + * @name ActivityListStargazersForRepo + * @summary List stargazers + * @request GET:/repos/{owner}/{repo}/stargazers + */ + export namespace ActivityListStargazersForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListStargazersForRepoData; + } + /** + * @description Lists the people watching the specified repository. + * @tags activity + * @name ActivityListWatchersForRepo + * @summary List watchers + * @request GET:/repos/{owner}/{repo}/subscribers + */ + export namespace ActivityListWatchersForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListWatchersForRepoData; + } + /** + * @description Marks all notifications in a repository as "read" removes them from the [default view on GitHub](https://github.com/notifications). If the number of notifications is too large to complete in one request, you will receive a \`202 Accepted\` status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the [List repository notifications for the authenticated user](https://docs.github.com/rest/reference/activity#list-repository-notifications-for-the-authenticated-user) endpoint and pass the query parameter \`all=false\`. + * @tags activity + * @name ActivityMarkRepoNotificationsAsRead + * @summary Mark repository notifications as read + * @request PUT:/repos/{owner}/{repo}/notifications + */ + export namespace ActivityMarkRepoNotificationsAsRead { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ActivityMarkRepoNotificationsAsReadPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActivityMarkRepoNotificationsAsReadData; + } + /** + * @description If you would like to watch a repository, set \`subscribed\` to \`true\`. If you would like to ignore notifications made within a repository, set \`ignored\` to \`true\`. If you would like to stop watching a repository, [delete the repository's subscription](https://docs.github.com/rest/reference/activity#delete-a-repository-subscription) completely. + * @tags activity + * @name ActivitySetRepoSubscription + * @summary Set a repository subscription + * @request PUT:/repos/{owner}/{repo}/subscription + */ + export namespace ActivitySetRepoSubscription { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ActivitySetRepoSubscriptionPayload; + export type RequestHeaders = {}; + export type ResponseBody = ActivitySetRepoSubscriptionData; + } + /** + * @description Enables an authenticated GitHub App to find the repository's installation information. The installation's account type will be either an organization or a user account, depending which account the repository belongs to. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsGetRepoInstallation + * @summary Get a repository installation for the authenticated app + * @request GET:/repos/{owner}/{repo}/installation + */ + export namespace AppsGetRepoInstallation { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsGetRepoInstallationData; + } + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Creates a new check run for a specific commit in a repository. Your GitHub App must have the \`checks:write\` permission to create check runs. In a check suite, GitHub limits the number of check runs with the same name to 1000. Once these check runs exceed 1000, GitHub will start to automatically delete older check runs. + * @tags checks + * @name ChecksCreate + * @summary Create a check run + * @request POST:/repos/{owner}/{repo}/check-runs + */ + export namespace ChecksCreate { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ChecksCreatePayload; + export type RequestHeaders = {}; + export type ResponseBody = ChecksCreateData; + } + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array and a \`null\` value for \`head_branch\`. By default, check suites are automatically created when you create a [check run](https://docs.github.com/rest/reference/checks#check-runs). You only need to use this endpoint for manually creating check suites when you've disabled automatic creation using "[Update repository preferences for check suites](https://docs.github.com/rest/reference/checks#update-repository-preferences-for-check-suites)". Your GitHub App must have the \`checks:write\` permission to create check suites. + * @tags checks + * @name ChecksCreateSuite + * @summary Create a check suite + * @request POST:/repos/{owner}/{repo}/check-suites + */ + export namespace ChecksCreateSuite { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ChecksCreateSuitePayload; + export type RequestHeaders = {}; + export type ResponseBody = ChecksCreateSuiteData; + } + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Gets a single check run using its \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the \`repo\` scope to get check runs in a private repository. + * @tags checks + * @name ChecksGet + * @summary Get a check run + * @request GET:/repos/{owner}/{repo}/check-runs/{check_run_id} + */ + export namespace ChecksGet { + export type RequestParams = { + /** check_run_id parameter */ + checkRunId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ChecksGetData; + } + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array and a \`null\` value for \`head_branch\`. Gets a single check suite using its \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check suites. OAuth Apps and authenticated users must have the \`repo\` scope to get check suites in a private repository. + * @tags checks + * @name ChecksGetSuite + * @summary Get a check suite + * @request GET:/repos/{owner}/{repo}/check-suites/{check_suite_id} + */ + export namespace ChecksGetSuite { + export type RequestParams = { + /** check_suite_id parameter */ + checkSuiteId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ChecksGetSuiteData; + } + /** + * @description Lists annotations for a check run using the annotation \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get annotations for a check run. OAuth Apps and authenticated users must have the \`repo\` scope to get annotations for a check run in a private repository. + * @tags checks + * @name ChecksListAnnotations + * @summary List check run annotations + * @request GET:/repos/{owner}/{repo}/check-runs/{check_run_id}/annotations + */ + export namespace ChecksListAnnotations { + export type RequestParams = { + /** check_run_id parameter */ + checkRunId: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ChecksListAnnotationsData; + } + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Lists check runs for a commit ref. The \`ref\` can be a SHA, branch name, or a tag name. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the \`repo\` scope to get check runs in a private repository. + * @tags checks + * @name ChecksListForRef + * @summary List check runs for a Git reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/check-runs + */ + export namespace ChecksListForRef { + export type RequestParams = { + owner: string; + /** ref+ parameter */ + ref: string; + repo: string; + }; + export type RequestQuery = { + /** Returns check runs with the specified \`name\`. */ + check_name?: string; + /** + * Filters check runs by their \`completed_at\` timestamp. Can be one of \`latest\` (returning the most recent check runs) or \`all\`. + * @default "latest" + */ + filter?: ChecksListForRefParams1FilterEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Returns check runs with the specified \`status\`. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ + status?: ChecksListForRefParams1StatusEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ChecksListForRefData; + } + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Lists check runs for a check suite using its \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the \`repo\` scope to get check runs in a private repository. + * @tags checks + * @name ChecksListForSuite + * @summary List check runs in a check suite + * @request GET:/repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs + */ + export namespace ChecksListForSuite { + export type RequestParams = { + /** check_suite_id parameter */ + checkSuiteId: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Returns check runs with the specified \`name\`. */ + check_name?: string; + /** + * Filters check runs by their \`completed_at\` timestamp. Can be one of \`latest\` (returning the most recent check runs) or \`all\`. + * @default "latest" + */ + filter?: ChecksListForSuiteParams1FilterEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Returns check runs with the specified \`status\`. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ + status?: ChecksListForSuiteParams1StatusEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ChecksListForSuiteData; + } + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array and a \`null\` value for \`head_branch\`. Lists check suites for a commit \`ref\`. The \`ref\` can be a SHA, branch name, or a tag name. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to list check suites. OAuth Apps and authenticated users must have the \`repo\` scope to get check suites in a private repository. + * @tags checks + * @name ChecksListSuitesForRef + * @summary List check suites for a Git reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/check-suites + */ + export namespace ChecksListSuitesForRef { + export type RequestParams = { + owner: string; + /** ref+ parameter */ + ref: string; + repo: string; + }; + export type RequestQuery = { + /** + * Filters check suites by GitHub App \`id\`. + * @example 1 + */ + app_id?: number; + /** Returns check runs with the specified \`name\`. */ + check_name?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ChecksListSuitesForRefData; + } + /** + * @description Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. This endpoint will trigger the [\`check_suite\` webhook](https://docs.github.com/webhooks/event-payloads/#check_suite) event with the action \`rerequested\`. When a check suite is \`rerequested\`, its \`status\` is reset to \`queued\` and the \`conclusion\` is cleared. To rerequest a check suite, your GitHub App must have the \`checks:read\` permission on a private repository or pull access to a public repository. + * @tags checks + * @name ChecksRerequestSuite + * @summary Rerequest a check suite + * @request POST:/repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest + */ + export namespace ChecksRerequestSuite { + export type RequestParams = { + /** check_suite_id parameter */ + checkSuiteId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ChecksRerequestSuiteData; + } + /** + * @description Changes the default automatic flow when creating check suites. By default, a check suite is automatically created each time code is pushed to a repository. When you disable the automatic creation of check suites, you can manually [Create a check suite](https://docs.github.com/rest/reference/checks#create-a-check-suite). You must have admin permissions in the repository to set preferences for check suites. + * @tags checks + * @name ChecksSetSuitesPreferences + * @summary Update repository preferences for check suites + * @request PATCH:/repos/{owner}/{repo}/check-suites/preferences + */ + export namespace ChecksSetSuitesPreferences { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ChecksSetSuitesPreferencesPayload; + export type RequestHeaders = {}; + export type ResponseBody = ChecksSetSuitesPreferencesData; + } + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Updates a check run for a specific commit in a repository. Your GitHub App must have the \`checks:write\` permission to edit check runs. + * @tags checks + * @name ChecksUpdate + * @summary Update a check run + * @request PATCH:/repos/{owner}/{repo}/check-runs/{check_run_id} + */ + export namespace ChecksUpdate { + export type RequestParams = { + /** check_run_id parameter */ + checkRunId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ChecksUpdatePayload; + export type RequestHeaders = {}; + export type ResponseBody = ChecksUpdateData; + } + /** + * @description Gets a single code scanning alert. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` read permission to use this endpoint. The security \`alert_number\` is found at the end of the security alert's URL. For example, the security alert ID for \`https://github.com/Octo-org/octo-repo/security/code-scanning/88\` is \`88\`. + * @tags code-scanning + * @name CodeScanningGetAlert + * @summary Get a code scanning alert + * @request GET:/repos/{owner}/{repo}/code-scanning/alerts/{alert_number} + */ + export namespace CodeScanningGetAlert { + export type RequestParams = { + alertNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CodeScanningGetAlertData; + } + /** + * @description Lists all open code scanning alerts for the default branch (usually \`main\` or \`master\`). You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` read permission to use this endpoint. + * @tags code-scanning + * @name CodeScanningListAlertsForRepo + * @summary List code scanning alerts for a repository + * @request GET:/repos/{owner}/{repo}/code-scanning/alerts + */ + export namespace CodeScanningListAlertsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Set a full Git reference to list alerts for a specific branch. The \`ref\` must be formatted as \`refs/heads/\`. */ + ref?: CodeScanningAlertRef; + /** Set to \`open\`, \`fixed\`, or \`dismissed\` to list code scanning alerts in a specific state. */ + state?: CodeScanningAlertState; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CodeScanningListAlertsForRepoData; + } + /** + * @description List the details of recent code scanning analyses for a repository. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` read permission to use this endpoint. + * @tags code-scanning + * @name CodeScanningListRecentAnalyses + * @summary List recent code scanning analyses for a repository + * @request GET:/repos/{owner}/{repo}/code-scanning/analyses + */ + export namespace CodeScanningListRecentAnalyses { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Set a full Git reference to list alerts for a specific branch. The \`ref\` must be formatted as \`refs/heads/\`. */ + ref?: CodeScanningAnalysisRef; + /** Set a single code scanning tool name to filter alerts by tool. */ + tool_name?: CodeScanningAnalysisToolName; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CodeScanningListRecentAnalysesData; + } + /** + * @description Updates the status of a single code scanning alert. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` write permission to use this endpoint. + * @tags code-scanning + * @name CodeScanningUpdateAlert + * @summary Update a code scanning alert + * @request PATCH:/repos/{owner}/{repo}/code-scanning/alerts/{alert_number} + */ + export namespace CodeScanningUpdateAlert { + export type RequestParams = { + /** The security alert number, found at the end of the security alert's URL. */ + alertNumber: AlertNumber; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = CodeScanningUpdateAlertPayload; + export type RequestHeaders = {}; + export type ResponseBody = CodeScanningUpdateAlertData; + } + /** + * @description Upload a SARIF file containing the results of a code scanning analysis to make the results available in a repository. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` write permission to use this endpoint. + * @tags code-scanning + * @name CodeScanningUploadSarif + * @summary Upload a SARIF file + * @request POST:/repos/{owner}/{repo}/code-scanning/sarifs + */ + export namespace CodeScanningUploadSarif { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = CodeScanningUploadSarifPayload; + export type RequestHeaders = {}; + export type ResponseBody = CodeScanningUploadSarifData; + } + /** + * @description Returns the contents of the repository's code of conduct file, if one is detected. A code of conduct is detected if there is a file named \`CODE_OF_CONDUCT\` in the root directory of the repository. GitHub detects which code of conduct it is using fuzzy matching. + * @tags codes-of-conduct + * @name CodesOfConductGetForRepo + * @summary Get the code of conduct for a repository + * @request GET:/repos/{owner}/{repo}/community/code_of_conduct + */ + export namespace CodesOfConductGetForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CodesOfConductGetForRepoData; + } + /** + * No description + * @tags git + * @name GitCreateBlob + * @summary Create a blob + * @request POST:/repos/{owner}/{repo}/git/blobs + */ + export namespace GitCreateBlob { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = GitCreateBlobPayload; + export type RequestHeaders = {}; + export type ResponseBody = GitCreateBlobData; + } + /** + * @description Creates a new Git [commit object](https://git-scm.com/book/en/v1/Git-Internals-Git-Objects#Commit-Objects). **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * @tags git + * @name GitCreateCommit + * @summary Create a commit + * @request POST:/repos/{owner}/{repo}/git/commits + */ + export namespace GitCreateCommit { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = GitCreateCommitPayload; + export type RequestHeaders = {}; + export type ResponseBody = GitCreateCommitData; + } + /** + * @description Creates a reference for your repository. You are unable to create new references for empty repositories, even if the commit SHA-1 hash used exists. Empty repositories are repositories without branches. + * @tags git + * @name GitCreateRef + * @summary Create a reference + * @request POST:/repos/{owner}/{repo}/git/refs + */ + export namespace GitCreateRef { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = GitCreateRefPayload; + export type RequestHeaders = {}; + export type ResponseBody = GitCreateRefData; + } + /** + * @description Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then [create](https://docs.github.com/rest/reference/git#create-a-reference) the \`refs/tags/[tag]\` reference. If you want to create a lightweight tag, you only have to [create](https://docs.github.com/rest/reference/git#create-a-reference) the tag reference - this call would be unnecessary. **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * @tags git + * @name GitCreateTag + * @summary Create a tag object + * @request POST:/repos/{owner}/{repo}/git/tags + */ + export namespace GitCreateTag { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = GitCreateTagPayload; + export type RequestHeaders = {}; + export type ResponseBody = GitCreateTagData; + } + /** + * @description The tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure. If you use this endpoint to add, delete, or modify the file contents in a tree, you will need to commit the tree and then update a branch to point to the commit. For more information see "[Create a commit](https://docs.github.com/rest/reference/git#create-a-commit)" and "[Update a reference](https://docs.github.com/rest/reference/git#update-a-reference)." + * @tags git + * @name GitCreateTree + * @summary Create a tree + * @request POST:/repos/{owner}/{repo}/git/trees + */ + export namespace GitCreateTree { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = GitCreateTreePayload; + export type RequestHeaders = {}; + export type ResponseBody = GitCreateTreeData; + } + /** + * No description + * @tags git + * @name GitDeleteRef + * @summary Delete a reference + * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} + */ + export namespace GitDeleteRef { + export type RequestParams = { + owner: string; + /** ref+ parameter */ + ref: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GitDeleteRefData; + } + /** + * @description The \`content\` in the response will always be Base64 encoded. _Note_: This API supports blobs up to 100 megabytes in size. + * @tags git + * @name GitGetBlob + * @summary Get a blob + * @request GET:/repos/{owner}/{repo}/git/blobs/{file_sha} + */ + export namespace GitGetBlob { + export type RequestParams = { + fileSha: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GitGetBlobData; + } + /** + * @description Gets a Git [commit object](https://git-scm.com/book/en/v1/Git-Internals-Git-Objects#Commit-Objects). **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * @tags git + * @name GitGetCommit + * @summary Get a commit + * @request GET:/repos/{owner}/{repo}/git/commits/{commit_sha} + */ + export namespace GitGetCommit { + export type RequestParams = { + /** commit_sha parameter */ + commitSha: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GitGetCommitData; + } + /** + * @description Returns a single reference from your Git database. The \`:ref\` in the URL must be formatted as \`heads/\` for branches and \`tags/\` for tags. If the \`:ref\` doesn't match an existing ref, a \`404\` is returned. **Note:** You need to explicitly [request a pull request](https://docs.github.com/rest/reference/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". + * @tags git + * @name GitGetRef + * @summary Get a reference + * @request GET:/repos/{owner}/{repo}/git/ref/{ref} + */ + export namespace GitGetRef { + export type RequestParams = { + owner: string; + /** ref+ parameter */ + ref: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GitGetRefData; + } + /** + * @description **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * @tags git + * @name GitGetTag + * @summary Get a tag + * @request GET:/repos/{owner}/{repo}/git/tags/{tag_sha} + */ + export namespace GitGetTag { + export type RequestParams = { + owner: string; + repo: string; + tagSha: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GitGetTagData; + } + /** + * @description Returns a single tree using the SHA1 value for that tree. If \`truncated\` is \`true\` in the response then the number of items in the \`tree\` array exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time. + * @tags git + * @name GitGetTree + * @summary Get a tree + * @request GET:/repos/{owner}/{repo}/git/trees/{tree_sha} + */ + export namespace GitGetTree { + export type RequestParams = { + owner: string; + repo: string; + treeSha: string; + }; + export type RequestQuery = { + /** Setting this parameter to any value returns the objects or subtrees referenced by the tree specified in \`:tree_sha\`. For example, setting \`recursive\` to any of the following will enable returning objects or subtrees: \`0\`, \`1\`, \`"true"\`, and \`"false"\`. Omit this parameter to prevent recursively returning objects or subtrees. */ + recursive?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GitGetTreeData; + } + /** + * @description Returns an array of references from your Git database that match the supplied name. The \`:ref\` in the URL must be formatted as \`heads/\` for branches and \`tags/\` for tags. If the \`:ref\` doesn't exist in the repository, but existing refs start with \`:ref\`, they will be returned as an array. When you use this endpoint without providing a \`:ref\`, it will return an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just \`heads\` and \`tags\`. **Note:** You need to explicitly [request a pull request](https://docs.github.com/rest/reference/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". If you request matching references for a branch named \`feature\` but the branch \`feature\` doesn't exist, the response can still include other matching head refs that start with the word \`feature\`, such as \`featureA\` and \`featureB\`. + * @tags git + * @name GitListMatchingRefs + * @summary List matching references + * @request GET:/repos/{owner}/{repo}/git/matching-refs/{ref} + */ + export namespace GitListMatchingRefs { + export type RequestParams = { + owner: string; + /** ref+ parameter */ + ref: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GitListMatchingRefsData; + } + /** + * No description + * @tags git + * @name GitUpdateRef + * @summary Update a reference + * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} + */ + export namespace GitUpdateRef { + export type RequestParams = { + owner: string; + /** ref+ parameter */ + ref: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = GitUpdateRefPayload; + export type RequestHeaders = {}; + export type ResponseBody = GitUpdateRefData; + } + /** + * @description Shows which type of GitHub user can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response. + * @tags interactions + * @name InteractionsGetRestrictionsForRepo + * @summary Get interaction restrictions for a repository + * @request GET:/repos/{owner}/{repo}/interaction-limits + */ + export namespace InteractionsGetRestrictionsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = InteractionsGetRestrictionsForRepoData; + } + /** + * @description Removes all interaction restrictions from the given repository. You must have owner or admin access to remove restrictions. If the interaction limit is set for the user or organization that owns this repository, you will receive a \`409 Conflict\` response and will not be able to use this endpoint to change the interaction limit for a single repository. + * @tags interactions + * @name InteractionsRemoveRestrictionsForRepo + * @summary Remove interaction restrictions for a repository + * @request DELETE:/repos/{owner}/{repo}/interaction-limits + */ + export namespace InteractionsRemoveRestrictionsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = InteractionsRemoveRestrictionsForRepoData; + } + /** + * @description Temporarily restricts interactions to a certain type of GitHub user within the given repository. You must have owner or admin access to set these restrictions. If an interaction limit is set for the user or organization that owns this repository, you will receive a \`409 Conflict\` response and will not be able to use this endpoint to change the interaction limit for a single repository. + * @tags interactions + * @name InteractionsSetRestrictionsForRepo + * @summary Set interaction restrictions for a repository + * @request PUT:/repos/{owner}/{repo}/interaction-limits + */ + export namespace InteractionsSetRestrictionsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = InteractionLimit; + export type RequestHeaders = {}; + export type ResponseBody = InteractionsSetRestrictionsForRepoData; + } + /** + * @description Adds up to 10 assignees to an issue. Users already assigned to an issue are not replaced. + * @tags issues + * @name IssuesAddAssignees + * @summary Add assignees to an issue + * @request POST:/repos/{owner}/{repo}/issues/{issue_number}/assignees + */ + export namespace IssuesAddAssignees { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesAddAssigneesPayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesAddAssigneesData; + } + /** + * No description + * @tags issues + * @name IssuesAddLabels + * @summary Add labels to an issue + * @request POST:/repos/{owner}/{repo}/issues/{issue_number}/labels + */ + export namespace IssuesAddLabels { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesAddLabelsPayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesAddLabelsData; + } + /** + * @description Checks if a user has permission to be assigned to an issue in this repository. If the \`assignee\` can be assigned to issues in the repository, a \`204\` header with no content is returned. Otherwise a \`404\` status code is returned. + * @tags issues + * @name IssuesCheckUserCanBeAssigned + * @summary Check if a user can be assigned + * @request GET:/repos/{owner}/{repo}/assignees/{assignee} + */ + export namespace IssuesCheckUserCanBeAssigned { + export type RequestParams = { + assignee: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesCheckUserCanBeAssignedData; + } + /** + * @description Any user with pull access to a repository can create an issue. If [issues are disabled in the repository](https://help.github.com/articles/disabling-issues/), the API returns a \`410 Gone\` status. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. + * @tags issues + * @name IssuesCreate + * @summary Create an issue + * @request POST:/repos/{owner}/{repo}/issues + */ + export namespace IssuesCreate { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesCreatePayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesCreateData; + } + /** + * @description This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. + * @tags issues + * @name IssuesCreateComment + * @summary Create an issue comment + * @request POST:/repos/{owner}/{repo}/issues/{issue_number}/comments + */ + export namespace IssuesCreateComment { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesCreateCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesCreateCommentData; + } + /** + * No description + * @tags issues + * @name IssuesCreateLabel + * @summary Create a label + * @request POST:/repos/{owner}/{repo}/labels + */ + export namespace IssuesCreateLabel { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesCreateLabelPayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesCreateLabelData; + } + /** + * No description + * @tags issues + * @name IssuesCreateMilestone + * @summary Create a milestone + * @request POST:/repos/{owner}/{repo}/milestones + */ + export namespace IssuesCreateMilestone { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesCreateMilestonePayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesCreateMilestoneData; + } + /** + * No description + * @tags issues + * @name IssuesDeleteComment + * @summary Delete an issue comment + * @request DELETE:/repos/{owner}/{repo}/issues/comments/{comment_id} + */ + export namespace IssuesDeleteComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesDeleteCommentData; + } + /** + * No description + * @tags issues + * @name IssuesDeleteLabel + * @summary Delete a label + * @request DELETE:/repos/{owner}/{repo}/labels/{name} + */ + export namespace IssuesDeleteLabel { + export type RequestParams = { + name: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesDeleteLabelData; + } + /** + * No description + * @tags issues + * @name IssuesDeleteMilestone + * @summary Delete a milestone + * @request DELETE:/repos/{owner}/{repo}/milestones/{milestone_number} + */ + export namespace IssuesDeleteMilestone { + export type RequestParams = { + /** milestone_number parameter */ + milestoneNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesDeleteMilestoneData; + } + /** + * @description The API returns a [\`301 Moved Permanently\` status](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-redirects-redirects) if the issue was [transferred](https://help.github.com/articles/transferring-an-issue-to-another-repository/) to another repository. If the issue was transferred to or deleted from a repository where the authenticated user lacks read access, the API returns a \`404 Not Found\` status. If the issue was deleted from a repository where the authenticated user has read access, the API returns a \`410 Gone\` status. To receive webhook events for transferred and deleted issues, subscribe to the [\`issues\`](https://docs.github.com/webhooks/event-payloads/#issues) webhook. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * @tags issues + * @name IssuesGet + * @summary Get an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number} + */ + export namespace IssuesGet { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesGetData; + } + /** + * No description + * @tags issues + * @name IssuesGetComment + * @summary Get an issue comment + * @request GET:/repos/{owner}/{repo}/issues/comments/{comment_id} + */ + export namespace IssuesGetComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesGetCommentData; + } + /** + * No description + * @tags issues + * @name IssuesGetEvent + * @summary Get an issue event + * @request GET:/repos/{owner}/{repo}/issues/events/{event_id} + */ + export namespace IssuesGetEvent { + export type RequestParams = { + eventId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesGetEventData; + } + /** + * No description + * @tags issues + * @name IssuesGetLabel + * @summary Get a label + * @request GET:/repos/{owner}/{repo}/labels/{name} + */ + export namespace IssuesGetLabel { + export type RequestParams = { + name: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesGetLabelData; + } + /** + * No description + * @tags issues + * @name IssuesGetMilestone + * @summary Get a milestone + * @request GET:/repos/{owner}/{repo}/milestones/{milestone_number} + */ + export namespace IssuesGetMilestone { + export type RequestParams = { + /** milestone_number parameter */ + milestoneNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesGetMilestoneData; + } + /** + * @description Lists the [available assignees](https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/) for issues in a repository. + * @tags issues + * @name IssuesListAssignees + * @summary List assignees + * @request GET:/repos/{owner}/{repo}/assignees + */ + export namespace IssuesListAssignees { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListAssigneesData; + } + /** + * @description Issue Comments are ordered by ascending ID. + * @tags issues + * @name IssuesListComments + * @summary List issue comments + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/comments + */ + export namespace IssuesListComments { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListCommentsData; + } + /** + * @description By default, Issue Comments are ordered by ascending ID. + * @tags issues + * @name IssuesListCommentsForRepo + * @summary List issue comments for a repository + * @request GET:/repos/{owner}/{repo}/issues/comments + */ + export namespace IssuesListCommentsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Either \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ + direction?: IssuesListCommentsForRepoParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: IssuesListCommentsForRepoParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListCommentsForRepoData; + } + /** + * No description + * @tags issues + * @name IssuesListEvents + * @summary List issue events + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/events + */ + export namespace IssuesListEvents { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListEventsData; + } + /** + * No description + * @tags issues + * @name IssuesListEventsForRepo + * @summary List issue events for a repository + * @request GET:/repos/{owner}/{repo}/issues/events + */ + export namespace IssuesListEventsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListEventsForRepoData; + } + /** + * No description + * @tags issues + * @name IssuesListEventsForTimeline + * @summary List timeline events for an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/timeline + */ + export namespace IssuesListEventsForTimeline { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListEventsForTimelineData; + } + /** + * @description List issues in a repository. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * @tags issues + * @name IssuesListForRepo + * @summary List repository issues + * @request GET:/repos/{owner}/{repo}/issues + */ + export namespace IssuesListForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Can be the name of a user. Pass in \`none\` for issues with no assigned user, and \`*\` for issues assigned to any user. */ + assignee?: string; + /** The user that created the issue. */ + creator?: string; + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: IssuesListForRepoParams1DirectionEnum; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + /** A user that's mentioned in the issue. */ + mentioned?: string; + /** If an \`integer\` is passed, it should refer to a milestone by its \`number\` field. If the string \`*\` is passed, issues with any milestone are accepted. If the string \`none\` is passed, issues without milestones are returned. */ + milestone?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: IssuesListForRepoParams1SortEnum; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: IssuesListForRepoParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListForRepoData; + } + /** + * No description + * @tags issues + * @name IssuesListLabelsForMilestone + * @summary List labels for issues in a milestone + * @request GET:/repos/{owner}/{repo}/milestones/{milestone_number}/labels + */ + export namespace IssuesListLabelsForMilestone { + export type RequestParams = { + /** milestone_number parameter */ + milestoneNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListLabelsForMilestoneData; + } + /** + * No description + * @tags issues + * @name IssuesListLabelsForRepo + * @summary List labels for a repository + * @request GET:/repos/{owner}/{repo}/labels + */ + export namespace IssuesListLabelsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListLabelsForRepoData; + } + /** + * No description + * @tags issues + * @name IssuesListLabelsOnIssue + * @summary List labels for an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/labels + */ + export namespace IssuesListLabelsOnIssue { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListLabelsOnIssueData; + } + /** + * No description + * @tags issues + * @name IssuesListMilestones + * @summary List milestones + * @request GET:/repos/{owner}/{repo}/milestones + */ + export namespace IssuesListMilestones { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * The direction of the sort. Either \`asc\` or \`desc\`. + * @default "asc" + */ + direction?: IssuesListMilestonesParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * What to sort results by. Either \`due_on\` or \`completeness\`. + * @default "due_on" + */ + sort?: IssuesListMilestonesParams1SortEnum; + /** + * The state of the milestone. Either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: IssuesListMilestonesParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListMilestonesData; + } + /** + * @description Users with push access can lock an issue or pull request's conversation. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * @tags issues + * @name IssuesLock + * @summary Lock an issue + * @request PUT:/repos/{owner}/{repo}/issues/{issue_number}/lock + */ + export namespace IssuesLock { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesLockPayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesLockData; + } + /** + * No description + * @tags issues + * @name IssuesRemoveAllLabels + * @summary Remove all labels from an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/labels + */ + export namespace IssuesRemoveAllLabels { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesRemoveAllLabelsData; + } + /** + * @description Removes one or more assignees from an issue. + * @tags issues + * @name IssuesRemoveAssignees + * @summary Remove assignees from an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/assignees + */ + export namespace IssuesRemoveAssignees { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesRemoveAssigneesPayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesRemoveAssigneesData; + } + /** + * @description Removes the specified label from the issue, and returns the remaining labels on the issue. This endpoint returns a \`404 Not Found\` status if the label does not exist. + * @tags issues + * @name IssuesRemoveLabel + * @summary Remove a label from an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/labels/{name} + */ + export namespace IssuesRemoveLabel { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + name: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesRemoveLabelData; + } + /** + * @description Removes any previous labels and sets the new labels for an issue. + * @tags issues + * @name IssuesSetLabels + * @summary Set labels for an issue + * @request PUT:/repos/{owner}/{repo}/issues/{issue_number}/labels + */ + export namespace IssuesSetLabels { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesSetLabelsPayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesSetLabelsData; + } + /** + * @description Users with push access can unlock an issue's conversation. + * @tags issues + * @name IssuesUnlock + * @summary Unlock an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/lock + */ + export namespace IssuesUnlock { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesUnlockData; + } + /** + * @description Issue owners and users with push access can edit an issue. + * @tags issues + * @name IssuesUpdate + * @summary Update an issue + * @request PATCH:/repos/{owner}/{repo}/issues/{issue_number} + */ + export namespace IssuesUpdate { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesUpdatePayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesUpdateData; + } + /** + * No description + * @tags issues + * @name IssuesUpdateComment + * @summary Update an issue comment + * @request PATCH:/repos/{owner}/{repo}/issues/comments/{comment_id} + */ + export namespace IssuesUpdateComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesUpdateCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesUpdateCommentData; + } + /** + * No description + * @tags issues + * @name IssuesUpdateLabel + * @summary Update a label + * @request PATCH:/repos/{owner}/{repo}/labels/{name} + */ + export namespace IssuesUpdateLabel { + export type RequestParams = { + name: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesUpdateLabelPayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesUpdateLabelData; + } + /** + * No description + * @tags issues + * @name IssuesUpdateMilestone + * @summary Update a milestone + * @request PATCH:/repos/{owner}/{repo}/milestones/{milestone_number} + */ + export namespace IssuesUpdateMilestone { + export type RequestParams = { + /** milestone_number parameter */ + milestoneNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = IssuesUpdateMilestonePayload; + export type RequestHeaders = {}; + export type ResponseBody = IssuesUpdateMilestoneData; + } + /** + * @description This method returns the contents of the repository's license file, if one is detected. Similar to [Get repository content](https://docs.github.com/rest/reference/repos#get-repository-content), this method also supports [custom media types](https://docs.github.com/rest/overview/media-types) for retrieving the raw license content or rendered license HTML. + * @tags licenses + * @name LicensesGetForRepo + * @summary Get the license for a repository + * @request GET:/repos/{owner}/{repo}/license + */ + export namespace LicensesGetForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = LicensesGetForRepoData; + } + /** + * @description Stop an import for a repository. + * @tags migrations + * @name MigrationsCancelImport + * @summary Cancel an import + * @request DELETE:/repos/{owner}/{repo}/import + */ + export namespace MigrationsCancelImport { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsCancelImportData; + } + /** + * @description Each type of source control system represents authors in a different way. For example, a Git commit author has a display name and an email address, but a Subversion commit author just has a username. The GitHub Importer will make the author information valid, but the author might not be correct. For example, it will change the bare Subversion username \`hubot\` into something like \`hubot \`. This endpoint and the [Map a commit author](https://docs.github.com/rest/reference/migrations#map-a-commit-author) endpoint allow you to provide correct Git author information. + * @tags migrations + * @name MigrationsGetCommitAuthors + * @summary Get commit authors + * @request GET:/repos/{owner}/{repo}/import/authors + */ + export namespace MigrationsGetCommitAuthors { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** A user ID. Only return users with an ID greater than this ID. */ + since?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsGetCommitAuthorsData; + } + /** + * @description View the progress of an import. **Import status** This section includes details about the possible values of the \`status\` field of the Import Progress response. An import that does not have errors will progress through these steps: * \`detecting\` - the "detection" step of the import is in progress because the request did not include a \`vcs\` parameter. The import is identifying the type of source control present at the URL. * \`importing\` - the "raw" step of the import is in progress. This is where commit data is fetched from the original repository. The import progress response will include \`commit_count\` (the total number of raw commits that will be imported) and \`percent\` (0 - 100, the current progress through the import). * \`mapping\` - the "rewrite" step of the import is in progress. This is where SVN branches are converted to Git branches, and where author updates are applied. The import progress response does not include progress information. * \`pushing\` - the "push" step of the import is in progress. This is where the importer updates the repository on GitHub. The import progress response will include \`push_percent\`, which is the percent value reported by \`git push\` when it is "Writing objects". * \`complete\` - the import is complete, and the repository is ready on GitHub. If there are problems, you will see one of these in the \`status\` field: * \`auth_failed\` - the import requires authentication in order to connect to the original repository. To update authentication for the import, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. * \`error\` - the import encountered an error. The import progress response will include the \`failed_step\` and an error message. Contact [GitHub Support](https://support.github.com/contact) or [GitHub Premium Support](https://premium.githubsupport.com) for more information. * \`detection_needs_auth\` - the importer requires authentication for the originating repository to continue detection. To update authentication for the import, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. * \`detection_found_nothing\` - the importer didn't recognize any source control at the URL. To resolve, [Cancel the import](https://docs.github.com/rest/reference/migrations#cancel-an-import) and [retry](https://docs.github.com/rest/reference/migrations#start-an-import) with the correct URL. * \`detection_found_multiple\` - the importer found several projects or repositories at the provided URL. When this is the case, the Import Progress response will also include a \`project_choices\` field with the possible project choices as values. To update project choice, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. **The project_choices field** When multiple projects are found at the provided URL, the response hash will include a \`project_choices\` field, the value of which is an array of hashes each representing a project choice. The exact key/value pairs of the project hashes will differ depending on the version control type. **Git LFS related fields** This section includes details about Git LFS related fields that may be present in the Import Progress response. * \`use_lfs\` - describes whether the import has been opted in or out of using Git LFS. The value can be \`opt_in\`, \`opt_out\`, or \`undecided\` if no action has been taken. * \`has_large_files\` - the boolean value describing whether files larger than 100MB were found during the \`importing\` step. * \`large_files_size\` - the total size in gigabytes of files larger than 100MB found in the originating repository. * \`large_files_count\` - the total number of files larger than 100MB found in the originating repository. To see a list of these files, make a "Get Large Files" request. + * @tags migrations + * @name MigrationsGetImportStatus + * @summary Get an import status + * @request GET:/repos/{owner}/{repo}/import + */ + export namespace MigrationsGetImportStatus { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsGetImportStatusData; + } + /** + * @description List files larger than 100MB found during the import + * @tags migrations + * @name MigrationsGetLargeFiles + * @summary Get large files + * @request GET:/repos/{owner}/{repo}/import/large_files + */ + export namespace MigrationsGetLargeFiles { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsGetLargeFilesData; + } + /** + * @description Update an author's identity for the import. Your application can continue updating authors any time before you push new commits to the repository. + * @tags migrations + * @name MigrationsMapCommitAuthor + * @summary Map a commit author + * @request PATCH:/repos/{owner}/{repo}/import/authors/{author_id} + */ + export namespace MigrationsMapCommitAuthor { + export type RequestParams = { + authorId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = MigrationsMapCommitAuthorPayload; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsMapCommitAuthorData; + } + /** + * @description You can import repositories from Subversion, Mercurial, and TFS that include files larger than 100MB. This ability is powered by [Git LFS](https://git-lfs.github.com). You can learn more about our LFS feature and working with large files [on our help site](https://help.github.com/articles/versioning-large-files/). + * @tags migrations + * @name MigrationsSetLfsPreference + * @summary Update Git LFS preference + * @request PATCH:/repos/{owner}/{repo}/import/lfs + */ + export namespace MigrationsSetLfsPreference { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = MigrationsSetLfsPreferencePayload; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsSetLfsPreferenceData; + } + /** + * @description Start a source import to a GitHub repository using GitHub Importer. + * @tags migrations + * @name MigrationsStartImport + * @summary Start an import + * @request PUT:/repos/{owner}/{repo}/import + */ + export namespace MigrationsStartImport { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = MigrationsStartImportPayload; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsStartImportData; + } + /** + * @description An import can be updated with credentials or a project choice by passing in the appropriate parameters in this API request. If no parameters are provided, the import will be restarted. + * @tags migrations + * @name MigrationsUpdateImport + * @summary Update an import + * @request PATCH:/repos/{owner}/{repo}/import + */ + export namespace MigrationsUpdateImport { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = MigrationsUpdateImportPayload; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsUpdateImportData; + } + /** + * @description Creates a repository project board. Returns a \`404 Not Found\` status if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * @tags projects + * @name ProjectsCreateForRepo + * @summary Create a repository project + * @request POST:/repos/{owner}/{repo}/projects + */ + export namespace ProjectsCreateForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectsCreateForRepoPayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsCreateForRepoData; + } + /** + * @description Lists the projects in a repository. Returns a \`404 Not Found\` status if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * @tags projects + * @name ProjectsListForRepo + * @summary List repository projects + * @request GET:/repos/{owner}/{repo}/projects + */ + export namespace ProjectsListForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: ProjectsListForRepoParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsListForRepoData; + } + /** + * No description + * @tags pulls + * @name PullsCheckIfMerged + * @summary Check if a pull request has been merged + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/merge + */ + export namespace PullsCheckIfMerged { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsCheckIfMergedData; + } + /** + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request. You can create a new pull request. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @tags pulls + * @name PullsCreate + * @summary Create a pull request + * @request POST:/repos/{owner}/{repo}/pulls + */ + export namespace PullsCreate { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = PullsCreatePayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsCreateData; + } + /** + * @description Creates a reply to a review comment for a pull request. For the \`comment_id\`, provide the ID of the review comment you are replying to. This must be the ID of a _top-level review comment_, not a reply to that comment. Replies to replies are not supported. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @tags pulls + * @name PullsCreateReplyForReviewComment + * @summary Create a reply for a review comment + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies + */ + export namespace PullsCreateReplyForReviewComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = PullsCreateReplyForReviewCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsCreateReplyForReviewCommentData; + } + /** + * @description This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. Pull request reviews created in the \`PENDING\` state do not include the \`submitted_at\` property in the response. **Note:** To comment on a specific line in a file, you need to first determine the _position_ of that line in the diff. The GitHub REST API v3 offers the \`application/vnd.github.v3.diff\` [media type](https://docs.github.com/rest/overview/media-types#commits-commit-comparison-and-pull-requests). To see a pull request diff, add this media type to the \`Accept\` header of a call to the [single pull request](https://docs.github.com/rest/reference/pulls#get-a-pull-request) endpoint. The \`position\` value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file. + * @tags pulls + * @name PullsCreateReview + * @summary Create a review for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/reviews + */ + export namespace PullsCreateReview { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = PullsCreateReviewPayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsCreateReviewData; + } + /** + * @description Creates a review comment in the pull request diff. To add a regular comment to a pull request timeline, see "[Create an issue comment](https://docs.github.com/rest/reference/issues#create-an-issue-comment)." We recommend creating a review comment using \`line\`, \`side\`, and optionally \`start_line\` and \`start_side\` if your comment applies to more than one line in the pull request diff. You can still create a review comment using the \`position\` parameter. When you use \`position\`, the \`line\`, \`side\`, \`start_line\`, and \`start_side\` parameters are not required. For more information, see the [\`comfort-fade\` preview notice](https://docs.github.com/rest/reference/pulls#create-a-review-comment-for-a-pull-request-preview-notices). **Note:** The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @tags pulls + * @name PullsCreateReviewComment + * @summary Create a review comment for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/comments + */ + export namespace PullsCreateReviewComment { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = PullsCreateReviewCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsCreateReviewCommentData; + } + /** + * No description + * @tags pulls + * @name PullsDeletePendingReview + * @summary Delete a pending review for a pull request + * @request DELETE:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} + */ + export namespace PullsDeletePendingReview { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + /** review_id parameter */ + reviewId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsDeletePendingReviewData; + } + /** + * @description Deletes a review comment. + * @tags pulls + * @name PullsDeleteReviewComment + * @summary Delete a review comment for a pull request + * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{comment_id} + */ + export namespace PullsDeleteReviewComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsDeleteReviewCommentData; + } + /** + * @description **Note:** To dismiss a pull request review on a [protected branch](https://docs.github.com/rest/reference/repos#branches), you must be a repository administrator or be included in the list of people or teams who can dismiss pull request reviews. + * @tags pulls + * @name PullsDismissReview + * @summary Dismiss a review for a pull request + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals + */ + export namespace PullsDismissReview { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + /** review_id parameter */ + reviewId: number; + }; + export type RequestQuery = {}; + export type RequestBody = PullsDismissReviewPayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsDismissReviewData; + } + /** + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists details of a pull request by providing its number. When you get, [create](https://docs.github.com/rest/reference/pulls/#create-a-pull-request), or [edit](https://docs.github.com/rest/reference/pulls#update-a-pull-request) a pull request, GitHub creates a merge commit to test whether the pull request can be automatically merged into the base branch. This test commit is not added to the base branch or the head branch. You can review the status of the test commit using the \`mergeable\` key. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". The value of the \`mergeable\` attribute can be \`true\`, \`false\`, or \`null\`. If the value is \`null\`, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-\`null\` value for the \`mergeable\` attribute in the response. If \`mergeable\` is \`true\`, then \`merge_commit_sha\` will be the SHA of the _test_ merge commit. The value of the \`merge_commit_sha\` attribute changes depending on the state of the pull request. Before merging a pull request, the \`merge_commit_sha\` attribute holds the SHA of the _test_ merge commit. After merging a pull request, the \`merge_commit_sha\` attribute changes depending on how you merged the pull request: * If merged as a [merge commit](https://help.github.com/articles/about-merge-methods-on-github/), \`merge_commit_sha\` represents the SHA of the merge commit. * If merged via a [squash](https://help.github.com/articles/about-merge-methods-on-github/#squashing-your-merge-commits), \`merge_commit_sha\` represents the SHA of the squashed commit on the base branch. * If [rebased](https://help.github.com/articles/about-merge-methods-on-github/#rebasing-and-merging-your-commits), \`merge_commit_sha\` represents the commit that the base branch was updated to. Pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats. + * @tags pulls + * @name PullsGet + * @summary Get a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number} + */ + export namespace PullsGet { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsGetData; + } + /** + * No description + * @tags pulls + * @name PullsGetReview + * @summary Get a review for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} + */ + export namespace PullsGetReview { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + /** review_id parameter */ + reviewId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsGetReviewData; + } + /** + * @description Provides details for a review comment. + * @tags pulls + * @name PullsGetReviewComment + * @summary Get a review comment for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/comments/{comment_id} + */ + export namespace PullsGetReviewComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsGetReviewCommentData; + } + /** + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags pulls + * @name PullsList + * @summary List pull requests + * @request GET:/repos/{owner}/{repo}/pulls + */ + export namespace PullsList { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Filter pulls by base branch name. Example: \`gh-pages\`. */ + base?: string; + /** The direction of the sort. Can be either \`asc\` or \`desc\`. Default: \`desc\` when sort is \`created\` or sort is not specified, otherwise \`asc\`. */ + direction?: PullsListParams1DirectionEnum; + /** Filter pulls by head user or head organization and branch name in the format of \`user:ref-name\` or \`organization:ref-name\`. For example: \`github:new-script-format\` or \`octocat:test-branch\`. */ + head?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`popularity\` (comment count) or \`long-running\` (age, filtering by pulls updated in the last month). + * @default "created" + */ + sort?: PullsListParams1SortEnum; + /** + * Either \`open\`, \`closed\`, or \`all\` to filter by state. + * @default "open" + */ + state?: PullsListParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsListData; + } + /** + * @description List comments for a specific pull request review. + * @tags pulls + * @name PullsListCommentsForReview + * @summary List comments for a pull request review + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments + */ + export namespace PullsListCommentsForReview { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + /** review_id parameter */ + reviewId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsListCommentsForReviewData; + } + /** + * @description Lists a maximum of 250 commits for a pull request. To receive a complete commit list for pull requests with more than 250 commits, use the [List commits](https://docs.github.com/rest/reference/repos#list-commits) endpoint. + * @tags pulls + * @name PullsListCommits + * @summary List commits on a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/commits + */ + export namespace PullsListCommits { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsListCommitsData; + } + /** + * @description **Note:** Responses include a maximum of 3000 files. The paginated response returns 30 files per page by default. + * @tags pulls + * @name PullsListFiles + * @summary List pull requests files + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/files + */ + export namespace PullsListFiles { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsListFilesData; + } + /** + * No description + * @tags pulls + * @name PullsListRequestedReviewers + * @summary List requested reviewers for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + */ + export namespace PullsListRequestedReviewers { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsListRequestedReviewersData; + } + /** + * @description Lists all review comments for a pull request. By default, review comments are in ascending order by ID. + * @tags pulls + * @name PullsListReviewComments + * @summary List review comments on a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/comments + */ + export namespace PullsListReviewComments { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = { + /** Can be either \`asc\` or \`desc\`. Ignored without \`sort\` parameter. */ + direction?: PullsListReviewCommentsParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: PullsListReviewCommentsParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsListReviewCommentsData; + } + /** + * @description Lists review comments for all pull requests in a repository. By default, review comments are in ascending order by ID. + * @tags pulls + * @name PullsListReviewCommentsForRepo + * @summary List review comments in a repository + * @request GET:/repos/{owner}/{repo}/pulls/comments + */ + export namespace PullsListReviewCommentsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Can be either \`asc\` or \`desc\`. Ignored without \`sort\` parameter. */ + direction?: PullsListReviewCommentsForRepoParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: PullsListReviewCommentsForRepoParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsListReviewCommentsForRepoData; + } + /** + * @description The list of reviews returns in chronological order. + * @tags pulls + * @name PullsListReviews + * @summary List reviews for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews + */ + export namespace PullsListReviews { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PullsListReviewsData; + } + /** + * @description This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. + * @tags pulls + * @name PullsMerge + * @summary Merge a pull request + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/merge + */ + export namespace PullsMerge { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = PullsMergePayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsMergeData; + } + /** + * No description + * @tags pulls + * @name PullsRemoveRequestedReviewers + * @summary Remove requested reviewers from a pull request + * @request DELETE:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + */ + export namespace PullsRemoveRequestedReviewers { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = PullsRemoveRequestedReviewersPayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsRemoveRequestedReviewersData; + } + /** + * @description This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. + * @tags pulls + * @name PullsRequestReviewers + * @summary Request reviewers for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + */ + export namespace PullsRequestReviewers { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = PullsRequestReviewersPayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsRequestReviewersData; + } + /** + * No description + * @tags pulls + * @name PullsSubmitReview + * @summary Submit a review for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events + */ + export namespace PullsSubmitReview { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + /** review_id parameter */ + reviewId: number; + }; + export type RequestQuery = {}; + export type RequestBody = PullsSubmitReviewPayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsSubmitReviewData; + } + /** + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request. + * @tags pulls + * @name PullsUpdate + * @summary Update a pull request + * @request PATCH:/repos/{owner}/{repo}/pulls/{pull_number} + */ + export namespace PullsUpdate { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = PullsUpdatePayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsUpdateData; + } + /** + * @description Updates the pull request branch with the latest upstream changes by merging HEAD from the base branch into the pull request branch. + * @tags pulls + * @name PullsUpdateBranch + * @summary Update a pull request branch + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/update-branch + */ + export namespace PullsUpdateBranch { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = PullsUpdateBranchPayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsUpdateBranchData; + } + /** + * @description Update the review summary comment with new text. + * @tags pulls + * @name PullsUpdateReview + * @summary Update a review for a pull request + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} + */ + export namespace PullsUpdateReview { + export type RequestParams = { + owner: string; + pullNumber: number; + repo: string; + /** review_id parameter */ + reviewId: number; + }; + export type RequestQuery = {}; + export type RequestBody = PullsUpdateReviewPayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsUpdateReviewData; + } + /** + * @description Enables you to edit a review comment. + * @tags pulls + * @name PullsUpdateReviewComment + * @summary Update a review comment for a pull request + * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{comment_id} + */ + export namespace PullsUpdateReviewComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = PullsUpdateReviewCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = PullsUpdateReviewCommentData; + } + /** + * @description Create a reaction to a [commit comment](https://docs.github.com/rest/reference/repos#comments). A response with a \`Status: 200 OK\` means that you already added the reaction type to this commit comment. + * @tags reactions + * @name ReactionsCreateForCommitComment + * @summary Create reaction for a commit comment + * @request POST:/repos/{owner}/{repo}/comments/{comment_id}/reactions + */ + export namespace ReactionsCreateForCommitComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReactionsCreateForCommitCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsCreateForCommitCommentData; + } + /** + * @description Create a reaction to an [issue](https://docs.github.com/rest/reference/issues/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this issue. + * @tags reactions + * @name ReactionsCreateForIssue + * @summary Create reaction for an issue + * @request POST:/repos/{owner}/{repo}/issues/{issue_number}/reactions + */ + export namespace ReactionsCreateForIssue { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReactionsCreateForIssuePayload; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsCreateForIssueData; + } + /** + * @description Create a reaction to an [issue comment](https://docs.github.com/rest/reference/issues#comments). A response with a \`Status: 200 OK\` means that you already added the reaction type to this issue comment. + * @tags reactions + * @name ReactionsCreateForIssueComment + * @summary Create reaction for an issue comment + * @request POST:/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions + */ + export namespace ReactionsCreateForIssueComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReactionsCreateForIssueCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsCreateForIssueCommentData; + } + /** + * @description Create a reaction to a [pull request review comment](https://docs.github.com/rest/reference/pulls#comments). A response with a \`Status: 200 OK\` means that you already added the reaction type to this pull request review comment. + * @tags reactions + * @name ReactionsCreateForPullRequestReviewComment + * @summary Create reaction for a pull request review comment + * @request POST:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions + */ + export namespace ReactionsCreateForPullRequestReviewComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReactionsCreateForPullRequestReviewCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsCreateForPullRequestReviewCommentData; + } + /** + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE /repositories/:repository_id/comments/:comment_id/reactions/:reaction_id\`. Delete a reaction to a [commit comment](https://docs.github.com/rest/reference/repos#comments). + * @tags reactions + * @name ReactionsDeleteForCommitComment + * @summary Delete a commit comment reaction + * @request DELETE:/repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} + */ + export namespace ReactionsDeleteForCommitComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + reactionId: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsDeleteForCommitCommentData; + } + /** + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE /repositories/:repository_id/issues/:issue_number/reactions/:reaction_id\`. Delete a reaction to an [issue](https://docs.github.com/rest/reference/issues/). + * @tags reactions + * @name ReactionsDeleteForIssue + * @summary Delete an issue reaction + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} + */ + export namespace ReactionsDeleteForIssue { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + reactionId: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsDeleteForIssueData; + } + /** + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE delete /repositories/:repository_id/issues/comments/:comment_id/reactions/:reaction_id\`. Delete a reaction to an [issue comment](https://docs.github.com/rest/reference/issues#comments). + * @tags reactions + * @name ReactionsDeleteForIssueComment + * @summary Delete an issue comment reaction + * @request DELETE:/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} + */ + export namespace ReactionsDeleteForIssueComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + reactionId: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsDeleteForIssueCommentData; + } + /** + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE /repositories/:repository_id/pulls/comments/:comment_id/reactions/:reaction_id.\` Delete a reaction to a [pull request review comment](https://docs.github.com/rest/reference/pulls#review-comments). + * @tags reactions + * @name ReactionsDeleteForPullRequestComment + * @summary Delete a pull request comment reaction + * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} + */ + export namespace ReactionsDeleteForPullRequestComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + reactionId: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsDeleteForPullRequestCommentData; + } + /** + * @description List the reactions to a [commit comment](https://docs.github.com/rest/reference/repos#comments). + * @tags reactions + * @name ReactionsListForCommitComment + * @summary List reactions for a commit comment + * @request GET:/repos/{owner}/{repo}/comments/{comment_id}/reactions + */ + export namespace ReactionsListForCommitComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a commit comment. */ + content?: ReactionsListForCommitCommentParams1ContentEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsListForCommitCommentData; + } + /** + * @description List the reactions to an [issue](https://docs.github.com/rest/reference/issues). + * @tags reactions + * @name ReactionsListForIssue + * @summary List reactions for an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/reactions + */ + export namespace ReactionsListForIssue { + export type RequestParams = { + /** issue_number parameter */ + issueNumber: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue. */ + content?: ReactionsListForIssueParams1ContentEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsListForIssueData; + } + /** + * @description List the reactions to an [issue comment](https://docs.github.com/rest/reference/issues#comments). + * @tags reactions + * @name ReactionsListForIssueComment + * @summary List reactions for an issue comment + * @request GET:/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions + */ + export namespace ReactionsListForIssueComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue comment. */ + content?: ReactionsListForIssueCommentParams1ContentEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsListForIssueCommentData; + } + /** + * @description List the reactions to a [pull request review comment](https://docs.github.com/rest/reference/pulls#review-comments). + * @tags reactions + * @name ReactionsListForPullRequestReviewComment + * @summary List reactions for a pull request review comment + * @request GET:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions + */ + export namespace ReactionsListForPullRequestReviewComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a pull request review comment. */ + content?: ReactionsListForPullRequestReviewCommentParams1ContentEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsListForPullRequestReviewCommentData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified apps push access for this branch. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | The GitHub Apps that have push access to this branch. Use the app's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @tags repos + * @name ReposAddAppAccessRestrictions + * @summary Add app access restrictions + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + */ + export namespace ReposAddAppAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposAddAppAccessRestrictionsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposAddAppAccessRestrictionsData; + } + /** + * @description This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. For more information the permission levels, see "[Repository permission levels for an organization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)". Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." The invitee will receive a notification that they have been invited to the repository, which they must accept or decline. They may do this via the notifications page, the email they receive, or by using the [repository invitations API endpoints](https://docs.github.com/rest/reference/repos#invitations). **Rate limits** To prevent abuse, you are limited to sending 50 invitations to a repository per 24 hour period. Note there is no limit if you are inviting organization members to an organization repository. + * @tags repos + * @name ReposAddCollaborator + * @summary Add a repository collaborator + * @request PUT:/repos/{owner}/{repo}/collaborators/{username} + */ + export namespace ReposAddCollaborator { + export type RequestParams = { + owner: string; + repo: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposAddCollaboratorPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposAddCollaboratorData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposAddStatusCheckContexts + * @summary Add status check contexts + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + */ + export namespace ReposAddStatusCheckContexts { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposAddStatusCheckContextsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposAddStatusCheckContextsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified teams push access for this branch. You can also give push access to child teams. | Type | Description | | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | \`array\` | The teams that can have push access. Use the team's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @tags repos + * @name ReposAddTeamAccessRestrictions + * @summary Add team access restrictions + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + */ + export namespace ReposAddTeamAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposAddTeamAccessRestrictionsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposAddTeamAccessRestrictionsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified people push access for this branch. | Type | Description | | ------- | ----------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Usernames for people who can have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @tags repos + * @name ReposAddUserAccessRestrictions + * @summary Add user access restrictions + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + */ + export namespace ReposAddUserAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposAddUserAccessRestrictionsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposAddUserAccessRestrictionsData; + } + /** + * @description For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. Team members will include the members of child teams. + * @tags repos + * @name ReposCheckCollaborator + * @summary Check if a user is a repository collaborator + * @request GET:/repos/{owner}/{repo}/collaborators/{username} + */ + export namespace ReposCheckCollaborator { + export type RequestParams = { + owner: string; + repo: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposCheckCollaboratorData; + } + /** + * @description Shows whether dependency alerts are enabled or disabled for a repository. The authenticated user must have admin access to the repository. For more information, see "[About security alerts for vulnerable dependencies](https://help.github.com/en/articles/about-security-alerts-for-vulnerable-dependencies)". + * @tags repos + * @name ReposCheckVulnerabilityAlerts + * @summary Check if vulnerability alerts are enabled for a repository + * @request GET:/repos/{owner}/{repo}/vulnerability-alerts + */ + export namespace ReposCheckVulnerabilityAlerts { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposCheckVulnerabilityAlertsData; + } + /** + * @description Both \`:base\` and \`:head\` must be branch names in \`:repo\`. To compare branches across other repositories in the same network as \`:repo\`, use the format \`:branch\`. The response from the API is equivalent to running the \`git log base..head\` command; however, commits are returned in chronological order. Pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats. The response also includes details on the files that were changed between the two commits. This includes the status of the change (for example, if a file was added, removed, modified, or renamed), and details of the change itself. For example, files with a \`renamed\` status have a \`previous_filename\` field showing the previous filename of the file, and files with a \`modified\` status have a \`patch\` field showing the changes made to the file. **Working with large comparisons** The response will include a comparison of up to 250 commits. If you are working with a larger commit range, you can use the [List commits](https://docs.github.com/rest/reference/repos#list-commits) to enumerate all commits in the range. For comparisons with extremely large diffs, you may receive an error response indicating that the diff took too long to generate. You can typically resolve this error by using a smaller commit range. **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * @tags repos + * @name ReposCompareCommits + * @summary Compare two commits + * @request GET:/repos/{owner}/{repo}/compare/{base}...{head} + */ + export namespace ReposCompareCommits { + export type RequestParams = { + base: string; + head: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposCompareCommitsData; + } + /** + * @description Create a comment for a commit using its \`:commit_sha\`. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @tags repos + * @name ReposCreateCommitComment + * @summary Create a commit comment + * @request POST:/repos/{owner}/{repo}/commits/{commit_sha}/comments + */ + export namespace ReposCreateCommitComment { + export type RequestParams = { + /** commit_sha parameter */ + commitSha: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateCommitCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateCommitCommentData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits. + * @tags repos + * @name ReposCreateCommitSignatureProtection + * @summary Create commit signature protection + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + */ + export namespace ReposCreateCommitSignatureProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateCommitSignatureProtectionData; + } + /** + * @description Users with push access in a repository can create commit statuses for a given SHA. Note: there is a limit of 1000 statuses per \`sha\` and \`context\` within a repository. Attempts to create more than 1000 statuses will result in a validation error. + * @tags repos + * @name ReposCreateCommitStatus + * @summary Create a commit status + * @request POST:/repos/{owner}/{repo}/statuses/{sha} + */ + export namespace ReposCreateCommitStatus { + export type RequestParams = { + owner: string; + repo: string; + sha: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateCommitStatusPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateCommitStatusData; + } + /** + * @description You can create a read-only deploy key. + * @tags repos + * @name ReposCreateDeployKey + * @summary Create a deploy key + * @request POST:/repos/{owner}/{repo}/keys + */ + export namespace ReposCreateDeployKey { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateDeployKeyPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateDeployKeyData; + } + /** + * @description Deployments offer a few configurable parameters with certain defaults. The \`ref\` parameter can be any named branch, tag, or SHA. At GitHub we often deploy branches and verify them before we merge a pull request. The \`environment\` parameter allows deployments to be issued to different runtime environments. Teams often have multiple environments for verifying their applications, such as \`production\`, \`staging\`, and \`qa\`. This parameter makes it easier to track which environments have requested deployments. The default environment is \`production\`. The \`auto_merge\` parameter is used to ensure that the requested ref is not behind the repository's default branch. If the ref _is_ behind the default branch for the repository, we will attempt to merge it for you. If the merge succeeds, the API will return a successful merge commit. If merge conflicts prevent the merge from succeeding, the API will return a failure response. By default, [commit statuses](https://docs.github.com/rest/reference/repos#statuses) for every submitted context must be in a \`success\` state. The \`required_contexts\` parameter allows you to specify a subset of contexts that must be \`success\`, or to specify contexts that have not yet been submitted. You are not required to use commit statuses to deploy. If you do not require any contexts or create any commit statuses, the deployment will always succeed. The \`payload\` parameter is available for any extra information that a deployment system might need. It is a JSON text field that will be passed on when a deployment event is dispatched. The \`task\` parameter is used by the deployment system to allow different execution paths. In the web world this might be \`deploy:migrations\` to run schema changes on the system. In the compiled world this could be a flag to compile an application with debugging enabled. Users with \`repo\` or \`repo_deployment\` scopes can create a deployment for a given ref. #### Merged branch response You will see this response when GitHub automatically merges the base branch into the topic branch instead of creating a deployment. This auto-merge happens when: * Auto-merge option is enabled in the repository * Topic branch does not include the latest changes on the base branch, which is \`master\` in the response example * There are no merge conflicts If there are no new commits in the base branch, a new request to create a deployment should give a successful response. #### Merge conflict response This error happens when the \`auto_merge\` option is enabled and when the default branch (in this case \`master\`), can't be merged into the branch that's being deployed (in this case \`topic-branch\`), due to merge conflicts. #### Failed commit status checks This error happens when the \`required_contexts\` parameter indicates that one or more contexts need to have a \`success\` status for the commit to be deployed, but one or more of the required contexts do not have a state of \`success\`. + * @tags repos + * @name ReposCreateDeployment + * @summary Create a deployment + * @request POST:/repos/{owner}/{repo}/deployments + */ + export namespace ReposCreateDeployment { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateDeploymentPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateDeploymentData; + } + /** + * @description Users with \`push\` access can create deployment statuses for a given deployment. GitHub Apps require \`read & write\` access to "Deployments" and \`read-only\` access to "Repo contents" (for private repos). OAuth Apps require the \`repo_deployment\` scope. + * @tags repos + * @name ReposCreateDeploymentStatus + * @summary Create a deployment status + * @request POST:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses + */ + export namespace ReposCreateDeploymentStatus { + export type RequestParams = { + /** deployment_id parameter */ + deploymentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateDeploymentStatusPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateDeploymentStatusData; + } + /** + * @description You can use this endpoint to trigger a webhook event called \`repository_dispatch\` when you want activity that happens outside of GitHub to trigger a GitHub Actions workflow or GitHub App webhook. You must configure your GitHub Actions workflow or GitHub App to run when the \`repository_dispatch\` event occurs. For an example \`repository_dispatch\` webhook payload, see "[RepositoryDispatchEvent](https://docs.github.com/webhooks/event-payloads/#repository_dispatch)." The \`client_payload\` parameter is available for any extra information that your workflow might need. This parameter is a JSON payload that will be passed on when the webhook event is dispatched. For example, the \`client_payload\` can include a message that a user would like to send using a GitHub Actions workflow. Or the \`client_payload\` can be used as a test to debug your workflow. This endpoint requires write access to the repository by providing either: - Personal access tokens with \`repo\` scope. For more information, see "[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line)" in the GitHub Help documentation. - GitHub Apps with both \`metadata:read\` and \`contents:read&write\` permissions. This input example shows how you can use the \`client_payload\` as a test to debug your workflow. + * @tags repos + * @name ReposCreateDispatchEvent + * @summary Create a repository dispatch event + * @request POST:/repos/{owner}/{repo}/dispatches + */ + export namespace ReposCreateDispatchEvent { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateDispatchEventPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateDispatchEventData; + } + /** + * @description Create a fork for the authenticated user. **Note**: Forking a Repository happens asynchronously. You may have to wait a short period of time before you can access the git objects. If this takes longer than 5 minutes, be sure to contact [GitHub Support](https://support.github.com/contact) or [GitHub Premium Support](https://premium.githubsupport.com). + * @tags repos + * @name ReposCreateFork + * @summary Create a fork + * @request POST:/repos/{owner}/{repo}/forks + */ + export namespace ReposCreateFork { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateForkPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateForkData; + } + /** + * @description Creates a new file or replaces an existing file in a repository. + * @tags repos + * @name ReposCreateOrUpdateFileContents + * @summary Create or update file contents + * @request PUT:/repos/{owner}/{repo}/contents/{path} + */ + export namespace ReposCreateOrUpdateFileContents { + export type RequestParams = { + owner: string; + /** path+ parameter */ + path: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateOrUpdateFileContentsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateOrUpdateFileContentsData; + } + /** + * @description Configures a GitHub Pages site. For more information, see "[About GitHub Pages](/github/working-with-github-pages/about-github-pages)." + * @tags repos + * @name ReposCreatePagesSite + * @summary Create a GitHub Pages site + * @request POST:/repos/{owner}/{repo}/pages + */ + export namespace ReposCreatePagesSite { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreatePagesSitePayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreatePagesSiteData; + } + /** + * @description Users with push access to the repository can create a release. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @tags repos + * @name ReposCreateRelease + * @summary Create a release + * @request POST:/repos/{owner}/{repo}/releases + */ + export namespace ReposCreateRelease { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateReleasePayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateReleaseData; + } + /** + * @description Creates a new repository using a repository template. Use the \`template_owner\` and \`template_repo\` route parameters to specify the repository to use as the template. The authenticated user must own or be a member of an organization that owns the repository. To check if a repository is available to use as a template, get the repository's information using the [Get a repository](https://docs.github.com/rest/reference/repos#get-a-repository) endpoint and check that the \`is_template\` key is \`true\`. **OAuth scope requirements** When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include: * \`public_repo\` scope or \`repo\` scope to create a public repository * \`repo\` scope to create a private repository + * @tags repos + * @name ReposCreateUsingTemplate + * @summary Create a repository using a template + * @request POST:/repos/{template_owner}/{template_repo}/generate + */ + export namespace ReposCreateUsingTemplate { + export type RequestParams = { + templateOwner: string; + templateRepo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateUsingTemplatePayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateUsingTemplateData; + } + /** + * @description Repositories can have multiple webhooks installed. Each webhook should have a unique \`config\`. Multiple webhooks can share the same \`config\` as long as those webhooks do not have any \`events\` that overlap. + * @tags repos + * @name ReposCreateWebhook + * @summary Create a repository webhook + * @request POST:/repos/{owner}/{repo}/hooks + */ + export namespace ReposCreateWebhook { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposCreateWebhookPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateWebhookData; + } + /** + * @description Deleting a repository requires admin access. If OAuth is used, the \`delete_repo\` scope is required. If an organization owner has configured the organization to prevent members from deleting organization-owned repositories, you will get a \`403 Forbidden\` response. + * @tags repos + * @name ReposDelete + * @summary Delete a repository + * @request DELETE:/repos/{owner}/{repo} + */ + export namespace ReposDelete { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Disables the ability to restrict who can push to this branch. + * @tags repos + * @name ReposDeleteAccessRestrictions + * @summary Delete access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions + */ + export namespace ReposDeleteAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteAccessRestrictionsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removing admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled. + * @tags repos + * @name ReposDeleteAdminBranchProtection + * @summary Delete admin branch protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + */ + export namespace ReposDeleteAdminBranchProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteAdminBranchProtectionData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposDeleteBranchProtection + * @summary Delete branch protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection + */ + export namespace ReposDeleteBranchProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteBranchProtectionData; + } + /** + * No description + * @tags repos + * @name ReposDeleteCommitComment + * @summary Delete a commit comment + * @request DELETE:/repos/{owner}/{repo}/comments/{comment_id} + */ + export namespace ReposDeleteCommitComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteCommitCommentData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to disable required signed commits on a branch. You must enable branch protection to require signed commits. + * @tags repos + * @name ReposDeleteCommitSignatureProtection + * @summary Delete commit signature protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + */ + export namespace ReposDeleteCommitSignatureProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteCommitSignatureProtectionData; + } + /** + * @description Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead. + * @tags repos + * @name ReposDeleteDeployKey + * @summary Delete a deploy key + * @request DELETE:/repos/{owner}/{repo}/keys/{key_id} + */ + export namespace ReposDeleteDeployKey { + export type RequestParams = { + /** key_id parameter */ + keyId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteDeployKeyData; + } + /** + * @description To ensure there can always be an active deployment, you can only delete an _inactive_ deployment. Anyone with \`repo\` or \`repo_deployment\` scopes can delete an inactive deployment. To set a deployment as inactive, you must: * Create a new deployment that is active so that the system has a record of the current state, then delete the previously active deployment. * Mark the active deployment as inactive by adding any non-successful deployment status. For more information, see "[Create a deployment](https://docs.github.com/rest/reference/repos/#create-a-deployment)" and "[Create a deployment status](https://docs.github.com/rest/reference/repos#create-a-deployment-status)." + * @tags repos + * @name ReposDeleteDeployment + * @summary Delete a deployment + * @request DELETE:/repos/{owner}/{repo}/deployments/{deployment_id} + */ + export namespace ReposDeleteDeployment { + export type RequestParams = { + /** deployment_id parameter */ + deploymentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteDeploymentData; + } + /** + * @description Deletes a file in a repository. You can provide an additional \`committer\` parameter, which is an object containing information about the committer. Or, you can provide an \`author\` parameter, which is an object containing information about the author. The \`author\` section is optional and is filled in with the \`committer\` information if omitted. If the \`committer\` information is omitted, the authenticated user's information is used. You must provide values for both \`name\` and \`email\`, whether you choose to use \`author\` or \`committer\`. Otherwise, you'll receive a \`422\` status code. + * @tags repos + * @name ReposDeleteFile + * @summary Delete a file + * @request DELETE:/repos/{owner}/{repo}/contents/{path} + */ + export namespace ReposDeleteFile { + export type RequestParams = { + owner: string; + /** path+ parameter */ + path: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposDeleteFilePayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteFileData; + } + /** + * No description + * @tags repos + * @name ReposDeleteInvitation + * @summary Delete a repository invitation + * @request DELETE:/repos/{owner}/{repo}/invitations/{invitation_id} + */ + export namespace ReposDeleteInvitation { + export type RequestParams = { + /** invitation_id parameter */ + invitationId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteInvitationData; + } + /** + * No description + * @tags repos + * @name ReposDeletePagesSite + * @summary Delete a GitHub Pages site + * @request DELETE:/repos/{owner}/{repo}/pages + */ + export namespace ReposDeletePagesSite { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeletePagesSiteData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposDeletePullRequestReviewProtection + * @summary Delete pull request review protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + */ + export namespace ReposDeletePullRequestReviewProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeletePullRequestReviewProtectionData; + } + /** + * @description Users with push access to the repository can delete a release. + * @tags repos + * @name ReposDeleteRelease + * @summary Delete a release + * @request DELETE:/repos/{owner}/{repo}/releases/{release_id} + */ + export namespace ReposDeleteRelease { + export type RequestParams = { + owner: string; + /** release_id parameter */ + releaseId: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteReleaseData; + } + /** + * No description + * @tags repos + * @name ReposDeleteReleaseAsset + * @summary Delete a release asset + * @request DELETE:/repos/{owner}/{repo}/releases/assets/{asset_id} + */ + export namespace ReposDeleteReleaseAsset { + export type RequestParams = { + /** asset_id parameter */ + assetId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteReleaseAssetData; + } + /** + * No description + * @tags repos + * @name ReposDeleteWebhook + * @summary Delete a repository webhook + * @request DELETE:/repos/{owner}/{repo}/hooks/{hook_id} + */ + export namespace ReposDeleteWebhook { + export type RequestParams = { + hookId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeleteWebhookData; + } + /** + * @description Disables automated security fixes for a repository. The authenticated user must have admin access to the repository. For more information, see "[Configuring automated security fixes](https://help.github.com/en/articles/configuring-automated-security-fixes)". + * @tags repos + * @name ReposDisableAutomatedSecurityFixes + * @summary Disable automated security fixes + * @request DELETE:/repos/{owner}/{repo}/automated-security-fixes + */ + export namespace ReposDisableAutomatedSecurityFixes { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDisableAutomatedSecurityFixesData; + } + /** + * @description Disables dependency alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "[About security alerts for vulnerable dependencies](https://help.github.com/en/articles/about-security-alerts-for-vulnerable-dependencies)". + * @tags repos + * @name ReposDisableVulnerabilityAlerts + * @summary Disable vulnerability alerts + * @request DELETE:/repos/{owner}/{repo}/vulnerability-alerts + */ + export namespace ReposDisableVulnerabilityAlerts { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDisableVulnerabilityAlertsData; + } + /** + * @description Gets a redirect URL to download a tar archive for a repository. If you omit \`:ref\`, the repository’s default branch (usually \`master\`) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use the \`Location\` header to make a second \`GET\` request. **Note**: For private repositories, these links are temporary and expire after five minutes. + * @tags repos + * @name ReposDownloadTarballArchive + * @summary Download a repository archive (tar) + * @request GET:/repos/{owner}/{repo}/tarball/{ref} + */ + export namespace ReposDownloadTarballArchive { + export type RequestParams = { + owner: string; + ref: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description Gets a redirect URL to download a zip archive for a repository. If you omit \`:ref\`, the repository’s default branch (usually \`master\`) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use the \`Location\` header to make a second \`GET\` request. **Note**: For private repositories, these links are temporary and expire after five minutes. + * @tags repos + * @name ReposDownloadZipballArchive + * @summary Download a repository archive (zip) + * @request GET:/repos/{owner}/{repo}/zipball/{ref} + */ + export namespace ReposDownloadZipballArchive { + export type RequestParams = { + owner: string; + ref: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description Enables automated security fixes for a repository. The authenticated user must have admin access to the repository. For more information, see "[Configuring automated security fixes](https://help.github.com/en/articles/configuring-automated-security-fixes)". + * @tags repos + * @name ReposEnableAutomatedSecurityFixes + * @summary Enable automated security fixes + * @request PUT:/repos/{owner}/{repo}/automated-security-fixes + */ + export namespace ReposEnableAutomatedSecurityFixes { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposEnableAutomatedSecurityFixesData; + } + /** + * @description Enables dependency alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "[About security alerts for vulnerable dependencies](https://help.github.com/en/articles/about-security-alerts-for-vulnerable-dependencies)". + * @tags repos + * @name ReposEnableVulnerabilityAlerts + * @summary Enable vulnerability alerts + * @request PUT:/repos/{owner}/{repo}/vulnerability-alerts + */ + export namespace ReposEnableVulnerabilityAlerts { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposEnableVulnerabilityAlertsData; + } + /** + * @description When you pass the \`scarlet-witch-preview\` media type, requests to get a repository will also return the repository's code of conduct if it can be detected from the repository's code of conduct file. The \`parent\` and \`source\` objects are present when the repository is a fork. \`parent\` is the repository this repository was forked from, \`source\` is the ultimate source for the network. + * @tags repos + * @name ReposGet + * @summary Get a repository + * @request GET:/repos/{owner}/{repo} + */ + export namespace ReposGet { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists who has access to this protected branch. **Note**: Users, apps, and teams \`restrictions\` are only available for organization-owned repositories. + * @tags repos + * @name ReposGetAccessRestrictions + * @summary Get access restrictions + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions + */ + export namespace ReposGetAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetAccessRestrictionsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposGetAdminBranchProtection + * @summary Get admin branch protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + */ + export namespace ReposGetAdminBranchProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetAdminBranchProtectionData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposGetAllStatusCheckContexts + * @summary Get all status check contexts + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + */ + export namespace ReposGetAllStatusCheckContexts { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetAllStatusCheckContextsData; + } + /** + * No description + * @tags repos + * @name ReposGetAllTopics + * @summary Get all repository topics + * @request GET:/repos/{owner}/{repo}/topics + */ + export namespace ReposGetAllTopics { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetAllTopicsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists the GitHub Apps that have push access to this branch. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. + * @tags repos + * @name ReposGetAppsWithAccessToProtectedBranch + * @summary Get apps with access to the protected branch + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + */ + export namespace ReposGetAppsWithAccessToProtectedBranch { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetAppsWithAccessToProtectedBranchData; + } + /** + * No description + * @tags repos + * @name ReposGetBranch + * @summary Get a branch + * @request GET:/repos/{owner}/{repo}/branches/{branch} + */ + export namespace ReposGetBranch { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetBranchData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposGetBranchProtection + * @summary Get branch protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection + */ + export namespace ReposGetBranchProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetBranchProtectionData; + } + /** + * @description Get the total number of clones and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday. + * @tags repos + * @name ReposGetClones + * @summary Get repository clones + * @request GET:/repos/{owner}/{repo}/traffic/clones + */ + export namespace ReposGetClones { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Must be one of: \`day\`, \`week\`. + * @default "day" + */ + per?: ReposGetClonesParams1PerEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetClonesData; + } + /** + * @description Returns a weekly aggregate of the number of additions and deletions pushed to a repository. + * @tags repos + * @name ReposGetCodeFrequencyStats + * @summary Get the weekly commit activity + * @request GET:/repos/{owner}/{repo}/stats/code_frequency + */ + export namespace ReposGetCodeFrequencyStats { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetCodeFrequencyStatsData; + } + /** + * @description Checks the repository permission of a collaborator. The possible repository permissions are \`admin\`, \`write\`, \`read\`, and \`none\`. + * @tags repos + * @name ReposGetCollaboratorPermissionLevel + * @summary Get repository permissions for a user + * @request GET:/repos/{owner}/{repo}/collaborators/{username}/permission + */ + export namespace ReposGetCollaboratorPermissionLevel { + export type RequestParams = { + owner: string; + repo: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetCollaboratorPermissionLevelData; + } + /** + * @description Users with pull access in a repository can access a combined view of commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name. The most recent status for each context is returned, up to 100. This field [paginates](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination) if there are over 100 contexts. Additionally, a combined \`state\` is returned. The \`state\` is one of: * **failure** if any of the contexts report as \`error\` or \`failure\` * **pending** if there are no statuses or a context is \`pending\` * **success** if the latest status for all contexts is \`success\` + * @tags repos + * @name ReposGetCombinedStatusForRef + * @summary Get the combined status for a specific reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/status + */ + export namespace ReposGetCombinedStatusForRef { + export type RequestParams = { + owner: string; + /** ref+ parameter */ + ref: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetCombinedStatusForRefData; + } + /** + * @description Returns the contents of a single commit reference. You must have \`read\` access for the repository to use this endpoint. **Note:** If there are more than 300 files in the commit diff, the response will include pagination link headers for the remaining files, up to a limit of 3000 files. Each page contains the static commit information, and the only changes are to the file listing. You can pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch \`diff\` and \`patch\` formats. Diffs with binary data will have no \`patch\` property. To return only the SHA-1 hash of the commit reference, you can provide the \`sha\` custom [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) in the \`Accept\` header. You can use this endpoint to check if a remote reference's SHA-1 hash is the same as your local reference's SHA-1 hash by providing the local SHA-1 reference as the ETag. **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * @tags repos + * @name ReposGetCommit + * @summary Get a commit + * @request GET:/repos/{owner}/{repo}/commits/{ref} + */ + export namespace ReposGetCommit { + export type RequestParams = { + owner: string; + /** ref+ parameter */ + ref: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetCommitData; + } + /** + * @description Returns the last year of commit activity grouped by week. The \`days\` array is a group of commits per day, starting on \`Sunday\`. + * @tags repos + * @name ReposGetCommitActivityStats + * @summary Get the last year of commit activity + * @request GET:/repos/{owner}/{repo}/stats/commit_activity + */ + export namespace ReposGetCommitActivityStats { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetCommitActivityStatsData; + } + /** + * No description + * @tags repos + * @name ReposGetCommitComment + * @summary Get a commit comment + * @request GET:/repos/{owner}/{repo}/comments/{comment_id} + */ + export namespace ReposGetCommitComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetCommitCommentData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to check whether a branch requires signed commits. An enabled status of \`true\` indicates you must sign commits on this branch. For more information, see [Signing commits with GPG](https://help.github.com/articles/signing-commits-with-gpg) in GitHub Help. **Note**: You must enable branch protection to require signed commits. + * @tags repos + * @name ReposGetCommitSignatureProtection + * @summary Get commit signature protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + */ + export namespace ReposGetCommitSignatureProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetCommitSignatureProtectionData; + } + /** + * @description This endpoint will return all community profile metrics, including an overall health score, repository description, the presence of documentation, detected code of conduct, detected license, and the presence of ISSUE\\_TEMPLATE, PULL\\_REQUEST\\_TEMPLATE, README, and CONTRIBUTING files. The \`health_percentage\` score is defined as a percentage of how many of these four documents are present: README, CONTRIBUTING, LICENSE, and CODE_OF_CONDUCT. For example, if all four documents are present, then the \`health_percentage\` is \`100\`. If only one is present, then the \`health_percentage\` is \`25\`. \`content_reports_enabled\` is only returned for organization-owned repositories. + * @tags repos + * @name ReposGetCommunityProfileMetrics + * @summary Get community profile metrics + * @request GET:/repos/{owner}/{repo}/community/profile + */ + export namespace ReposGetCommunityProfileMetrics { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetCommunityProfileMetricsData; + } + /** + * @description Gets the contents of a file or directory in a repository. Specify the file path or directory in \`:path\`. If you omit \`:path\`, you will receive the contents of the repository's root directory. See the description below regarding what the API response includes for directories. Files and symlinks support [a custom media type](https://docs.github.com/rest/reference/repos#custom-media-types) for retrieving the raw content or rendered HTML (when supported). All content types support [a custom media type](https://docs.github.com/rest/reference/repos#custom-media-types) to ensure the content is returned in a consistent object format. **Note**: * To get a repository's contents recursively, you can [recursively get the tree](https://docs.github.com/rest/reference/git#trees). * This API has an upper limit of 1,000 files for a directory. If you need to retrieve more files, use the [Git Trees API](https://docs.github.com/rest/reference/git#get-a-tree). * This API supports files up to 1 megabyte in size. #### If the content is a directory The response will be an array of objects, one object for each item in the directory. When listing the contents of a directory, submodules have their "type" specified as "file". Logically, the value _should_ be "submodule". This behavior exists in API v3 [for backwards compatibility purposes](https://git.io/v1YCW). In the next major version of the API, the type will be returned as "submodule". #### If the content is a symlink If the requested \`:path\` points to a symlink, and the symlink's target is a normal file in the repository, then the API responds with the content of the file (in the format shown in the example. Otherwise, the API responds with an object describing the symlink itself. #### If the content is a submodule The \`submodule_git_url\` identifies the location of the submodule repository, and the \`sha\` identifies a specific commit within the submodule repository. Git uses the given URL when cloning the submodule repository, and checks out the submodule at that specific commit. If the submodule repository is not hosted on github.com, the Git URLs (\`git_url\` and \`_links["git"]\`) and the github.com URLs (\`html_url\` and \`_links["html"]\`) will have null values. + * @tags repos + * @name ReposGetContent + * @summary Get repository content + * @request GET:/repos/{owner}/{repo}/contents/{path} + */ + export namespace ReposGetContent { + export type RequestParams = { + owner: string; + /** path+ parameter */ + path: string; + repo: string; + }; + export type RequestQuery = { + /** The name of the commit/branch/tag. Default: the repository’s default branch (usually \`master\`) */ + ref?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetContentData; + } + /** + * @description Returns the \`total\` number of commits authored by the contributor. In addition, the response includes a Weekly Hash (\`weeks\` array) with the following information: * \`w\` - Start of the week, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). * \`a\` - Number of additions * \`d\` - Number of deletions * \`c\` - Number of commits + * @tags repos + * @name ReposGetContributorsStats + * @summary Get all contributor commit activity + * @request GET:/repos/{owner}/{repo}/stats/contributors + */ + export namespace ReposGetContributorsStats { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetContributorsStatsData; + } + /** + * No description + * @tags repos + * @name ReposGetDeployKey + * @summary Get a deploy key + * @request GET:/repos/{owner}/{repo}/keys/{key_id} + */ + export namespace ReposGetDeployKey { + export type RequestParams = { + /** key_id parameter */ + keyId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetDeployKeyData; + } + /** + * No description + * @tags repos + * @name ReposGetDeployment + * @summary Get a deployment + * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id} + */ + export namespace ReposGetDeployment { + export type RequestParams = { + /** deployment_id parameter */ + deploymentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetDeploymentData; + } + /** + * @description Users with pull access can view a deployment status for a deployment: + * @tags repos + * @name ReposGetDeploymentStatus + * @summary Get a deployment status + * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id} + */ + export namespace ReposGetDeploymentStatus { + export type RequestParams = { + /** deployment_id parameter */ + deploymentId: number; + owner: string; + repo: string; + statusId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetDeploymentStatusData; + } + /** + * No description + * @tags repos + * @name ReposGetLatestPagesBuild + * @summary Get latest Pages build + * @request GET:/repos/{owner}/{repo}/pages/builds/latest + */ + export namespace ReposGetLatestPagesBuild { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetLatestPagesBuildData; + } + /** + * @description View the latest published full release for the repository. The latest release is the most recent non-prerelease, non-draft release, sorted by the \`created_at\` attribute. The \`created_at\` attribute is the date of the commit used for the release, and not the date when the release was drafted or published. + * @tags repos + * @name ReposGetLatestRelease + * @summary Get the latest release + * @request GET:/repos/{owner}/{repo}/releases/latest + */ + export namespace ReposGetLatestRelease { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetLatestReleaseData; + } + /** + * No description + * @tags repos + * @name ReposGetPages + * @summary Get a GitHub Pages site + * @request GET:/repos/{owner}/{repo}/pages + */ + export namespace ReposGetPages { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetPagesData; + } + /** + * No description + * @tags repos + * @name ReposGetPagesBuild + * @summary Get GitHub Pages build + * @request GET:/repos/{owner}/{repo}/pages/builds/{build_id} + */ + export namespace ReposGetPagesBuild { + export type RequestParams = { + buildId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetPagesBuildData; + } + /** + * @description Returns the total commit counts for the \`owner\` and total commit counts in \`all\`. \`all\` is everyone combined, including the \`owner\` in the last 52 weeks. If you'd like to get the commit counts for non-owners, you can subtract \`owner\` from \`all\`. The array order is oldest week (index 0) to most recent week. + * @tags repos + * @name ReposGetParticipationStats + * @summary Get the weekly commit count + * @request GET:/repos/{owner}/{repo}/stats/participation + */ + export namespace ReposGetParticipationStats { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetParticipationStatsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposGetPullRequestReviewProtection + * @summary Get pull request review protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + */ + export namespace ReposGetPullRequestReviewProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetPullRequestReviewProtectionData; + } + /** + * @description Each array contains the day number, hour number, and number of commits: * \`0-6\`: Sunday - Saturday * \`0-23\`: Hour of day * Number of commits For example, \`[2, 14, 25]\` indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits. + * @tags repos + * @name ReposGetPunchCardStats + * @summary Get the hourly commit count for each day + * @request GET:/repos/{owner}/{repo}/stats/punch_card + */ + export namespace ReposGetPunchCardStats { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetPunchCardStatsData; + } + /** + * @description Gets the preferred README for a repository. READMEs support [custom media types](https://docs.github.com/rest/reference/repos#custom-media-types) for retrieving the raw content or rendered HTML. + * @tags repos + * @name ReposGetReadme + * @summary Get a repository README + * @request GET:/repos/{owner}/{repo}/readme + */ + export namespace ReposGetReadme { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** The name of the commit/branch/tag. Default: the repository’s default branch (usually \`master\`) */ + ref?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetReadmeData; + } + /** + * @description **Note:** This returns an \`upload_url\` key corresponding to the endpoint for uploading release assets. This key is a [hypermedia resource](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia). + * @tags repos + * @name ReposGetRelease + * @summary Get a release + * @request GET:/repos/{owner}/{repo}/releases/{release_id} + */ + export namespace ReposGetRelease { + export type RequestParams = { + owner: string; + /** release_id parameter */ + releaseId: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetReleaseData; + } + /** + * @description To download the asset's binary content, set the \`Accept\` header of the request to [\`application/octet-stream\`](https://docs.github.com/rest/overview/media-types). The API will either redirect the client to the location, or stream it directly if possible. API clients should handle both a \`200\` or \`302\` response. + * @tags repos + * @name ReposGetReleaseAsset + * @summary Get a release asset + * @request GET:/repos/{owner}/{repo}/releases/assets/{asset_id} + */ + export namespace ReposGetReleaseAsset { + export type RequestParams = { + /** asset_id parameter */ + assetId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetReleaseAssetData; + } + /** + * @description Get a published release with the specified tag. + * @tags repos + * @name ReposGetReleaseByTag + * @summary Get a release by tag name + * @request GET:/repos/{owner}/{repo}/releases/tags/{tag} + */ + export namespace ReposGetReleaseByTag { + export type RequestParams = { + owner: string; + repo: string; + /** tag+ parameter */ + tag: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetReleaseByTagData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposGetStatusChecksProtection + * @summary Get status checks protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + */ + export namespace ReposGetStatusChecksProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetStatusChecksProtectionData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists the teams who have push access to this branch. The list includes child teams. + * @tags repos + * @name ReposGetTeamsWithAccessToProtectedBranch + * @summary Get teams with access to the protected branch + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + */ + export namespace ReposGetTeamsWithAccessToProtectedBranch { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetTeamsWithAccessToProtectedBranchData; + } + /** + * @description Get the top 10 popular contents over the last 14 days. + * @tags repos + * @name ReposGetTopPaths + * @summary Get top referral paths + * @request GET:/repos/{owner}/{repo}/traffic/popular/paths + */ + export namespace ReposGetTopPaths { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetTopPathsData; + } + /** + * @description Get the top 10 referrers over the last 14 days. + * @tags repos + * @name ReposGetTopReferrers + * @summary Get top referral sources + * @request GET:/repos/{owner}/{repo}/traffic/popular/referrers + */ + export namespace ReposGetTopReferrers { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetTopReferrersData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists the people who have push access to this branch. + * @tags repos + * @name ReposGetUsersWithAccessToProtectedBranch + * @summary Get users with access to the protected branch + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + */ + export namespace ReposGetUsersWithAccessToProtectedBranch { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetUsersWithAccessToProtectedBranchData; + } + /** + * @description Get the total number of views and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday. + * @tags repos + * @name ReposGetViews + * @summary Get page views + * @request GET:/repos/{owner}/{repo}/traffic/views + */ + export namespace ReposGetViews { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Must be one of: \`day\`, \`week\`. + * @default "day" + */ + per?: ReposGetViewsParams1PerEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetViewsData; + } + /** + * @description Returns a webhook configured in a repository. To get only the webhook \`config\` properties, see "[Get a webhook configuration for a repository](/rest/reference/repos#get-a-webhook-configuration-for-a-repository)." + * @tags repos + * @name ReposGetWebhook + * @summary Get a repository webhook + * @request GET:/repos/{owner}/{repo}/hooks/{hook_id} + */ + export namespace ReposGetWebhook { + export type RequestParams = { + hookId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetWebhookData; + } + /** + * @description Returns the webhook configuration for a repository. To get more information about the webhook, including the \`active\` state and \`events\`, use "[Get a repository webhook](/rest/reference/orgs#get-a-repository-webhook)." Access tokens must have the \`read:repo_hook\` or \`repo\` scope, and GitHub Apps must have the \`repository_hooks:read\` permission. + * @tags repos + * @name ReposGetWebhookConfigForRepo + * @summary Get a webhook configuration for a repository + * @request GET:/repos/{owner}/{repo}/hooks/{hook_id}/config + */ + export namespace ReposGetWebhookConfigForRepo { + export type RequestParams = { + hookId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposGetWebhookConfigForRepoData; + } + /** + * No description + * @tags repos + * @name ReposListBranches + * @summary List branches + * @request GET:/repos/{owner}/{repo}/branches + */ + export namespace ReposListBranches { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Setting to \`true\` returns only protected branches. When set to \`false\`, only unprotected branches are returned. Omitting this parameter returns all branches. */ + protected?: boolean; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListBranchesData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Returns all branches where the given commit SHA is the HEAD, or latest commit for the branch. + * @tags repos + * @name ReposListBranchesForHeadCommit + * @summary List branches for HEAD commit + * @request GET:/repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head + */ + export namespace ReposListBranchesForHeadCommit { + export type RequestParams = { + /** commit_sha parameter */ + commitSha: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListBranchesForHeadCommitData; + } + /** + * @description For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. Team members will include the members of child teams. + * @tags repos + * @name ReposListCollaborators + * @summary List repository collaborators + * @request GET:/repos/{owner}/{repo}/collaborators + */ + export namespace ReposListCollaborators { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Filter collaborators returned by their affiliation. Can be one of: + * \\* \`outside\`: All outside collaborators of an organization-owned repository. + * \\* \`direct\`: All collaborators with permissions to an organization-owned repository, regardless of organization membership status. + * \\* \`all\`: All collaborators the authenticated user can see. + * @default "all" + */ + affiliation?: ReposListCollaboratorsParams1AffiliationEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListCollaboratorsData; + } + /** + * @description Use the \`:commit_sha\` to specify the commit that will have its comments listed. + * @tags repos + * @name ReposListCommentsForCommit + * @summary List commit comments + * @request GET:/repos/{owner}/{repo}/commits/{commit_sha}/comments + */ + export namespace ReposListCommentsForCommit { + export type RequestParams = { + /** commit_sha parameter */ + commitSha: string; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListCommentsForCommitData; + } + /** + * @description Commit Comments use [these custom media types](https://docs.github.com/rest/reference/repos#custom-media-types). You can read more about the use of media types in the API [here](https://docs.github.com/rest/overview/media-types/). Comments are ordered by ascending ID. + * @tags repos + * @name ReposListCommitCommentsForRepo + * @summary List commit comments for a repository + * @request GET:/repos/{owner}/{repo}/comments + */ + export namespace ReposListCommitCommentsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListCommitCommentsForRepoData; + } + /** + * @description **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * @tags repos + * @name ReposListCommits + * @summary List commits + * @request GET:/repos/{owner}/{repo}/commits + */ + export namespace ReposListCommits { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** GitHub login or email address by which to filter by commit author. */ + author?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** Only commits containing this file path will be returned. */ + path?: string; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** SHA or branch to start listing commits from. Default: the repository’s default branch (usually \`master\`). */ + sha?: string; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** Only commits before this date will be returned. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + until?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListCommitsData; + } + /** + * @description Users with pull access in a repository can view commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name. Statuses are returned in reverse chronological order. The first status in the list will be the latest one. This resource is also available via a legacy route: \`GET /repos/:owner/:repo/statuses/:ref\`. + * @tags repos + * @name ReposListCommitStatusesForRef + * @summary List commit statuses for a reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/statuses + */ + export namespace ReposListCommitStatusesForRef { + export type RequestParams = { + owner: string; + /** ref+ parameter */ + ref: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListCommitStatusesForRefData; + } + /** + * @description Lists contributors to the specified repository and sorts them by the number of commits per contributor in descending order. This endpoint may return information that is a few hours old because the GitHub REST API v3 caches contributor data to improve performance. GitHub identifies contributors by author email address. This endpoint groups contribution counts by GitHub user, which includes all associated email addresses. To improve performance, only the first 500 author email addresses in the repository link to GitHub users. The rest will appear as anonymous contributors without associated GitHub user information. + * @tags repos + * @name ReposListContributors + * @summary List repository contributors + * @request GET:/repos/{owner}/{repo}/contributors + */ + export namespace ReposListContributors { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** Set to \`1\` or \`true\` to include anonymous contributors in results. */ + anon?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListContributorsData; + } + /** + * No description + * @tags repos + * @name ReposListDeployKeys + * @summary List deploy keys + * @request GET:/repos/{owner}/{repo}/keys + */ + export namespace ReposListDeployKeys { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListDeployKeysData; + } + /** + * @description Simple filtering of deployments is available via query parameters: + * @tags repos + * @name ReposListDeployments + * @summary List deployments + * @request GET:/repos/{owner}/{repo}/deployments + */ + export namespace ReposListDeployments { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * The name of the environment that was deployed to (e.g., \`staging\` or \`production\`). + * @default "none" + */ + environment?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * The name of the ref. This can be a branch, tag, or SHA. + * @default "none" + */ + ref?: string; + /** + * The SHA recorded at creation time. + * @default "none" + */ + sha?: string; + /** + * The name of the task for the deployment (e.g., \`deploy\` or \`deploy:migrations\`). + * @default "none" + */ + task?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListDeploymentsData; + } + /** + * @description Users with pull access can view deployment statuses for a deployment: + * @tags repos + * @name ReposListDeploymentStatuses + * @summary List deployment statuses + * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses + */ + export namespace ReposListDeploymentStatuses { + export type RequestParams = { + /** deployment_id parameter */ + deploymentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListDeploymentStatusesData; + } + /** + * No description + * @tags repos + * @name ReposListForks + * @summary List forks + * @request GET:/repos/{owner}/{repo}/forks + */ + export namespace ReposListForks { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * The sort order. Can be either \`newest\`, \`oldest\`, or \`stargazers\`. + * @default "newest" + */ + sort?: ReposListForksParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListForksData; + } + /** + * @description When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations. + * @tags repos + * @name ReposListInvitations + * @summary List repository invitations + * @request GET:/repos/{owner}/{repo}/invitations + */ + export namespace ReposListInvitations { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListInvitationsData; + } + /** + * @description Lists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language. + * @tags repos + * @name ReposListLanguages + * @summary List repository languages + * @request GET:/repos/{owner}/{repo}/languages + */ + export namespace ReposListLanguages { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListLanguagesData; + } + /** + * No description + * @tags repos + * @name ReposListPagesBuilds + * @summary List GitHub Pages builds + * @request GET:/repos/{owner}/{repo}/pages/builds + */ + export namespace ReposListPagesBuilds { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListPagesBuildsData; + } + /** + * @description Lists all pull requests containing the provided commit SHA, which can be from any point in the commit history. The results will include open and closed pull requests. Additional preview headers may be required to see certain details for associated pull requests, such as whether a pull request is in a draft state. For more information about previews that might affect this endpoint, see the [List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests) endpoint. + * @tags repos + * @name ReposListPullRequestsAssociatedWithCommit + * @summary List pull requests associated with a commit + * @request GET:/repos/{owner}/{repo}/commits/{commit_sha}/pulls + */ + export namespace ReposListPullRequestsAssociatedWithCommit { + export type RequestParams = { + /** commit_sha parameter */ + commitSha: string; + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListPullRequestsAssociatedWithCommitData; + } + /** + * No description + * @tags repos + * @name ReposListReleaseAssets + * @summary List release assets + * @request GET:/repos/{owner}/{repo}/releases/{release_id}/assets + */ + export namespace ReposListReleaseAssets { + export type RequestParams = { + owner: string; + /** release_id parameter */ + releaseId: number; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListReleaseAssetsData; + } + /** + * @description This returns a list of releases, which does not include regular Git tags that have not been associated with a release. To get a list of Git tags, use the [Repository Tags API](https://docs.github.com/rest/reference/repos#list-repository-tags). Information about published releases are available to everyone. Only users with push access will receive listings for draft releases. + * @tags repos + * @name ReposListReleases + * @summary List releases + * @request GET:/repos/{owner}/{repo}/releases + */ + export namespace ReposListReleases { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListReleasesData; + } + /** + * No description + * @tags repos + * @name ReposListTags + * @summary List repository tags + * @request GET:/repos/{owner}/{repo}/tags + */ + export namespace ReposListTags { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListTagsData; + } + /** + * No description + * @tags repos + * @name ReposListTeams + * @summary List repository teams + * @request GET:/repos/{owner}/{repo}/teams + */ + export namespace ReposListTeams { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListTeamsData; + } + /** + * No description + * @tags repos + * @name ReposListWebhooks + * @summary List repository webhooks + * @request GET:/repos/{owner}/{repo}/hooks + */ + export namespace ReposListWebhooks { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListWebhooksData; + } + /** + * No description + * @tags repos + * @name ReposMerge + * @summary Merge a branch + * @request POST:/repos/{owner}/{repo}/merges + */ + export namespace ReposMerge { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposMergePayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposMergeData; + } + /** + * @description This will trigger a [ping event](https://docs.github.com/webhooks/#ping-event) to be sent to the hook. + * @tags repos + * @name ReposPingWebhook + * @summary Ping a repository webhook + * @request POST:/repos/{owner}/{repo}/hooks/{hook_id}/pings + */ + export namespace ReposPingWebhook { + export type RequestParams = { + hookId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposPingWebhookData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of an app to push to this branch. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | The GitHub Apps that have push access to this branch. Use the app's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @tags repos + * @name ReposRemoveAppAccessRestrictions + * @summary Remove app access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + */ + export namespace ReposRemoveAppAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposRemoveAppAccessRestrictionsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposRemoveAppAccessRestrictionsData; + } + /** + * No description + * @tags repos + * @name ReposRemoveCollaborator + * @summary Remove a repository collaborator + * @request DELETE:/repos/{owner}/{repo}/collaborators/{username} + */ + export namespace ReposRemoveCollaborator { + export type RequestParams = { + owner: string; + repo: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposRemoveCollaboratorData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposRemoveStatusCheckContexts + * @summary Remove status check contexts + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + */ + export namespace ReposRemoveStatusCheckContexts { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposRemoveStatusCheckContextsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposRemoveStatusCheckContextsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposRemoveStatusCheckProtection + * @summary Remove status check protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + */ + export namespace ReposRemoveStatusCheckProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposRemoveStatusCheckProtectionData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of a team to push to this branch. You can also remove push access for child teams. | Type | Description | | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Teams that should no longer have push access. Use the team's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @tags repos + * @name ReposRemoveTeamAccessRestrictions + * @summary Remove team access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + */ + export namespace ReposRemoveTeamAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposRemoveTeamAccessRestrictionsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposRemoveTeamAccessRestrictionsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of a user to push to this branch. | Type | Description | | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Usernames of the people who should no longer have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @tags repos + * @name ReposRemoveUserAccessRestrictions + * @summary Remove user access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + */ + export namespace ReposRemoveUserAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposRemoveUserAccessRestrictionsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposRemoveUserAccessRestrictionsData; + } + /** + * @description Renames a branch in a repository. **Note:** Although the API responds immediately, the branch rename process might take some extra time to complete in the background. You won't be able to push to the old branch name while the rename process is in progress. For more information, see "[Renaming a branch](https://docs.github.com/github/administering-a-repository/renaming-a-branch)". The permissions required to use this endpoint depends on whether you are renaming the default branch. To rename a non-default branch: * Users must have push access. * GitHub Apps must have the \`contents:write\` repository permission. To rename the default branch: * Users must have admin or owner permissions. * GitHub Apps must have the \`administration:write\` repository permission. + * @tags repos + * @name ReposRenameBranch + * @summary Rename a branch + * @request POST:/repos/{owner}/{repo}/branches/{branch}/rename + */ + export namespace ReposRenameBranch { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposRenameBranchPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposRenameBranchData; + } + /** + * No description + * @tags repos + * @name ReposReplaceAllTopics + * @summary Replace all repository topics + * @request PUT:/repos/{owner}/{repo}/topics + */ + export namespace ReposReplaceAllTopics { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposReplaceAllTopicsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposReplaceAllTopicsData; + } + /** + * @description You can request that your site be built from the latest revision on the default branch. This has the same effect as pushing a commit to your default branch, but does not require an additional commit. Manually triggering page builds can be helpful when diagnosing build warnings and failures. Build requests are limited to one concurrent build per repository and one concurrent build per requester. If you request a build while another is still in progress, the second request will be queued until the first completes. + * @tags repos + * @name ReposRequestPagesBuild + * @summary Request a GitHub Pages build + * @request POST:/repos/{owner}/{repo}/pages/builds + */ + export namespace ReposRequestPagesBuild { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposRequestPagesBuildData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Adding admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled. + * @tags repos + * @name ReposSetAdminBranchProtection + * @summary Set admin branch protection + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + */ + export namespace ReposSetAdminBranchProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposSetAdminBranchProtectionData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Replaces the list of apps that have push access to this branch. This removes all apps that previously had push access and grants push access to the new list of apps. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | The GitHub Apps that have push access to this branch. Use the app's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @tags repos + * @name ReposSetAppAccessRestrictions + * @summary Set app access restrictions + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + */ + export namespace ReposSetAppAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposSetAppAccessRestrictionsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposSetAppAccessRestrictionsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @tags repos + * @name ReposSetStatusCheckContexts + * @summary Set status check contexts + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + */ + export namespace ReposSetStatusCheckContexts { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposSetStatusCheckContextsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposSetStatusCheckContextsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Replaces the list of teams that have push access to this branch. This removes all teams that previously had push access and grants push access to the new list of teams. Team restrictions include child teams. | Type | Description | | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | \`array\` | The teams that can have push access. Use the team's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @tags repos + * @name ReposSetTeamAccessRestrictions + * @summary Set team access restrictions + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + */ + export namespace ReposSetTeamAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposSetTeamAccessRestrictionsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposSetTeamAccessRestrictionsData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Replaces the list of people that have push access to this branch. This removes all people that previously had push access and grants push access to the new list of people. | Type | Description | | ------- | ----------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Usernames for people who can have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @tags repos + * @name ReposSetUserAccessRestrictions + * @summary Set user access restrictions + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + */ + export namespace ReposSetUserAccessRestrictions { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposSetUserAccessRestrictionsPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposSetUserAccessRestrictionsData; + } + /** + * @description This will trigger the hook with the latest push to the current repository if the hook is subscribed to \`push\` events. If the hook is not subscribed to \`push\` events, the server will respond with 204 but no test POST will be generated. **Note**: Previously \`/repos/:owner/:repo/hooks/:hook_id/test\` + * @tags repos + * @name ReposTestPushWebhook + * @summary Test the push repository webhook + * @request POST:/repos/{owner}/{repo}/hooks/{hook_id}/tests + */ + export namespace ReposTestPushWebhook { + export type RequestParams = { + hookId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposTestPushWebhookData; + } + /** + * @description A transfer request will need to be accepted by the new owner when transferring a personal repository to another user. The response will contain the original \`owner\`, and the transfer will continue asynchronously. For more details on the requirements to transfer personal and organization-owned repositories, see [about repository transfers](https://help.github.com/articles/about-repository-transfers/). + * @tags repos + * @name ReposTransfer + * @summary Transfer a repository + * @request POST:/repos/{owner}/{repo}/transfer + */ + export namespace ReposTransfer { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposTransferPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposTransferData; + } + /** + * @description **Note**: To edit a repository's topics, use the [Replace all repository topics](https://docs.github.com/rest/reference/repos#replace-all-repository-topics) endpoint. + * @tags repos + * @name ReposUpdate + * @summary Update a repository + * @request PATCH:/repos/{owner}/{repo} + */ + export namespace ReposUpdate { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdatePayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdateData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Protecting a branch requires admin or owner permissions to the repository. **Note**: Passing new arrays of \`users\` and \`teams\` replaces their previous values. **Note**: The list of users, apps, and teams in total is limited to 100 items. + * @tags repos + * @name ReposUpdateBranchProtection + * @summary Update branch protection + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection + */ + export namespace ReposUpdateBranchProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdateBranchProtectionPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdateBranchProtectionData; + } + /** + * No description + * @tags repos + * @name ReposUpdateCommitComment + * @summary Update a commit comment + * @request PATCH:/repos/{owner}/{repo}/comments/{comment_id} + */ + export namespace ReposUpdateCommitComment { + export type RequestParams = { + /** comment_id parameter */ + commentId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdateCommitCommentPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdateCommitCommentData; + } + /** + * @description Updates information for a GitHub Pages site. For more information, see "[About GitHub Pages](/github/working-with-github-pages/about-github-pages). + * @tags repos + * @name ReposUpdateInformationAboutPagesSite + * @summary Update information about a GitHub Pages site + * @request PUT:/repos/{owner}/{repo}/pages + */ + export namespace ReposUpdateInformationAboutPagesSite { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdateInformationAboutPagesSitePayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdateInformationAboutPagesSiteData; + } + /** + * No description + * @tags repos + * @name ReposUpdateInvitation + * @summary Update a repository invitation + * @request PATCH:/repos/{owner}/{repo}/invitations/{invitation_id} + */ + export namespace ReposUpdateInvitation { + export type RequestParams = { + /** invitation_id parameter */ + invitationId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdateInvitationPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdateInvitationData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Updating pull request review enforcement requires admin or owner permissions to the repository and branch protection to be enabled. **Note**: Passing new arrays of \`users\` and \`teams\` replaces their previous values. + * @tags repos + * @name ReposUpdatePullRequestReviewProtection + * @summary Update pull request review protection + * @request PATCH:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + */ + export namespace ReposUpdatePullRequestReviewProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdatePullRequestReviewProtectionPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdatePullRequestReviewProtectionData; + } + /** + * @description Users with push access to the repository can edit a release. + * @tags repos + * @name ReposUpdateRelease + * @summary Update a release + * @request PATCH:/repos/{owner}/{repo}/releases/{release_id} + */ + export namespace ReposUpdateRelease { + export type RequestParams = { + owner: string; + /** release_id parameter */ + releaseId: number; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdateReleasePayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdateReleaseData; + } + /** + * @description Users with push access to the repository can edit a release asset. + * @tags repos + * @name ReposUpdateReleaseAsset + * @summary Update a release asset + * @request PATCH:/repos/{owner}/{repo}/releases/assets/{asset_id} + */ + export namespace ReposUpdateReleaseAsset { + export type RequestParams = { + /** asset_id parameter */ + assetId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdateReleaseAssetPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdateReleaseAssetData; + } + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Updating required status checks requires admin or owner permissions to the repository and branch protection to be enabled. + * @tags repos + * @name ReposUpdateStatusCheckProtection + * @summary Update status check protection + * @request PATCH:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + */ + export namespace ReposUpdateStatusCheckProtection { + export type RequestParams = { + /** The name of the branch. */ + branch: string; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdateStatusCheckProtectionPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdateStatusCheckProtectionData; + } + /** + * @description Updates a webhook configured in a repository. If you previously had a \`secret\` set, you must provide the same \`secret\` or set a new \`secret\` or the secret will be removed. If you are only updating individual webhook \`config\` properties, use "[Update a webhook configuration for a repository](/rest/reference/repos#update-a-webhook-configuration-for-a-repository)." + * @tags repos + * @name ReposUpdateWebhook + * @summary Update a repository webhook + * @request PATCH:/repos/{owner}/{repo}/hooks/{hook_id} + */ + export namespace ReposUpdateWebhook { + export type RequestParams = { + hookId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdateWebhookPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdateWebhookData; + } + /** + * @description Updates the webhook configuration for a repository. To update more information about the webhook, including the \`active\` state and \`events\`, use "[Update a repository webhook](/rest/reference/orgs#update-a-repository-webhook)." Access tokens must have the \`write:repo_hook\` or \`repo\` scope, and GitHub Apps must have the \`repository_hooks:write\` permission. + * @tags repos + * @name ReposUpdateWebhookConfigForRepo + * @summary Update a webhook configuration for a repository + * @request PATCH:/repos/{owner}/{repo}/hooks/{hook_id}/config + */ + export namespace ReposUpdateWebhookConfigForRepo { + export type RequestParams = { + hookId: number; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = ReposUpdateWebhookConfigForRepoPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUpdateWebhookConfigForRepoData; + } + /** + * @description This endpoint makes use of [a Hypermedia relation](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia) to determine which URL to access. The endpoint you call to upload release assets is specific to your release. Use the \`upload_url\` returned in the response of the [Create a release endpoint](https://docs.github.com/rest/reference/repos#create-a-release) to upload a release asset. You need to use an HTTP client which supports [SNI](http://en.wikipedia.org/wiki/Server_Name_Indication) to make calls to this endpoint. Most libraries will set the required \`Content-Length\` header automatically. Use the required \`Content-Type\` header to provide the media type of the asset. For a list of media types, see [Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml). For example: \`application/zip\` GitHub expects the asset data in its raw binary form, rather than JSON. You will send the raw binary content of the asset as the request body. Everything else about the endpoint is the same as the rest of the API. For example, you'll still need to pass your authentication to be able to upload an asset. When an upstream failure occurs, you will receive a \`502 Bad Gateway\` status. This may leave an empty asset with a state of \`starter\`. It can be safely deleted. **Notes:** * GitHub renames asset filenames that have special characters, non-alphanumeric characters, and leading or trailing periods. The "[List assets for a release](https://docs.github.com/rest/reference/repos#list-assets-for-a-release)" endpoint lists the renamed filenames. For more information and help, contact [GitHub Support](https://support.github.com/contact). * If you upload an asset with the same filename as another uploaded asset, you'll receive an error and must delete the old file before you can re-upload the new asset. + * @tags repos + * @name ReposUploadReleaseAsset + * @summary Upload a release asset + * @request POST:/repos/{owner}/{repo}/releases/{release_id}/assets + */ + export namespace ReposUploadReleaseAsset { + export type RequestParams = { + owner: string; + /** release_id parameter */ + releaseId: number; + repo: string; + }; + export type RequestQuery = { + label?: string; + name?: string; + }; + export type RequestBody = ReposUploadReleaseAssetPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposUploadReleaseAssetData; + } + /** + * @description Gets a single secret scanning alert detected in a private repository. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the \`repo\` scope or \`security_events\` scope. GitHub Apps must have the \`secret_scanning_alerts\` read permission to use this endpoint. + * @tags secret-scanning + * @name SecretScanningGetAlert + * @summary Get a secret scanning alert + * @request GET:/repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} + */ + export namespace SecretScanningGetAlert { + export type RequestParams = { + /** The security alert number, found at the end of the security alert's URL. */ + alertNumber: AlertNumber; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SecretScanningGetAlertData; + } + /** + * @description Lists all secret scanning alerts for a private repository, from newest to oldest. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the \`repo\` scope or \`security_events\` scope. GitHub Apps must have the \`secret_scanning_alerts\` read permission to use this endpoint. + * @tags secret-scanning + * @name SecretScanningListAlertsForRepo + * @summary List secret scanning alerts for a repository + * @request GET:/repos/{owner}/{repo}/secret-scanning/alerts + */ + export namespace SecretScanningListAlertsForRepo { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Set to \`open\` or \`resolved\` to only list secret scanning alerts in a specific state. */ + state?: SecretScanningListAlertsForRepoParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SecretScanningListAlertsForRepoData; + } + /** + * @description Updates the status of a secret scanning alert in a private repository. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the \`repo\` scope or \`security_events\` scope. GitHub Apps must have the \`secret_scanning_alerts\` write permission to use this endpoint. + * @tags secret-scanning + * @name SecretScanningUpdateAlert + * @summary Update a secret scanning alert + * @request PATCH:/repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} + */ + export namespace SecretScanningUpdateAlert { + export type RequestParams = { + /** The security alert number, found at the end of the security alert's URL. */ + alertNumber: AlertNumber; + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = SecretScanningUpdateAlertPayload; + export type RequestHeaders = {}; + export type ResponseBody = SecretScanningUpdateAlertData; + } +} + +export namespace Repositories { + /** + * @description Lists all public repositories in the order that they were created. Note: Pagination is powered exclusively by the \`since\` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of repositories. + * @tags repos + * @name ReposListPublic + * @summary List public repositories + * @request GET:/repositories + */ + export namespace ReposListPublic { + export type RequestParams = {}; + export type RequestQuery = { + /** A repository ID. Only return repositories with an ID greater than this ID. */ + since?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListPublicData; + } +} + +export namespace Scim { + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * @tags enterprise-admin + * @name EnterpriseAdminDeleteScimGroupFromEnterprise + * @summary Delete a SCIM group from an enterprise + * @request DELETE:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} + */ + export namespace EnterpriseAdminDeleteScimGroupFromEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Identifier generated by the GitHub SCIM endpoint. */ + scimGroupId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminDeleteScimGroupFromEnterpriseData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * @tags enterprise-admin + * @name EnterpriseAdminDeleteUserFromEnterprise + * @summary Delete a SCIM user from an enterprise + * @request DELETE:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + */ + export namespace EnterpriseAdminDeleteUserFromEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** scim_user_id parameter */ + scimUserId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminDeleteUserFromEnterpriseData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * @tags enterprise-admin + * @name EnterpriseAdminGetProvisioningInformationForEnterpriseGroup + * @summary Get SCIM provisioning information for an enterprise group + * @request GET:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} + */ + export namespace EnterpriseAdminGetProvisioningInformationForEnterpriseGroup { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Identifier generated by the GitHub SCIM endpoint. */ + scimGroupId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminGetProvisioningInformationForEnterpriseGroupData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * @tags enterprise-admin + * @name EnterpriseAdminGetProvisioningInformationForEnterpriseUser + * @summary Get SCIM provisioning information for an enterprise user + * @request GET:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + */ + export namespace EnterpriseAdminGetProvisioningInformationForEnterpriseUser { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** scim_user_id parameter */ + scimUserId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminGetProvisioningInformationForEnterpriseUserData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * @tags enterprise-admin + * @name EnterpriseAdminListProvisionedGroupsEnterprise + * @summary List provisioned SCIM groups for an enterprise + * @request GET:/scim/v2/enterprises/{enterprise}/Groups + */ + export namespace EnterpriseAdminListProvisionedGroupsEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = { + /** Used for pagination: the number of results to return. */ + count?: number; + /** Used for pagination: the index of the first result to return. */ + startIndex?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminListProvisionedGroupsEnterpriseData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Retrieves a paginated list of all provisioned enterprise members, including pending invitations. When a user with a SAML-provisioned external identity leaves (or is removed from) an enterprise, the account's metadata is immediately removed. However, the returned list of user accounts might not always match the organization or enterprise member list you see on GitHub. This can happen in certain cases where an external identity associated with an organization will not match an organization member: - When a user with a SCIM-provisioned external identity is removed from an enterprise, the account's metadata is preserved to allow the user to re-join the organization in the future. - When inviting a user to join an organization, you can expect to see their external identity in the results before they accept the invitation, or if the invitation is cancelled (or never accepted). - When a user is invited over SCIM, an external identity is created that matches with the invitee's email address. However, this identity is only linked to a user account when the user accepts the invitation by going through SAML SSO. The returned list of external identities can include an entry for a \`null\` user. These are unlinked SAML identities that are created when a user goes through the following Single Sign-On (SSO) process but does not sign in to their GitHub account after completing SSO: 1. The user is granted access by the IdP and is not a member of the GitHub enterprise. 1. The user attempts to access the GitHub enterprise and initiates the SAML SSO process, and is not currently signed in to their GitHub account. 1. After successfully authenticating with the SAML SSO IdP, the \`null\` external identity entry is created and the user is prompted to sign in to their GitHub account: - If the user signs in, their GitHub account is linked to this entry. - If the user does not sign in (or does not create a new account when prompted), they are not added to the GitHub enterprise, and the external identity \`null\` entry remains in place. + * @tags enterprise-admin + * @name EnterpriseAdminListProvisionedIdentitiesEnterprise + * @summary List SCIM provisioned identities for an enterprise + * @request GET:/scim/v2/enterprises/{enterprise}/Users + */ + export namespace EnterpriseAdminListProvisionedIdentitiesEnterprise { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = { + /** Used for pagination: the number of results to return. */ + count?: number; + /** Used for pagination: the index of the first result to return. */ + startIndex?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminListProvisionedIdentitiesEnterpriseData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Provision an enterprise group, and invite users to the group. This sends invitation emails to the email address of the invited users to join the GitHub organization that the SCIM group corresponds to. + * @tags enterprise-admin + * @name EnterpriseAdminProvisionAndInviteEnterpriseGroup + * @summary Provision a SCIM enterprise group and invite users + * @request POST:/scim/v2/enterprises/{enterprise}/Groups + */ + export namespace EnterpriseAdminProvisionAndInviteEnterpriseGroup { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminProvisionAndInviteEnterpriseGroupPayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminProvisionAndInviteEnterpriseGroupData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Provision enterprise membership for a user, and send organization invitation emails to the email address. You can optionally include the groups a user will be invited to join. If you do not provide a list of \`groups\`, the user is provisioned for the enterprise, but no organization invitation emails will be sent. + * @tags enterprise-admin + * @name EnterpriseAdminProvisionAndInviteEnterpriseUser + * @summary Provision and invite a SCIM enterprise user + * @request POST:/scim/v2/enterprises/{enterprise}/Users + */ + export namespace EnterpriseAdminProvisionAndInviteEnterpriseUser { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminProvisionAndInviteEnterpriseUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminProvisionAndInviteEnterpriseUserData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Replaces an existing provisioned group’s information. You must provide all the information required for the group as if you were provisioning it for the first time. Any existing group information that you don't provide will be removed, including group membership. If you want to only update a specific attribute, use the [Update an attribute for a SCIM enterprise group](#update-an-attribute-for-a-scim-enterprise-group) endpoint instead. + * @tags enterprise-admin + * @name EnterpriseAdminSetInformationForProvisionedEnterpriseGroup + * @summary Set SCIM information for a provisioned enterprise group + * @request PUT:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} + */ + export namespace EnterpriseAdminSetInformationForProvisionedEnterpriseGroup { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Identifier generated by the GitHub SCIM endpoint. */ + scimGroupId: string; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminSetInformationForProvisionedEnterpriseGroupPayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminSetInformationForProvisionedEnterpriseGroupData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Replaces an existing provisioned user's information. You must provide all the information required for the user as if you were provisioning them for the first time. Any existing user information that you don't provide will be removed. If you want to only update a specific attribute, use the [Update an attribute for a SCIM user](#update-an-attribute-for-an-enterprise-scim-user) endpoint instead. You must at least provide the required values for the user: \`userName\`, \`name\`, and \`emails\`. **Warning:** Setting \`active: false\` removes the user from the enterprise, deletes the external identity, and deletes the associated \`{scim_user_id}\`. + * @tags enterprise-admin + * @name EnterpriseAdminSetInformationForProvisionedEnterpriseUser + * @summary Set SCIM information for a provisioned enterprise user + * @request PUT:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + */ + export namespace EnterpriseAdminSetInformationForProvisionedEnterpriseUser { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** scim_user_id parameter */ + scimUserId: string; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminSetInformationForProvisionedEnterpriseUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminSetInformationForProvisionedEnterpriseUserData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Allows you to change a provisioned group’s individual attributes. To change a group’s values, you must provide a specific Operations JSON format that contains at least one of the add, remove, or replace operations. For examples and more information on the SCIM operations format, see the [SCIM specification](https://tools.ietf.org/html/rfc7644#section-3.5.2). + * @tags enterprise-admin + * @name EnterpriseAdminUpdateAttributeForEnterpriseGroup + * @summary Update an attribute for a SCIM enterprise group + * @request PATCH:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} + */ + export namespace EnterpriseAdminUpdateAttributeForEnterpriseGroup { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** Identifier generated by the GitHub SCIM endpoint. */ + scimGroupId: string; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminUpdateAttributeForEnterpriseGroupPayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminUpdateAttributeForEnterpriseGroupData; + } + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Allows you to change a provisioned user's individual attributes. To change a user's values, you must provide a specific \`Operations\` JSON format that contains at least one of the \`add\`, \`remove\`, or \`replace\` operations. For examples and more information on the SCIM operations format, see the [SCIM specification](https://tools.ietf.org/html/rfc7644#section-3.5.2). **Note:** Complicated SCIM \`path\` selectors that include filters are not supported. For example, a \`path\` selector defined as \`"path": "emails[type eq \\"work\\"]"\` will not work. **Warning:** If you set \`active:false\` using the \`replace\` operation (as shown in the JSON example below), it removes the user from the enterprise, deletes the external identity, and deletes the associated \`:scim_user_id\`. \`\`\` { "Operations":[{ "op":"replace", "value":{ "active":false } }] } \`\`\` + * @tags enterprise-admin + * @name EnterpriseAdminUpdateAttributeForEnterpriseUser + * @summary Update an attribute for a SCIM enterprise user + * @request PATCH:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + */ + export namespace EnterpriseAdminUpdateAttributeForEnterpriseUser { + export type RequestParams = { + /** The slug version of the enterprise name. You can also substitute this value with the enterprise id. */ + enterprise: string; + /** scim_user_id parameter */ + scimUserId: string; + }; + export type RequestQuery = {}; + export type RequestBody = EnterpriseAdminUpdateAttributeForEnterpriseUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = EnterpriseAdminUpdateAttributeForEnterpriseUserData; + } + /** + * No description + * @tags scim + * @name ScimDeleteUserFromOrg + * @summary Delete a SCIM user from an organization + * @request DELETE:/scim/v2/organizations/{org}/Users/{scim_user_id} + */ + export namespace ScimDeleteUserFromOrg { + export type RequestParams = { + org: string; + /** scim_user_id parameter */ + scimUserId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ScimDeleteUserFromOrgData; + } + /** + * No description + * @tags scim + * @name ScimGetProvisioningInformationForUser + * @summary Get SCIM provisioning information for a user + * @request GET:/scim/v2/organizations/{org}/Users/{scim_user_id} + */ + export namespace ScimGetProvisioningInformationForUser { + export type RequestParams = { + org: string; + /** scim_user_id parameter */ + scimUserId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ScimGetProvisioningInformationForUserData; + } + /** + * @description Retrieves a paginated list of all provisioned organization members, including pending invitations. If you provide the \`filter\` parameter, the resources for all matching provisions members are returned. When a user with a SAML-provisioned external identity leaves (or is removed from) an organization, the account's metadata is immediately removed. However, the returned list of user accounts might not always match the organization or enterprise member list you see on GitHub. This can happen in certain cases where an external identity associated with an organization will not match an organization member: - When a user with a SCIM-provisioned external identity is removed from an organization, the account's metadata is preserved to allow the user to re-join the organization in the future. - When inviting a user to join an organization, you can expect to see their external identity in the results before they accept the invitation, or if the invitation is cancelled (or never accepted). - When a user is invited over SCIM, an external identity is created that matches with the invitee's email address. However, this identity is only linked to a user account when the user accepts the invitation by going through SAML SSO. The returned list of external identities can include an entry for a \`null\` user. These are unlinked SAML identities that are created when a user goes through the following Single Sign-On (SSO) process but does not sign in to their GitHub account after completing SSO: 1. The user is granted access by the IdP and is not a member of the GitHub organization. 1. The user attempts to access the GitHub organization and initiates the SAML SSO process, and is not currently signed in to their GitHub account. 1. After successfully authenticating with the SAML SSO IdP, the \`null\` external identity entry is created and the user is prompted to sign in to their GitHub account: - If the user signs in, their GitHub account is linked to this entry. - If the user does not sign in (or does not create a new account when prompted), they are not added to the GitHub organization, and the external identity \`null\` entry remains in place. + * @tags scim + * @name ScimListProvisionedIdentities + * @summary List SCIM provisioned identities + * @request GET:/scim/v2/organizations/{org}/Users + */ + export namespace ScimListProvisionedIdentities { + export type RequestParams = { + org: string; + }; + export type RequestQuery = { + /** Used for pagination: the number of results to return. */ + count?: number; + /** + * Filters results using the equals query parameter operator (\`eq\`). You can filter results that are equal to \`id\`, \`userName\`, \`emails\`, and \`external_id\`. For example, to search for an identity with the \`userName\` Octocat, you would use this query: + * + * \`?filter=userName%20eq%20\\"Octocat\\"\`. + * + * To filter results for the identity with the email \`octocat@github.com\`, you would use this query: + * + * \`?filter=emails%20eq%20\\"octocat@github.com\\"\`. + */ + filter?: string; + /** Used for pagination: the index of the first result to return. */ + startIndex?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ScimListProvisionedIdentitiesData; + } + /** + * @description Provision organization membership for a user, and send an activation email to the email address. + * @tags scim + * @name ScimProvisionAndInviteUser + * @summary Provision and invite a SCIM user + * @request POST:/scim/v2/organizations/{org}/Users + */ + export namespace ScimProvisionAndInviteUser { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = ScimProvisionAndInviteUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = ScimProvisionAndInviteUserData; + } + /** + * @description Replaces an existing provisioned user's information. You must provide all the information required for the user as if you were provisioning them for the first time. Any existing user information that you don't provide will be removed. If you want to only update a specific attribute, use the [Update an attribute for a SCIM user](https://docs.github.com/rest/reference/scim#update-an-attribute-for-a-scim-user) endpoint instead. You must at least provide the required values for the user: \`userName\`, \`name\`, and \`emails\`. **Warning:** Setting \`active: false\` removes the user from the organization, deletes the external identity, and deletes the associated \`{scim_user_id}\`. + * @tags scim + * @name ScimSetInformationForProvisionedUser + * @summary Update a provisioned organization membership + * @request PUT:/scim/v2/organizations/{org}/Users/{scim_user_id} + */ + export namespace ScimSetInformationForProvisionedUser { + export type RequestParams = { + org: string; + /** scim_user_id parameter */ + scimUserId: string; + }; + export type RequestQuery = {}; + export type RequestBody = ScimSetInformationForProvisionedUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = ScimSetInformationForProvisionedUserData; + } + /** + * @description Allows you to change a provisioned user's individual attributes. To change a user's values, you must provide a specific \`Operations\` JSON format that contains at least one of the \`add\`, \`remove\`, or \`replace\` operations. For examples and more information on the SCIM operations format, see the [SCIM specification](https://tools.ietf.org/html/rfc7644#section-3.5.2). **Note:** Complicated SCIM \`path\` selectors that include filters are not supported. For example, a \`path\` selector defined as \`"path": "emails[type eq \\"work\\"]"\` will not work. **Warning:** If you set \`active:false\` using the \`replace\` operation (as shown in the JSON example below), it removes the user from the organization, deletes the external identity, and deletes the associated \`:scim_user_id\`. \`\`\` { "Operations":[{ "op":"replace", "value":{ "active":false } }] } \`\`\` + * @tags scim + * @name ScimUpdateAttributeForUser + * @summary Update an attribute for a SCIM user + * @request PATCH:/scim/v2/organizations/{org}/Users/{scim_user_id} + */ + export namespace ScimUpdateAttributeForUser { + export type RequestParams = { + org: string; + /** scim_user_id parameter */ + scimUserId: string; + }; + export type RequestQuery = {}; + export type RequestBody = ScimUpdateAttributeForUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = ScimUpdateAttributeForUserData; + } +} + +export namespace Search { + /** + * @description Searches for query terms inside of a file. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for code, you can get text match metadata for the file **content** and file **path** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find the definition of the \`addClass\` function inside [jQuery](https://github.com/jquery/jquery) repository, your query would look something like this: \`q=addClass+in:file+language:js+repo:jquery/jquery\` This query searches for the keyword \`addClass\` within a file's contents. The query limits the search to files where the language is JavaScript in the \`jquery/jquery\` repository. #### Considerations for code search Due to the complexity of searching code, there are a few restrictions on how searches are performed: * Only the _default branch_ is considered. In most cases, this will be the \`master\` branch. * Only files smaller than 384 KB are searchable. * You must always include at least one search term when searching source code. For example, searching for [\`language:go\`](https://github.com/search?utf8=%E2%9C%93&q=language%3Ago&type=Code) is not valid, while [\`amazing language:go\`](https://github.com/search?utf8=%E2%9C%93&q=amazing+language%3Ago&type=Code) is. + * @tags search + * @name SearchCode + * @summary Search code + * @request GET:/search/code + */ + export namespace SearchCode { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: SearchCodeParams1OrderEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching code](https://help.github.com/articles/searching-code/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query. Can only be \`indexed\`, which indicates how recently a file has been indexed by the GitHub search infrastructure. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SearchCodeParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SearchCodeData; + } + /** + * @description Find commits via various criteria on the default branch (usually \`master\`). This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for commits, you can get text match metadata for the **message** field when you provide the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find commits related to CSS in the [octocat/Spoon-Knife](https://github.com/octocat/Spoon-Knife) repository. Your query would look something like this: \`q=repo:octocat/Spoon-Knife+css\` + * @tags search + * @name SearchCommits + * @summary Search commits + * @request GET:/search/commits + */ + export namespace SearchCommits { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: SearchCommitsParams1OrderEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching commits](https://help.github.com/articles/searching-commits/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query by \`author-date\` or \`committer-date\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SearchCommitsParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SearchCommitsData; + } + /** + * @description Find issues by state and keyword. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for issues, you can get text match metadata for the issue **title**, issue **body**, and issue **comment body** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find the oldest unresolved Python bugs on Windows. Your query might look something like this. \`q=windows+label:bug+language:python+state:open&sort=created&order=asc\` This query searches for the keyword \`windows\`, within any open issue that is labeled as \`bug\`. The search runs across repositories whose primary language is Python. The results are sorted by creation date in ascending order, which means the oldest issues appear first in the search results. **Note:** For [user-to-server](https://docs.github.com/developers/apps/identifying-and-authorizing-users-for-github-apps#user-to-server-requests) GitHub App requests, you can't retrieve a combination of issues and pull requests in a single query. Requests that don't include the \`is:issue\` or \`is:pull-request\` qualifier will receive an HTTP \`422 Unprocessable Entity\` response. To get results for both issues and pull requests, you must send separate queries for issues and pull requests. For more information about the \`is\` qualifier, see "[Searching only issues or pull requests](https://docs.github.com/github/searching-for-information-on-github/searching-issues-and-pull-requests#search-only-issues-or-pull-requests)." + * @tags search + * @name SearchIssuesAndPullRequests + * @summary Search issues and pull requests + * @request GET:/search/issues + */ + export namespace SearchIssuesAndPullRequests { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: SearchIssuesAndPullRequestsParams1OrderEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching issues and pull requests](https://help.github.com/articles/searching-issues-and-pull-requests/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query by the number of \`comments\`, \`reactions\`, \`reactions-+1\`, \`reactions--1\`, \`reactions-smile\`, \`reactions-thinking_face\`, \`reactions-heart\`, \`reactions-tada\`, or \`interactions\`. You can also sort results by how recently the items were \`created\` or \`updated\`, Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SearchIssuesAndPullRequestsParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SearchIssuesAndPullRequestsData; + } + /** + * @description Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for labels, you can get text match metadata for the label **name** and **description** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find labels in the \`linguist\` repository that match \`bug\`, \`defect\`, or \`enhancement\`. Your query might look like this: \`q=bug+defect+enhancement&repository_id=64778136\` The labels that best match the query appear first in the search results. + * @tags search + * @name SearchLabels + * @summary Search labels + * @request GET:/search/labels + */ + export namespace SearchLabels { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: SearchLabelsParams1OrderEnum; + /** The search keywords. This endpoint does not accept qualifiers in the query. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). */ + q: string; + /** The id of the repository. */ + repository_id: number; + /** Sorts the results of your query by when the label was \`created\` or \`updated\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SearchLabelsParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SearchLabelsData; + } + /** + * @description Find repositories via various criteria. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for repositories, you can get text match metadata for the **name** and **description** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to search for popular Tetris repositories written in assembly code, your query might look like this: \`q=tetris+language:assembly&sort=stars&order=desc\` This query searches for repositories with the word \`tetris\` in the name, the description, or the README. The results are limited to repositories where the primary language is assembly. The results are sorted by stars in descending order, so that the most popular repositories appear first in the search results. When you include the \`mercy\` preview header, you can also search for multiple topics by adding more \`topic:\` instances. For example, your query might look like this: \`q=topic:ruby+topic:rails\` + * @tags search + * @name SearchRepos + * @summary Search repositories + * @request GET:/search/repositories + */ + export namespace SearchRepos { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: SearchReposParams1OrderEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching for repositories](https://help.github.com/articles/searching-for-repositories/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query by number of \`stars\`, \`forks\`, or \`help-wanted-issues\` or how recently the items were \`updated\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SearchReposParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SearchReposData; + } + /** + * @description Find topics via various criteria. Results are sorted by best match. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). See "[Searching topics](https://help.github.com/articles/searching-topics/)" for a detailed list of qualifiers. When searching for topics, you can get text match metadata for the topic's **short\\_description**, **description**, **name**, or **display\\_name** field when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to search for topics related to Ruby that are featured on https://github.com/topics. Your query might look like this: \`q=ruby+is:featured\` This query searches for topics with the keyword \`ruby\` and limits the results to find only topics that are featured. The topics that are the best match for the query appear first in the search results. + * @tags search + * @name SearchTopics + * @summary Search topics + * @request GET:/search/topics + */ + export namespace SearchTopics { + export type RequestParams = {}; + export type RequestQuery = { + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). */ + q: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SearchTopicsData; + } + /** + * @description Find users via various criteria. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for users, you can get text match metadata for the issue **login**, **email**, and **name** fields when you pass the \`text-match\` media type. For more details about highlighting search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you're looking for a list of popular users, you might try this query: \`q=tom+repos:%3E42+followers:%3E1000\` This query searches for users with the name \`tom\`. The results are restricted to users with more than 42 repositories and over 1,000 followers. + * @tags search + * @name SearchUsers + * @summary Search users + * @request GET:/search/users + */ + export namespace SearchUsers { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: SearchUsersParams1OrderEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching users](https://help.github.com/articles/searching-users/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query by number of \`followers\` or \`repositories\`, or when the person \`joined\` GitHub. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: SearchUsersParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SearchUsersData; + } +} + +export namespace Teams { + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new "[Create reaction for a team discussion comment](https://docs.github.com/rest/reference/reactions#create-reaction-for-a-team-discussion-comment)" endpoint. Create a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion comment. + * @tags reactions + * @name ReactionsCreateForTeamDiscussionCommentLegacy + * @summary Create reaction for a team discussion comment (Legacy) + * @request POST:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions + * @deprecated + */ + export namespace ReactionsCreateForTeamDiscussionCommentLegacy { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ReactionsCreateForTeamDiscussionCommentLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsCreateForTeamDiscussionCommentLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`Create reaction for a team discussion\`](https://docs.github.com/rest/reference/reactions#create-reaction-for-a-team-discussion) endpoint. Create a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion. + * @tags reactions + * @name ReactionsCreateForTeamDiscussionLegacy + * @summary Create reaction for a team discussion (Legacy) + * @request POST:/teams/{team_id}/discussions/{discussion_number}/reactions + * @deprecated + */ + export namespace ReactionsCreateForTeamDiscussionLegacy { + export type RequestParams = { + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = ReactionsCreateForTeamDiscussionLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsCreateForTeamDiscussionLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List reactions for a team discussion comment\`](https://docs.github.com/rest/reference/reactions#list-reactions-for-a-team-discussion-comment) endpoint. List the reactions to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags reactions + * @name ReactionsListForTeamDiscussionCommentLegacy + * @summary List reactions for a team discussion comment (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions + * @deprecated + */ + export namespace ReactionsListForTeamDiscussionCommentLegacy { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ + content?: ReactionsListForTeamDiscussionCommentLegacyParams1ContentEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsListForTeamDiscussionCommentLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List reactions for a team discussion\`](https://docs.github.com/rest/reference/reactions#list-reactions-for-a-team-discussion) endpoint. List the reactions to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags reactions + * @name ReactionsListForTeamDiscussionLegacy + * @summary List reactions for a team discussion (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/reactions + * @deprecated + */ + export namespace ReactionsListForTeamDiscussionLegacy { + export type RequestParams = { + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ + content?: ReactionsListForTeamDiscussionLegacyParams1ContentEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReactionsListForTeamDiscussionLegacyData; + } + /** + * @description The "Add team member" endpoint (described below) is deprecated. We recommend using the [Add or update team membership for a user](https://docs.github.com/rest/reference/teams#add-or-update-team-membership-for-a-user) endpoint instead. It allows you to invite new organization members to your teams. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To add someone to a team, the authenticated user must be an organization owner or a team maintainer in the team they're changing. The person being added to the team must be a member of the team's organization. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * @tags teams + * @name TeamsAddMemberLegacy + * @summary Add team member (Legacy) + * @request PUT:/teams/{team_id}/members/{username} + * @deprecated + */ + export namespace TeamsAddMemberLegacy { + export type RequestParams = { + teamId: number; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsAddMemberLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Add or update team membership for a user](https://docs.github.com/rest/reference/teams#add-or-update-team-membership-for-a-user) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. If the user is already a member of the team's organization, this endpoint will add the user to the team. To add a membership between an organization member and a team, the authenticated user must be an organization owner or a team maintainer. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." If the user is unaffiliated with the team's organization, this endpoint will send an invitation to the user via email. This newly-created membership will be in the "pending" state until the user accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. To add a membership between an unaffiliated user and a team, the authenticated user must be an organization owner. If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer. + * @tags teams + * @name TeamsAddOrUpdateMembershipForUserLegacy + * @summary Add or update team membership for a user (Legacy) + * @request PUT:/teams/{team_id}/memberships/{username} + * @deprecated + */ + export namespace TeamsAddOrUpdateMembershipForUserLegacy { + export type RequestParams = { + teamId: number; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsAddOrUpdateMembershipForUserLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsAddOrUpdateMembershipForUserLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Add or update team project permissions](https://docs.github.com/rest/reference/teams#add-or-update-team-project-permissions) endpoint. Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have \`admin\` permissions for the project. The project and team must be part of the same organization. + * @tags teams + * @name TeamsAddOrUpdateProjectPermissionsLegacy + * @summary Add or update team project permissions (Legacy) + * @request PUT:/teams/{team_id}/projects/{project_id} + * @deprecated + */ + export namespace TeamsAddOrUpdateProjectPermissionsLegacy { + export type RequestParams = { + projectId: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsAddOrUpdateProjectPermissionsLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsAddOrUpdateProjectPermissionsLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new "[Add or update team repository permissions](https://docs.github.com/rest/reference/teams#add-or-update-team-repository-permissions)" endpoint. To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a \`422 Unprocessable Entity\` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * @tags teams + * @name TeamsAddOrUpdateRepoPermissionsLegacy + * @summary Add or update team repository permissions (Legacy) + * @request PUT:/teams/{team_id}/repos/{owner}/{repo} + * @deprecated + */ + export namespace TeamsAddOrUpdateRepoPermissionsLegacy { + export type RequestParams = { + owner: string; + repo: string; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsAddOrUpdateRepoPermissionsLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsAddOrUpdateRepoPermissionsLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Check team permissions for a project](https://docs.github.com/rest/reference/teams#check-team-permissions-for-a-project) endpoint. Checks whether a team has \`read\`, \`write\`, or \`admin\` permissions for an organization project. The response includes projects inherited from a parent team. + * @tags teams + * @name TeamsCheckPermissionsForProjectLegacy + * @summary Check team permissions for a project (Legacy) + * @request GET:/teams/{team_id}/projects/{project_id} + * @deprecated + */ + export namespace TeamsCheckPermissionsForProjectLegacy { + export type RequestParams = { + projectId: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCheckPermissionsForProjectLegacyData; + } + /** + * @description **Note**: Repositories inherited through a parent team will also be checked. **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Check team permissions for a repository](https://docs.github.com/rest/reference/teams#check-team-permissions-for-a-repository) endpoint. You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: + * @tags teams + * @name TeamsCheckPermissionsForRepoLegacy + * @summary Check team permissions for a repository (Legacy) + * @request GET:/teams/{team_id}/repos/{owner}/{repo} + * @deprecated + */ + export namespace TeamsCheckPermissionsForRepoLegacy { + export type RequestParams = { + owner: string; + repo: string; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCheckPermissionsForRepoLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Create a discussion comment](https://docs.github.com/rest/reference/teams#create-a-discussion-comment) endpoint. Creates a new comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @tags teams + * @name TeamsCreateDiscussionCommentLegacy + * @summary Create a discussion comment (Legacy) + * @request POST:/teams/{team_id}/discussions/{discussion_number}/comments + * @deprecated + */ + export namespace TeamsCreateDiscussionCommentLegacy { + export type RequestParams = { + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsCreateDiscussionCommentLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCreateDiscussionCommentLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`Create a discussion\`](https://docs.github.com/rest/reference/teams#create-a-discussion) endpoint. Creates a new discussion post on a team's page. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @tags teams + * @name TeamsCreateDiscussionLegacy + * @summary Create a discussion (Legacy) + * @request POST:/teams/{team_id}/discussions + * @deprecated + */ + export namespace TeamsCreateDiscussionLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsCreateDiscussionLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCreateDiscussionLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`Create or update IdP group connections\`](https://docs.github.com/rest/reference/teams#create-or-update-idp-group-connections) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty \`groups\` array will remove all connections for a team. + * @tags teams + * @name TeamsCreateOrUpdateIdpGroupConnectionsLegacy + * @summary Create or update IdP group connections (Legacy) + * @request PATCH:/teams/{team_id}/team-sync/group-mappings + * @deprecated + */ + export namespace TeamsCreateOrUpdateIdpGroupConnectionsLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsCreateOrUpdateIdpGroupConnectionsLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsCreateOrUpdateIdpGroupConnectionsLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Delete a discussion comment](https://docs.github.com/rest/reference/teams#delete-a-discussion-comment) endpoint. Deletes a comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags teams + * @name TeamsDeleteDiscussionCommentLegacy + * @summary Delete a discussion comment (Legacy) + * @request DELETE:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + * @deprecated + */ + export namespace TeamsDeleteDiscussionCommentLegacy { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsDeleteDiscussionCommentLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`Delete a discussion\`](https://docs.github.com/rest/reference/teams#delete-a-discussion) endpoint. Delete a discussion from a team's page. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags teams + * @name TeamsDeleteDiscussionLegacy + * @summary Delete a discussion (Legacy) + * @request DELETE:/teams/{team_id}/discussions/{discussion_number} + * @deprecated + */ + export namespace TeamsDeleteDiscussionLegacy { + export type RequestParams = { + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsDeleteDiscussionLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Delete a team](https://docs.github.com/rest/reference/teams#delete-a-team) endpoint. To delete a team, the authenticated user must be an organization owner or team maintainer. If you are an organization owner, deleting a parent team will delete all of its child teams as well. + * @tags teams + * @name TeamsDeleteLegacy + * @summary Delete a team (Legacy) + * @request DELETE:/teams/{team_id} + * @deprecated + */ + export namespace TeamsDeleteLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsDeleteLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get a discussion comment](https://docs.github.com/rest/reference/teams#get-a-discussion-comment) endpoint. Get a specific comment on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags teams + * @name TeamsGetDiscussionCommentLegacy + * @summary Get a discussion comment (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + * @deprecated + */ + export namespace TeamsGetDiscussionCommentLegacy { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsGetDiscussionCommentLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get a discussion](https://docs.github.com/rest/reference/teams#get-a-discussion) endpoint. Get a specific discussion on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags teams + * @name TeamsGetDiscussionLegacy + * @summary Get a discussion (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number} + * @deprecated + */ + export namespace TeamsGetDiscussionLegacy { + export type RequestParams = { + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsGetDiscussionLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the [Get a team by name](https://docs.github.com/rest/reference/teams#get-a-team-by-name) endpoint. + * @tags teams + * @name TeamsGetLegacy + * @summary Get a team (Legacy) + * @request GET:/teams/{team_id} + * @deprecated + */ + export namespace TeamsGetLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsGetLegacyData; + } + /** + * @description The "Get team member" endpoint (described below) is deprecated. We recommend using the [Get team membership for a user](https://docs.github.com/rest/reference/teams#get-team-membership-for-a-user) endpoint instead. It allows you to get both active and pending memberships. To list members in a team, the team must be visible to the authenticated user. + * @tags teams + * @name TeamsGetMemberLegacy + * @summary Get team member (Legacy) + * @request GET:/teams/{team_id}/members/{username} + * @deprecated + */ + export namespace TeamsGetMemberLegacy { + export type RequestParams = { + teamId: number; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsGetMemberLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get team membership for a user](https://docs.github.com/rest/reference/teams#get-team-membership-for-a-user) endpoint. Team members will include the members of child teams. To get a user's membership with a team, the team must be visible to the authenticated user. **Note:** The \`role\` for organization owners returns as \`maintainer\`. For more information about \`maintainer\` roles, see [Create a team](https://docs.github.com/rest/reference/teams#create-a-team). + * @tags teams + * @name TeamsGetMembershipForUserLegacy + * @summary Get team membership for a user (Legacy) + * @request GET:/teams/{team_id}/memberships/{username} + * @deprecated + */ + export namespace TeamsGetMembershipForUserLegacy { + export type RequestParams = { + teamId: number; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsGetMembershipForUserLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List child teams\`](https://docs.github.com/rest/reference/teams#list-child-teams) endpoint. + * @tags teams + * @name TeamsListChildLegacy + * @summary List child teams (Legacy) + * @request GET:/teams/{team_id}/teams + * @deprecated + */ + export namespace TeamsListChildLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListChildLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [List discussion comments](https://docs.github.com/rest/reference/teams#list-discussion-comments) endpoint. List all comments on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags teams + * @name TeamsListDiscussionCommentsLegacy + * @summary List discussion comments (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments + * @deprecated + */ + export namespace TeamsListDiscussionCommentsLegacy { + export type RequestParams = { + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: TeamsListDiscussionCommentsLegacyParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListDiscussionCommentsLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List discussions\`](https://docs.github.com/rest/reference/teams#list-discussions) endpoint. List all discussions on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags teams + * @name TeamsListDiscussionsLegacy + * @summary List discussions (Legacy) + * @request GET:/teams/{team_id}/discussions + * @deprecated + */ + export namespace TeamsListDiscussionsLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: TeamsListDiscussionsLegacyParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListDiscussionsLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List IdP groups for a team\`](https://docs.github.com/rest/reference/teams#list-idp-groups-for-a-team) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups connected to a team on GitHub. + * @tags teams + * @name TeamsListIdpGroupsForLegacy + * @summary List IdP groups for a team (Legacy) + * @request GET:/teams/{team_id}/team-sync/group-mappings + * @deprecated + */ + export namespace TeamsListIdpGroupsForLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListIdpGroupsForLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List team members\`](https://docs.github.com/rest/reference/teams#list-team-members) endpoint. Team members will include the members of child teams. + * @tags teams + * @name TeamsListMembersLegacy + * @summary List team members (Legacy) + * @request GET:/teams/{team_id}/members + * @deprecated + */ + export namespace TeamsListMembersLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Filters members returned by their role in the team. Can be one of: + * \\* \`member\` - normal members of the team. + * \\* \`maintainer\` - team maintainers. + * \\* \`all\` - all members of the team. + * @default "all" + */ + role?: TeamsListMembersLegacyParams1RoleEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListMembersLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List pending team invitations\`](https://docs.github.com/rest/reference/teams#list-pending-team-invitations) endpoint. The return hash contains a \`role\` field which refers to the Organization Invitation role and will be one of the following values: \`direct_member\`, \`admin\`, \`billing_manager\`, \`hiring_manager\`, or \`reinstate\`. If the invitee is not a GitHub member, the \`login\` field in the return hash will be \`null\`. + * @tags teams + * @name TeamsListPendingInvitationsLegacy + * @summary List pending team invitations (Legacy) + * @request GET:/teams/{team_id}/invitations + * @deprecated + */ + export namespace TeamsListPendingInvitationsLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListPendingInvitationsLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List team projects\`](https://docs.github.com/rest/reference/teams#list-team-projects) endpoint. Lists the organization projects for a team. + * @tags teams + * @name TeamsListProjectsLegacy + * @summary List team projects (Legacy) + * @request GET:/teams/{team_id}/projects + * @deprecated + */ + export namespace TeamsListProjectsLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListProjectsLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [List team repositories](https://docs.github.com/rest/reference/teams#list-team-repositories) endpoint. + * @tags teams + * @name TeamsListReposLegacy + * @summary List team repositories (Legacy) + * @request GET:/teams/{team_id}/repos + * @deprecated + */ + export namespace TeamsListReposLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListReposLegacyData; + } + /** + * @description The "Remove team member" endpoint (described below) is deprecated. We recommend using the [Remove team membership for a user](https://docs.github.com/rest/reference/teams#remove-team-membership-for-a-user) endpoint instead. It allows you to remove both active and pending memberships. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To remove a team member, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. Removing a team member does not delete the user, it just removes them from the team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." + * @tags teams + * @name TeamsRemoveMemberLegacy + * @summary Remove team member (Legacy) + * @request DELETE:/teams/{team_id}/members/{username} + * @deprecated + */ + export namespace TeamsRemoveMemberLegacy { + export type RequestParams = { + teamId: number; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsRemoveMemberLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove team membership for a user](https://docs.github.com/rest/reference/teams#remove-team-membership-for-a-user) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." + * @tags teams + * @name TeamsRemoveMembershipForUserLegacy + * @summary Remove team membership for a user (Legacy) + * @request DELETE:/teams/{team_id}/memberships/{username} + * @deprecated + */ + export namespace TeamsRemoveMembershipForUserLegacy { + export type RequestParams = { + teamId: number; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsRemoveMembershipForUserLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove a project from a team](https://docs.github.com/rest/reference/teams#remove-a-project-from-a-team) endpoint. Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have \`read\` access to both the team and project, or \`admin\` access to the team or project. **Note:** This endpoint removes the project from the team, but does not delete it. + * @tags teams + * @name TeamsRemoveProjectLegacy + * @summary Remove a project from a team (Legacy) + * @request DELETE:/teams/{team_id}/projects/{project_id} + * @deprecated + */ + export namespace TeamsRemoveProjectLegacy { + export type RequestParams = { + projectId: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsRemoveProjectLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove a repository from a team](https://docs.github.com/rest/reference/teams#remove-a-repository-from-a-team) endpoint. If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. NOTE: This does not delete the repository, it just removes it from the team. + * @tags teams + * @name TeamsRemoveRepoLegacy + * @summary Remove a repository from a team (Legacy) + * @request DELETE:/teams/{team_id}/repos/{owner}/{repo} + * @deprecated + */ + export namespace TeamsRemoveRepoLegacy { + export type RequestParams = { + owner: string; + repo: string; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsRemoveRepoLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a discussion comment](https://docs.github.com/rest/reference/teams#update-a-discussion-comment) endpoint. Edits the body text of a discussion comment. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags teams + * @name TeamsUpdateDiscussionCommentLegacy + * @summary Update a discussion comment (Legacy) + * @request PATCH:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + * @deprecated + */ + export namespace TeamsUpdateDiscussionCommentLegacy { + export type RequestParams = { + commentNumber: number; + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsUpdateDiscussionCommentLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsUpdateDiscussionCommentLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a discussion](https://docs.github.com/rest/reference/teams#update-a-discussion) endpoint. Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags teams + * @name TeamsUpdateDiscussionLegacy + * @summary Update a discussion (Legacy) + * @request PATCH:/teams/{team_id}/discussions/{discussion_number} + * @deprecated + */ + export namespace TeamsUpdateDiscussionLegacy { + export type RequestParams = { + discussionNumber: number; + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsUpdateDiscussionLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsUpdateDiscussionLegacyData; + } + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a team](https://docs.github.com/rest/reference/teams#update-a-team) endpoint. To edit a team, the authenticated user must either be an organization owner or a team maintainer. **Note:** With nested teams, the \`privacy\` for parent teams cannot be \`secret\`. + * @tags teams + * @name TeamsUpdateLegacy + * @summary Update a team (Legacy) + * @request PATCH:/teams/{team_id} + * @deprecated + */ + export namespace TeamsUpdateLegacy { + export type RequestParams = { + teamId: number; + }; + export type RequestQuery = {}; + export type RequestBody = TeamsUpdateLegacyPayload; + export type RequestHeaders = {}; + export type ResponseBody = TeamsUpdateLegacyData; + } +} + +export namespace User { + /** + * No description + * @tags activity + * @name ActivityCheckRepoIsStarredByAuthenticatedUser + * @summary Check if a repository is starred by the authenticated user + * @request GET:/user/starred/{owner}/{repo} + */ + export namespace ActivityCheckRepoIsStarredByAuthenticatedUser { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityCheckRepoIsStarredByAuthenticatedUserData; + } + /** + * @description Lists repositories the authenticated user has starred. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: + * @tags activity + * @name ActivityListReposStarredByAuthenticatedUser + * @summary List repositories starred by the authenticated user + * @request GET:/user/starred + */ + export namespace ActivityListReposStarredByAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: ActivityListReposStarredByAuthenticatedUserParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: ActivityListReposStarredByAuthenticatedUserParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListReposStarredByAuthenticatedUserData; + } + /** + * @description Lists repositories the authenticated user is watching. + * @tags activity + * @name ActivityListWatchedReposForAuthenticatedUser + * @summary List repositories watched by the authenticated user + * @request GET:/user/subscriptions + */ + export namespace ActivityListWatchedReposForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListWatchedReposForAuthenticatedUserData; + } + /** + * @description Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * @tags activity + * @name ActivityStarRepoForAuthenticatedUser + * @summary Star a repository for the authenticated user + * @request PUT:/user/starred/{owner}/{repo} + */ + export namespace ActivityStarRepoForAuthenticatedUser { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityStarRepoForAuthenticatedUserData; + } + /** + * No description + * @tags activity + * @name ActivityUnstarRepoForAuthenticatedUser + * @summary Unstar a repository for the authenticated user + * @request DELETE:/user/starred/{owner}/{repo} + */ + export namespace ActivityUnstarRepoForAuthenticatedUser { + export type RequestParams = { + owner: string; + repo: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityUnstarRepoForAuthenticatedUserData; + } + /** + * @description Add a single repository to an installation. The authenticated user must have admin access to the repository. You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint. + * @tags apps + * @name AppsAddRepoToInstallation + * @summary Add a repository to an app installation + * @request PUT:/user/installations/{installation_id}/repositories/{repository_id} + */ + export namespace AppsAddRepoToInstallation { + export type RequestParams = { + /** installation_id parameter */ + installationId: number; + repositoryId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsAddRepoToInstallationData; + } + /** + * @description List repositories that the authenticated user has explicit permission (\`:read\`, \`:write\`, or \`:admin\`) to access for an installation. The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. The access the user has to each repository is included in the hash under the \`permissions\` key. + * @tags apps + * @name AppsListInstallationReposForAuthenticatedUser + * @summary List repositories accessible to the user access token + * @request GET:/user/installations/{installation_id}/repositories + */ + export namespace AppsListInstallationReposForAuthenticatedUser { + export type RequestParams = { + /** installation_id parameter */ + installationId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsListInstallationReposForAuthenticatedUserData; + } + /** + * @description Lists installations of your GitHub App that the authenticated user has explicit permission (\`:read\`, \`:write\`, or \`:admin\`) to access. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. You can find the permissions for the installation under the \`permissions\` key. + * @tags apps + * @name AppsListInstallationsForAuthenticatedUser + * @summary List app installations accessible to the user access token + * @request GET:/user/installations + */ + export namespace AppsListInstallationsForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsListInstallationsForAuthenticatedUserData; + } + /** + * @description Lists the active subscriptions for the authenticated user. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an [OAuth token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/). + * @tags apps + * @name AppsListSubscriptionsForAuthenticatedUser + * @summary List subscriptions for the authenticated user + * @request GET:/user/marketplace_purchases + */ + export namespace AppsListSubscriptionsForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsListSubscriptionsForAuthenticatedUserData; + } + /** + * @description Lists the active subscriptions for the authenticated user. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an [OAuth token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/). + * @tags apps + * @name AppsListSubscriptionsForAuthenticatedUserStubbed + * @summary List subscriptions for the authenticated user (stubbed) + * @request GET:/user/marketplace_purchases/stubbed + */ + export namespace AppsListSubscriptionsForAuthenticatedUserStubbed { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsListSubscriptionsForAuthenticatedUserStubbedData; + } + /** + * @description Remove a single repository from an installation. The authenticated user must have admin access to the repository. You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint. + * @tags apps + * @name AppsRemoveRepoFromInstallation + * @summary Remove a repository from an app installation + * @request DELETE:/user/installations/{installation_id}/repositories/{repository_id} + */ + export namespace AppsRemoveRepoFromInstallation { + export type RequestParams = { + /** installation_id parameter */ + installationId: number; + repositoryId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsRemoveRepoFromInstallationData; + } + /** + * @description Shows which type of GitHub user can interact with your public repositories and when the restriction expires. If there are no restrictions, you will see an empty response. + * @tags interactions + * @name InteractionsGetRestrictionsForAuthenticatedUser + * @summary Get interaction restrictions for your public repositories + * @request GET:/user/interaction-limits + */ + export namespace InteractionsGetRestrictionsForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = InteractionsGetRestrictionsForAuthenticatedUserData; + } + /** + * @description Removes any interaction restrictions from your public repositories. + * @tags interactions + * @name InteractionsRemoveRestrictionsForAuthenticatedUser + * @summary Remove interaction restrictions from your public repositories + * @request DELETE:/user/interaction-limits + */ + export namespace InteractionsRemoveRestrictionsForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = InteractionsRemoveRestrictionsForAuthenticatedUserData; + } + /** + * @description Temporarily restricts which type of GitHub user can interact with your public repositories. Setting the interaction limit at the user level will overwrite any interaction limits that are set for individual repositories owned by the user. + * @tags interactions + * @name InteractionsSetRestrictionsForAuthenticatedUser + * @summary Set interaction restrictions for your public repositories + * @request PUT:/user/interaction-limits + */ + export namespace InteractionsSetRestrictionsForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = InteractionLimit; + export type RequestHeaders = {}; + export type ResponseBody = InteractionsSetRestrictionsForAuthenticatedUserData; + } + /** + * @description List issues across owned and member repositories assigned to the authenticated user. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * @tags issues + * @name IssuesListForAuthenticatedUser + * @summary List user account issues assigned to the authenticated user + * @request GET:/user/issues + */ + export namespace IssuesListForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: IssuesListForAuthenticatedUserParams1DirectionEnum; + /** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ + filter?: IssuesListForAuthenticatedUserParams1FilterEnum; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: IssuesListForAuthenticatedUserParams1SortEnum; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: IssuesListForAuthenticatedUserParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = IssuesListForAuthenticatedUserData; + } + /** + * @description Deletes a previous migration archive. Downloadable migration archives are automatically deleted after seven days. Migration metadata, which is returned in the [List user migrations](https://docs.github.com/rest/reference/migrations#list-user-migrations) and [Get a user migration status](https://docs.github.com/rest/reference/migrations#get-a-user-migration-status) endpoints, will continue to be available even after an archive is deleted. + * @tags migrations + * @name MigrationsDeleteArchiveForAuthenticatedUser + * @summary Delete a user migration archive + * @request DELETE:/user/migrations/{migration_id}/archive + */ + export namespace MigrationsDeleteArchiveForAuthenticatedUser { + export type RequestParams = { + /** migration_id parameter */ + migrationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsDeleteArchiveForAuthenticatedUserData; + } + /** + * @description Fetches the URL to download the migration archive as a \`tar.gz\` file. Depending on the resources your repository uses, the migration archive can contain JSON files with data for these objects: * attachments * bases * commit\\_comments * issue\\_comments * issue\\_events * issues * milestones * organizations * projects * protected\\_branches * pull\\_request\\_reviews * pull\\_requests * releases * repositories * review\\_comments * schema * users The archive will also contain an \`attachments\` directory that includes all attachment files uploaded to GitHub.com and a \`repositories\` directory that contains the repository's Git data. + * @tags migrations + * @name MigrationsGetArchiveForAuthenticatedUser + * @summary Download a user migration archive + * @request GET:/user/migrations/{migration_id}/archive + */ + export namespace MigrationsGetArchiveForAuthenticatedUser { + export type RequestParams = { + /** migration_id parameter */ + migrationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description Fetches a single user migration. The response includes the \`state\` of the migration, which can be one of the following values: * \`pending\` - the migration hasn't started yet. * \`exporting\` - the migration is in progress. * \`exported\` - the migration finished successfully. * \`failed\` - the migration failed. Once the migration has been \`exported\` you can [download the migration archive](https://docs.github.com/rest/reference/migrations#download-a-user-migration-archive). + * @tags migrations + * @name MigrationsGetStatusForAuthenticatedUser + * @summary Get a user migration status + * @request GET:/user/migrations/{migration_id} + */ + export namespace MigrationsGetStatusForAuthenticatedUser { + export type RequestParams = { + /** migration_id parameter */ + migrationId: number; + }; + export type RequestQuery = { + exclude?: string[]; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsGetStatusForAuthenticatedUserData; + } + /** + * @description Lists all migrations a user has started. + * @tags migrations + * @name MigrationsListForAuthenticatedUser + * @summary List user migrations + * @request GET:/user/migrations + */ + export namespace MigrationsListForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsListForAuthenticatedUserData; + } + /** + * @description Lists all the repositories for this user migration. + * @tags migrations + * @name MigrationsListReposForUser + * @summary List repositories for a user migration + * @request GET:/user/migrations/{migration_id}/repositories + */ + export namespace MigrationsListReposForUser { + export type RequestParams = { + /** migration_id parameter */ + migrationId: number; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsListReposForUserData; + } + /** + * @description Initiates the generation of a user migration archive. + * @tags migrations + * @name MigrationsStartForAuthenticatedUser + * @summary Start a user migration + * @request POST:/user/migrations + */ + export namespace MigrationsStartForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = MigrationsStartForAuthenticatedUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsStartForAuthenticatedUserData; + } + /** + * @description Unlocks a repository. You can lock repositories when you [start a user migration](https://docs.github.com/rest/reference/migrations#start-a-user-migration). Once the migration is complete you can unlock each repository to begin using it again or [delete the repository](https://docs.github.com/rest/reference/repos#delete-a-repository) if you no longer need the source data. Returns a status of \`404 Not Found\` if the repository is not locked. + * @tags migrations + * @name MigrationsUnlockRepoForAuthenticatedUser + * @summary Unlock a user repository + * @request DELETE:/user/migrations/{migration_id}/repos/{repo_name}/lock + */ + export namespace MigrationsUnlockRepoForAuthenticatedUser { + export type RequestParams = { + /** migration_id parameter */ + migrationId: number; + /** repo_name parameter */ + repoName: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MigrationsUnlockRepoForAuthenticatedUserData; + } + /** + * No description + * @tags orgs + * @name OrgsGetMembershipForAuthenticatedUser + * @summary Get an organization membership for the authenticated user + * @request GET:/user/memberships/orgs/{org} + */ + export namespace OrgsGetMembershipForAuthenticatedUser { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsGetMembershipForAuthenticatedUserData; + } + /** + * @description List organizations for the authenticated user. **OAuth scope requirements** This only lists organizations that your authorization allows you to operate on in some way (e.g., you can list teams with \`read:org\` scope, you can publicize your organization membership with \`user\` scope, etc.). Therefore, this API requires at least \`user\` or \`read:org\` scope. OAuth requests with insufficient scope receive a \`403 Forbidden\` response. + * @tags orgs + * @name OrgsListForAuthenticatedUser + * @summary List organizations for the authenticated user + * @request GET:/user/orgs + */ + export namespace OrgsListForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListForAuthenticatedUserData; + } + /** + * No description + * @tags orgs + * @name OrgsListMembershipsForAuthenticatedUser + * @summary List organization memberships for the authenticated user + * @request GET:/user/memberships/orgs + */ + export namespace OrgsListMembershipsForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Indicates the state of the memberships to return. Can be either \`active\` or \`pending\`. If not specified, the API returns both active and pending memberships. */ + state?: OrgsListMembershipsForAuthenticatedUserParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListMembershipsForAuthenticatedUserData; + } + /** + * No description + * @tags orgs + * @name OrgsUpdateMembershipForAuthenticatedUser + * @summary Update an organization membership for the authenticated user + * @request PATCH:/user/memberships/orgs/{org} + */ + export namespace OrgsUpdateMembershipForAuthenticatedUser { + export type RequestParams = { + org: string; + }; + export type RequestQuery = {}; + export type RequestBody = OrgsUpdateMembershipForAuthenticatedUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = OrgsUpdateMembershipForAuthenticatedUserData; + } + /** + * No description + * @tags projects + * @name ProjectsCreateForAuthenticatedUser + * @summary Create a user project + * @request POST:/user/projects + */ + export namespace ProjectsCreateForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = ProjectsCreateForAuthenticatedUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsCreateForAuthenticatedUserData; + } + /** + * No description + * @tags repos + * @name ReposAcceptInvitation + * @summary Accept a repository invitation + * @request PATCH:/user/repository_invitations/{invitation_id} + */ + export namespace ReposAcceptInvitation { + export type RequestParams = { + /** invitation_id parameter */ + invitationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposAcceptInvitationData; + } + /** + * @description Creates a new repository for the authenticated user. **OAuth scope requirements** When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include: * \`public_repo\` scope or \`repo\` scope to create a public repository * \`repo\` scope to create a private repository + * @tags repos + * @name ReposCreateForAuthenticatedUser + * @summary Create a repository for the authenticated user + * @request POST:/user/repos + */ + export namespace ReposCreateForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = ReposCreateForAuthenticatedUserPayload; + export type RequestHeaders = {}; + export type ResponseBody = ReposCreateForAuthenticatedUserData; + } + /** + * No description + * @tags repos + * @name ReposDeclineInvitation + * @summary Decline a repository invitation + * @request DELETE:/user/repository_invitations/{invitation_id} + */ + export namespace ReposDeclineInvitation { + export type RequestParams = { + /** invitation_id parameter */ + invitationId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposDeclineInvitationData; + } + /** + * @description Lists repositories that the authenticated user has explicit permission (\`:read\`, \`:write\`, or \`:admin\`) to access. The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. + * @tags repos + * @name ReposListForAuthenticatedUser + * @summary List repositories for the authenticated user + * @request GET:/user/repos + */ + export namespace ReposListForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Comma-separated list of values. Can include: + * \\* \`owner\`: Repositories that are owned by the authenticated user. + * \\* \`collaborator\`: Repositories that the user has been added to as a collaborator. + * \\* \`organization_member\`: Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on. + * @default "owner,collaborator,organization_member" + */ + affiliation?: string; + /** Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + before?: string; + /** Can be one of \`asc\` or \`desc\`. Default: \`asc\` when using \`full_name\`, otherwise \`desc\` */ + direction?: ReposListForAuthenticatedUserParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "full_name" + */ + sort?: ReposListForAuthenticatedUserParams1SortEnum; + /** + * Can be one of \`all\`, \`owner\`, \`public\`, \`private\`, \`member\`. Default: \`all\` + * + * Will cause a \`422\` error if used in the same request as **visibility** or **affiliation**. Will cause a \`422\` error if used in the same request as **visibility** or **affiliation**. + * @default "all" + */ + type?: ReposListForAuthenticatedUserParams1TypeEnum; + /** + * Can be one of \`all\`, \`public\`, or \`private\`. + * @default "all" + */ + visibility?: ReposListForAuthenticatedUserParams1VisibilityEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListForAuthenticatedUserData; + } + /** + * @description When authenticating as a user, this endpoint will list all currently open repository invitations for that user. + * @tags repos + * @name ReposListInvitationsForAuthenticatedUser + * @summary List repository invitations for the authenticated user + * @request GET:/user/repository_invitations + */ + export namespace ReposListInvitationsForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListInvitationsForAuthenticatedUserData; + } + /** + * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires \`user\`, \`repo\`, or \`read:org\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/) when authenticating via [OAuth](https://docs.github.com/apps/building-oauth-apps/). + * @tags teams + * @name TeamsListForAuthenticatedUser + * @summary List teams for the authenticated user + * @request GET:/user/teams + */ + export namespace TeamsListForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TeamsListForAuthenticatedUserData; + } + /** + * @description This endpoint is accessible with the \`user\` scope. + * @tags users + * @name UsersAddEmailForAuthenticated + * @summary Add an email address for the authenticated user + * @request POST:/user/emails + */ + export namespace UsersAddEmailForAuthenticated { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = UsersAddEmailForAuthenticatedPayload; + export type RequestHeaders = {}; + export type ResponseBody = UsersAddEmailForAuthenticatedData; + } + /** + * No description + * @tags users + * @name UsersBlock + * @summary Block a user + * @request PUT:/user/blocks/{username} + */ + export namespace UsersBlock { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersBlockData; + } + /** + * No description + * @tags users + * @name UsersCheckBlocked + * @summary Check if a user is blocked by the authenticated user + * @request GET:/user/blocks/{username} + */ + export namespace UsersCheckBlocked { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersCheckBlockedData; + } + /** + * No description + * @tags users + * @name UsersCheckPersonIsFollowedByAuthenticated + * @summary Check if a person is followed by the authenticated user + * @request GET:/user/following/{username} + */ + export namespace UsersCheckPersonIsFollowedByAuthenticated { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersCheckPersonIsFollowedByAuthenticatedData; + } + /** + * @description Adds a GPG key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least \`write:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags users + * @name UsersCreateGpgKeyForAuthenticated + * @summary Create a GPG key for the authenticated user + * @request POST:/user/gpg_keys + */ + export namespace UsersCreateGpgKeyForAuthenticated { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = UsersCreateGpgKeyForAuthenticatedPayload; + export type RequestHeaders = {}; + export type ResponseBody = UsersCreateGpgKeyForAuthenticatedData; + } + /** + * @description Adds a public SSH key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least \`write:public_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags users + * @name UsersCreatePublicSshKeyForAuthenticated + * @summary Create a public SSH key for the authenticated user + * @request POST:/user/keys + */ + export namespace UsersCreatePublicSshKeyForAuthenticated { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = UsersCreatePublicSshKeyForAuthenticatedPayload; + export type RequestHeaders = {}; + export type ResponseBody = UsersCreatePublicSshKeyForAuthenticatedData; + } + /** + * @description This endpoint is accessible with the \`user\` scope. + * @tags users + * @name UsersDeleteEmailForAuthenticated + * @summary Delete an email address for the authenticated user + * @request DELETE:/user/emails + */ + export namespace UsersDeleteEmailForAuthenticated { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = UsersDeleteEmailForAuthenticatedPayload; + export type RequestHeaders = {}; + export type ResponseBody = UsersDeleteEmailForAuthenticatedData; + } + /** + * @description Removes a GPG key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least \`admin:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags users + * @name UsersDeleteGpgKeyForAuthenticated + * @summary Delete a GPG key for the authenticated user + * @request DELETE:/user/gpg_keys/{gpg_key_id} + */ + export namespace UsersDeleteGpgKeyForAuthenticated { + export type RequestParams = { + /** gpg_key_id parameter */ + gpgKeyId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersDeleteGpgKeyForAuthenticatedData; + } + /** + * @description Removes a public SSH key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least \`admin:public_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags users + * @name UsersDeletePublicSshKeyForAuthenticated + * @summary Delete a public SSH key for the authenticated user + * @request DELETE:/user/keys/{key_id} + */ + export namespace UsersDeletePublicSshKeyForAuthenticated { + export type RequestParams = { + /** key_id parameter */ + keyId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersDeletePublicSshKeyForAuthenticatedData; + } + /** + * @description Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the \`user:follow\` scope. + * @tags users + * @name UsersFollow + * @summary Follow a user + * @request PUT:/user/following/{username} + */ + export namespace UsersFollow { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersFollowData; + } + /** + * @description If the authenticated user is authenticated through basic authentication or OAuth with the \`user\` scope, then the response lists public and private profile information. If the authenticated user is authenticated through OAuth without the \`user\` scope, then the response lists only public profile information. + * @tags users + * @name UsersGetAuthenticated + * @summary Get the authenticated user + * @request GET:/user + */ + export namespace UsersGetAuthenticated { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersGetAuthenticatedData; + } + /** + * @description View extended details for a single GPG key. Requires that you are authenticated via Basic Auth or via OAuth with at least \`read:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags users + * @name UsersGetGpgKeyForAuthenticated + * @summary Get a GPG key for the authenticated user + * @request GET:/user/gpg_keys/{gpg_key_id} + */ + export namespace UsersGetGpgKeyForAuthenticated { + export type RequestParams = { + /** gpg_key_id parameter */ + gpgKeyId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersGetGpgKeyForAuthenticatedData; + } + /** + * @description View extended details for a single public SSH key. Requires that you are authenticated via Basic Auth or via OAuth with at least \`read:public_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags users + * @name UsersGetPublicSshKeyForAuthenticated + * @summary Get a public SSH key for the authenticated user + * @request GET:/user/keys/{key_id} + */ + export namespace UsersGetPublicSshKeyForAuthenticated { + export type RequestParams = { + /** key_id parameter */ + keyId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersGetPublicSshKeyForAuthenticatedData; + } + /** + * @description List the users you've blocked on your personal account. + * @tags users + * @name UsersListBlockedByAuthenticated + * @summary List users blocked by the authenticated user + * @request GET:/user/blocks + */ + export namespace UsersListBlockedByAuthenticated { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListBlockedByAuthenticatedData; + } + /** + * @description Lists all of your email addresses, and specifies which one is visible to the public. This endpoint is accessible with the \`user:email\` scope. + * @tags users + * @name UsersListEmailsForAuthenticated + * @summary List email addresses for the authenticated user + * @request GET:/user/emails + */ + export namespace UsersListEmailsForAuthenticated { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListEmailsForAuthenticatedData; + } + /** + * @description Lists the people who the authenticated user follows. + * @tags users + * @name UsersListFollowedByAuthenticated + * @summary List the people the authenticated user follows + * @request GET:/user/following + */ + export namespace UsersListFollowedByAuthenticated { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListFollowedByAuthenticatedData; + } + /** + * @description Lists the people following the authenticated user. + * @tags users + * @name UsersListFollowersForAuthenticatedUser + * @summary List followers of the authenticated user + * @request GET:/user/followers + */ + export namespace UsersListFollowersForAuthenticatedUser { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListFollowersForAuthenticatedUserData; + } + /** + * @description Lists the current user's GPG keys. Requires that you are authenticated via Basic Auth or via OAuth with at least \`read:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags users + * @name UsersListGpgKeysForAuthenticated + * @summary List GPG keys for the authenticated user + * @request GET:/user/gpg_keys + */ + export namespace UsersListGpgKeysForAuthenticated { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListGpgKeysForAuthenticatedData; + } + /** + * @description Lists your publicly visible email address, which you can set with the [Set primary email visibility for the authenticated user](https://docs.github.com/rest/reference/users#set-primary-email-visibility-for-the-authenticated-user) endpoint. This endpoint is accessible with the \`user:email\` scope. + * @tags users + * @name UsersListPublicEmailsForAuthenticated + * @summary List public email addresses for the authenticated user + * @request GET:/user/public_emails + */ + export namespace UsersListPublicEmailsForAuthenticated { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListPublicEmailsForAuthenticatedData; + } + /** + * @description Lists the public SSH keys for the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least \`read:public_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @tags users + * @name UsersListPublicSshKeysForAuthenticated + * @summary List public SSH keys for the authenticated user + * @request GET:/user/keys + */ + export namespace UsersListPublicSshKeysForAuthenticated { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListPublicSshKeysForAuthenticatedData; + } + /** + * @description Sets the visibility for your primary email addresses. + * @tags users + * @name UsersSetPrimaryEmailVisibilityForAuthenticated + * @summary Set primary email visibility for the authenticated user + * @request PATCH:/user/email/visibility + */ + export namespace UsersSetPrimaryEmailVisibilityForAuthenticated { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = UsersSetPrimaryEmailVisibilityForAuthenticatedPayload; + export type RequestHeaders = {}; + export type ResponseBody = UsersSetPrimaryEmailVisibilityForAuthenticatedData; + } + /** + * No description + * @tags users + * @name UsersUnblock + * @summary Unblock a user + * @request DELETE:/user/blocks/{username} + */ + export namespace UsersUnblock { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersUnblockData; + } + /** + * @description Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the \`user:follow\` scope. + * @tags users + * @name UsersUnfollow + * @summary Unfollow a user + * @request DELETE:/user/following/{username} + */ + export namespace UsersUnfollow { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersUnfollowData; + } + /** + * @description **Note:** If your email is set to private and you send an \`email\` parameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API. + * @tags users + * @name UsersUpdateAuthenticated + * @summary Update the authenticated user + * @request PATCH:/user + */ + export namespace UsersUpdateAuthenticated { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = UsersUpdateAuthenticatedPayload; + export type RequestHeaders = {}; + export type ResponseBody = UsersUpdateAuthenticatedData; + } +} + +export namespace Users { + /** + * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. + * @tags activity + * @name ActivityListEventsForAuthenticatedUser + * @summary List events for the authenticated user + * @request GET:/users/{username}/events + */ + export namespace ActivityListEventsForAuthenticatedUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListEventsForAuthenticatedUserData; + } + /** + * @description This is the user's organization dashboard. You must be authenticated as the user to view this. + * @tags activity + * @name ActivityListOrgEventsForAuthenticatedUser + * @summary List organization events for the authenticated user + * @request GET:/users/{username}/events/orgs/{org} + */ + export namespace ActivityListOrgEventsForAuthenticatedUser { + export type RequestParams = { + org: string; + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListOrgEventsForAuthenticatedUserData; + } + /** + * No description + * @tags activity + * @name ActivityListPublicEventsForUser + * @summary List public events for a user + * @request GET:/users/{username}/events/public + */ + export namespace ActivityListPublicEventsForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListPublicEventsForUserData; + } + /** + * @description These are events that you've received by watching repos and following users. If you are authenticated as the given user, you will see private events. Otherwise, you'll only see public events. + * @tags activity + * @name ActivityListReceivedEventsForUser + * @summary List events received by the authenticated user + * @request GET:/users/{username}/received_events + */ + export namespace ActivityListReceivedEventsForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListReceivedEventsForUserData; + } + /** + * No description + * @tags activity + * @name ActivityListReceivedPublicEventsForUser + * @summary List public events received by a user + * @request GET:/users/{username}/received_events/public + */ + export namespace ActivityListReceivedPublicEventsForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListReceivedPublicEventsForUserData; + } + /** + * @description Lists repositories a user has starred. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: + * @tags activity + * @name ActivityListReposStarredByUser + * @summary List repositories starred by a user + * @request GET:/users/{username}/starred + */ + export namespace ActivityListReposStarredByUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: ActivityListReposStarredByUserParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: ActivityListReposStarredByUserParams1SortEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListReposStarredByUserData; + } + /** + * @description Lists repositories a user is watching. + * @tags activity + * @name ActivityListReposWatchedByUser + * @summary List repositories watched by a user + * @request GET:/users/{username}/subscriptions + */ + export namespace ActivityListReposWatchedByUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ActivityListReposWatchedByUserData; + } + /** + * @description Enables an authenticated GitHub App to find the user’s installation information. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @tags apps + * @name AppsGetUserInstallation + * @summary Get a user installation for the authenticated app + * @request GET:/users/{username}/installation + */ + export namespace AppsGetUserInstallation { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AppsGetUserInstallationData; + } + /** + * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Access tokens must have the \`user\` scope. + * @tags billing + * @name BillingGetGithubActionsBillingUser + * @summary Get GitHub Actions billing for a user + * @request GET:/users/{username}/settings/billing/actions + */ + export namespace BillingGetGithubActionsBillingUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = BillingGetGithubActionsBillingUserData; + } + /** + * @description Gets the free and paid storage used for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`user\` scope. + * @tags billing + * @name BillingGetGithubPackagesBillingUser + * @summary Get GitHub Packages billing for a user + * @request GET:/users/{username}/settings/billing/packages + */ + export namespace BillingGetGithubPackagesBillingUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = BillingGetGithubPackagesBillingUserData; + } + /** + * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`user\` scope. + * @tags billing + * @name BillingGetSharedStorageBillingUser + * @summary Get shared storage billing for a user + * @request GET:/users/{username}/settings/billing/shared-storage + */ + export namespace BillingGetSharedStorageBillingUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = BillingGetSharedStorageBillingUserData; + } + /** + * @description Lists public gists for the specified user: + * @tags gists + * @name GistsListForUser + * @summary List gists for a user + * @request GET:/users/{username}/gists + */ + export namespace GistsListForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GistsListForUserData; + } + /** + * @description List [public organization memberships](https://help.github.com/articles/publicizing-or-concealing-organization-membership) for the specified user. This method only lists _public_ memberships, regardless of authentication. If you need to fetch all of the organization memberships (public and private) for the authenticated user, use the [List organizations for the authenticated user](https://docs.github.com/rest/reference/orgs#list-organizations-for-the-authenticated-user) API instead. + * @tags orgs + * @name OrgsListForUser + * @summary List organizations for a user + * @request GET:/users/{username}/orgs + */ + export namespace OrgsListForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = OrgsListForUserData; + } + /** + * No description + * @tags projects + * @name ProjectsListForUser + * @summary List user projects + * @request GET:/users/{username}/projects + */ + export namespace ProjectsListForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: ProjectsListForUserParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProjectsListForUserData; + } + /** + * @description Lists public repositories for the specified user. + * @tags repos + * @name ReposListForUser + * @summary List repositories for a user + * @request GET:/users/{username}/repos + */ + export namespace ReposListForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** Can be one of \`asc\` or \`desc\`. Default: \`asc\` when using \`full_name\`, otherwise \`desc\` */ + direction?: ReposListForUserParams1DirectionEnum; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "full_name" + */ + sort?: ReposListForUserParams1SortEnum; + /** + * Can be one of \`all\`, \`owner\`, \`member\`. + * @default "owner" + */ + type?: ReposListForUserParams1TypeEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ReposListForUserData; + } + /** + * No description + * @tags users + * @name UsersCheckFollowingForUser + * @summary Check if a user follows another user + * @request GET:/users/{username}/following/{target_user} + */ + export namespace UsersCheckFollowingForUser { + export type RequestParams = { + targetUser: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersCheckFollowingForUserData; + } + /** + * @description Provides publicly available information about someone with a GitHub account. GitHub Apps with the \`Plan\` user permission can use this endpoint to retrieve information about a user's GitHub plan. The GitHub App must be authenticated as a user. See "[Identifying and authorizing users for GitHub Apps](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/)" for details about authentication. For an example response, see 'Response with GitHub plan information' below" The \`email\` key in the following response is the publicly visible email address from your GitHub [profile page](https://github.com/settings/profile). When setting up your profile, you can select a primary email address to be “public” which provides an email entry for this endpoint. If you do not set a public email address for \`email\`, then it will have a value of \`null\`. You only see publicly visible email addresses when authenticated with GitHub. For more information, see [Authentication](https://docs.github.com/rest/overview/resources-in-the-rest-api#authentication). The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see "[Emails API](https://docs.github.com/rest/reference/users#emails)". + * @tags users + * @name UsersGetByUsername + * @summary Get a user + * @request GET:/users/{username} + */ + export namespace UsersGetByUsername { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersGetByUsernameData; + } + /** + * @description Provides hovercard information when authenticated through basic auth or OAuth with the \`repo\` scope. You can find out more about someone in relation to their pull requests, issues, repositories, and organizations. The \`subject_type\` and \`subject_id\` parameters provide context for the person's hovercard, which returns more information than without the parameters. For example, if you wanted to find out more about \`octocat\` who owns the \`Spoon-Knife\` repository via cURL, it would look like this: \`\`\`shell curl -u username:token https://api.github.com/users/octocat/hovercard?subject_type=repository&subject_id=1300192 \`\`\` + * @tags users + * @name UsersGetContextForUser + * @summary Get contextual information for a user + * @request GET:/users/{username}/hovercard + */ + export namespace UsersGetContextForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** Uses the ID for the \`subject_type\` you specified. **Required** when using \`subject_type\`. */ + subject_id?: string; + /** Identifies which additional information you'd like to receive about the person's hovercard. Can be \`organization\`, \`repository\`, \`issue\`, \`pull_request\`. **Required** when using \`subject_id\`. */ + subject_type?: UsersGetContextForUserParams1SubjectTypeEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersGetContextForUserData; + } + /** + * @description Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts. Note: Pagination is powered exclusively by the \`since\` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of users. + * @tags users + * @name UsersList + * @summary List users + * @request GET:/users + */ + export namespace UsersList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** A user ID. Only return users with an ID greater than this ID. */ + since?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListData; + } + /** + * @description Lists the people following the specified user. + * @tags users + * @name UsersListFollowersForUser + * @summary List followers of a user + * @request GET:/users/{username}/followers + */ + export namespace UsersListFollowersForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListFollowersForUserData; + } + /** + * @description Lists the people who the specified user follows. + * @tags users + * @name UsersListFollowingForUser + * @summary List the people a user follows + * @request GET:/users/{username}/following + */ + export namespace UsersListFollowingForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListFollowingForUserData; + } + /** + * @description Lists the GPG keys for a user. This information is accessible by anyone. + * @tags users + * @name UsersListGpgKeysForUser + * @summary List GPG keys for a user + * @request GET:/users/{username}/gpg_keys + */ + export namespace UsersListGpgKeysForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListGpgKeysForUserData; + } + /** + * @description Lists the _verified_ public SSH keys for a user. This is accessible by anyone. + * @tags users + * @name UsersListPublicKeysForUser + * @summary List public keys for a user + * @request GET:/users/{username}/keys + */ + export namespace UsersListPublicKeysForUser { + export type RequestParams = { + username: string; + }; + export type RequestQuery = { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = UsersListPublicKeysForUserData; + } +} + +export namespace Zen { + /** + * @description Get a random sentence from the Zen of GitHub + * @tags meta + * @name MetaGetZen + * @summary Get the Zen of GitHub + * @request GET:/zen + */ + export namespace MetaGetZen { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MetaGetZenData; + } +} + +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://api.github.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) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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 v3 REST API + * @version 1.1.4 + * @license MIT (https://spdx.org/licenses/MIT) + * @termsOfService https://docs.github.com/articles/github-terms-of-service + * @baseUrl https://api.github.com + * @externalDocs https://docs.github.com/rest/ + * @contact Support (https://support.github.com/contact) + * + * GitHub's v3 REST API. + */ +export class Api extends HttpClient { + /** + * @description Get Hypermedia links to resources accessible in GitHub's REST API + * + * @tags meta + * @name MetaRoot + * @summary GitHub API Root + * @request GET:/ + */ + metaRoot = (params: RequestParams = {}) => + this.request({ + path: \`/\`, + method: "GET", + ...params, + }); + + app = { + /** + * @description Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of \`401 - Unauthorized\`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. To restrict the access to specific repositories, you can provide the \`repository_ids\` when creating the token. When you omit \`repository_ids\`, the response does not contain the \`repositories\` key. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsCreateInstallationAccessToken + * @summary Create an installation access token for an app + * @request POST:/app/installations/{installation_id}/access_tokens + */ + appsCreateInstallationAccessToken: ( + installationId: number, + data: AppsCreateInstallationAccessTokenPayload, + params: RequestParams = {}, + ) => + this.request< + AppsCreateInstallationAccessTokenData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/app/installations/\${installationId}/access_tokens\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Uninstalls a GitHub App on a user, organization, or business account. If you prefer to temporarily suspend an app's access to your account's resources, then we recommend the "[Suspend an app installation](https://docs.github.com/v3/apps/#suspend-an-app-installation)" endpoint. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsDeleteInstallation + * @summary Delete an installation for the authenticated app + * @request DELETE:/app/installations/{installation_id} + */ + appsDeleteInstallation: (installationId: number, params: RequestParams = {}) => + this.request({ + path: \`/app/installations/\${installationId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Returns the GitHub App associated with the authentication credentials used. To see how many app installations are associated with this GitHub App, see the \`installations_count\` in the response. For more details about your app's installations, see the "[List installations for the authenticated app](https://docs.github.com/rest/reference/apps#list-installations-for-the-authenticated-app)" endpoint. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsGetAuthenticated + * @summary Get the authenticated app + * @request GET:/app + */ + appsGetAuthenticated: (params: RequestParams = {}) => + this.request({ + path: \`/app\`, + method: "GET", + ...params, + }), + + /** + * @description Enables an authenticated GitHub App to find an installation's information using the installation id. The installation's account type (\`target_type\`) will be either an organization or a user account, depending which account the repository belongs to. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsGetInstallation + * @summary Get an installation for the authenticated app + * @request GET:/app/installations/{installation_id} + */ + appsGetInstallation: (installationId: number, params: RequestParams = {}) => + this.request< + AppsGetInstallationData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/app/installations/\${installationId}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)." You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsGetWebhookConfigForApp + * @summary Get a webhook configuration for an app + * @request GET:/app/hook/config + */ + appsGetWebhookConfigForApp: (params: RequestParams = {}) => + this.request({ + path: \`/app/hook/config\`, + method: "GET", + ...params, + }), + + /** + * @description You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. The permissions the installation has are included under the \`permissions\` key. + * + * @tags apps + * @name AppsListInstallations + * @summary List installations for the authenticated app + * @request GET:/app/installations + */ + appsListInstallations: (query: AppsListInstallationsParams, params: RequestParams = {}) => + this.request({ + path: \`/app/installations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Note:** Suspending a GitHub App installation is currently in beta and subject to change. Before you can suspend a GitHub App, the app owner must enable suspending installations for the app by opting-in to the beta. For more information, see "[Suspending a GitHub App installation](https://docs.github.com/apps/managing-github-apps/suspending-a-github-app-installation/)." Suspends a GitHub App on a user, organization, or business account, which blocks the app from accessing the account's resources. When a GitHub App is suspended, the app's access to the GitHub API or webhook events is blocked for that account. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsSuspendInstallation + * @summary Suspend an app installation + * @request PUT:/app/installations/{installation_id}/suspended + */ + appsSuspendInstallation: (installationId: number, params: RequestParams = {}) => + this.request({ + path: \`/app/installations/\${installationId}/suspended\`, + method: "PUT", + ...params, + }), + + /** + * @description **Note:** Suspending a GitHub App installation is currently in beta and subject to change. Before you can suspend a GitHub App, the app owner must enable suspending installations for the app by opting-in to the beta. For more information, see "[Suspending a GitHub App installation](https://docs.github.com/apps/managing-github-apps/suspending-a-github-app-installation/)." Removes a GitHub App installation suspension. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsUnsuspendInstallation + * @summary Unsuspend an app installation + * @request DELETE:/app/installations/{installation_id}/suspended + */ + appsUnsuspendInstallation: (installationId: number, params: RequestParams = {}) => + this.request({ + path: \`/app/installations/\${installationId}/suspended\`, + method: "DELETE", + ...params, + }), + + /** + * @description Updates the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)." You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsUpdateWebhookConfigForApp + * @summary Update a webhook configuration for an app + * @request PATCH:/app/hook/config + */ + appsUpdateWebhookConfigForApp: (data: AppsUpdateWebhookConfigForAppPayload, params: RequestParams = {}) => + this.request({ + path: \`/app/hook/config\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; + appManifests = { + /** + * @description Use this endpoint to complete the handshake necessary when implementing the [GitHub App Manifest flow](https://docs.github.com/apps/building-github-apps/creating-github-apps-from-a-manifest/). When you create a GitHub App with the manifest flow, you receive a temporary \`code\` used to retrieve the GitHub App's \`id\`, \`pem\` (private key), and \`webhook_secret\`. + * + * @tags apps + * @name AppsCreateFromManifest + * @summary Create a GitHub App from a manifest + * @request POST:/app-manifests/{code}/conversions + */ + appsCreateFromManifest: (code: string, params: RequestParams = {}) => + this.request({ + path: \`/app-manifests/\${code}/conversions\`, + method: "POST", + ...params, + }), + }; + applications = { + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * + * @tags apps + * @name AppsCheckAuthorization + * @summary Check an authorization + * @request GET:/applications/{client_id}/tokens/{access_token} + * @deprecated + */ + appsCheckAuthorization: (clientId: string, accessToken: string, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/tokens/\${accessToken}\`, + method: "GET", + ...params, + }), + + /** + * @description OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) to use this endpoint, where the username is the OAuth application \`client_id\` and the password is its \`client_secret\`. Invalid tokens will return \`404 NOT FOUND\`. + * + * @tags apps + * @name AppsCheckToken + * @summary Check a token + * @request POST:/applications/{client_id}/token + */ + appsCheckToken: (clientId: string, data: AppsCheckTokenPayload, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/token\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. You must also provide a valid OAuth \`access_token\` as an input parameter and the grant for the token's owner will be deleted. Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). + * + * @tags apps + * @name AppsDeleteAuthorization + * @summary Delete an app authorization + * @request DELETE:/applications/{client_id}/grant + */ + appsDeleteAuthorization: (clientId: string, data: AppsDeleteAuthorizationPayload, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/grant\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. + * + * @tags apps + * @name AppsDeleteToken + * @summary Delete an app token + * @request DELETE:/applications/{client_id}/token + */ + appsDeleteToken: (clientId: string, data: AppsDeleteTokenPayload, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/token\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * + * @tags apps + * @name AppsResetAuthorization + * @summary Reset an authorization + * @request POST:/applications/{client_id}/tokens/{access_token} + * @deprecated + */ + appsResetAuthorization: (clientId: string, accessToken: string, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/tokens/\${accessToken}\`, + method: "POST", + ...params, + }), + + /** + * @description OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * + * @tags apps + * @name AppsResetToken + * @summary Reset a token + * @request PATCH:/applications/{client_id}/token + */ + appsResetToken: (clientId: string, data: AppsResetTokenPayload, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/token\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. + * + * @tags apps + * @name AppsRevokeAuthorizationForApplication + * @summary Revoke an authorization for an application + * @request DELETE:/applications/{client_id}/tokens/{access_token} + * @deprecated + */ + appsRevokeAuthorizationForApplication: (clientId: string, accessToken: string, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/tokens/\${accessToken}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. You must also provide a valid token as \`:access_token\` and the grant for the token's owner will be deleted. Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the Applications settings page under "Authorized OAuth Apps" on GitHub](https://github.com/settings/applications#authorized). + * + * @tags apps + * @name AppsRevokeGrantForApplication + * @summary Revoke a grant for an application + * @request DELETE:/applications/{client_id}/grants/{access_token} + * @deprecated + */ + appsRevokeGrantForApplication: (clientId: string, accessToken: string, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/grants/\${accessToken}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Exchanges a non-repository scoped user-to-server OAuth access token for a repository scoped user-to-server OAuth access token. You can specify which repositories the token can access and which permissions are granted to the token. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * + * @tags apps + * @name AppsScopeToken + * @summary Create a scoped access token + * @request POST:/applications/{client_id}/token/scoped + */ + appsScopeToken: (clientId: string, data: AppsScopeTokenPayload, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/token/scoped\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user. Once deleted, the application has no access to your account and is no longer listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsDeleteGrant + * @summary Delete a grant + * @request DELETE:/applications/grants/{grant_id} + * @deprecated + */ + oauthAuthorizationsDeleteGrant: (grantId: number, params: RequestParams = {}) => + this.request({ + path: \`/applications/grants/\${grantId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsGetGrant + * @summary Get a single grant + * @request GET:/applications/grants/{grant_id} + * @deprecated + */ + oauthAuthorizationsGetGrant: (grantId: number, params: RequestParams = {}) => + this.request({ + path: \`/applications/grants/\${grantId}\`, + method: "GET", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the [list your authorizations](https://docs.github.com/rest/reference/oauth-authorizations#list-your-authorizations) API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). The \`scopes\` returned are the union of scopes authorized for the application. For example, if an application has one token with \`repo\` scope and another token with \`user\` scope, the grant will return \`["repo", "user"]\`. + * + * @tags oauth-authorizations + * @name OauthAuthorizationsListGrants + * @summary List your grants + * @request GET:/applications/grants + * @deprecated + */ + oauthAuthorizationsListGrants: (query: OauthAuthorizationsListGrantsParams, params: RequestParams = {}) => + this.request({ + path: \`/applications/grants\`, + method: "GET", + query: query, + ...params, + }), + }; + apps = { + /** + * @description **Note**: The \`:app_slug\` is just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., \`https://github.com/settings/apps/:app_slug\`). If the GitHub App you specify is public, you can access this endpoint without authenticating. If the GitHub App you specify is private, you must authenticate with a [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) or an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * + * @tags apps + * @name AppsGetBySlug + * @summary Get an app + * @request GET:/apps/{app_slug} + */ + appsGetBySlug: (appSlug: string, params: RequestParams = {}) => + this.request< + AppsGetBySlugData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/apps/\${appSlug}\`, + method: "GET", + ...params, + }), + }; + authorizations = { + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). Creates OAuth tokens using [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication). If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." To create tokens for a particular OAuth application using this endpoint, you must authenticate as the user you want to create an authorization for and provide the app's client ID and secret, found on your OAuth application's settings page. If your OAuth application intends to create multiple tokens for one user, use \`fingerprint\` to differentiate between them. You can also create tokens on GitHub from the [personal access tokens settings](https://github.com/settings/tokens) page. Read more about these tokens in [the GitHub Help documentation](https://help.github.com/articles/creating-an-access-token-for-command-line-use). Organizations that enforce SAML SSO require personal access tokens to be allowed. Read more about allowing tokens in [the GitHub Help documentation](https://help.github.com/articles/about-identity-and-access-management-with-saml-single-sign-on). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsCreateAuthorization + * @summary Create a new authorization + * @request POST:/authorizations + * @deprecated + */ + oauthAuthorizationsCreateAuthorization: ( + data: OauthAuthorizationsCreateAuthorizationPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/authorizations\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsDeleteAuthorization + * @summary Delete an authorization + * @request DELETE:/authorizations/{authorization_id} + * @deprecated + */ + oauthAuthorizationsDeleteAuthorization: (authorizationId: number, params: RequestParams = {}) => + this.request({ + path: \`/authorizations/\${authorizationId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsGetAuthorization + * @summary Get a single authorization + * @request GET:/authorizations/{authorization_id} + * @deprecated + */ + oauthAuthorizationsGetAuthorization: (authorizationId: number, params: RequestParams = {}) => + this.request({ + path: \`/authorizations/\${authorizationId}\`, + method: "GET", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). Creates a new authorization for the specified OAuth application, only if an authorization for that application doesn't already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one. If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsGetOrCreateAuthorizationForApp + * @summary Get-or-create an authorization for a specific app + * @request PUT:/authorizations/clients/{client_id} + * @deprecated + */ + oauthAuthorizationsGetOrCreateAuthorizationForApp: ( + clientId: string, + data: OauthAuthorizationsGetOrCreateAuthorizationForAppPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/authorizations/clients/\${clientId}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). This method will create a new authorization for the specified OAuth application, only if an authorization for that application and fingerprint do not already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. \`fingerprint\` is a unique string to distinguish an authorization from others created for the same client ID and user. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one. If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." + * + * @tags oauth-authorizations + * @name OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint + * @summary Get-or-create an authorization for a specific app and fingerprint + * @request PUT:/authorizations/clients/{client_id}/{fingerprint} + * @deprecated + */ + oauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint: ( + clientId: string, + fingerprint: string, + data: OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprintPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/authorizations/clients/\${clientId}/\${fingerprint}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsListAuthorizations + * @summary List your authorizations + * @request GET:/authorizations + * @deprecated + */ + oauthAuthorizationsListAuthorizations: ( + query: OauthAuthorizationsListAuthorizationsParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/authorizations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." You can only send one of these scope keys at a time. + * + * @tags oauth-authorizations + * @name OauthAuthorizationsUpdateAuthorization + * @summary Update an existing authorization + * @request PATCH:/authorizations/{authorization_id} + * @deprecated + */ + oauthAuthorizationsUpdateAuthorization: ( + authorizationId: number, + data: OauthAuthorizationsUpdateAuthorizationPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/authorizations/\${authorizationId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; + codesOfConduct = { + /** + * No description + * + * @tags codes-of-conduct + * @name CodesOfConductGetAllCodesOfConduct + * @summary Get all codes of conduct + * @request GET:/codes_of_conduct + */ + codesOfConductGetAllCodesOfConduct: (params: RequestParams = {}) => + this.request< + CodesOfConductGetAllCodesOfConductData, + { + documentation_url: string; + message: string; + } + >({ + path: \`/codes_of_conduct\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags codes-of-conduct + * @name CodesOfConductGetConductCode + * @summary Get a code of conduct + * @request GET:/codes_of_conduct/{key} + */ + codesOfConductGetConductCode: (key: string, params: RequestParams = {}) => + this.request< + CodesOfConductGetConductCodeData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/codes_of_conduct/\${key}\`, + method: "GET", + ...params, + }), + }; + contentReferences = { + /** + * @description Creates an attachment under a content reference URL in the body or comment of an issue or pull request. Use the \`id\` of the content reference from the [\`content_reference\` event](https://docs.github.com/webhooks/event-payloads/#content_reference) to create an attachment. The app must create a content attachment within six hours of the content reference URL being posted. See "[Using content attachments](https://docs.github.com/apps/using-content-attachments/)" for details about content attachments. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * + * @tags apps + * @name AppsCreateContentAttachment + * @summary Create a content attachment + * @request POST:/content_references/{content_reference_id}/attachments + */ + appsCreateContentAttachment: ( + contentReferenceId: number, + data: AppsCreateContentAttachmentPayload, + params: RequestParams = {}, + ) => + this.request< + AppsCreateContentAttachmentData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/content_references/\${contentReferenceId}/attachments\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + }; + emojis = { + /** + * @description Lists all the emojis available to use on GitHub. + * + * @tags emojis + * @name EmojisGet + * @summary Get emojis + * @request GET:/emojis + */ + emojisGet: (params: RequestParams = {}) => + this.request({ + path: \`/emojis\`, + method: "GET", + ...params, + }), + }; + enterprises = { + /** + * @description **Note:** The audit log REST API is currently in beta and is subject to change. Gets the audit log for an enterprise. To use this endpoint, you must be an enterprise admin, and you must use an access token with the \`admin:enterprise\` scope. + * + * @tags audit-log + * @name AuditLogGetAuditLog + * @summary Get the audit log for an enterprise + * @request GET:/enterprises/{enterprise}/audit-log + */ + auditLogGetAuditLog: ({ enterprise, ...query }: AuditLogGetAuditLogParams, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/audit-log\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". The authenticated user must be an enterprise admin. + * + * @tags billing + * @name BillingGetGithubActionsBillingGhe + * @summary Get GitHub Actions billing for an enterprise + * @request GET:/enterprises/{enterprise}/settings/billing/actions + */ + billingGetGithubActionsBillingGhe: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/settings/billing/actions\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the free and paid storage used for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." The authenticated user must be an enterprise admin. + * + * @tags billing + * @name BillingGetGithubPackagesBillingGhe + * @summary Get GitHub Packages billing for an enterprise + * @request GET:/enterprises/{enterprise}/settings/billing/packages + */ + billingGetGithubPackagesBillingGhe: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/settings/billing/packages\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." The authenticated user must be an enterprise admin. + * + * @tags billing + * @name BillingGetSharedStorageBillingGhe + * @summary Get shared storage billing for an enterprise + * @request GET:/enterprises/{enterprise}/settings/billing/shared-storage + */ + billingGetSharedStorageBillingGhe: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/settings/billing/shared-storage\`, + method: "GET", + ...params, + }), + + /** + * @description Adds an organization to the list of selected organizations that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary Add organization access to a self-hosted runner group in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} + */ + enterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise: ( + enterprise: string, + runnerGroupId: number, + orgId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/organizations/\${orgId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Adds a self-hosted runner to a runner group configured in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminAddSelfHostedRunnerToGroupForEnterprise + * @summary Add a self-hosted runner to a group for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + enterpriseAdminAddSelfHostedRunnerToGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/runners/\${runnerId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Returns a token that you can pass to the \`config\` script. The token expires after one hour. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing \`TOKEN\` with the registration token provided by this endpoint. \`\`\` ./config.sh --url https://github.com/enterprises/octo-enterprise --token TOKEN \`\`\` + * + * @tags enterprise-admin + * @name EnterpriseAdminCreateRegistrationTokenForEnterprise + * @summary Create a registration token for an enterprise + * @request POST:/enterprises/{enterprise}/actions/runners/registration-token + */ + enterpriseAdminCreateRegistrationTokenForEnterprise: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners/registration-token\`, + method: "POST", + ...params, + }), + + /** + * @description Returns a token that you can pass to the \`config\` script to remove a self-hosted runner from an enterprise. The token expires after one hour. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from an enterprise, replace \`TOKEN\` with the remove token provided by this endpoint. \`\`\` ./config.sh remove --token TOKEN \`\`\` + * + * @tags enterprise-admin + * @name EnterpriseAdminCreateRemoveTokenForEnterprise + * @summary Create a remove token for an enterprise + * @request POST:/enterprises/{enterprise}/actions/runners/remove-token + */ + enterpriseAdminCreateRemoveTokenForEnterprise: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners/remove-token\`, + method: "POST", + ...params, + }), + + /** + * @description Creates a new self-hosted runner group for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminCreateSelfHostedRunnerGroupForEnterprise + * @summary Create a self-hosted runner group for an enterprise + * @request POST:/enterprises/{enterprise}/actions/runner-groups + */ + enterpriseAdminCreateSelfHostedRunnerGroupForEnterprise: ( + enterprise: string, + data: EnterpriseAdminCreateSelfHostedRunnerGroupForEnterprisePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Forces the removal of a self-hosted runner from an enterprise. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminDeleteSelfHostedRunnerFromEnterprise + * @summary Delete a self-hosted runner from an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runners/{runner_id} + */ + enterpriseAdminDeleteSelfHostedRunnerFromEnterprise: ( + enterprise: string, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners/\${runnerId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Deletes a self-hosted runner group for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise + * @summary Delete a self-hosted runner group from an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + */ + enterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise: ( + enterprise: string, + runnerGroupId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise + * @summary Disable a selected organization for GitHub Actions in an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/permissions/organizations/{org_id} + */ + enterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise: ( + enterprise: string, + orgId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/organizations/\${orgId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise + * @summary Enable a selected organization for GitHub Actions in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions/organizations/{org_id} + */ + enterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise: ( + enterprise: string, + orgId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/organizations/\${orgId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Gets the selected actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminGetAllowedActionsEnterprise + * @summary Get allowed actions for an enterprise + * @request GET:/enterprises/{enterprise}/actions/permissions/selected-actions + */ + enterpriseAdminGetAllowedActionsEnterprise: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/selected-actions\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminGetGithubActionsPermissionsEnterprise + * @summary Get GitHub Actions permissions for an enterprise + * @request GET:/enterprises/{enterprise}/actions/permissions + */ + enterpriseAdminGetGithubActionsPermissionsEnterprise: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a specific self-hosted runner configured in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminGetSelfHostedRunnerForEnterprise + * @summary Get a self-hosted runner for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runners/{runner_id} + */ + enterpriseAdminGetSelfHostedRunnerForEnterprise: ( + enterprise: string, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners/\${runnerId}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a specific self-hosted runner group for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminGetSelfHostedRunnerGroupForEnterprise + * @summary Get a self-hosted runner group for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + */ + enterpriseAdminGetSelfHostedRunnerGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}\`, + method: "GET", + ...params, + }), + + /** + * @description Lists the organizations with access to a self-hosted runner group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary List organization access to a self-hosted runner group in an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations + */ + enterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise: ( + { enterprise, runnerGroupId, ...query }: EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/organizations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists binaries for the runner application that you can download and run. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListRunnerApplicationsForEnterprise + * @summary List runner applications for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runners/downloads + */ + enterpriseAdminListRunnerApplicationsForEnterprise: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners/downloads\`, + method: "GET", + ...params, + }), + + /** + * @description Lists the organizations that are selected to have GitHub Actions enabled in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise + * @summary List selected organizations enabled for GitHub Actions in an enterprise + * @request GET:/enterprises/{enterprise}/actions/permissions/organizations + */ + enterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise: ( + { enterprise, ...query }: EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/organizations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all self-hosted runner groups for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListSelfHostedRunnerGroupsForEnterprise + * @summary List self-hosted runner groups for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups + */ + enterpriseAdminListSelfHostedRunnerGroupsForEnterprise: ( + { enterprise, ...query }: EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all self-hosted runners configured for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListSelfHostedRunnersForEnterprise + * @summary List self-hosted runners for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runners + */ + enterpriseAdminListSelfHostedRunnersForEnterprise: ( + { enterprise, ...query }: EnterpriseAdminListSelfHostedRunnersForEnterpriseParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the self-hosted runners that are in a specific enterprise group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListSelfHostedRunnersInGroupForEnterprise + * @summary List self-hosted runners in a group for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners + */ + enterpriseAdminListSelfHostedRunnersInGroupForEnterprise: ( + { enterprise, runnerGroupId, ...query }: EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/runners\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Removes an organization from the list of selected organizations that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary Remove organization access to a self-hosted runner group in an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} + */ + enterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise: ( + enterprise: string, + runnerGroupId: number, + orgId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/organizations/\${orgId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Removes a self-hosted runner from a group configured in an enterprise. The runner is then returned to the default group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise + * @summary Remove a self-hosted runner from a group for an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + enterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/runners/\${runnerId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Sets the actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetAllowedActionsEnterprise + * @summary Set allowed actions for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions/selected-actions + */ + enterpriseAdminSetAllowedActionsEnterprise: ( + enterprise: string, + data: SelectedActions, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/selected-actions\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Sets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetGithubActionsPermissionsEnterprise + * @summary Set GitHub Actions permissions for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions + */ + enterpriseAdminSetGithubActionsPermissionsEnterprise: ( + enterprise: string, + data: EnterpriseAdminSetGithubActionsPermissionsEnterprisePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Replaces the list of organizations that have access to a self-hosted runner configured in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary Set organization access for a self-hosted runner group in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations + */ + enterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise: ( + enterprise: string, + runnerGroupId: number, + data: EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprisePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/organizations\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise + * @summary Set selected organizations enabled for GitHub Actions in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions/organizations + */ + enterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise: ( + enterprise: string, + data: EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprisePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/organizations\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Replaces the list of self-hosted runners that are part of an enterprise runner group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetSelfHostedRunnersInGroupForEnterprise + * @summary Set self-hosted runners in a group for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners + */ + enterpriseAdminSetSelfHostedRunnersInGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + data: EnterpriseAdminSetSelfHostedRunnersInGroupForEnterprisePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/runners\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Updates the \`name\` and \`visibility\` of a self-hosted runner group in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise + * @summary Update a self-hosted runner group for an enterprise + * @request PATCH:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + */ + enterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + data: EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprisePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; + events = { + /** + * @description We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago. + * + * @tags activity + * @name ActivityListPublicEvents + * @summary List public events + * @request GET:/events + */ + activityListPublicEvents: (query: ActivityListPublicEventsParams, params: RequestParams = {}) => + this.request< + ActivityListPublicEventsData, + | BasicError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/events\`, + method: "GET", + query: query, + ...params, + }), + }; + feeds = { + /** + * @description GitHub provides several timeline resources in [Atom](http://en.wikipedia.org/wiki/Atom_(standard)) format. The Feeds API lists all the feeds available to the authenticated user: * **Timeline**: The GitHub global public timeline * **User**: The public timeline for any user, using [URI template](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia) * **Current user public**: The public timeline for the authenticated user * **Current user**: The private timeline for the authenticated user * **Current user actor**: The private timeline for activity created by the authenticated user * **Current user organizations**: The private timeline for the organizations the authenticated user is a member of. * **Security advisories**: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub. **Note**: Private feeds are only returned when [authenticating via Basic Auth](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) since current feed URIs use the older, non revocable auth tokens. + * + * @tags activity + * @name ActivityGetFeeds + * @summary Get feeds + * @request GET:/feeds + */ + activityGetFeeds: (params: RequestParams = {}) => + this.request({ + path: \`/feeds\`, + method: "GET", + ...params, + }), + }; + gists = { + /** + * No description + * + * @tags gists + * @name GistsCheckIsStarred + * @summary Check if a gist is starred + * @request GET:/gists/{gist_id}/star + */ + gistsCheckIsStarred: (gistId: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/star\`, + method: "GET", + ...params, + }), + + /** + * @description Allows you to add a new gist with one or more files. **Note:** Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally. + * + * @tags gists + * @name GistsCreate + * @summary Create a gist + * @request POST:/gists + */ + gistsCreate: (data: GistsCreatePayload, params: RequestParams = {}) => + this.request({ + path: \`/gists\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsCreateComment + * @summary Create a gist comment + * @request POST:/gists/{gist_id}/comments + */ + gistsCreateComment: (gistId: string, data: GistsCreateCommentPayload, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/comments\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsDelete + * @summary Delete a gist + * @request DELETE:/gists/{gist_id} + */ + gistsDelete: (gistId: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsDeleteComment + * @summary Delete a gist comment + * @request DELETE:/gists/{gist_id}/comments/{comment_id} + */ + gistsDeleteComment: (gistId: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/comments/\${commentId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note**: This was previously \`/gists/:gist_id/fork\`. + * + * @tags gists + * @name GistsFork + * @summary Fork a gist + * @request POST:/gists/{gist_id}/forks + */ + gistsFork: (gistId: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/forks\`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsGet + * @summary Get a gist + * @request GET:/gists/{gist_id} + */ + gistsGet: (gistId: string, params: RequestParams = {}) => + this.request< + GistsGetData, + | { + block?: { + created_at?: string; + html_url?: string | null; + reason?: string; + }; + documentation_url?: string; + message?: string; + } + | BasicError + >({ + path: \`/gists/\${gistId}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsGetComment + * @summary Get a gist comment + * @request GET:/gists/{gist_id}/comments/{comment_id} + */ + gistsGetComment: (gistId: string, commentId: number, params: RequestParams = {}) => + this.request< + GistsGetCommentData, + | { + block?: { + created_at?: string; + html_url?: string | null; + reason?: string; + }; + documentation_url?: string; + message?: string; + } + | BasicError + >({ + path: \`/gists/\${gistId}/comments/\${commentId}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsGetRevision + * @summary Get a gist revision + * @request GET:/gists/{gist_id}/{sha} + */ + gistsGetRevision: (gistId: string, sha: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/\${sha}\`, + method: "GET", + ...params, + }), + + /** + * @description Lists the authenticated user's gists or if called anonymously, this endpoint returns all public gists: + * + * @tags gists + * @name GistsList + * @summary List gists for the authenticated user + * @request GET:/gists + */ + gistsList: (query: GistsListParams, params: RequestParams = {}) => + this.request({ + path: \`/gists\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsListComments + * @summary List gist comments + * @request GET:/gists/{gist_id}/comments + */ + gistsListComments: ({ gistId, ...query }: GistsListCommentsParams, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/comments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsListCommits + * @summary List gist commits + * @request GET:/gists/{gist_id}/commits + */ + gistsListCommits: ({ gistId, ...query }: GistsListCommitsParams, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/commits\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsListForks + * @summary List gist forks + * @request GET:/gists/{gist_id}/forks + */ + gistsListForks: ({ gistId, ...query }: GistsListForksParams, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/forks\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List public gists sorted by most recently updated to least recently updated. Note: With [pagination](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination), you can fetch up to 3000 gists. For example, you can fetch 100 pages with 30 gists per page or 30 pages with 100 gists per page. + * + * @tags gists + * @name GistsListPublic + * @summary List public gists + * @request GET:/gists/public + */ + gistsListPublic: (query: GistsListPublicParams, params: RequestParams = {}) => + this.request({ + path: \`/gists/public\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List the authenticated user's starred gists: + * + * @tags gists + * @name GistsListStarred + * @summary List starred gists + * @request GET:/gists/starred + */ + gistsListStarred: (query: GistsListStarredParams, params: RequestParams = {}) => + this.request({ + path: \`/gists/starred\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * + * @tags gists + * @name GistsStar + * @summary Star a gist + * @request PUT:/gists/{gist_id}/star + */ + gistsStar: (gistId: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/star\`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsUnstar + * @summary Unstar a gist + * @request DELETE:/gists/{gist_id}/star + */ + gistsUnstar: (gistId: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/star\`, + method: "DELETE", + ...params, + }), + + /** + * @description Allows you to update or delete a gist file and rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged. + * + * @tags gists + * @name GistsUpdate + * @summary Update a gist + * @request PATCH:/gists/{gist_id} + */ + gistsUpdate: (gistId: string, data: GistsUpdatePayload, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsUpdateComment + * @summary Update a gist comment + * @request PATCH:/gists/{gist_id}/comments/{comment_id} + */ + gistsUpdateComment: ( + gistId: string, + commentId: number, + data: GistsUpdateCommentPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists/\${gistId}/comments/\${commentId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; + gitignore = { + /** + * @description List all templates available to pass as an option when [creating a repository](https://docs.github.com/rest/reference/repos#create-a-repository-for-the-authenticated-user). + * + * @tags gitignore + * @name GitignoreGetAllTemplates + * @summary Get all gitignore templates + * @request GET:/gitignore/templates + */ + gitignoreGetAllTemplates: (params: RequestParams = {}) => + this.request({ + path: \`/gitignore/templates\`, + method: "GET", + ...params, + }), + + /** + * @description The API also allows fetching the source of a single template. Use the raw [media type](https://docs.github.com/rest/overview/media-types/) to get the raw contents. + * + * @tags gitignore + * @name GitignoreGetTemplate + * @summary Get a gitignore template + * @request GET:/gitignore/templates/{name} + */ + gitignoreGetTemplate: (name: string, params: RequestParams = {}) => + this.request({ + path: \`/gitignore/templates/\${name}\`, + method: "GET", + ...params, + }), + }; + installation = { + /** + * @description List repositories that an app installation can access. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * + * @tags apps + * @name AppsListReposAccessibleToInstallation + * @summary List repositories accessible to the app installation + * @request GET:/installation/repositories + */ + appsListReposAccessibleToInstallation: ( + query: AppsListReposAccessibleToInstallationParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/installation/repositories\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Revokes the installation token you're using to authenticate as an installation and access this endpoint. Once an installation token is revoked, the token is invalidated and cannot be used. Other endpoints that require the revoked installation token must have a new installation token to work. You can create a new token using the "[Create an installation access token for an app](https://docs.github.com/rest/reference/apps#create-an-installation-access-token-for-an-app)" endpoint. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * + * @tags apps + * @name AppsRevokeInstallationAccessToken + * @summary Revoke an installation access token + * @request DELETE:/installation/token + */ + appsRevokeInstallationAccessToken: (params: RequestParams = {}) => + this.request({ + path: \`/installation/token\`, + method: "DELETE", + ...params, + }), + }; + issues = { + /** + * @description List issues assigned to the authenticated user across all visible repositories including owned repositories, member repositories, and organization repositories. You can use the \`filter\` query parameter to fetch issues that are not necessarily assigned to you. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * + * @tags issues + * @name IssuesList + * @summary List issues assigned to the authenticated user + * @request GET:/issues + */ + issuesList: (query: IssuesListParams, params: RequestParams = {}) => + this.request({ + path: \`/issues\`, + method: "GET", + query: query, + ...params, + }), + }; + licenses = { + /** + * No description + * + * @tags licenses + * @name LicensesGet + * @summary Get a license + * @request GET:/licenses/{license} + */ + licensesGet: (license: string, params: RequestParams = {}) => + this.request({ + path: \`/licenses/\${license}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags licenses + * @name LicensesGetAllCommonlyUsed + * @summary Get all commonly used licenses + * @request GET:/licenses + */ + licensesGetAllCommonlyUsed: (query: LicensesGetAllCommonlyUsedParams, params: RequestParams = {}) => + this.request({ + path: \`/licenses\`, + method: "GET", + query: query, + ...params, + }), + }; + markdown = { + /** + * No description + * + * @tags markdown + * @name MarkdownRender + * @summary Render a Markdown document + * @request POST:/markdown + */ + markdownRender: (data: MarkdownRenderPayload, params: RequestParams = {}) => + this.request({ + path: \`/markdown\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description You must send Markdown as plain text (using a \`Content-Type\` header of \`text/plain\` or \`text/x-markdown\`) to this endpoint, rather than using JSON format. In raw mode, [GitHub Flavored Markdown](https://github.github.com/gfm/) is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less. + * + * @tags markdown + * @name MarkdownRenderRaw + * @summary Render a Markdown document in raw mode + * @request POST:/markdown/raw + */ + markdownRenderRaw: (data: MarkdownRenderRawPayload, params: RequestParams = {}) => + this.request({ + path: \`/markdown/raw\`, + method: "POST", + body: data, + type: ContentType.Text, + ...params, + }), + }; + marketplaceListing = { + /** + * @description Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsGetSubscriptionPlanForAccount + * @summary Get a subscription plan for an account + * @request GET:/marketplace_listing/accounts/{account_id} + */ + appsGetSubscriptionPlanForAccount: (accountId: number, params: RequestParams = {}) => + this.request({ + path: \`/marketplace_listing/accounts/\${accountId}\`, + method: "GET", + ...params, + }), + + /** + * @description Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsGetSubscriptionPlanForAccountStubbed + * @summary Get a subscription plan for an account (stubbed) + * @request GET:/marketplace_listing/stubbed/accounts/{account_id} + */ + appsGetSubscriptionPlanForAccountStubbed: (accountId: number, params: RequestParams = {}) => + this.request({ + path: \`/marketplace_listing/stubbed/accounts/\${accountId}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns user and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsListAccountsForPlan + * @summary List accounts for a plan + * @request GET:/marketplace_listing/plans/{plan_id}/accounts + */ + appsListAccountsForPlan: ({ planId, ...query }: AppsListAccountsForPlanParams, params: RequestParams = {}) => + this.request({ + path: \`/marketplace_listing/plans/\${planId}/accounts\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Returns repository and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsListAccountsForPlanStubbed + * @summary List accounts for a plan (stubbed) + * @request GET:/marketplace_listing/stubbed/plans/{plan_id}/accounts + */ + appsListAccountsForPlanStubbed: ( + { planId, ...query }: AppsListAccountsForPlanStubbedParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/marketplace_listing/stubbed/plans/\${planId}/accounts\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all plans that are part of your GitHub Marketplace listing. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsListPlans + * @summary List plans + * @request GET:/marketplace_listing/plans + */ + appsListPlans: (query: AppsListPlansParams, params: RequestParams = {}) => + this.request({ + path: \`/marketplace_listing/plans\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all plans that are part of your GitHub Marketplace listing. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsListPlansStubbed + * @summary List plans (stubbed) + * @request GET:/marketplace_listing/stubbed/plans + */ + appsListPlansStubbed: (query: AppsListPlansStubbedParams, params: RequestParams = {}) => + this.request({ + path: \`/marketplace_listing/stubbed/plans\`, + method: "GET", + query: query, + ...params, + }), + }; + meta = { + /** + * @description Returns meta information about GitHub, including a list of GitHub's IP addresses. For more information, see "[About GitHub's IP addresses](https://help.github.com/articles/about-github-s-ip-addresses/)." **Note:** The IP addresses shown in the documentation's response are only example values. You must always query the API directly to get the latest list of IP addresses. + * + * @tags meta + * @name MetaGet + * @summary Get GitHub meta information + * @request GET:/meta + */ + metaGet: (params: RequestParams = {}) => + this.request({ + path: \`/meta\`, + method: "GET", + ...params, + }), + }; + networks = { + /** + * No description + * + * @tags activity + * @name ActivityListPublicEventsForRepoNetwork + * @summary List public events for a network of repositories + * @request GET:/networks/{owner}/{repo}/events + */ + activityListPublicEventsForRepoNetwork: ( + { owner, repo, ...query }: ActivityListPublicEventsForRepoNetworkParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/networks/\${owner}/\${repo}/events\`, + method: "GET", + query: query, + ...params, + }), + }; + notifications = { + /** + * @description Mutes all future notifications for a conversation until you comment on the thread or get an **@mention**. If you are watching the repository of the thread, you will still receive notifications. To ignore future notifications for a repository you are watching, use the [Set a thread subscription](https://docs.github.com/rest/reference/activity#set-a-thread-subscription) endpoint and set \`ignore\` to \`true\`. + * + * @tags activity + * @name ActivityDeleteThreadSubscription + * @summary Delete a thread subscription + * @request DELETE:/notifications/threads/{thread_id}/subscription + */ + activityDeleteThreadSubscription: (threadId: number, params: RequestParams = {}) => + this.request({ + path: \`/notifications/threads/\${threadId}/subscription\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityGetThread + * @summary Get a thread + * @request GET:/notifications/threads/{thread_id} + */ + activityGetThread: (threadId: number, params: RequestParams = {}) => + this.request({ + path: \`/notifications/threads/\${threadId}\`, + method: "GET", + ...params, + }), + + /** + * @description This checks to see if the current user is subscribed to a thread. You can also [get a repository subscription](https://docs.github.com/rest/reference/activity#get-a-repository-subscription). Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were **@mentioned**, or manually subscribe to a thread. + * + * @tags activity + * @name ActivityGetThreadSubscriptionForAuthenticatedUser + * @summary Get a thread subscription for the authenticated user + * @request GET:/notifications/threads/{thread_id}/subscription + */ + activityGetThreadSubscriptionForAuthenticatedUser: (threadId: number, params: RequestParams = {}) => + this.request({ + path: \`/notifications/threads/\${threadId}/subscription\`, + method: "GET", + ...params, + }), + + /** + * @description List all notifications for the current user, sorted by most recently updated. + * + * @tags activity + * @name ActivityListNotificationsForAuthenticatedUser + * @summary List notifications for the authenticated user + * @request GET:/notifications + */ + activityListNotificationsForAuthenticatedUser: ( + query: ActivityListNotificationsForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/notifications\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Marks all notifications as "read" removes it from the [default view on GitHub](https://github.com/notifications). If the number of notifications is too large to complete in one request, you will receive a \`202 Accepted\` status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the [List notifications for the authenticated user](https://docs.github.com/rest/reference/activity#list-notifications-for-the-authenticated-user) endpoint and pass the query parameter \`all=false\`. + * + * @tags activity + * @name ActivityMarkNotificationsAsRead + * @summary Mark notifications as read + * @request PUT:/notifications + */ + activityMarkNotificationsAsRead: (data: ActivityMarkNotificationsAsReadPayload, params: RequestParams = {}) => + this.request({ + path: \`/notifications\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityMarkThreadAsRead + * @summary Mark a thread as read + * @request PATCH:/notifications/threads/{thread_id} + */ + activityMarkThreadAsRead: (threadId: number, params: RequestParams = {}) => + this.request({ + path: \`/notifications/threads/\${threadId}\`, + method: "PATCH", + ...params, + }), + + /** + * @description If you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an **@mention**. You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored. Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the [Delete a thread subscription](https://docs.github.com/rest/reference/activity#delete-a-thread-subscription) endpoint. + * + * @tags activity + * @name ActivitySetThreadSubscription + * @summary Set a thread subscription + * @request PUT:/notifications/threads/{thread_id}/subscription + */ + activitySetThreadSubscription: ( + threadId: number, + data: ActivitySetThreadSubscriptionPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/notifications/threads/\${threadId}/subscription\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + }; + octocat = { + /** + * @description Get the octocat as ASCII art + * + * @tags meta + * @name MetaGetOctocat + * @summary Get Octocat + * @request GET:/octocat + */ + metaGetOctocat: (query: MetaGetOctocatParams, params: RequestParams = {}) => + this.request({ + path: \`/octocat\`, + method: "GET", + query: query, + ...params, + }), + }; + organizations = { + /** + * @description Lists all organizations, in the order that they were created on GitHub. **Note:** Pagination is powered exclusively by the \`since\` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of organizations. + * + * @tags orgs + * @name OrgsList + * @summary List organizations + * @request GET:/organizations + */ + orgsList: (query: OrgsListParams, params: RequestParams = {}) => + this.request({ + path: \`/organizations\`, + method: "GET", + query: query, + ...params, + }), + }; + orgs = { + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Adds a repository to the list of selected repositories that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsAddRepoAccessToSelfHostedRunnerGroupInOrg + * @summary Add repository access to a self-hosted runner group in an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} + */ + actionsAddRepoAccessToSelfHostedRunnerGroupInOrg: ( + org: string, + runnerGroupId: number, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/repositories/\${repositoryId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Adds a repository to an organization secret when the \`visibility\` for repository access is set to \`selected\`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsAddSelectedRepoToOrgSecret + * @summary Add selected repository to an organization secret + * @request PUT:/orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} + */ + actionsAddSelectedRepoToOrgSecret: ( + org: string, + secretName: string, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}/repositories/\${repositoryId}\`, + method: "PUT", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Adds a self-hosted runner to a runner group configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsAddSelfHostedRunnerToGroupForOrg + * @summary Add a self-hosted runner to a group for an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + actionsAddSelfHostedRunnerToGroupForOrg: ( + org: string, + runnerGroupId: number, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/runners/\${runnerId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Creates or updates an organization secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. #### Example encrypting a secret using Node.js Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library. \`\`\` const sodium = require('tweetsodium'); const key = "base64-encoded-public-key"; const value = "plain-text-secret"; // Convert the message and key to Uint8Array's (Buffer implements that interface) const messageBytes = Buffer.from(value); const keyBytes = Buffer.from(key, 'base64'); // Encrypt using LibSodium. const encryptedBytes = sodium.seal(messageBytes, keyBytes); // Base64 the encrypted secret const encrypted = Buffer.from(encryptedBytes).toString('base64'); console.log(encrypted); \`\`\` #### Example encrypting a secret using Python Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3. \`\`\` from base64 import b64encode from nacl import encoding, public def encrypt(public_key: str, secret_value: str) -> str: """Encrypt a Unicode string using the public key.""" public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder()) sealed_box = public.SealedBox(public_key) encrypted = sealed_box.encrypt(secret_value.encode("utf-8")) return b64encode(encrypted).decode("utf-8") \`\`\` #### Example encrypting a secret using C# Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package. \`\`\` var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret"); var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU="); var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey); Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox)); \`\`\` #### Example encrypting a secret using Ruby Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem. \`\`\`ruby require "rbnacl" require "base64" key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=") public_key = RbNaCl::PublicKey.new(key) box = RbNaCl::Boxes::Sealed.from_public_key(public_key) encrypted_secret = box.encrypt("my_secret") # Print the base64 encoded secret puts Base64.strict_encode64(encrypted_secret) \`\`\` + * + * @tags actions + * @name ActionsCreateOrUpdateOrgSecret + * @summary Create or update an organization secret + * @request PUT:/orgs/{org}/actions/secrets/{secret_name} + */ + actionsCreateOrUpdateOrgSecret: ( + org: string, + secretName: string, + data: ActionsCreateOrUpdateOrgSecretPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Returns a token that you can pass to the \`config\` script. The token expires after one hour. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing \`TOKEN\` with the registration token provided by this endpoint. \`\`\` ./config.sh --url https://github.com/octo-org --token TOKEN \`\`\` + * + * @tags actions + * @name ActionsCreateRegistrationTokenForOrg + * @summary Create a registration token for an organization + * @request POST:/orgs/{org}/actions/runners/registration-token + */ + actionsCreateRegistrationTokenForOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runners/registration-token\`, + method: "POST", + ...params, + }), + + /** + * @description Returns a token that you can pass to the \`config\` script to remove a self-hosted runner from an organization. The token expires after one hour. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from an organization, replace \`TOKEN\` with the remove token provided by this endpoint. \`\`\` ./config.sh remove --token TOKEN \`\`\` + * + * @tags actions + * @name ActionsCreateRemoveTokenForOrg + * @summary Create a remove token for an organization + * @request POST:/orgs/{org}/actions/runners/remove-token + */ + actionsCreateRemoveTokenForOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runners/remove-token\`, + method: "POST", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Creates a new self-hosted runner group for an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsCreateSelfHostedRunnerGroupForOrg + * @summary Create a self-hosted runner group for an organization + * @request POST:/orgs/{org}/actions/runner-groups + */ + actionsCreateSelfHostedRunnerGroupForOrg: ( + org: string, + data: ActionsCreateSelfHostedRunnerGroupForOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Deletes a secret in an organization using the secret name. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsDeleteOrgSecret + * @summary Delete an organization secret + * @request DELETE:/orgs/{org}/actions/secrets/{secret_name} + */ + actionsDeleteOrgSecret: (org: string, secretName: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsDeleteSelfHostedRunnerFromOrg + * @summary Delete a self-hosted runner from an organization + * @request DELETE:/orgs/{org}/actions/runners/{runner_id} + */ + actionsDeleteSelfHostedRunnerFromOrg: (org: string, runnerId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runners/\${runnerId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Deletes a self-hosted runner group for an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsDeleteSelfHostedRunnerGroupFromOrg + * @summary Delete a self-hosted runner group from an organization + * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id} + */ + actionsDeleteSelfHostedRunnerGroupFromOrg: (org: string, runnerGroupId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Removes a repository from the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsDisableSelectedRepositoryGithubActionsOrganization + * @summary Disable a selected repository for GitHub Actions in an organization + * @request DELETE:/orgs/{org}/actions/permissions/repositories/{repository_id} + */ + actionsDisableSelectedRepositoryGithubActionsOrganization: ( + org: string, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/repositories/\${repositoryId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsEnableSelectedRepositoryGithubActionsOrganization + * @summary Enable a selected repository for GitHub Actions in an organization + * @request PUT:/orgs/{org}/actions/permissions/repositories/{repository_id} + */ + actionsEnableSelectedRepositoryGithubActionsOrganization: ( + org: string, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/repositories/\${repositoryId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Gets the selected actions that are allowed in an organization. To use this endpoint, the organization permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."" You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsGetAllowedActionsOrganization + * @summary Get allowed actions for an organization + * @request GET:/orgs/{org}/actions/permissions/selected-actions + */ + actionsGetAllowedActionsOrganization: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/selected-actions\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsGetGithubActionsPermissionsOrganization + * @summary Get GitHub Actions permissions for an organization + * @request GET:/orgs/{org}/actions/permissions + */ + actionsGetGithubActionsPermissionsOrganization: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/permissions\`, + method: "GET", + ...params, + }), + + /** + * @description Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsGetOrgPublicKey + * @summary Get an organization public key + * @request GET:/orgs/{org}/actions/secrets/public-key + */ + actionsGetOrgPublicKey: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/public-key\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a single organization secret without revealing its encrypted value. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsGetOrgSecret + * @summary Get an organization secret + * @request GET:/orgs/{org}/actions/secrets/{secret_name} + */ + actionsGetOrgSecret: (org: string, secretName: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a specific self-hosted runner configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsGetSelfHostedRunnerForOrg + * @summary Get a self-hosted runner for an organization + * @request GET:/orgs/{org}/actions/runners/{runner_id} + */ + actionsGetSelfHostedRunnerForOrg: (org: string, runnerId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runners/\${runnerId}\`, + method: "GET", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Gets a specific self-hosted runner group for an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsGetSelfHostedRunnerGroupForOrg + * @summary Get a self-hosted runner group for an organization + * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id} + */ + actionsGetSelfHostedRunnerGroupForOrg: (org: string, runnerGroupId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}\`, + method: "GET", + ...params, + }), + + /** + * @description Lists all secrets available in an organization without revealing their encrypted values. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsListOrgSecrets + * @summary List organization secrets + * @request GET:/orgs/{org}/actions/secrets + */ + actionsListOrgSecrets: ({ org, ...query }: ActionsListOrgSecretsParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/secrets\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists the repositories with access to a self-hosted runner group configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListRepoAccessToSelfHostedRunnerGroupInOrg + * @summary List repository access to a self-hosted runner group in an organization + * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories + */ + actionsListRepoAccessToSelfHostedRunnerGroupInOrg: ( + org: string, + runnerGroupId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/repositories\`, + method: "GET", + ...params, + }), + + /** + * @description Lists binaries for the runner application that you can download and run. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListRunnerApplicationsForOrg + * @summary List runner applications for an organization + * @request GET:/orgs/{org}/actions/runners/downloads + */ + actionsListRunnerApplicationsForOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runners/downloads\`, + method: "GET", + ...params, + }), + + /** + * @description Lists all repositories that have been selected when the \`visibility\` for repository access to a secret is set to \`selected\`. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsListSelectedReposForOrgSecret + * @summary List selected repositories for an organization secret + * @request GET:/orgs/{org}/actions/secrets/{secret_name}/repositories + */ + actionsListSelectedReposForOrgSecret: (org: string, secretName: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}/repositories\`, + method: "GET", + ...params, + }), + + /** + * @description Lists the selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsListSelectedRepositoriesEnabledGithubActionsOrganization + * @summary List selected repositories enabled for GitHub Actions in an organization + * @request GET:/orgs/{org}/actions/permissions/repositories + */ + actionsListSelectedRepositoriesEnabledGithubActionsOrganization: ( + { org, ...query }: ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/repositories\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists all self-hosted runner groups configured in an organization and inherited from an enterprise. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListSelfHostedRunnerGroupsForOrg + * @summary List self-hosted runner groups for an organization + * @request GET:/orgs/{org}/actions/runner-groups + */ + actionsListSelfHostedRunnerGroupsForOrg: ( + { org, ...query }: ActionsListSelfHostedRunnerGroupsForOrgParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all self-hosted runners configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListSelfHostedRunnersForOrg + * @summary List self-hosted runners for an organization + * @request GET:/orgs/{org}/actions/runners + */ + actionsListSelfHostedRunnersForOrg: ( + { org, ...query }: ActionsListSelfHostedRunnersForOrgParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runners\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists self-hosted runners that are in a specific organization group. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListSelfHostedRunnersInGroupForOrg + * @summary List self-hosted runners in a group for an organization + * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners + */ + actionsListSelfHostedRunnersInGroupForOrg: ( + { org, runnerGroupId, ...query }: ActionsListSelfHostedRunnersInGroupForOrgParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/runners\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Removes a repository from the list of selected repositories that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg + * @summary Remove repository access to a self-hosted runner group in an organization + * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} + */ + actionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg: ( + org: string, + runnerGroupId: number, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/repositories/\${repositoryId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Removes a repository from an organization secret when the \`visibility\` for repository access is set to \`selected\`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsRemoveSelectedRepoFromOrgSecret + * @summary Remove selected repository from an organization secret + * @request DELETE:/orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} + */ + actionsRemoveSelectedRepoFromOrgSecret: ( + org: string, + secretName: string, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}/repositories/\${repositoryId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Removes a self-hosted runner from a group configured in an organization. The runner is then returned to the default group. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsRemoveSelfHostedRunnerFromGroupForOrg + * @summary Remove a self-hosted runner from a group for an organization + * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + actionsRemoveSelfHostedRunnerFromGroupForOrg: ( + org: string, + runnerGroupId: number, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/runners/\${runnerId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Sets the actions that are allowed in an organization. To use this endpoint, the organization permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." If the organization belongs to an enterprise that has \`selected\` actions set at the enterprise level, then you cannot override any of the enterprise's allowed actions settings. To use the \`patterns_allowed\` setting for private repositories, the organization must belong to an enterprise. If the organization does not belong to an enterprise, then the \`patterns_allowed\` setting only applies to public repositories in the organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsSetAllowedActionsOrganization + * @summary Set allowed actions for an organization + * @request PUT:/orgs/{org}/actions/permissions/selected-actions + */ + actionsSetAllowedActionsOrganization: (org: string, data: SelectedActions, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/selected-actions\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Sets the GitHub Actions permissions policy for repositories and allowed actions in an organization. If the organization belongs to an enterprise that has set restrictive permissions at the enterprise level, such as \`allowed_actions\` to \`selected\` actions, then you cannot override them for the organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsSetGithubActionsPermissionsOrganization + * @summary Set GitHub Actions permissions for an organization + * @request PUT:/orgs/{org}/actions/permissions + */ + actionsSetGithubActionsPermissionsOrganization: ( + org: string, + data: ActionsSetGithubActionsPermissionsOrganizationPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/permissions\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Replaces the list of repositories that have access to a self-hosted runner group configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsSetRepoAccessToSelfHostedRunnerGroupInOrg + * @summary Set repository access for a self-hosted runner group in an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories + */ + actionsSetRepoAccessToSelfHostedRunnerGroupInOrg: ( + org: string, + runnerGroupId: number, + data: ActionsSetRepoAccessToSelfHostedRunnerGroupInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/repositories\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Replaces all repositories for an organization secret when the \`visibility\` for repository access is set to \`selected\`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsSetSelectedReposForOrgSecret + * @summary Set selected repositories for an organization secret + * @request PUT:/orgs/{org}/actions/secrets/{secret_name}/repositories + */ + actionsSetSelectedReposForOrgSecret: ( + org: string, + secretName: string, + data: ActionsSetSelectedReposForOrgSecretPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}/repositories\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Replaces the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsSetSelectedRepositoriesEnabledGithubActionsOrganization + * @summary Set selected repositories enabled for GitHub Actions in an organization + * @request PUT:/orgs/{org}/actions/permissions/repositories + */ + actionsSetSelectedRepositoriesEnabledGithubActionsOrganization: ( + org: string, + data: ActionsSetSelectedRepositoriesEnabledGithubActionsOrganizationPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/repositories\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Replaces the list of self-hosted runners that are part of an organization runner group. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsSetSelfHostedRunnersInGroupForOrg + * @summary Set self-hosted runners in a group for an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners + */ + actionsSetSelfHostedRunnersInGroupForOrg: ( + org: string, + runnerGroupId: number, + data: ActionsSetSelfHostedRunnersInGroupForOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/runners\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Updates the \`name\` and \`visibility\` of a self-hosted runner group in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsUpdateSelfHostedRunnerGroupForOrg + * @summary Update a self-hosted runner group for an organization + * @request PATCH:/orgs/{org}/actions/runner-groups/{runner_group_id} + */ + actionsUpdateSelfHostedRunnerGroupForOrg: ( + org: string, + runnerGroupId: number, + data: ActionsUpdateSelfHostedRunnerGroupForOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityListPublicOrgEvents + * @summary List public organization events + * @request GET:/orgs/{org}/events + */ + activityListPublicOrgEvents: ({ org, ...query }: ActivityListPublicOrgEventsParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/events\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Enables an authenticated GitHub App to find the organization's installation information. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsGetOrgInstallation + * @summary Get an organization installation for the authenticated app + * @request GET:/orgs/{org}/installation + */ + appsGetOrgInstallation: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/installation\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Access tokens must have the \`repo\` or \`admin:org\` scope. + * + * @tags billing + * @name BillingGetGithubActionsBillingOrg + * @summary Get GitHub Actions billing for an organization + * @request GET:/orgs/{org}/settings/billing/actions + */ + billingGetGithubActionsBillingOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/settings/billing/actions\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the free and paid storage usued for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`repo\` or \`admin:org\` scope. + * + * @tags billing + * @name BillingGetGithubPackagesBillingOrg + * @summary Get GitHub Packages billing for an organization + * @request GET:/orgs/{org}/settings/billing/packages + */ + billingGetGithubPackagesBillingOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/settings/billing/packages\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`repo\` or \`admin:org\` scope. + * + * @tags billing + * @name BillingGetSharedStorageBillingOrg + * @summary Get shared storage billing for an organization + * @request GET:/orgs/{org}/settings/billing/shared-storage + */ + billingGetSharedStorageBillingOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/settings/billing/shared-storage\`, + method: "GET", + ...params, + }), + + /** + * @description Shows which type of GitHub user can interact with this organization and when the restriction expires. If there is no restrictions, you will see an empty response. + * + * @tags interactions + * @name InteractionsGetRestrictionsForOrg + * @summary Get interaction restrictions for an organization + * @request GET:/orgs/{org}/interaction-limits + */ + interactionsGetRestrictionsForOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/interaction-limits\`, + method: "GET", + ...params, + }), + + /** + * @description Removes all interaction restrictions from public repositories in the given organization. You must be an organization owner to remove restrictions. + * + * @tags interactions + * @name InteractionsRemoveRestrictionsForOrg + * @summary Remove interaction restrictions for an organization + * @request DELETE:/orgs/{org}/interaction-limits + */ + interactionsRemoveRestrictionsForOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/interaction-limits\`, + method: "DELETE", + ...params, + }), + + /** + * @description Temporarily restricts interactions to a certain type of GitHub user in any public repository in the given organization. You must be an organization owner to set these restrictions. Setting the interaction limit at the organization level will overwrite any interaction limits that are set for individual repositories owned by the organization. + * + * @tags interactions + * @name InteractionsSetRestrictionsForOrg + * @summary Set interaction restrictions for an organization + * @request PUT:/orgs/{org}/interaction-limits + */ + interactionsSetRestrictionsForOrg: (org: string, data: InteractionLimit, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/interaction-limits\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description List issues in an organization assigned to the authenticated user. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * + * @tags issues + * @name IssuesListForOrg + * @summary List organization issues assigned to the authenticated user + * @request GET:/orgs/{org}/issues + */ + issuesListForOrg: ({ org, ...query }: IssuesListForOrgParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/issues\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Deletes a previous migration archive. Migration archives are automatically deleted after seven days. + * + * @tags migrations + * @name MigrationsDeleteArchiveForOrg + * @summary Delete an organization migration archive + * @request DELETE:/orgs/{org}/migrations/{migration_id}/archive + */ + migrationsDeleteArchiveForOrg: (org: string, migrationId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/migrations/\${migrationId}/archive\`, + method: "DELETE", + ...params, + }), + + /** + * @description Fetches the URL to a migration archive. + * + * @tags migrations + * @name MigrationsDownloadArchiveForOrg + * @summary Download an organization migration archive + * @request GET:/orgs/{org}/migrations/{migration_id}/archive + */ + migrationsDownloadArchiveForOrg: (org: string, migrationId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/migrations/\${migrationId}/archive\`, + method: "GET", + ...params, + }), + + /** + * @description Fetches the status of a migration. The \`state\` of a migration can be one of the following values: * \`pending\`, which means the migration hasn't started yet. * \`exporting\`, which means the migration is in progress. * \`exported\`, which means the migration finished successfully. * \`failed\`, which means the migration failed. + * + * @tags migrations + * @name MigrationsGetStatusForOrg + * @summary Get an organization migration status + * @request GET:/orgs/{org}/migrations/{migration_id} + */ + migrationsGetStatusForOrg: (org: string, migrationId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/migrations/\${migrationId}\`, + method: "GET", + ...params, + }), + + /** + * @description Lists the most recent migrations. + * + * @tags migrations + * @name MigrationsListForOrg + * @summary List organization migrations + * @request GET:/orgs/{org}/migrations + */ + migrationsListForOrg: ({ org, ...query }: MigrationsListForOrgParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/migrations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List all the repositories for this organization migration. + * + * @tags migrations + * @name MigrationsListReposForOrg + * @summary List repositories in an organization migration + * @request GET:/orgs/{org}/migrations/{migration_id}/repositories + */ + migrationsListReposForOrg: ( + { org, migrationId, ...query }: MigrationsListReposForOrgParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/migrations/\${migrationId}/repositories\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Initiates the generation of a migration archive. + * + * @tags migrations + * @name MigrationsStartForOrg + * @summary Start an organization migration + * @request POST:/orgs/{org}/migrations + */ + migrationsStartForOrg: (org: string, data: MigrationsStartForOrgPayload, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/migrations\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Unlocks a repository that was locked for migration. You should unlock each migrated repository and [delete them](https://docs.github.com/rest/reference/repos#delete-a-repository) when the migration is complete and you no longer need the source data. + * + * @tags migrations + * @name MigrationsUnlockRepoForOrg + * @summary Unlock an organization repository + * @request DELETE:/orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock + */ + migrationsUnlockRepoForOrg: (org: string, migrationId: number, repoName: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/migrations/\${migrationId}/repos/\${repoName}/lock\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsBlockUser + * @summary Block a user from an organization + * @request PUT:/orgs/{org}/blocks/{username} + */ + orgsBlockUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/blocks/\${username}\`, + method: "PUT", + ...params, + }), + + /** + * @description Cancel an organization invitation. In order to cancel an organization invitation, the authenticated user must be an organization owner. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). + * + * @tags orgs + * @name OrgsCancelInvitation + * @summary Cancel an organization invitation + * @request DELETE:/orgs/{org}/invitations/{invitation_id} + */ + orgsCancelInvitation: (org: string, invitationId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/invitations/\${invitationId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsCheckBlockedUser + * @summary Check if a user is blocked by an organization + * @request GET:/orgs/{org}/blocks/{username} + */ + orgsCheckBlockedUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/blocks/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description Check if a user is, publicly or privately, a member of the organization. + * + * @tags orgs + * @name OrgsCheckMembershipForUser + * @summary Check organization membership for a user + * @request GET:/orgs/{org}/members/{username} + */ + orgsCheckMembershipForUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/members/\${username}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsCheckPublicMembershipForUser + * @summary Check public organization membership for a user + * @request GET:/orgs/{org}/public_members/{username} + */ + orgsCheckPublicMembershipForUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/public_members/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description When an organization member is converted to an outside collaborator, they'll only have access to the repositories that their current team membership allows. The user will no longer be a member of the organization. For more information, see "[Converting an organization member to an outside collaborator](https://help.github.com/articles/converting-an-organization-member-to-an-outside-collaborator/)". + * + * @tags orgs + * @name OrgsConvertMemberToOutsideCollaborator + * @summary Convert an organization member to outside collaborator + * @request PUT:/orgs/{org}/outside_collaborators/{username} + */ + orgsConvertMemberToOutsideCollaborator: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/outside_collaborators/\${username}\`, + method: "PUT", + ...params, + }), + + /** + * @description Invite people to an organization by using their GitHub user ID or their email address. In order to create invitations in an organization, the authenticated user must be an organization owner. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * + * @tags orgs + * @name OrgsCreateInvitation + * @summary Create an organization invitation + * @request POST:/orgs/{org}/invitations + */ + orgsCreateInvitation: (org: string, data: OrgsCreateInvitationPayload, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/invitations\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Here's how you can create a hook that posts payloads in JSON format: + * + * @tags orgs + * @name OrgsCreateWebhook + * @summary Create an organization webhook + * @request POST:/orgs/{org}/hooks + */ + orgsCreateWebhook: (org: string, data: OrgsCreateWebhookPayload, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsDeleteWebhook + * @summary Delete an organization webhook + * @request DELETE:/orgs/{org}/hooks/{hook_id} + */ + orgsDeleteWebhook: (org: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description To see many of the organization response values, you need to be an authenticated organization owner with the \`admin:org\` scope. When the value of \`two_factor_requirement_enabled\` is \`true\`, the organization requires all members, billing managers, and outside collaborators to enable [two-factor authentication](https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/). GitHub Apps with the \`Organization plan\` permission can use this endpoint to retrieve information about an organization's GitHub plan. See "[Authenticating with GitHub Apps](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/)" for details. For an example response, see 'Response with GitHub plan information' below." + * + * @tags orgs + * @name OrgsGet + * @summary Get an organization + * @request GET:/orgs/{org} + */ + orgsGet: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}\`, + method: "GET", + ...params, + }), + + /** + * @description **Note:** The audit log REST API is currently in beta and is subject to change. Gets the audit log for an organization. For more information, see "[Reviewing the audit log for your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization)." To use this endpoint, you must be an organization owner, and you must use an access token with the \`admin:org\` scope. GitHub Apps must have the \`organization_administration\` read permission to use this endpoint. + * + * @tags orgs + * @name OrgsGetAuditLog + * @summary Get the audit log for an organization + * @request GET:/orgs/{org}/audit-log + */ + orgsGetAuditLog: ({ org, ...query }: OrgsGetAuditLogParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/audit-log\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description In order to get a user's membership with an organization, the authenticated user must be an organization member. + * + * @tags orgs + * @name OrgsGetMembershipForUser + * @summary Get organization membership for a user + * @request GET:/orgs/{org}/memberships/{username} + */ + orgsGetMembershipForUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/memberships/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns a webhook configured in an organization. To get only the webhook \`config\` properties, see "[Get a webhook configuration for an organization](/rest/reference/orgs#get-a-webhook-configuration-for-an-organization)." + * + * @tags orgs + * @name OrgsGetWebhook + * @summary Get an organization webhook + * @request GET:/orgs/{org}/hooks/{hook_id} + */ + orgsGetWebhook: (org: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns the webhook configuration for an organization. To get more information about the webhook, including the \`active\` state and \`events\`, use "[Get an organization webhook ](/rest/reference/orgs#get-an-organization-webhook)." Access tokens must have the \`admin:org_hook\` scope, and GitHub Apps must have the \`organization_hooks:read\` permission. + * + * @tags orgs + * @name OrgsGetWebhookConfigForOrg + * @summary Get a webhook configuration for an organization + * @request GET:/orgs/{org}/hooks/{hook_id}/config + */ + orgsGetWebhookConfigForOrg: (org: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}/config\`, + method: "GET", + ...params, + }), + + /** + * @description Lists all GitHub Apps in an organization. The installation count includes all GitHub Apps installed on repositories in the organization. You must be an organization owner with \`admin:read\` scope to use this endpoint. + * + * @tags orgs + * @name OrgsListAppInstallations + * @summary List app installations for an organization + * @request GET:/orgs/{org}/installations + */ + orgsListAppInstallations: ({ org, ...query }: OrgsListAppInstallationsParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/installations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List the users blocked by an organization. + * + * @tags orgs + * @name OrgsListBlockedUsers + * @summary List users blocked by an organization + * @request GET:/orgs/{org}/blocks + */ + orgsListBlockedUsers: (org: string, params: RequestParams = {}) => + this.request< + OrgsListBlockedUsersData, + { + documentation_url: string; + message: string; + } + >({ + path: \`/orgs/\${org}/blocks\`, + method: "GET", + ...params, + }), + + /** + * @description The return hash contains \`failed_at\` and \`failed_reason\` fields which represent the time at which the invitation failed and the reason for the failure. + * + * @tags orgs + * @name OrgsListFailedInvitations + * @summary List failed organization invitations + * @request GET:/orgs/{org}/failed_invitations + */ + orgsListFailedInvitations: ({ org, ...query }: OrgsListFailedInvitationsParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/failed_invitations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List all teams associated with an invitation. In order to see invitations in an organization, the authenticated user must be an organization owner. + * + * @tags orgs + * @name OrgsListInvitationTeams + * @summary List organization invitation teams + * @request GET:/orgs/{org}/invitations/{invitation_id}/teams + */ + orgsListInvitationTeams: ( + { org, invitationId, ...query }: OrgsListInvitationTeamsParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/invitations/\${invitationId}/teams\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned. + * + * @tags orgs + * @name OrgsListMembers + * @summary List organization members + * @request GET:/orgs/{org}/members + */ + orgsListMembers: ({ org, ...query }: OrgsListMembersParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/members\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List all users who are outside collaborators of an organization. + * + * @tags orgs + * @name OrgsListOutsideCollaborators + * @summary List outside collaborators for an organization + * @request GET:/orgs/{org}/outside_collaborators + */ + orgsListOutsideCollaborators: ({ org, ...query }: OrgsListOutsideCollaboratorsParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/outside_collaborators\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description The return hash contains a \`role\` field which refers to the Organization Invitation role and will be one of the following values: \`direct_member\`, \`admin\`, \`billing_manager\`, \`hiring_manager\`, or \`reinstate\`. If the invitee is not a GitHub member, the \`login\` field in the return hash will be \`null\`. + * + * @tags orgs + * @name OrgsListPendingInvitations + * @summary List pending organization invitations + * @request GET:/orgs/{org}/invitations + */ + orgsListPendingInvitations: ({ org, ...query }: OrgsListPendingInvitationsParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/invitations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Members of an organization can choose to have their membership publicized or not. + * + * @tags orgs + * @name OrgsListPublicMembers + * @summary List public organization members + * @request GET:/orgs/{org}/public_members + */ + orgsListPublicMembers: ({ org, ...query }: OrgsListPublicMembersParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/public_members\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products). An authenticated organization owner with the \`read:org\` scope can list all credential authorizations for an organization that uses SAML single sign-on (SSO). The credentials are either personal access tokens or SSH keys that organization members have authorized for the organization. For more information, see [About authentication with SAML single sign-on](https://help.github.com/en/articles/about-authentication-with-saml-single-sign-on). + * + * @tags orgs + * @name OrgsListSamlSsoAuthorizations + * @summary List SAML SSO authorizations for an organization + * @request GET:/orgs/{org}/credential-authorizations + */ + orgsListSamlSsoAuthorizations: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/credential-authorizations\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsListWebhooks + * @summary List organization webhooks + * @request GET:/orgs/{org}/hooks + */ + orgsListWebhooks: ({ org, ...query }: OrgsListWebhooksParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description This will trigger a [ping event](https://docs.github.com/webhooks/#ping-event) to be sent to the hook. + * + * @tags orgs + * @name OrgsPingWebhook + * @summary Ping an organization webhook + * @request POST:/orgs/{org}/hooks/{hook_id}/pings + */ + orgsPingWebhook: (org: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}/pings\`, + method: "POST", + ...params, + }), + + /** + * @description Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. + * + * @tags orgs + * @name OrgsRemoveMember + * @summary Remove an organization member + * @request DELETE:/orgs/{org}/members/{username} + */ + orgsRemoveMember: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/members/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description In order to remove a user's membership with an organization, the authenticated user must be an organization owner. If the specified user is an active member of the organization, this will remove them from the organization. If the specified user has been invited to the organization, this will cancel their invitation. The specified user will receive an email notification in both cases. + * + * @tags orgs + * @name OrgsRemoveMembershipForUser + * @summary Remove organization membership for a user + * @request DELETE:/orgs/{org}/memberships/{username} + */ + orgsRemoveMembershipForUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/memberships/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Removing a user from this list will remove them from all the organization's repositories. + * + * @tags orgs + * @name OrgsRemoveOutsideCollaborator + * @summary Remove outside collaborator from an organization + * @request DELETE:/orgs/{org}/outside_collaborators/{username} + */ + orgsRemoveOutsideCollaborator: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/outside_collaborators/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsRemovePublicMembershipForAuthenticatedUser + * @summary Remove public organization membership for the authenticated user + * @request DELETE:/orgs/{org}/public_members/{username} + */ + orgsRemovePublicMembershipForAuthenticatedUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/public_members/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products). An authenticated organization owner with the \`admin:org\` scope can remove a credential authorization for an organization that uses SAML SSO. Once you remove someone's credential authorization, they will need to create a new personal access token or SSH key and authorize it for the organization they want to access. + * + * @tags orgs + * @name OrgsRemoveSamlSsoAuthorization + * @summary Remove a SAML SSO authorization for an organization + * @request DELETE:/orgs/{org}/credential-authorizations/{credential_id} + */ + orgsRemoveSamlSsoAuthorization: (org: string, credentialId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/credential-authorizations/\${credentialId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Only authenticated organization owners can add a member to the organization or update the member's role. * If the authenticated user is _adding_ a member to the organization, the invited user will receive an email inviting them to the organization. The user's [membership status](https://docs.github.com/rest/reference/orgs#get-organization-membership-for-a-user) will be \`pending\` until they accept the invitation. * Authenticated users can _update_ a user's membership by passing the \`role\` parameter. If the authenticated user changes a member's role to \`admin\`, the affected user will receive an email notifying them that they've been made an organization owner. If the authenticated user changes an owner's role to \`member\`, no email will be sent. **Rate limits** To prevent abuse, the authenticated user is limited to 50 organization invitations per 24 hour period. If the organization is more than one month old or on a paid plan, the limit is 500 invitations per 24 hour period. + * + * @tags orgs + * @name OrgsSetMembershipForUser + * @summary Set organization membership for a user + * @request PUT:/orgs/{org}/memberships/{username} + */ + orgsSetMembershipForUser: ( + org: string, + username: string, + data: OrgsSetMembershipForUserPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/memberships/\${username}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description The user can publicize their own membership. (A user cannot publicize the membership for another user.) Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * + * @tags orgs + * @name OrgsSetPublicMembershipForAuthenticatedUser + * @summary Set public organization membership for the authenticated user + * @request PUT:/orgs/{org}/public_members/{username} + */ + orgsSetPublicMembershipForAuthenticatedUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/public_members/\${username}\`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsUnblockUser + * @summary Unblock a user from an organization + * @request DELETE:/orgs/{org}/blocks/{username} + */ + orgsUnblockUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/blocks/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Parameter Deprecation Notice:** GitHub will replace and discontinue \`members_allowed_repository_creation_type\` in favor of more granular permissions. The new input parameters are \`members_can_create_public_repositories\`, \`members_can_create_private_repositories\` for all organizations and \`members_can_create_internal_repositories\` for organizations associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see the [blog post](https://developer.github.com/changes/2019-12-03-internal-visibility-changes). Enables an authenticated organization owner with the \`admin:org\` scope to update the organization's profile and member privileges. + * + * @tags orgs + * @name OrgsUpdate + * @summary Update an organization + * @request PATCH:/orgs/{org} + */ + orgsUpdate: (org: string, data: OrgsUpdatePayload, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Updates a webhook configured in an organization. When you update a webhook, the \`secret\` will be overwritten. If you previously had a \`secret\` set, you must provide the same \`secret\` or set a new \`secret\` or the secret will be removed. If you are only updating individual webhook \`config\` properties, use "[Update a webhook configuration for an organization](/rest/reference/orgs#update-a-webhook-configuration-for-an-organization)." + * + * @tags orgs + * @name OrgsUpdateWebhook + * @summary Update an organization webhook + * @request PATCH:/orgs/{org}/hooks/{hook_id} + */ + orgsUpdateWebhook: (org: string, hookId: number, data: OrgsUpdateWebhookPayload, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Updates the webhook configuration for an organization. To update more information about the webhook, including the \`active\` state and \`events\`, use "[Update an organization webhook ](/rest/reference/orgs#update-an-organization-webhook)." Access tokens must have the \`admin:org_hook\` scope, and GitHub Apps must have the \`organization_hooks:write\` permission. + * + * @tags orgs + * @name OrgsUpdateWebhookConfigForOrg + * @summary Update a webhook configuration for an organization + * @request PATCH:/orgs/{org}/hooks/{hook_id}/config + */ + orgsUpdateWebhookConfigForOrg: ( + org: string, + hookId: number, + data: OrgsUpdateWebhookConfigForOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}/config\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Creates an organization project board. Returns a \`404 Not Found\` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * + * @tags projects + * @name ProjectsCreateForOrg + * @summary Create an organization project + * @request POST:/orgs/{org}/projects + */ + projectsCreateForOrg: (org: string, data: ProjectsCreateForOrgPayload, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/projects\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Lists the projects in an organization. Returns a \`404 Not Found\` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * + * @tags projects + * @name ProjectsListForOrg + * @summary List organization projects + * @request GET:/orgs/{org}/projects + */ + projectsListForOrg: ({ org, ...query }: ProjectsListForOrgParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/projects\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Create a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion comment. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions\`. + * + * @tags reactions + * @name ReactionsCreateForTeamDiscussionCommentInOrg + * @summary Create reaction for a team discussion comment + * @request POST:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions + */ + reactionsCreateForTeamDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + data: ReactionsCreateForTeamDiscussionCommentInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Create a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions\`. + * + * @tags reactions + * @name ReactionsCreateForTeamDiscussionInOrg + * @summary Create reaction for a team discussion + * @request POST:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions + */ + reactionsCreateForTeamDiscussionInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + data: ReactionsCreateForTeamDiscussionInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note:** You can also specify a team or organization with \`team_id\` and \`org_id\` using the route \`DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions/:reaction_id\`. Delete a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags reactions + * @name ReactionsDeleteForTeamDiscussion + * @summary Delete team discussion reaction + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id} + */ + reactionsDeleteForTeamDiscussion: ( + org: string, + teamSlug: string, + discussionNumber: number, + reactionId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/reactions/\${reactionId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note:** You can also specify a team or organization with \`team_id\` and \`org_id\` using the route \`DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id\`. Delete a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags reactions + * @name ReactionsDeleteForTeamDiscussionComment + * @summary Delete team discussion comment reaction + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id} + */ + reactionsDeleteForTeamDiscussionComment: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + reactionId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}/reactions/\${reactionId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description List the reactions to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments/). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions\`. + * + * @tags reactions + * @name ReactionsListForTeamDiscussionCommentInOrg + * @summary List reactions for a team discussion comment + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions + */ + reactionsListForTeamDiscussionCommentInOrg: ( + { org, teamSlug, discussionNumber, commentNumber, ...query }: ReactionsListForTeamDiscussionCommentInOrgParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}/reactions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List the reactions to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions\`. + * + * @tags reactions + * @name ReactionsListForTeamDiscussionInOrg + * @summary List reactions for a team discussion + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions + */ + reactionsListForTeamDiscussionInOrg: ( + { org, teamSlug, discussionNumber, ...query }: ReactionsListForTeamDiscussionInOrgParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/reactions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Creates a new repository in the specified organization. The authenticated user must be a member of the organization. **OAuth scope requirements** When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include: * \`public_repo\` scope or \`repo\` scope to create a public repository * \`repo\` scope to create a private repository + * + * @tags repos + * @name ReposCreateInOrg + * @summary Create an organization repository + * @request POST:/orgs/{org}/repos + */ + reposCreateInOrg: (org: string, data: ReposCreateInOrgPayload, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/repos\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Lists repositories for the specified organization. + * + * @tags repos + * @name ReposListForOrg + * @summary List organization repositories + * @request GET:/orgs/{org}/repos + */ + reposListForOrg: ({ org, ...query }: ReposListForOrgParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/repos\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Adds an organization member to a team. An authenticated organization owner or team maintainer can add organization members to a team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." An organization owner can add someone who is not part of the team's organization to a team. When an organization owner adds someone to a team who is not an organization member, this endpoint will send an invitation to the person via email. This newly-created membership will be in the "pending" state until the person accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PUT /organizations/{org_id}/team/{team_id}/memberships/{username}\`. + * + * @tags teams + * @name TeamsAddOrUpdateMembershipForUserInOrg + * @summary Add or update team membership for a user + * @request PUT:/orgs/{org}/teams/{team_slug}/memberships/{username} + */ + teamsAddOrUpdateMembershipForUserInOrg: ( + org: string, + teamSlug: string, + username: string, + data: TeamsAddOrUpdateMembershipForUserInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/memberships/\${username}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have \`admin\` permissions for the project. The project and team must be part of the same organization. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PUT /organizations/{org_id}/team/{team_id}/projects/{project_id}\`. + * + * @tags teams + * @name TeamsAddOrUpdateProjectPermissionsInOrg + * @summary Add or update team project permissions + * @request PUT:/orgs/{org}/teams/{team_slug}/projects/{project_id} + */ + teamsAddOrUpdateProjectPermissionsInOrg: ( + org: string, + teamSlug: string, + projectId: number, + data: TeamsAddOrUpdateProjectPermissionsInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/projects/\${projectId}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a \`422 Unprocessable Entity\` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PUT /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}\`. For more information about the permission levels, see "[Repository permission levels for an organization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)". + * + * @tags teams + * @name TeamsAddOrUpdateRepoPermissionsInOrg + * @summary Add or update team repository permissions + * @request PUT:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + */ + teamsAddOrUpdateRepoPermissionsInOrg: ( + org: string, + teamSlug: string, + owner: string, + repo: string, + data: TeamsAddOrUpdateRepoPermissionsInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/repos/\${owner}/\${repo}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Checks whether a team has \`read\`, \`write\`, or \`admin\` permissions for an organization project. The response includes projects inherited from a parent team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/projects/{project_id}\`. + * + * @tags teams + * @name TeamsCheckPermissionsForProjectInOrg + * @summary Check team permissions for a project + * @request GET:/orgs/{org}/teams/{team_slug}/projects/{project_id} + */ + teamsCheckPermissionsForProjectInOrg: ( + org: string, + teamSlug: string, + projectId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/projects/\${projectId}\`, + method: "GET", + ...params, + }), + + /** + * @description Checks whether a team has \`admin\`, \`push\`, \`maintain\`, \`triage\`, or \`pull\` permission for a repository. Repositories inherited through a parent team will also be checked. You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`application/vnd.github.v3.repository+json\` accept header. If a team doesn't have permission for the repository, you will receive a \`404 Not Found\` response status. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}\`. + * + * @tags teams + * @name TeamsCheckPermissionsForRepoInOrg + * @summary Check team permissions for a repository + * @request GET:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + */ + teamsCheckPermissionsForRepoInOrg: ( + org: string, + teamSlug: string, + owner: string, + repo: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/repos/\${owner}/\${repo}\`, + method: "GET", + ...params, + }), + + /** + * @description To create a team, the authenticated user must be a member or owner of \`{org}\`. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see "[Setting team creation permissions](https://help.github.com/en/articles/setting-team-creation-permissions-in-your-organization)." When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of \`maintainers\`. For more information, see "[About teams](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/about-teams)". + * + * @tags teams + * @name TeamsCreate + * @summary Create a team + * @request POST:/orgs/{org}/teams + */ + teamsCreate: (org: string, data: TeamsCreatePayload, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Creates a new comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments\`. + * + * @tags teams + * @name TeamsCreateDiscussionCommentInOrg + * @summary Create a discussion comment + * @request POST:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments + */ + teamsCreateDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + data: TeamsCreateDiscussionCommentInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Creates a new discussion post on a team's page. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/{org_id}/team/{team_id}/discussions\`. + * + * @tags teams + * @name TeamsCreateDiscussionInOrg + * @summary Create a discussion + * @request POST:/orgs/{org}/teams/{team_slug}/discussions + */ + teamsCreateDiscussionInOrg: ( + org: string, + teamSlug: string, + data: TeamsCreateDiscussionInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty \`groups\` array will remove all connections for a team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}/team-sync/group-mappings\`. + * + * @tags teams + * @name TeamsCreateOrUpdateIdpGroupConnectionsInOrg + * @summary Create or update IdP group connections + * @request PATCH:/orgs/{org}/teams/{team_slug}/team-sync/group-mappings + */ + teamsCreateOrUpdateIdpGroupConnectionsInOrg: ( + org: string, + teamSlug: string, + data: TeamsCreateOrUpdateIdpGroupConnectionsInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/team-sync/group-mappings\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Deletes a comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}\`. + * + * @tags teams + * @name TeamsDeleteDiscussionCommentInOrg + * @summary Delete a discussion comment + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + */ + teamsDeleteDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Delete a discussion from a team's page. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}\`. + * + * @tags teams + * @name TeamsDeleteDiscussionInOrg + * @summary Delete a discussion + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + */ + teamsDeleteDiscussionInOrg: (org: string, teamSlug: string, discussionNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}\`, + method: "DELETE", + ...params, + }), + + /** + * @description To delete a team, the authenticated user must be an organization owner or team maintainer. If you are an organization owner, deleting a parent team will delete all of its child teams as well. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}\`. + * + * @tags teams + * @name TeamsDeleteInOrg + * @summary Delete a team + * @request DELETE:/orgs/{org}/teams/{team_slug} + */ + teamsDeleteInOrg: (org: string, teamSlug: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Gets a team using the team's \`slug\`. GitHub generates the \`slug\` from the team \`name\`. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}\`. + * + * @tags teams + * @name TeamsGetByName + * @summary Get a team by name + * @request GET:/orgs/{org}/teams/{team_slug} + */ + teamsGetByName: (org: string, teamSlug: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}\`, + method: "GET", + ...params, + }), + + /** + * @description Get a specific comment on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}\`. + * + * @tags teams + * @name TeamsGetDiscussionCommentInOrg + * @summary Get a discussion comment + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + */ + teamsGetDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "GET", + ...params, + }), + + /** + * @description Get a specific discussion on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}\`. + * + * @tags teams + * @name TeamsGetDiscussionInOrg + * @summary Get a discussion + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + */ + teamsGetDiscussionInOrg: (org: string, teamSlug: string, discussionNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}\`, + method: "GET", + ...params, + }), + + /** + * @description Team members will include the members of child teams. To get a user's membership with a team, the team must be visible to the authenticated user. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/memberships/{username}\`. **Note:** The \`role\` for organization owners returns as \`maintainer\`. For more information about \`maintainer\` roles, see [Create a team](https://docs.github.com/rest/reference/teams#create-a-team). + * + * @tags teams + * @name TeamsGetMembershipForUserInOrg + * @summary Get team membership for a user + * @request GET:/orgs/{org}/teams/{team_slug}/memberships/{username} + */ + teamsGetMembershipForUserInOrg: (org: string, teamSlug: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/memberships/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description Lists all teams in an organization that are visible to the authenticated user. + * + * @tags teams + * @name TeamsList + * @summary List teams + * @request GET:/orgs/{org}/teams + */ + teamsList: ({ org, ...query }: TeamsListParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the child teams of the team specified by \`{team_slug}\`. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/teams\`. + * + * @tags teams + * @name TeamsListChildInOrg + * @summary List child teams + * @request GET:/orgs/{org}/teams/{team_slug}/teams + */ + teamsListChildInOrg: ({ org, teamSlug, ...query }: TeamsListChildInOrgParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/teams\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List all comments on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments\`. + * + * @tags teams + * @name TeamsListDiscussionCommentsInOrg + * @summary List discussion comments + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments + */ + teamsListDiscussionCommentsInOrg: ( + { org, teamSlug, discussionNumber, ...query }: TeamsListDiscussionCommentsInOrgParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List all discussions on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions\`. + * + * @tags teams + * @name TeamsListDiscussionsInOrg + * @summary List discussions + * @request GET:/orgs/{org}/teams/{team_slug}/discussions + */ + teamsListDiscussionsInOrg: ( + { org, teamSlug, ...query }: TeamsListDiscussionsInOrgParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups available in an organization. You can limit your page results using the \`per_page\` parameter. GitHub generates a url-encoded \`page\` token using a cursor value for where the next page begins. For more information on cursor pagination, see "[Offset and Cursor Pagination explained](https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89)." The \`per_page\` parameter provides pagination for a list of IdP groups the authenticated user can access in an organization. For example, if the user \`octocat\` wants to see two groups per page in \`octo-org\` via cURL, it would look like this: + * + * @tags teams + * @name TeamsListIdpGroupsForOrg + * @summary List IdP groups for an organization + * @request GET:/orgs/{org}/team-sync/groups + */ + teamsListIdpGroupsForOrg: ({ org, ...query }: TeamsListIdpGroupsForOrgParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/team-sync/groups\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups connected to a team on GitHub. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/team-sync/group-mappings\`. + * + * @tags teams + * @name TeamsListIdpGroupsInOrg + * @summary List IdP groups for a team + * @request GET:/orgs/{org}/teams/{team_slug}/team-sync/group-mappings + */ + teamsListIdpGroupsInOrg: (org: string, teamSlug: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/team-sync/group-mappings\`, + method: "GET", + ...params, + }), + + /** + * @description Team members will include the members of child teams. To list members in a team, the team must be visible to the authenticated user. + * + * @tags teams + * @name TeamsListMembersInOrg + * @summary List team members + * @request GET:/orgs/{org}/teams/{team_slug}/members + */ + teamsListMembersInOrg: ({ org, teamSlug, ...query }: TeamsListMembersInOrgParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/members\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description The return hash contains a \`role\` field which refers to the Organization Invitation role and will be one of the following values: \`direct_member\`, \`admin\`, \`billing_manager\`, \`hiring_manager\`, or \`reinstate\`. If the invitee is not a GitHub member, the \`login\` field in the return hash will be \`null\`. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/invitations\`. + * + * @tags teams + * @name TeamsListPendingInvitationsInOrg + * @summary List pending team invitations + * @request GET:/orgs/{org}/teams/{team_slug}/invitations + */ + teamsListPendingInvitationsInOrg: ( + { org, teamSlug, ...query }: TeamsListPendingInvitationsInOrgParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/invitations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the organization projects for a team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/projects\`. + * + * @tags teams + * @name TeamsListProjectsInOrg + * @summary List team projects + * @request GET:/orgs/{org}/teams/{team_slug}/projects + */ + teamsListProjectsInOrg: ({ org, teamSlug, ...query }: TeamsListProjectsInOrgParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/projects\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists a team's repositories visible to the authenticated user. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/repos\`. + * + * @tags teams + * @name TeamsListReposInOrg + * @summary List team repositories + * @request GET:/orgs/{org}/teams/{team_slug}/repos + */ + teamsListReposInOrg: ({ org, teamSlug, ...query }: TeamsListReposInOrgParams, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/repos\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/memberships/{username}\`. + * + * @tags teams + * @name TeamsRemoveMembershipForUserInOrg + * @summary Remove team membership for a user + * @request DELETE:/orgs/{org}/teams/{team_slug}/memberships/{username} + */ + teamsRemoveMembershipForUserInOrg: (org: string, teamSlug: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/memberships/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have \`read\` access to both the team and project, or \`admin\` access to the team or project. This endpoint removes the project from the team, but does not delete the project. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/projects/{project_id}\`. + * + * @tags teams + * @name TeamsRemoveProjectInOrg + * @summary Remove a project from a team + * @request DELETE:/orgs/{org}/teams/{team_slug}/projects/{project_id} + */ + teamsRemoveProjectInOrg: (org: string, teamSlug: string, projectId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/projects/\${projectId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. This does not delete the repository, it just removes it from the team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}\`. + * + * @tags teams + * @name TeamsRemoveRepoInOrg + * @summary Remove a repository from a team + * @request DELETE:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + */ + teamsRemoveRepoInOrg: (org: string, teamSlug: string, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/repos/\${owner}/\${repo}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Edits the body text of a discussion comment. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}\`. + * + * @tags teams + * @name TeamsUpdateDiscussionCommentInOrg + * @summary Update a discussion comment + * @request PATCH:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + */ + teamsUpdateDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + data: TeamsUpdateDiscussionCommentInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}\`. + * + * @tags teams + * @name TeamsUpdateDiscussionInOrg + * @summary Update a discussion + * @request PATCH:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + */ + teamsUpdateDiscussionInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + data: TeamsUpdateDiscussionInOrgPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description To edit a team, the authenticated user must either be an organization owner or a team maintainer. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}\`. + * + * @tags teams + * @name TeamsUpdateInOrg + * @summary Update a team + * @request PATCH:/orgs/{org}/teams/{team_slug} + */ + teamsUpdateInOrg: (org: string, teamSlug: string, data: TeamsUpdateInOrgPayload, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; + projects = { + /** + * @description Adds a collaborator to an organization project and sets their permission level. You must be an organization owner or a project \`admin\` to add a collaborator. + * + * @tags projects + * @name ProjectsAddCollaborator + * @summary Add project collaborator + * @request PUT:/projects/{project_id}/collaborators/{username} + */ + projectsAddCollaborator: ( + projectId: number, + username: string, + data: ProjectsAddCollaboratorPayload, + params: RequestParams = {}, + ) => + this.request< + ProjectsAddCollaboratorData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/projects/\${projectId}/collaborators/\${username}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * + * @tags projects + * @name ProjectsCreateCard + * @summary Create a project card + * @request POST:/projects/columns/{column_id}/cards + */ + projectsCreateCard: (columnId: number, data: ProjectsCreateCardPayload, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/\${columnId}/cards\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsCreateColumn + * @summary Create a project column + * @request POST:/projects/{project_id}/columns + */ + projectsCreateColumn: (projectId: number, data: ProjectsCreateColumnPayload, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${projectId}/columns\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Deletes a project board. Returns a \`404 Not Found\` status if projects are disabled. + * + * @tags projects + * @name ProjectsDelete + * @summary Delete a project + * @request DELETE:/projects/{project_id} + */ + projectsDelete: (projectId: number, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${projectId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsDeleteCard + * @summary Delete a project card + * @request DELETE:/projects/columns/cards/{card_id} + */ + projectsDeleteCard: (cardId: number, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/cards/\${cardId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsDeleteColumn + * @summary Delete a project column + * @request DELETE:/projects/columns/{column_id} + */ + projectsDeleteColumn: (columnId: number, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/\${columnId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Gets a project by its \`id\`. Returns a \`404 Not Found\` status if projects are disabled. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * + * @tags projects + * @name ProjectsGet + * @summary Get a project + * @request GET:/projects/{project_id} + */ + projectsGet: (projectId: number, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${projectId}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsGetCard + * @summary Get a project card + * @request GET:/projects/columns/cards/{card_id} + */ + projectsGetCard: (cardId: number, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/cards/\${cardId}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsGetColumn + * @summary Get a project column + * @request GET:/projects/columns/{column_id} + */ + projectsGetColumn: (columnId: number, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/\${columnId}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns the collaborator's permission level for an organization project. Possible values for the \`permission\` key: \`admin\`, \`write\`, \`read\`, \`none\`. You must be an organization owner or a project \`admin\` to review a user's permission level. + * + * @tags projects + * @name ProjectsGetPermissionForUser + * @summary Get project permission for a user + * @request GET:/projects/{project_id}/collaborators/{username}/permission + */ + projectsGetPermissionForUser: (projectId: number, username: string, params: RequestParams = {}) => + this.request< + ProjectsGetPermissionForUserData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/projects/\${projectId}/collaborators/\${username}/permission\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsListCards + * @summary List project cards + * @request GET:/projects/columns/{column_id}/cards + */ + projectsListCards: ({ columnId, ...query }: ProjectsListCardsParams, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/\${columnId}/cards\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the collaborators for an organization project. For a project, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. You must be an organization owner or a project \`admin\` to list collaborators. + * + * @tags projects + * @name ProjectsListCollaborators + * @summary List project collaborators + * @request GET:/projects/{project_id}/collaborators + */ + projectsListCollaborators: ({ projectId, ...query }: ProjectsListCollaboratorsParams, params: RequestParams = {}) => + this.request< + ProjectsListCollaboratorsData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/projects/\${projectId}/collaborators\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsListColumns + * @summary List project columns + * @request GET:/projects/{project_id}/columns + */ + projectsListColumns: ({ projectId, ...query }: ProjectsListColumnsParams, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${projectId}/columns\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsMoveCard + * @summary Move a project card + * @request POST:/projects/columns/cards/{card_id}/moves + */ + projectsMoveCard: (cardId: number, data: ProjectsMoveCardPayload, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/cards/\${cardId}/moves\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsMoveColumn + * @summary Move a project column + * @request POST:/projects/columns/{column_id}/moves + */ + projectsMoveColumn: (columnId: number, data: ProjectsMoveColumnPayload, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/\${columnId}/moves\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Removes a collaborator from an organization project. You must be an organization owner or a project \`admin\` to remove a collaborator. + * + * @tags projects + * @name ProjectsRemoveCollaborator + * @summary Remove user as a collaborator + * @request DELETE:/projects/{project_id}/collaborators/{username} + */ + projectsRemoveCollaborator: (projectId: number, username: string, params: RequestParams = {}) => + this.request< + ProjectsRemoveCollaboratorData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/projects/\${projectId}/collaborators/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Updates a project board's information. Returns a \`404 Not Found\` status if projects are disabled. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * + * @tags projects + * @name ProjectsUpdate + * @summary Update a project + * @request PATCH:/projects/{project_id} + */ + projectsUpdate: (projectId: number, data: ProjectsUpdatePayload, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${projectId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsUpdateCard + * @summary Update an existing project card + * @request PATCH:/projects/columns/cards/{card_id} + */ + projectsUpdateCard: (cardId: number, data: ProjectsUpdateCardPayload, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/cards/\${cardId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsUpdateColumn + * @summary Update an existing project column + * @request PATCH:/projects/columns/{column_id} + */ + projectsUpdateColumn: (columnId: number, data: ProjectsUpdateColumnPayload, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/\${columnId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; + rateLimit = { + /** + * @description **Note:** Accessing this endpoint does not count against your REST API rate limit. **Note:** The \`rate\` object is deprecated. If you're writing new API client code or updating existing code, you should use the \`core\` object instead of the \`rate\` object. The \`core\` object contains the same information that is present in the \`rate\` object. + * + * @tags rate-limit + * @name RateLimitGet + * @summary Get rate limit status for the authenticated user + * @request GET:/rate_limit + */ + rateLimitGet: (params: RequestParams = {}) => + this.request({ + path: \`/rate_limit\`, + method: "GET", + ...params, + }), + }; + reactions = { + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Reactions API. We recommend migrating your existing code to use the new delete reactions endpoints. For more information, see this [blog post](https://developer.github.com/changes/2020-02-26-new-delete-reactions-endpoints/). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), when deleting a [team discussion](https://docs.github.com/rest/reference/teams#discussions) or [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). + * + * @tags reactions + * @name ReactionsDeleteLegacy + * @summary Delete a reaction (Legacy) + * @request DELETE:/reactions/{reaction_id} + * @deprecated + */ + reactionsDeleteLegacy: (reactionId: number, params: RequestParams = {}) => + this.request< + ReactionsDeleteLegacyData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/reactions/\${reactionId}\`, + method: "DELETE", + ...params, + }), + }; + repos = { + /** + * @description Cancels a workflow run using its \`id\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * + * @tags actions + * @name ActionsCancelWorkflowRun + * @summary Cancel a workflow run + * @request POST:/repos/{owner}/{repo}/actions/runs/{run_id}/cancel + */ + actionsCancelWorkflowRun: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/cancel\`, + method: "POST", + ...params, + }), + + /** + * @description Creates or updates a repository secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. #### Example encrypting a secret using Node.js Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library. \`\`\` const sodium = require('tweetsodium'); const key = "base64-encoded-public-key"; const value = "plain-text-secret"; // Convert the message and key to Uint8Array's (Buffer implements that interface) const messageBytes = Buffer.from(value); const keyBytes = Buffer.from(key, 'base64'); // Encrypt using LibSodium. const encryptedBytes = sodium.seal(messageBytes, keyBytes); // Base64 the encrypted secret const encrypted = Buffer.from(encryptedBytes).toString('base64'); console.log(encrypted); \`\`\` #### Example encrypting a secret using Python Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3. \`\`\` from base64 import b64encode from nacl import encoding, public def encrypt(public_key: str, secret_value: str) -> str: """Encrypt a Unicode string using the public key.""" public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder()) sealed_box = public.SealedBox(public_key) encrypted = sealed_box.encrypt(secret_value.encode("utf-8")) return b64encode(encrypted).decode("utf-8") \`\`\` #### Example encrypting a secret using C# Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package. \`\`\` var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret"); var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU="); var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey); Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox)); \`\`\` #### Example encrypting a secret using Ruby Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem. \`\`\`ruby require "rbnacl" require "base64" key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=") public_key = RbNaCl::PublicKey.new(key) box = RbNaCl::Boxes::Sealed.from_public_key(public_key) encrypted_secret = box.encrypt("my_secret") # Print the base64 encoded secret puts Base64.strict_encode64(encrypted_secret) \`\`\` + * + * @tags actions + * @name ActionsCreateOrUpdateRepoSecret + * @summary Create or update a repository secret + * @request PUT:/repos/{owner}/{repo}/actions/secrets/{secret_name} + */ + actionsCreateOrUpdateRepoSecret: ( + owner: string, + repo: string, + secretName: string, + data: ActionsCreateOrUpdateRepoSecretPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/secrets/\${secretName}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Returns a token that you can pass to the \`config\` script. The token expires after one hour. You must authenticate using an access token with the \`repo\` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing \`TOKEN\` with the registration token provided by this endpoint. \`\`\` ./config.sh --url https://github.com/octo-org/octo-repo-artifacts --token TOKEN \`\`\` + * + * @tags actions + * @name ActionsCreateRegistrationTokenForRepo + * @summary Create a registration token for a repository + * @request POST:/repos/{owner}/{repo}/actions/runners/registration-token + */ + actionsCreateRegistrationTokenForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners/registration-token\`, + method: "POST", + ...params, + }), + + /** + * @description Returns a token that you can pass to remove a self-hosted runner from a repository. The token expires after one hour. You must authenticate using an access token with the \`repo\` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from a repository, replace TOKEN with the remove token provided by this endpoint. \`\`\` ./config.sh remove --token TOKEN \`\`\` + * + * @tags actions + * @name ActionsCreateRemoveTokenForRepo + * @summary Create a remove token for a repository + * @request POST:/repos/{owner}/{repo}/actions/runners/remove-token + */ + actionsCreateRemoveTokenForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners/remove-token\`, + method: "POST", + ...params, + }), + + /** + * @description You can use this endpoint to manually trigger a GitHub Actions workflow run. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You must configure your GitHub Actions workflow to run when the [\`workflow_dispatch\` webhook](/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch) event occurs. The \`inputs\` are configured in the workflow file. For more information about how to configure the \`workflow_dispatch\` event in the workflow file, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)." You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. For more information, see "[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line)." + * + * @tags actions + * @name ActionsCreateWorkflowDispatch + * @summary Create a workflow dispatch event + * @request POST:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches + */ + actionsCreateWorkflowDispatch: ( + owner: string, + repo: string, + workflowId: number | string, + data: ActionsCreateWorkflowDispatchPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}/dispatches\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Deletes an artifact for a workflow run. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * + * @tags actions + * @name ActionsDeleteArtifact + * @summary Delete an artifact + * @request DELETE:/repos/{owner}/{repo}/actions/artifacts/{artifact_id} + */ + actionsDeleteArtifact: (owner: string, repo: string, artifactId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/artifacts/\${artifactId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Deletes a secret in a repository using the secret name. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. + * + * @tags actions + * @name ActionsDeleteRepoSecret + * @summary Delete a repository secret + * @request DELETE:/repos/{owner}/{repo}/actions/secrets/{secret_name} + */ + actionsDeleteRepoSecret: (owner: string, repo: string, secretName: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/secrets/\${secretName}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Forces the removal of a self-hosted runner from a repository. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the \`repo\` scope to use this endpoint. + * + * @tags actions + * @name ActionsDeleteSelfHostedRunnerFromRepo + * @summary Delete a self-hosted runner from a repository + * @request DELETE:/repos/{owner}/{repo}/actions/runners/{runner_id} + */ + actionsDeleteSelfHostedRunnerFromRepo: ( + owner: string, + repo: string, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners/\${runnerId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Delete a specific workflow run. Anyone with write access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * + * @tags actions + * @name ActionsDeleteWorkflowRun + * @summary Delete a workflow run + * @request DELETE:/repos/{owner}/{repo}/actions/runs/{run_id} + */ + actionsDeleteWorkflowRun: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Deletes all logs for a workflow run. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * + * @tags actions + * @name ActionsDeleteWorkflowRunLogs + * @summary Delete workflow run logs + * @request DELETE:/repos/{owner}/{repo}/actions/runs/{run_id}/logs + */ + actionsDeleteWorkflowRunLogs: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/logs\`, + method: "DELETE", + ...params, + }), + + /** + * @description Disables a workflow and sets the \`state\` of the workflow to \`disabled_manually\`. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * + * @tags actions + * @name ActionsDisableWorkflow + * @summary Disable a workflow + * @request PUT:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable + */ + actionsDisableWorkflow: (owner: string, repo: string, workflowId: number | string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}/disable\`, + method: "PUT", + ...params, + }), + + /** + * @description Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for \`Location:\` in the response header to find the URL for the download. The \`:archive_format\` must be \`zip\`. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsDownloadArtifact + * @summary Download an artifact + * @request GET:/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format} + */ + actionsDownloadArtifact: ( + owner: string, + repo: string, + artifactId: number, + archiveFormat: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/artifacts/\${artifactId}/\${archiveFormat}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look for \`Location:\` in the response header to find the URL for the download. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsDownloadJobLogsForWorkflowRun + * @summary Download job logs for a workflow run + * @request GET:/repos/{owner}/{repo}/actions/jobs/{job_id}/logs + */ + actionsDownloadJobLogsForWorkflowRun: (owner: string, repo: string, jobId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/jobs/\${jobId}/logs\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a redirect URL to download an archive of log files for a workflow run. This link expires after 1 minute. Look for \`Location:\` in the response header to find the URL for the download. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsDownloadWorkflowRunLogs + * @summary Download workflow run logs + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/logs + */ + actionsDownloadWorkflowRunLogs: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/logs\`, + method: "GET", + ...params, + }), + + /** + * @description Enables a workflow and sets the \`state\` of the workflow to \`active\`. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * + * @tags actions + * @name ActionsEnableWorkflow + * @summary Enable a workflow + * @request PUT:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable + */ + actionsEnableWorkflow: (owner: string, repo: string, workflowId: number | string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}/enable\`, + method: "PUT", + ...params, + }), + + /** + * @description Gets the settings for selected actions that are allowed in a repository. To use this endpoint, the repository policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)." You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. + * + * @tags actions + * @name ActionsGetAllowedActionsRepository + * @summary Get allowed actions for a repository + * @request GET:/repos/{owner}/{repo}/actions/permissions/selected-actions + */ + actionsGetAllowedActionsRepository: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/permissions/selected-actions\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a specific artifact for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsGetArtifact + * @summary Get an artifact + * @request GET:/repos/{owner}/{repo}/actions/artifacts/{artifact_id} + */ + actionsGetArtifact: (owner: string, repo: string, artifactId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/artifacts/\${artifactId}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the GitHub Actions permissions policy for a repository, including whether GitHub Actions is enabled and the actions allowed to run in the repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. + * + * @tags actions + * @name ActionsGetGithubActionsPermissionsRepository + * @summary Get GitHub Actions permissions for a repository + * @request GET:/repos/{owner}/{repo}/actions/permissions + */ + actionsGetGithubActionsPermissionsRepository: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/permissions\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a specific job in a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsGetJobForWorkflowRun + * @summary Get a job for a workflow run + * @request GET:/repos/{owner}/{repo}/actions/jobs/{job_id} + */ + actionsGetJobForWorkflowRun: (owner: string, repo: string, jobId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/jobs/\${jobId}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. + * + * @tags actions + * @name ActionsGetRepoPublicKey + * @summary Get a repository public key + * @request GET:/repos/{owner}/{repo}/actions/secrets/public-key + */ + actionsGetRepoPublicKey: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/secrets/public-key\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a single repository secret without revealing its encrypted value. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. + * + * @tags actions + * @name ActionsGetRepoSecret + * @summary Get a repository secret + * @request GET:/repos/{owner}/{repo}/actions/secrets/{secret_name} + */ + actionsGetRepoSecret: (owner: string, repo: string, secretName: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/secrets/\${secretName}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a specific self-hosted runner configured in a repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. + * + * @tags actions + * @name ActionsGetSelfHostedRunnerForRepo + * @summary Get a self-hosted runner for a repository + * @request GET:/repos/{owner}/{repo}/actions/runners/{runner_id} + */ + actionsGetSelfHostedRunnerForRepo: (owner: string, repo: string, runnerId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners/\${runnerId}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a specific workflow. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsGetWorkflow + * @summary Get a workflow + * @request GET:/repos/{owner}/{repo}/actions/workflows/{workflow_id} + */ + actionsGetWorkflow: (owner: string, repo: string, workflowId: number | string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a specific workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsGetWorkflowRun + * @summary Get a workflow run + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id} + */ + actionsGetWorkflowRun: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the number of billable minutes and total run time for a specific workflow run. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsGetWorkflowRunUsage + * @summary Get workflow run usage + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/timing + */ + actionsGetWorkflowRunUsage: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/timing\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the number of billable minutes used by a specific workflow during the current billing cycle. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsGetWorkflowUsage + * @summary Get workflow usage + * @request GET:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/timing + */ + actionsGetWorkflowUsage: (owner: string, repo: string, workflowId: number | string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}/timing\`, + method: "GET", + ...params, + }), + + /** + * @description Lists all artifacts for a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsListArtifactsForRepo + * @summary List artifacts for a repository + * @request GET:/repos/{owner}/{repo}/actions/artifacts + */ + actionsListArtifactsForRepo: ( + { owner, repo, ...query }: ActionsListArtifactsForRepoParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/artifacts\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists jobs for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). + * + * @tags actions + * @name ActionsListJobsForWorkflowRun + * @summary List jobs for a workflow run + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/jobs + */ + actionsListJobsForWorkflowRun: ( + { owner, repo, runId, ...query }: ActionsListJobsForWorkflowRunParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/jobs\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all secrets available in a repository without revealing their encrypted values. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. + * + * @tags actions + * @name ActionsListRepoSecrets + * @summary List repository secrets + * @request GET:/repos/{owner}/{repo}/actions/secrets + */ + actionsListRepoSecrets: ({ owner, repo, ...query }: ActionsListRepoSecretsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/secrets\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the workflows in a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsListRepoWorkflows + * @summary List repository workflows + * @request GET:/repos/{owner}/{repo}/actions/workflows + */ + actionsListRepoWorkflows: ({ owner, repo, ...query }: ActionsListRepoWorkflowsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/workflows\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists binaries for the runner application that you can download and run. You must authenticate using an access token with the \`repo\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListRunnerApplicationsForRepo + * @summary List runner applications for a repository + * @request GET:/repos/{owner}/{repo}/actions/runners/downloads + */ + actionsListRunnerApplicationsForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners/downloads\`, + method: "GET", + ...params, + }), + + /** + * @description Lists all self-hosted runners configured in a repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListSelfHostedRunnersForRepo + * @summary List self-hosted runners for a repository + * @request GET:/repos/{owner}/{repo}/actions/runners + */ + actionsListSelfHostedRunnersForRepo: ( + { owner, repo, ...query }: ActionsListSelfHostedRunnersForRepoParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists artifacts for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsListWorkflowRunArtifacts + * @summary List workflow run artifacts + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/artifacts + */ + actionsListWorkflowRunArtifacts: ( + { owner, repo, runId, ...query }: ActionsListWorkflowRunArtifactsParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/artifacts\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List all workflow runs for a workflow. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. + * + * @tags actions + * @name ActionsListWorkflowRuns + * @summary List workflow runs + * @request GET:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs + */ + actionsListWorkflowRuns: ( + { owner, repo, workflowId, ...query }: ActionsListWorkflowRunsParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}/runs\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all workflow runs for a repository. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. + * + * @tags actions + * @name ActionsListWorkflowRunsForRepo + * @summary List workflow runs for a repository + * @request GET:/repos/{owner}/{repo}/actions/runs + */ + actionsListWorkflowRunsForRepo: ( + { owner, repo, ...query }: ActionsListWorkflowRunsForRepoParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Re-runs your workflow run using its \`id\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * + * @tags actions + * @name ActionsReRunWorkflow + * @summary Re-run a workflow + * @request POST:/repos/{owner}/{repo}/actions/runs/{run_id}/rerun + */ + actionsReRunWorkflow: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/rerun\`, + method: "POST", + ...params, + }), + + /** + * @description Sets the actions that are allowed in a repository. To use this endpoint, the repository permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)." If the repository belongs to an organization or enterprise that has \`selected\` actions set at the organization or enterprise levels, then you cannot override any of the allowed actions settings. To use the \`patterns_allowed\` setting for private repositories, the repository must belong to an enterprise. If the repository does not belong to an enterprise, then the \`patterns_allowed\` setting only applies to public repositories. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. + * + * @tags actions + * @name ActionsSetAllowedActionsRepository + * @summary Set allowed actions for a repository + * @request PUT:/repos/{owner}/{repo}/actions/permissions/selected-actions + */ + actionsSetAllowedActionsRepository: ( + owner: string, + repo: string, + data: SelectedActions, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/permissions/selected-actions\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Sets the GitHub Actions permissions policy for enabling GitHub Actions and allowed actions in the repository. If the repository belongs to an organization or enterprise that has set restrictive permissions at the organization or enterprise levels, such as \`allowed_actions\` to \`selected\` actions, then you cannot override them for the repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. + * + * @tags actions + * @name ActionsSetGithubActionsPermissionsRepository + * @summary Set GitHub Actions permissions for a repository + * @request PUT:/repos/{owner}/{repo}/actions/permissions + */ + actionsSetGithubActionsPermissionsRepository: ( + owner: string, + repo: string, + data: ActionsSetGithubActionsPermissionsRepositoryPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/permissions\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description This endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, [set the repository's subscription manually](https://docs.github.com/rest/reference/activity#set-a-repository-subscription). + * + * @tags activity + * @name ActivityDeleteRepoSubscription + * @summary Delete a repository subscription + * @request DELETE:/repos/{owner}/{repo}/subscription + */ + activityDeleteRepoSubscription: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/subscription\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityGetRepoSubscription + * @summary Get a repository subscription + * @request GET:/repos/{owner}/{repo}/subscription + */ + activityGetRepoSubscription: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/subscription\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityListRepoEvents + * @summary List repository events + * @request GET:/repos/{owner}/{repo}/events + */ + activityListRepoEvents: ({ owner, repo, ...query }: ActivityListRepoEventsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/events\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List all notifications for the current user. + * + * @tags activity + * @name ActivityListRepoNotificationsForAuthenticatedUser + * @summary List repository notifications for the authenticated user + * @request GET:/repos/{owner}/{repo}/notifications + */ + activityListRepoNotificationsForAuthenticatedUser: ( + { owner, repo, ...query }: ActivityListRepoNotificationsForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/notifications\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the people that have starred the repository. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: + * + * @tags activity + * @name ActivityListStargazersForRepo + * @summary List stargazers + * @request GET:/repos/{owner}/{repo}/stargazers + */ + activityListStargazersForRepo: ( + { owner, repo, ...query }: ActivityListStargazersForRepoParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stargazers\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the people watching the specified repository. + * + * @tags activity + * @name ActivityListWatchersForRepo + * @summary List watchers + * @request GET:/repos/{owner}/{repo}/subscribers + */ + activityListWatchersForRepo: ( + { owner, repo, ...query }: ActivityListWatchersForRepoParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/subscribers\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Marks all notifications in a repository as "read" removes them from the [default view on GitHub](https://github.com/notifications). If the number of notifications is too large to complete in one request, you will receive a \`202 Accepted\` status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the [List repository notifications for the authenticated user](https://docs.github.com/rest/reference/activity#list-repository-notifications-for-the-authenticated-user) endpoint and pass the query parameter \`all=false\`. + * + * @tags activity + * @name ActivityMarkRepoNotificationsAsRead + * @summary Mark repository notifications as read + * @request PUT:/repos/{owner}/{repo}/notifications + */ + activityMarkRepoNotificationsAsRead: ( + owner: string, + repo: string, + data: ActivityMarkRepoNotificationsAsReadPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/notifications\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description If you would like to watch a repository, set \`subscribed\` to \`true\`. If you would like to ignore notifications made within a repository, set \`ignored\` to \`true\`. If you would like to stop watching a repository, [delete the repository's subscription](https://docs.github.com/rest/reference/activity#delete-a-repository-subscription) completely. + * + * @tags activity + * @name ActivitySetRepoSubscription + * @summary Set a repository subscription + * @request PUT:/repos/{owner}/{repo}/subscription + */ + activitySetRepoSubscription: ( + owner: string, + repo: string, + data: ActivitySetRepoSubscriptionPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/subscription\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Enables an authenticated GitHub App to find the repository's installation information. The installation's account type will be either an organization or a user account, depending which account the repository belongs to. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsGetRepoInstallation + * @summary Get a repository installation for the authenticated app + * @request GET:/repos/{owner}/{repo}/installation + */ + appsGetRepoInstallation: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/installation\`, + method: "GET", + ...params, + }), + + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Creates a new check run for a specific commit in a repository. Your GitHub App must have the \`checks:write\` permission to create check runs. In a check suite, GitHub limits the number of check runs with the same name to 1000. Once these check runs exceed 1000, GitHub will start to automatically delete older check runs. + * + * @tags checks + * @name ChecksCreate + * @summary Create a check run + * @request POST:/repos/{owner}/{repo}/check-runs + */ + checksCreate: (owner: string, repo: string, data: ChecksCreatePayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-runs\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array and a \`null\` value for \`head_branch\`. By default, check suites are automatically created when you create a [check run](https://docs.github.com/rest/reference/checks#check-runs). You only need to use this endpoint for manually creating check suites when you've disabled automatic creation using "[Update repository preferences for check suites](https://docs.github.com/rest/reference/checks#update-repository-preferences-for-check-suites)". Your GitHub App must have the \`checks:write\` permission to create check suites. + * + * @tags checks + * @name ChecksCreateSuite + * @summary Create a check suite + * @request POST:/repos/{owner}/{repo}/check-suites + */ + checksCreateSuite: (owner: string, repo: string, data: ChecksCreateSuitePayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-suites\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Gets a single check run using its \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the \`repo\` scope to get check runs in a private repository. + * + * @tags checks + * @name ChecksGet + * @summary Get a check run + * @request GET:/repos/{owner}/{repo}/check-runs/{check_run_id} + */ + checksGet: (owner: string, repo: string, checkRunId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-runs/\${checkRunId}\`, + method: "GET", + ...params, + }), + + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array and a \`null\` value for \`head_branch\`. Gets a single check suite using its \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check suites. OAuth Apps and authenticated users must have the \`repo\` scope to get check suites in a private repository. + * + * @tags checks + * @name ChecksGetSuite + * @summary Get a check suite + * @request GET:/repos/{owner}/{repo}/check-suites/{check_suite_id} + */ + checksGetSuite: (owner: string, repo: string, checkSuiteId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-suites/\${checkSuiteId}\`, + method: "GET", + ...params, + }), + + /** + * @description Lists annotations for a check run using the annotation \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get annotations for a check run. OAuth Apps and authenticated users must have the \`repo\` scope to get annotations for a check run in a private repository. + * + * @tags checks + * @name ChecksListAnnotations + * @summary List check run annotations + * @request GET:/repos/{owner}/{repo}/check-runs/{check_run_id}/annotations + */ + checksListAnnotations: ( + { owner, repo, checkRunId, ...query }: ChecksListAnnotationsParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-runs/\${checkRunId}/annotations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Lists check runs for a commit ref. The \`ref\` can be a SHA, branch name, or a tag name. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the \`repo\` scope to get check runs in a private repository. + * + * @tags checks + * @name ChecksListForRef + * @summary List check runs for a Git reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/check-runs + */ + checksListForRef: ({ owner, repo, ref, ...query }: ChecksListForRefParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/check-runs\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Lists check runs for a check suite using its \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the \`repo\` scope to get check runs in a private repository. + * + * @tags checks + * @name ChecksListForSuite + * @summary List check runs in a check suite + * @request GET:/repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs + */ + checksListForSuite: ( + { owner, repo, checkSuiteId, ...query }: ChecksListForSuiteParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-suites/\${checkSuiteId}/check-runs\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array and a \`null\` value for \`head_branch\`. Lists check suites for a commit \`ref\`. The \`ref\` can be a SHA, branch name, or a tag name. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to list check suites. OAuth Apps and authenticated users must have the \`repo\` scope to get check suites in a private repository. + * + * @tags checks + * @name ChecksListSuitesForRef + * @summary List check suites for a Git reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/check-suites + */ + checksListSuitesForRef: ( + { owner, repo, ref, ...query }: ChecksListSuitesForRefParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/check-suites\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. This endpoint will trigger the [\`check_suite\` webhook](https://docs.github.com/webhooks/event-payloads/#check_suite) event with the action \`rerequested\`. When a check suite is \`rerequested\`, its \`status\` is reset to \`queued\` and the \`conclusion\` is cleared. To rerequest a check suite, your GitHub App must have the \`checks:read\` permission on a private repository or pull access to a public repository. + * + * @tags checks + * @name ChecksRerequestSuite + * @summary Rerequest a check suite + * @request POST:/repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest + */ + checksRerequestSuite: (owner: string, repo: string, checkSuiteId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-suites/\${checkSuiteId}/rerequest\`, + method: "POST", + ...params, + }), + + /** + * @description Changes the default automatic flow when creating check suites. By default, a check suite is automatically created each time code is pushed to a repository. When you disable the automatic creation of check suites, you can manually [Create a check suite](https://docs.github.com/rest/reference/checks#create-a-check-suite). You must have admin permissions in the repository to set preferences for check suites. + * + * @tags checks + * @name ChecksSetSuitesPreferences + * @summary Update repository preferences for check suites + * @request PATCH:/repos/{owner}/{repo}/check-suites/preferences + */ + checksSetSuitesPreferences: ( + owner: string, + repo: string, + data: ChecksSetSuitesPreferencesPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-suites/preferences\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Updates a check run for a specific commit in a repository. Your GitHub App must have the \`checks:write\` permission to edit check runs. + * + * @tags checks + * @name ChecksUpdate + * @summary Update a check run + * @request PATCH:/repos/{owner}/{repo}/check-runs/{check_run_id} + */ + checksUpdate: ( + owner: string, + repo: string, + checkRunId: number, + data: ChecksUpdatePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-runs/\${checkRunId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Gets a single code scanning alert. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` read permission to use this endpoint. The security \`alert_number\` is found at the end of the security alert's URL. For example, the security alert ID for \`https://github.com/Octo-org/octo-repo/security/code-scanning/88\` is \`88\`. + * + * @tags code-scanning + * @name CodeScanningGetAlert + * @summary Get a code scanning alert + * @request GET:/repos/{owner}/{repo}/code-scanning/alerts/{alert_number} + */ + codeScanningGetAlert: (owner: string, repo: string, alertNumber: number, params: RequestParams = {}) => + this.request< + CodeScanningGetAlertData, + | void + | BasicError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/code-scanning/alerts/\${alertNumber}\`, + method: "GET", + ...params, + }), + + /** + * @description Lists all open code scanning alerts for the default branch (usually \`main\` or \`master\`). You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` read permission to use this endpoint. + * + * @tags code-scanning + * @name CodeScanningListAlertsForRepo + * @summary List code scanning alerts for a repository + * @request GET:/repos/{owner}/{repo}/code-scanning/alerts + */ + codeScanningListAlertsForRepo: ( + { owner, repo, ...query }: CodeScanningListAlertsForRepoParams, + params: RequestParams = {}, + ) => + this.request< + CodeScanningListAlertsForRepoData, + void | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/code-scanning/alerts\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List the details of recent code scanning analyses for a repository. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` read permission to use this endpoint. + * + * @tags code-scanning + * @name CodeScanningListRecentAnalyses + * @summary List recent code scanning analyses for a repository + * @request GET:/repos/{owner}/{repo}/code-scanning/analyses + */ + codeScanningListRecentAnalyses: ( + { owner, repo, ...query }: CodeScanningListRecentAnalysesParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/code-scanning/analyses\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Updates the status of a single code scanning alert. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` write permission to use this endpoint. + * + * @tags code-scanning + * @name CodeScanningUpdateAlert + * @summary Update a code scanning alert + * @request PATCH:/repos/{owner}/{repo}/code-scanning/alerts/{alert_number} + */ + codeScanningUpdateAlert: ( + owner: string, + repo: string, + alertNumber: AlertNumber, + data: CodeScanningUpdateAlertPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/code-scanning/alerts/\${alertNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Upload a SARIF file containing the results of a code scanning analysis to make the results available in a repository. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` write permission to use this endpoint. + * + * @tags code-scanning + * @name CodeScanningUploadSarif + * @summary Upload a SARIF file + * @request POST:/repos/{owner}/{repo}/code-scanning/sarifs + */ + codeScanningUploadSarif: ( + owner: string, + repo: string, + data: CodeScanningUploadSarifPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/code-scanning/sarifs\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Returns the contents of the repository's code of conduct file, if one is detected. A code of conduct is detected if there is a file named \`CODE_OF_CONDUCT\` in the root directory of the repository. GitHub detects which code of conduct it is using fuzzy matching. + * + * @tags codes-of-conduct + * @name CodesOfConductGetForRepo + * @summary Get the code of conduct for a repository + * @request GET:/repos/{owner}/{repo}/community/code_of_conduct + */ + codesOfConductGetForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/community/code_of_conduct\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags git + * @name GitCreateBlob + * @summary Create a blob + * @request POST:/repos/{owner}/{repo}/git/blobs + */ + gitCreateBlob: (owner: string, repo: string, data: GitCreateBlobPayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/blobs\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Creates a new Git [commit object](https://git-scm.com/book/en/v1/Git-Internals-Git-Objects#Commit-Objects). **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * + * @tags git + * @name GitCreateCommit + * @summary Create a commit + * @request POST:/repos/{owner}/{repo}/git/commits + */ + gitCreateCommit: (owner: string, repo: string, data: GitCreateCommitPayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/commits\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Creates a reference for your repository. You are unable to create new references for empty repositories, even if the commit SHA-1 hash used exists. Empty repositories are repositories without branches. + * + * @tags git + * @name GitCreateRef + * @summary Create a reference + * @request POST:/repos/{owner}/{repo}/git/refs + */ + gitCreateRef: (owner: string, repo: string, data: GitCreateRefPayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/refs\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then [create](https://docs.github.com/rest/reference/git#create-a-reference) the \`refs/tags/[tag]\` reference. If you want to create a lightweight tag, you only have to [create](https://docs.github.com/rest/reference/git#create-a-reference) the tag reference - this call would be unnecessary. **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * + * @tags git + * @name GitCreateTag + * @summary Create a tag object + * @request POST:/repos/{owner}/{repo}/git/tags + */ + gitCreateTag: (owner: string, repo: string, data: GitCreateTagPayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/tags\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description The tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure. If you use this endpoint to add, delete, or modify the file contents in a tree, you will need to commit the tree and then update a branch to point to the commit. For more information see "[Create a commit](https://docs.github.com/rest/reference/git#create-a-commit)" and "[Update a reference](https://docs.github.com/rest/reference/git#update-a-reference)." + * + * @tags git + * @name GitCreateTree + * @summary Create a tree + * @request POST:/repos/{owner}/{repo}/git/trees + */ + gitCreateTree: (owner: string, repo: string, data: GitCreateTreePayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/trees\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags git + * @name GitDeleteRef + * @summary Delete a reference + * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} + */ + gitDeleteRef: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, + method: "DELETE", + ...params, + }), + + /** + * @description The \`content\` in the response will always be Base64 encoded. _Note_: This API supports blobs up to 100 megabytes in size. + * + * @tags git + * @name GitGetBlob + * @summary Get a blob + * @request GET:/repos/{owner}/{repo}/git/blobs/{file_sha} + */ + gitGetBlob: (owner: string, repo: string, fileSha: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/blobs/\${fileSha}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a Git [commit object](https://git-scm.com/book/en/v1/Git-Internals-Git-Objects#Commit-Objects). **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * + * @tags git + * @name GitGetCommit + * @summary Get a commit + * @request GET:/repos/{owner}/{repo}/git/commits/{commit_sha} + */ + gitGetCommit: (owner: string, repo: string, commitSha: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/commits/\${commitSha}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns a single reference from your Git database. The \`:ref\` in the URL must be formatted as \`heads/\` for branches and \`tags/\` for tags. If the \`:ref\` doesn't match an existing ref, a \`404\` is returned. **Note:** You need to explicitly [request a pull request](https://docs.github.com/rest/reference/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". + * + * @tags git + * @name GitGetRef + * @summary Get a reference + * @request GET:/repos/{owner}/{repo}/git/ref/{ref} + */ + gitGetRef: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/ref/\${ref}\`, + method: "GET", + ...params, + }), + + /** + * @description **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * + * @tags git + * @name GitGetTag + * @summary Get a tag + * @request GET:/repos/{owner}/{repo}/git/tags/{tag_sha} + */ + gitGetTag: (owner: string, repo: string, tagSha: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/tags/\${tagSha}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns a single tree using the SHA1 value for that tree. If \`truncated\` is \`true\` in the response then the number of items in the \`tree\` array exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time. + * + * @tags git + * @name GitGetTree + * @summary Get a tree + * @request GET:/repos/{owner}/{repo}/git/trees/{tree_sha} + */ + gitGetTree: ({ owner, repo, treeSha, ...query }: GitGetTreeParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/trees/\${treeSha}\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Returns an array of references from your Git database that match the supplied name. The \`:ref\` in the URL must be formatted as \`heads/\` for branches and \`tags/\` for tags. If the \`:ref\` doesn't exist in the repository, but existing refs start with \`:ref\`, they will be returned as an array. When you use this endpoint without providing a \`:ref\`, it will return an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just \`heads\` and \`tags\`. **Note:** You need to explicitly [request a pull request](https://docs.github.com/rest/reference/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". If you request matching references for a branch named \`feature\` but the branch \`feature\` doesn't exist, the response can still include other matching head refs that start with the word \`feature\`, such as \`featureA\` and \`featureB\`. + * + * @tags git + * @name GitListMatchingRefs + * @summary List matching references + * @request GET:/repos/{owner}/{repo}/git/matching-refs/{ref} + */ + gitListMatchingRefs: ({ owner, repo, ref, ...query }: GitListMatchingRefsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/matching-refs/\${ref}\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags git + * @name GitUpdateRef + * @summary Update a reference + * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} + */ + gitUpdateRef: (owner: string, repo: string, ref: string, data: GitUpdateRefPayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Shows which type of GitHub user can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response. + * + * @tags interactions + * @name InteractionsGetRestrictionsForRepo + * @summary Get interaction restrictions for a repository + * @request GET:/repos/{owner}/{repo}/interaction-limits + */ + interactionsGetRestrictionsForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/interaction-limits\`, + method: "GET", + ...params, + }), + + /** + * @description Removes all interaction restrictions from the given repository. You must have owner or admin access to remove restrictions. If the interaction limit is set for the user or organization that owns this repository, you will receive a \`409 Conflict\` response and will not be able to use this endpoint to change the interaction limit for a single repository. + * + * @tags interactions + * @name InteractionsRemoveRestrictionsForRepo + * @summary Remove interaction restrictions for a repository + * @request DELETE:/repos/{owner}/{repo}/interaction-limits + */ + interactionsRemoveRestrictionsForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/interaction-limits\`, + method: "DELETE", + ...params, + }), + + /** + * @description Temporarily restricts interactions to a certain type of GitHub user within the given repository. You must have owner or admin access to set these restrictions. If an interaction limit is set for the user or organization that owns this repository, you will receive a \`409 Conflict\` response and will not be able to use this endpoint to change the interaction limit for a single repository. + * + * @tags interactions + * @name InteractionsSetRestrictionsForRepo + * @summary Set interaction restrictions for a repository + * @request PUT:/repos/{owner}/{repo}/interaction-limits + */ + interactionsSetRestrictionsForRepo: ( + owner: string, + repo: string, + data: InteractionLimit, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/interaction-limits\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Adds up to 10 assignees to an issue. Users already assigned to an issue are not replaced. + * + * @tags issues + * @name IssuesAddAssignees + * @summary Add assignees to an issue + * @request POST:/repos/{owner}/{repo}/issues/{issue_number}/assignees + */ + issuesAddAssignees: ( + owner: string, + repo: string, + issueNumber: number, + data: IssuesAddAssigneesPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/assignees\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesAddLabels + * @summary Add labels to an issue + * @request POST:/repos/{owner}/{repo}/issues/{issue_number}/labels + */ + issuesAddLabels: ( + owner: string, + repo: string, + issueNumber: number, + data: IssuesAddLabelsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/labels\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Checks if a user has permission to be assigned to an issue in this repository. If the \`assignee\` can be assigned to issues in the repository, a \`204\` header with no content is returned. Otherwise a \`404\` status code is returned. + * + * @tags issues + * @name IssuesCheckUserCanBeAssigned + * @summary Check if a user can be assigned + * @request GET:/repos/{owner}/{repo}/assignees/{assignee} + */ + issuesCheckUserCanBeAssigned: (owner: string, repo: string, assignee: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/assignees/\${assignee}\`, + method: "GET", + ...params, + }), + + /** + * @description Any user with pull access to a repository can create an issue. If [issues are disabled in the repository](https://help.github.com/articles/disabling-issues/), the API returns a \`410 Gone\` status. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. + * + * @tags issues + * @name IssuesCreate + * @summary Create an issue + * @request POST:/repos/{owner}/{repo}/issues + */ + issuesCreate: (owner: string, repo: string, data: IssuesCreatePayload, params: RequestParams = {}) => + this.request< + IssuesCreateData, + | BasicError + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/issues\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. + * + * @tags issues + * @name IssuesCreateComment + * @summary Create an issue comment + * @request POST:/repos/{owner}/{repo}/issues/{issue_number}/comments + */ + issuesCreateComment: ( + owner: string, + repo: string, + issueNumber: number, + data: IssuesCreateCommentPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/comments\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesCreateLabel + * @summary Create a label + * @request POST:/repos/{owner}/{repo}/labels + */ + issuesCreateLabel: (owner: string, repo: string, data: IssuesCreateLabelPayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/labels\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesCreateMilestone + * @summary Create a milestone + * @request POST:/repos/{owner}/{repo}/milestones + */ + issuesCreateMilestone: ( + owner: string, + repo: string, + data: IssuesCreateMilestonePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesDeleteComment + * @summary Delete an issue comment + * @request DELETE:/repos/{owner}/{repo}/issues/comments/{comment_id} + */ + issuesDeleteComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesDeleteLabel + * @summary Delete a label + * @request DELETE:/repos/{owner}/{repo}/labels/{name} + */ + issuesDeleteLabel: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesDeleteMilestone + * @summary Delete a milestone + * @request DELETE:/repos/{owner}/{repo}/milestones/{milestone_number} + */ + issuesDeleteMilestone: (owner: string, repo: string, milestoneNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones/\${milestoneNumber}\`, + method: "DELETE", + ...params, + }), + + /** + * @description The API returns a [\`301 Moved Permanently\` status](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-redirects-redirects) if the issue was [transferred](https://help.github.com/articles/transferring-an-issue-to-another-repository/) to another repository. If the issue was transferred to or deleted from a repository where the authenticated user lacks read access, the API returns a \`404 Not Found\` status. If the issue was deleted from a repository where the authenticated user has read access, the API returns a \`410 Gone\` status. To receive webhook events for transferred and deleted issues, subscribe to the [\`issues\`](https://docs.github.com/webhooks/event-payloads/#issues) webhook. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * + * @tags issues + * @name IssuesGet + * @summary Get an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number} + */ + issuesGet: (owner: string, repo: string, issueNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesGetComment + * @summary Get an issue comment + * @request GET:/repos/{owner}/{repo}/issues/comments/{comment_id} + */ + issuesGetComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesGetEvent + * @summary Get an issue event + * @request GET:/repos/{owner}/{repo}/issues/events/{event_id} + */ + issuesGetEvent: (owner: string, repo: string, eventId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/events/\${eventId}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesGetLabel + * @summary Get a label + * @request GET:/repos/{owner}/{repo}/labels/{name} + */ + issuesGetLabel: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesGetMilestone + * @summary Get a milestone + * @request GET:/repos/{owner}/{repo}/milestones/{milestone_number} + */ + issuesGetMilestone: (owner: string, repo: string, milestoneNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones/\${milestoneNumber}\`, + method: "GET", + ...params, + }), + + /** + * @description Lists the [available assignees](https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/) for issues in a repository. + * + * @tags issues + * @name IssuesListAssignees + * @summary List assignees + * @request GET:/repos/{owner}/{repo}/assignees + */ + issuesListAssignees: ({ owner, repo, ...query }: IssuesListAssigneesParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/assignees\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Issue Comments are ordered by ascending ID. + * + * @tags issues + * @name IssuesListComments + * @summary List issue comments + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/comments + */ + issuesListComments: ( + { owner, repo, issueNumber, ...query }: IssuesListCommentsParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/comments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description By default, Issue Comments are ordered by ascending ID. + * + * @tags issues + * @name IssuesListCommentsForRepo + * @summary List issue comments for a repository + * @request GET:/repos/{owner}/{repo}/issues/comments + */ + issuesListCommentsForRepo: ( + { owner, repo, ...query }: IssuesListCommentsForRepoParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/comments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesListEvents + * @summary List issue events + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/events + */ + issuesListEvents: ({ owner, repo, issueNumber, ...query }: IssuesListEventsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/events\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesListEventsForRepo + * @summary List issue events for a repository + * @request GET:/repos/{owner}/{repo}/issues/events + */ + issuesListEventsForRepo: ({ owner, repo, ...query }: IssuesListEventsForRepoParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/events\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesListEventsForTimeline + * @summary List timeline events for an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/timeline + */ + issuesListEventsForTimeline: ( + { owner, repo, issueNumber, ...query }: IssuesListEventsForTimelineParams, + params: RequestParams = {}, + ) => + this.request< + IssuesListEventsForTimelineData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/timeline\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List issues in a repository. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * + * @tags issues + * @name IssuesListForRepo + * @summary List repository issues + * @request GET:/repos/{owner}/{repo}/issues + */ + issuesListForRepo: ({ owner, repo, ...query }: IssuesListForRepoParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesListLabelsForMilestone + * @summary List labels for issues in a milestone + * @request GET:/repos/{owner}/{repo}/milestones/{milestone_number}/labels + */ + issuesListLabelsForMilestone: ( + { owner, repo, milestoneNumber, ...query }: IssuesListLabelsForMilestoneParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones/\${milestoneNumber}/labels\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesListLabelsForRepo + * @summary List labels for a repository + * @request GET:/repos/{owner}/{repo}/labels + */ + issuesListLabelsForRepo: ({ owner, repo, ...query }: IssuesListLabelsForRepoParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/labels\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesListLabelsOnIssue + * @summary List labels for an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/labels + */ + issuesListLabelsOnIssue: ( + { owner, repo, issueNumber, ...query }: IssuesListLabelsOnIssueParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/labels\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesListMilestones + * @summary List milestones + * @request GET:/repos/{owner}/{repo}/milestones + */ + issuesListMilestones: ({ owner, repo, ...query }: IssuesListMilestonesParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Users with push access can lock an issue or pull request's conversation. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * + * @tags issues + * @name IssuesLock + * @summary Lock an issue + * @request PUT:/repos/{owner}/{repo}/issues/{issue_number}/lock + */ + issuesLock: ( + owner: string, + repo: string, + issueNumber: number, + data: IssuesLockPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/lock\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesRemoveAllLabels + * @summary Remove all labels from an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/labels + */ + issuesRemoveAllLabels: (owner: string, repo: string, issueNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/labels\`, + method: "DELETE", + ...params, + }), + + /** + * @description Removes one or more assignees from an issue. + * + * @tags issues + * @name IssuesRemoveAssignees + * @summary Remove assignees from an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/assignees + */ + issuesRemoveAssignees: ( + owner: string, + repo: string, + issueNumber: number, + data: IssuesRemoveAssigneesPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/assignees\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Removes the specified label from the issue, and returns the remaining labels on the issue. This endpoint returns a \`404 Not Found\` status if the label does not exist. + * + * @tags issues + * @name IssuesRemoveLabel + * @summary Remove a label from an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/labels/{name} + */ + issuesRemoveLabel: (owner: string, repo: string, issueNumber: number, name: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/labels/\${name}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Removes any previous labels and sets the new labels for an issue. + * + * @tags issues + * @name IssuesSetLabels + * @summary Set labels for an issue + * @request PUT:/repos/{owner}/{repo}/issues/{issue_number}/labels + */ + issuesSetLabels: ( + owner: string, + repo: string, + issueNumber: number, + data: IssuesSetLabelsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/labels\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Users with push access can unlock an issue's conversation. + * + * @tags issues + * @name IssuesUnlock + * @summary Unlock an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/lock + */ + issuesUnlock: (owner: string, repo: string, issueNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/lock\`, + method: "DELETE", + ...params, + }), + + /** + * @description Issue owners and users with push access can edit an issue. + * + * @tags issues + * @name IssuesUpdate + * @summary Update an issue + * @request PATCH:/repos/{owner}/{repo}/issues/{issue_number} + */ + issuesUpdate: ( + owner: string, + repo: string, + issueNumber: number, + data: IssuesUpdatePayload, + params: RequestParams = {}, + ) => + this.request< + IssuesUpdateData, + | BasicError + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesUpdateComment + * @summary Update an issue comment + * @request PATCH:/repos/{owner}/{repo}/issues/comments/{comment_id} + */ + issuesUpdateComment: ( + owner: string, + repo: string, + commentId: number, + data: IssuesUpdateCommentPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesUpdateLabel + * @summary Update a label + * @request PATCH:/repos/{owner}/{repo}/labels/{name} + */ + issuesUpdateLabel: ( + owner: string, + repo: string, + name: string, + data: IssuesUpdateLabelPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesUpdateMilestone + * @summary Update a milestone + * @request PATCH:/repos/{owner}/{repo}/milestones/{milestone_number} + */ + issuesUpdateMilestone: ( + owner: string, + repo: string, + milestoneNumber: number, + data: IssuesUpdateMilestonePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones/\${milestoneNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description This method returns the contents of the repository's license file, if one is detected. Similar to [Get repository content](https://docs.github.com/rest/reference/repos#get-repository-content), this method also supports [custom media types](https://docs.github.com/rest/overview/media-types) for retrieving the raw license content or rendered license HTML. + * + * @tags licenses + * @name LicensesGetForRepo + * @summary Get the license for a repository + * @request GET:/repos/{owner}/{repo}/license + */ + licensesGetForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/license\`, + method: "GET", + ...params, + }), + + /** + * @description Stop an import for a repository. + * + * @tags migrations + * @name MigrationsCancelImport + * @summary Cancel an import + * @request DELETE:/repos/{owner}/{repo}/import + */ + migrationsCancelImport: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import\`, + method: "DELETE", + ...params, + }), + + /** + * @description Each type of source control system represents authors in a different way. For example, a Git commit author has a display name and an email address, but a Subversion commit author just has a username. The GitHub Importer will make the author information valid, but the author might not be correct. For example, it will change the bare Subversion username \`hubot\` into something like \`hubot \`. This endpoint and the [Map a commit author](https://docs.github.com/rest/reference/migrations#map-a-commit-author) endpoint allow you to provide correct Git author information. + * + * @tags migrations + * @name MigrationsGetCommitAuthors + * @summary Get commit authors + * @request GET:/repos/{owner}/{repo}/import/authors + */ + migrationsGetCommitAuthors: ( + { owner, repo, ...query }: MigrationsGetCommitAuthorsParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import/authors\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description View the progress of an import. **Import status** This section includes details about the possible values of the \`status\` field of the Import Progress response. An import that does not have errors will progress through these steps: * \`detecting\` - the "detection" step of the import is in progress because the request did not include a \`vcs\` parameter. The import is identifying the type of source control present at the URL. * \`importing\` - the "raw" step of the import is in progress. This is where commit data is fetched from the original repository. The import progress response will include \`commit_count\` (the total number of raw commits that will be imported) and \`percent\` (0 - 100, the current progress through the import). * \`mapping\` - the "rewrite" step of the import is in progress. This is where SVN branches are converted to Git branches, and where author updates are applied. The import progress response does not include progress information. * \`pushing\` - the "push" step of the import is in progress. This is where the importer updates the repository on GitHub. The import progress response will include \`push_percent\`, which is the percent value reported by \`git push\` when it is "Writing objects". * \`complete\` - the import is complete, and the repository is ready on GitHub. If there are problems, you will see one of these in the \`status\` field: * \`auth_failed\` - the import requires authentication in order to connect to the original repository. To update authentication for the import, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. * \`error\` - the import encountered an error. The import progress response will include the \`failed_step\` and an error message. Contact [GitHub Support](https://support.github.com/contact) or [GitHub Premium Support](https://premium.githubsupport.com) for more information. * \`detection_needs_auth\` - the importer requires authentication for the originating repository to continue detection. To update authentication for the import, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. * \`detection_found_nothing\` - the importer didn't recognize any source control at the URL. To resolve, [Cancel the import](https://docs.github.com/rest/reference/migrations#cancel-an-import) and [retry](https://docs.github.com/rest/reference/migrations#start-an-import) with the correct URL. * \`detection_found_multiple\` - the importer found several projects or repositories at the provided URL. When this is the case, the Import Progress response will also include a \`project_choices\` field with the possible project choices as values. To update project choice, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. **The project_choices field** When multiple projects are found at the provided URL, the response hash will include a \`project_choices\` field, the value of which is an array of hashes each representing a project choice. The exact key/value pairs of the project hashes will differ depending on the version control type. **Git LFS related fields** This section includes details about Git LFS related fields that may be present in the Import Progress response. * \`use_lfs\` - describes whether the import has been opted in or out of using Git LFS. The value can be \`opt_in\`, \`opt_out\`, or \`undecided\` if no action has been taken. * \`has_large_files\` - the boolean value describing whether files larger than 100MB were found during the \`importing\` step. * \`large_files_size\` - the total size in gigabytes of files larger than 100MB found in the originating repository. * \`large_files_count\` - the total number of files larger than 100MB found in the originating repository. To see a list of these files, make a "Get Large Files" request. + * + * @tags migrations + * @name MigrationsGetImportStatus + * @summary Get an import status + * @request GET:/repos/{owner}/{repo}/import + */ + migrationsGetImportStatus: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import\`, + method: "GET", + ...params, + }), + + /** + * @description List files larger than 100MB found during the import + * + * @tags migrations + * @name MigrationsGetLargeFiles + * @summary Get large files + * @request GET:/repos/{owner}/{repo}/import/large_files + */ + migrationsGetLargeFiles: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import/large_files\`, + method: "GET", + ...params, + }), + + /** + * @description Update an author's identity for the import. Your application can continue updating authors any time before you push new commits to the repository. + * + * @tags migrations + * @name MigrationsMapCommitAuthor + * @summary Map a commit author + * @request PATCH:/repos/{owner}/{repo}/import/authors/{author_id} + */ + migrationsMapCommitAuthor: ( + owner: string, + repo: string, + authorId: number, + data: MigrationsMapCommitAuthorPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import/authors/\${authorId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description You can import repositories from Subversion, Mercurial, and TFS that include files larger than 100MB. This ability is powered by [Git LFS](https://git-lfs.github.com). You can learn more about our LFS feature and working with large files [on our help site](https://help.github.com/articles/versioning-large-files/). + * + * @tags migrations + * @name MigrationsSetLfsPreference + * @summary Update Git LFS preference + * @request PATCH:/repos/{owner}/{repo}/import/lfs + */ + migrationsSetLfsPreference: ( + owner: string, + repo: string, + data: MigrationsSetLfsPreferencePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import/lfs\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Start a source import to a GitHub repository using GitHub Importer. + * + * @tags migrations + * @name MigrationsStartImport + * @summary Start an import + * @request PUT:/repos/{owner}/{repo}/import + */ + migrationsStartImport: ( + owner: string, + repo: string, + data: MigrationsStartImportPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description An import can be updated with credentials or a project choice by passing in the appropriate parameters in this API request. If no parameters are provided, the import will be restarted. + * + * @tags migrations + * @name MigrationsUpdateImport + * @summary Update an import + * @request PATCH:/repos/{owner}/{repo}/import + */ + migrationsUpdateImport: ( + owner: string, + repo: string, + data: MigrationsUpdateImportPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Creates a repository project board. Returns a \`404 Not Found\` status if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * + * @tags projects + * @name ProjectsCreateForRepo + * @summary Create a repository project + * @request POST:/repos/{owner}/{repo}/projects + */ + projectsCreateForRepo: ( + owner: string, + repo: string, + data: ProjectsCreateForRepoPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/projects\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Lists the projects in a repository. Returns a \`404 Not Found\` status if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * + * @tags projects + * @name ProjectsListForRepo + * @summary List repository projects + * @request GET:/repos/{owner}/{repo}/projects + */ + projectsListForRepo: ({ owner, repo, ...query }: ProjectsListForRepoParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/projects\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags pulls + * @name PullsCheckIfMerged + * @summary Check if a pull request has been merged + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/merge + */ + pullsCheckIfMerged: (owner: string, repo: string, pullNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/merge\`, + method: "GET", + ...params, + }), + + /** + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request. You can create a new pull request. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * + * @tags pulls + * @name PullsCreate + * @summary Create a pull request + * @request POST:/repos/{owner}/{repo}/pulls + */ + pullsCreate: (owner: string, repo: string, data: PullsCreatePayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Creates a reply to a review comment for a pull request. For the \`comment_id\`, provide the ID of the review comment you are replying to. This must be the ID of a _top-level review comment_, not a reply to that comment. Replies to replies are not supported. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * + * @tags pulls + * @name PullsCreateReplyForReviewComment + * @summary Create a reply for a review comment + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies + */ + pullsCreateReplyForReviewComment: ( + owner: string, + repo: string, + pullNumber: number, + commentId: number, + data: PullsCreateReplyForReviewCommentPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/comments/\${commentId}/replies\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. Pull request reviews created in the \`PENDING\` state do not include the \`submitted_at\` property in the response. **Note:** To comment on a specific line in a file, you need to first determine the _position_ of that line in the diff. The GitHub REST API v3 offers the \`application/vnd.github.v3.diff\` [media type](https://docs.github.com/rest/overview/media-types#commits-commit-comparison-and-pull-requests). To see a pull request diff, add this media type to the \`Accept\` header of a call to the [single pull request](https://docs.github.com/rest/reference/pulls#get-a-pull-request) endpoint. The \`position\` value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file. + * + * @tags pulls + * @name PullsCreateReview + * @summary Create a review for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/reviews + */ + pullsCreateReview: ( + owner: string, + repo: string, + pullNumber: number, + data: PullsCreateReviewPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Creates a review comment in the pull request diff. To add a regular comment to a pull request timeline, see "[Create an issue comment](https://docs.github.com/rest/reference/issues#create-an-issue-comment)." We recommend creating a review comment using \`line\`, \`side\`, and optionally \`start_line\` and \`start_side\` if your comment applies to more than one line in the pull request diff. You can still create a review comment using the \`position\` parameter. When you use \`position\`, the \`line\`, \`side\`, \`start_line\`, and \`start_side\` parameters are not required. For more information, see the [\`comfort-fade\` preview notice](https://docs.github.com/rest/reference/pulls#create-a-review-comment-for-a-pull-request-preview-notices). **Note:** The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * + * @tags pulls + * @name PullsCreateReviewComment + * @summary Create a review comment for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/comments + */ + pullsCreateReviewComment: ( + owner: string, + repo: string, + pullNumber: number, + data: PullsCreateReviewCommentPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/comments\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags pulls + * @name PullsDeletePendingReview + * @summary Delete a pending review for a pull request + * @request DELETE:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} + */ + pullsDeletePendingReview: ( + owner: string, + repo: string, + pullNumber: number, + reviewId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Deletes a review comment. + * + * @tags pulls + * @name PullsDeleteReviewComment + * @summary Delete a review comment for a pull request + * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{comment_id} + */ + pullsDeleteReviewComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note:** To dismiss a pull request review on a [protected branch](https://docs.github.com/rest/reference/repos#branches), you must be a repository administrator or be included in the list of people or teams who can dismiss pull request reviews. + * + * @tags pulls + * @name PullsDismissReview + * @summary Dismiss a review for a pull request + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals + */ + pullsDismissReview: ( + owner: string, + repo: string, + pullNumber: number, + reviewId: number, + data: PullsDismissReviewPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}/dismissals\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists details of a pull request by providing its number. When you get, [create](https://docs.github.com/rest/reference/pulls/#create-a-pull-request), or [edit](https://docs.github.com/rest/reference/pulls#update-a-pull-request) a pull request, GitHub creates a merge commit to test whether the pull request can be automatically merged into the base branch. This test commit is not added to the base branch or the head branch. You can review the status of the test commit using the \`mergeable\` key. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". The value of the \`mergeable\` attribute can be \`true\`, \`false\`, or \`null\`. If the value is \`null\`, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-\`null\` value for the \`mergeable\` attribute in the response. If \`mergeable\` is \`true\`, then \`merge_commit_sha\` will be the SHA of the _test_ merge commit. The value of the \`merge_commit_sha\` attribute changes depending on the state of the pull request. Before merging a pull request, the \`merge_commit_sha\` attribute holds the SHA of the _test_ merge commit. After merging a pull request, the \`merge_commit_sha\` attribute changes depending on how you merged the pull request: * If merged as a [merge commit](https://help.github.com/articles/about-merge-methods-on-github/), \`merge_commit_sha\` represents the SHA of the merge commit. * If merged via a [squash](https://help.github.com/articles/about-merge-methods-on-github/#squashing-your-merge-commits), \`merge_commit_sha\` represents the SHA of the squashed commit on the base branch. * If [rebased](https://help.github.com/articles/about-merge-methods-on-github/#rebasing-and-merging-your-commits), \`merge_commit_sha\` represents the commit that the base branch was updated to. Pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats. + * + * @tags pulls + * @name PullsGet + * @summary Get a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number} + */ + pullsGet: (owner: string, repo: string, pullNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags pulls + * @name PullsGetReview + * @summary Get a review for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} + */ + pullsGetReview: (owner: string, repo: string, pullNumber: number, reviewId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}\`, + method: "GET", + ...params, + }), + + /** + * @description Provides details for a review comment. + * + * @tags pulls + * @name PullsGetReviewComment + * @summary Get a review comment for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/comments/{comment_id} + */ + pullsGetReviewComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, + method: "GET", + ...params, + }), + + /** + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags pulls + * @name PullsList + * @summary List pull requests + * @request GET:/repos/{owner}/{repo}/pulls + */ + pullsList: ({ owner, repo, ...query }: PullsListParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List comments for a specific pull request review. + * + * @tags pulls + * @name PullsListCommentsForReview + * @summary List comments for a pull request review + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments + */ + pullsListCommentsForReview: ( + { owner, repo, pullNumber, reviewId, ...query }: PullsListCommentsForReviewParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}/comments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists a maximum of 250 commits for a pull request. To receive a complete commit list for pull requests with more than 250 commits, use the [List commits](https://docs.github.com/rest/reference/repos#list-commits) endpoint. + * + * @tags pulls + * @name PullsListCommits + * @summary List commits on a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/commits + */ + pullsListCommits: ({ owner, repo, pullNumber, ...query }: PullsListCommitsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/commits\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Note:** Responses include a maximum of 3000 files. The paginated response returns 30 files per page by default. + * + * @tags pulls + * @name PullsListFiles + * @summary List pull requests files + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/files + */ + pullsListFiles: ({ owner, repo, pullNumber, ...query }: PullsListFilesParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/files\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags pulls + * @name PullsListRequestedReviewers + * @summary List requested reviewers for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + */ + pullsListRequestedReviewers: ( + { owner, repo, pullNumber, ...query }: PullsListRequestedReviewersParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/requested_reviewers\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all review comments for a pull request. By default, review comments are in ascending order by ID. + * + * @tags pulls + * @name PullsListReviewComments + * @summary List review comments on a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/comments + */ + pullsListReviewComments: ( + { owner, repo, pullNumber, ...query }: PullsListReviewCommentsParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/comments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists review comments for all pull requests in a repository. By default, review comments are in ascending order by ID. + * + * @tags pulls + * @name PullsListReviewCommentsForRepo + * @summary List review comments in a repository + * @request GET:/repos/{owner}/{repo}/pulls/comments + */ + pullsListReviewCommentsForRepo: ( + { owner, repo, ...query }: PullsListReviewCommentsForRepoParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/comments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description The list of reviews returns in chronological order. + * + * @tags pulls + * @name PullsListReviews + * @summary List reviews for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews + */ + pullsListReviews: ({ owner, repo, pullNumber, ...query }: PullsListReviewsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. + * + * @tags pulls + * @name PullsMerge + * @summary Merge a pull request + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/merge + */ + pullsMerge: ( + owner: string, + repo: string, + pullNumber: number, + data: PullsMergePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/merge\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags pulls + * @name PullsRemoveRequestedReviewers + * @summary Remove requested reviewers from a pull request + * @request DELETE:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + */ + pullsRemoveRequestedReviewers: ( + owner: string, + repo: string, + pullNumber: number, + data: PullsRemoveRequestedReviewersPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/requested_reviewers\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. + * + * @tags pulls + * @name PullsRequestReviewers + * @summary Request reviewers for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + */ + pullsRequestReviewers: ( + owner: string, + repo: string, + pullNumber: number, + data: PullsRequestReviewersPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/requested_reviewers\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags pulls + * @name PullsSubmitReview + * @summary Submit a review for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events + */ + pullsSubmitReview: ( + owner: string, + repo: string, + pullNumber: number, + reviewId: number, + data: PullsSubmitReviewPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}/events\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request. + * + * @tags pulls + * @name PullsUpdate + * @summary Update a pull request + * @request PATCH:/repos/{owner}/{repo}/pulls/{pull_number} + */ + pullsUpdate: ( + owner: string, + repo: string, + pullNumber: number, + data: PullsUpdatePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Updates the pull request branch with the latest upstream changes by merging HEAD from the base branch into the pull request branch. + * + * @tags pulls + * @name PullsUpdateBranch + * @summary Update a pull request branch + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/update-branch + */ + pullsUpdateBranch: ( + owner: string, + repo: string, + pullNumber: number, + data: PullsUpdateBranchPayload, + params: RequestParams = {}, + ) => + this.request< + PullsUpdateBranchData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/update-branch\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Update the review summary comment with new text. + * + * @tags pulls + * @name PullsUpdateReview + * @summary Update a review for a pull request + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} + */ + pullsUpdateReview: ( + owner: string, + repo: string, + pullNumber: number, + reviewId: number, + data: PullsUpdateReviewPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Enables you to edit a review comment. + * + * @tags pulls + * @name PullsUpdateReviewComment + * @summary Update a review comment for a pull request + * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{comment_id} + */ + pullsUpdateReviewComment: ( + owner: string, + repo: string, + commentId: number, + data: PullsUpdateReviewCommentPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Create a reaction to a [commit comment](https://docs.github.com/rest/reference/repos#comments). A response with a \`Status: 200 OK\` means that you already added the reaction type to this commit comment. + * + * @tags reactions + * @name ReactionsCreateForCommitComment + * @summary Create reaction for a commit comment + * @request POST:/repos/{owner}/{repo}/comments/{comment_id}/reactions + */ + reactionsCreateForCommitComment: ( + owner: string, + repo: string, + commentId: number, + data: ReactionsCreateForCommitCommentPayload, + params: RequestParams = {}, + ) => + this.request< + ReactionsCreateForCommitCommentData, + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Create a reaction to an [issue](https://docs.github.com/rest/reference/issues/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this issue. + * + * @tags reactions + * @name ReactionsCreateForIssue + * @summary Create reaction for an issue + * @request POST:/repos/{owner}/{repo}/issues/{issue_number}/reactions + */ + reactionsCreateForIssue: ( + owner: string, + repo: string, + issueNumber: number, + data: ReactionsCreateForIssuePayload, + params: RequestParams = {}, + ) => + this.request< + ReactionsCreateForIssueData, + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Create a reaction to an [issue comment](https://docs.github.com/rest/reference/issues#comments). A response with a \`Status: 200 OK\` means that you already added the reaction type to this issue comment. + * + * @tags reactions + * @name ReactionsCreateForIssueComment + * @summary Create reaction for an issue comment + * @request POST:/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions + */ + reactionsCreateForIssueComment: ( + owner: string, + repo: string, + commentId: number, + data: ReactionsCreateForIssueCommentPayload, + params: RequestParams = {}, + ) => + this.request< + ReactionsCreateForIssueCommentData, + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Create a reaction to a [pull request review comment](https://docs.github.com/rest/reference/pulls#comments). A response with a \`Status: 200 OK\` means that you already added the reaction type to this pull request review comment. + * + * @tags reactions + * @name ReactionsCreateForPullRequestReviewComment + * @summary Create reaction for a pull request review comment + * @request POST:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions + */ + reactionsCreateForPullRequestReviewComment: ( + owner: string, + repo: string, + commentId: number, + data: ReactionsCreateForPullRequestReviewCommentPayload, + params: RequestParams = {}, + ) => + this.request< + ReactionsCreateForPullRequestReviewCommentData, + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE /repositories/:repository_id/comments/:comment_id/reactions/:reaction_id\`. Delete a reaction to a [commit comment](https://docs.github.com/rest/reference/repos#comments). + * + * @tags reactions + * @name ReactionsDeleteForCommitComment + * @summary Delete a commit comment reaction + * @request DELETE:/repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} + */ + reactionsDeleteForCommitComment: ( + owner: string, + repo: string, + commentId: number, + reactionId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}/reactions/\${reactionId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE /repositories/:repository_id/issues/:issue_number/reactions/:reaction_id\`. Delete a reaction to an [issue](https://docs.github.com/rest/reference/issues/). + * + * @tags reactions + * @name ReactionsDeleteForIssue + * @summary Delete an issue reaction + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} + */ + reactionsDeleteForIssue: ( + owner: string, + repo: string, + issueNumber: number, + reactionId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/reactions/\${reactionId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE delete /repositories/:repository_id/issues/comments/:comment_id/reactions/:reaction_id\`. Delete a reaction to an [issue comment](https://docs.github.com/rest/reference/issues#comments). + * + * @tags reactions + * @name ReactionsDeleteForIssueComment + * @summary Delete an issue comment reaction + * @request DELETE:/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} + */ + reactionsDeleteForIssueComment: ( + owner: string, + repo: string, + commentId: number, + reactionId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}/reactions/\${reactionId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE /repositories/:repository_id/pulls/comments/:comment_id/reactions/:reaction_id.\` Delete a reaction to a [pull request review comment](https://docs.github.com/rest/reference/pulls#review-comments). + * + * @tags reactions + * @name ReactionsDeleteForPullRequestComment + * @summary Delete a pull request comment reaction + * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} + */ + reactionsDeleteForPullRequestComment: ( + owner: string, + repo: string, + commentId: number, + reactionId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}/reactions/\${reactionId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description List the reactions to a [commit comment](https://docs.github.com/rest/reference/repos#comments). + * + * @tags reactions + * @name ReactionsListForCommitComment + * @summary List reactions for a commit comment + * @request GET:/repos/{owner}/{repo}/comments/{comment_id}/reactions + */ + reactionsListForCommitComment: ( + { owner, repo, commentId, ...query }: ReactionsListForCommitCommentParams, + params: RequestParams = {}, + ) => + this.request< + ReactionsListForCommitCommentData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}/reactions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List the reactions to an [issue](https://docs.github.com/rest/reference/issues). + * + * @tags reactions + * @name ReactionsListForIssue + * @summary List reactions for an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/reactions + */ + reactionsListForIssue: ( + { owner, repo, issueNumber, ...query }: ReactionsListForIssueParams, + params: RequestParams = {}, + ) => + this.request< + ReactionsListForIssueData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/reactions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List the reactions to an [issue comment](https://docs.github.com/rest/reference/issues#comments). + * + * @tags reactions + * @name ReactionsListForIssueComment + * @summary List reactions for an issue comment + * @request GET:/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions + */ + reactionsListForIssueComment: ( + { owner, repo, commentId, ...query }: ReactionsListForIssueCommentParams, + params: RequestParams = {}, + ) => + this.request< + ReactionsListForIssueCommentData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}/reactions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List the reactions to a [pull request review comment](https://docs.github.com/rest/reference/pulls#review-comments). + * + * @tags reactions + * @name ReactionsListForPullRequestReviewComment + * @summary List reactions for a pull request review comment + * @request GET:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions + */ + reactionsListForPullRequestReviewComment: ( + { owner, repo, commentId, ...query }: ReactionsListForPullRequestReviewCommentParams, + params: RequestParams = {}, + ) => + this.request< + ReactionsListForPullRequestReviewCommentData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}/reactions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified apps push access for this branch. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | The GitHub Apps that have push access to this branch. Use the app's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * + * @tags repos + * @name ReposAddAppAccessRestrictions + * @summary Add app access restrictions + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + */ + reposAddAppAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: ReposAddAppAccessRestrictionsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/apps\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. For more information the permission levels, see "[Repository permission levels for an organization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)". Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." The invitee will receive a notification that they have been invited to the repository, which they must accept or decline. They may do this via the notifications page, the email they receive, or by using the [repository invitations API endpoints](https://docs.github.com/rest/reference/repos#invitations). **Rate limits** To prevent abuse, you are limited to sending 50 invitations to a repository per 24 hour period. Note there is no limit if you are inviting organization members to an organization repository. + * + * @tags repos + * @name ReposAddCollaborator + * @summary Add a repository collaborator + * @request PUT:/repos/{owner}/{repo}/collaborators/{username} + */ + reposAddCollaborator: ( + owner: string, + repo: string, + username: string, + data: ReposAddCollaboratorPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/collaborators/\${username}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposAddStatusCheckContexts + * @summary Add status check contexts + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + */ + reposAddStatusCheckContexts: ( + owner: string, + repo: string, + branch: string, + data: ReposAddStatusCheckContextsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks/contexts\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified teams push access for this branch. You can also give push access to child teams. | Type | Description | | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | \`array\` | The teams that can have push access. Use the team's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * + * @tags repos + * @name ReposAddTeamAccessRestrictions + * @summary Add team access restrictions + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + */ + reposAddTeamAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: ReposAddTeamAccessRestrictionsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/teams\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified people push access for this branch. | Type | Description | | ------- | ----------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Usernames for people who can have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * + * @tags repos + * @name ReposAddUserAccessRestrictions + * @summary Add user access restrictions + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + */ + reposAddUserAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: ReposAddUserAccessRestrictionsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/users\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. Team members will include the members of child teams. + * + * @tags repos + * @name ReposCheckCollaborator + * @summary Check if a user is a repository collaborator + * @request GET:/repos/{owner}/{repo}/collaborators/{username} + */ + reposCheckCollaborator: (owner: string, repo: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/collaborators/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description Shows whether dependency alerts are enabled or disabled for a repository. The authenticated user must have admin access to the repository. For more information, see "[About security alerts for vulnerable dependencies](https://help.github.com/en/articles/about-security-alerts-for-vulnerable-dependencies)". + * + * @tags repos + * @name ReposCheckVulnerabilityAlerts + * @summary Check if vulnerability alerts are enabled for a repository + * @request GET:/repos/{owner}/{repo}/vulnerability-alerts + */ + reposCheckVulnerabilityAlerts: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/vulnerability-alerts\`, + method: "GET", + ...params, + }), + + /** + * @description Both \`:base\` and \`:head\` must be branch names in \`:repo\`. To compare branches across other repositories in the same network as \`:repo\`, use the format \`:branch\`. The response from the API is equivalent to running the \`git log base..head\` command; however, commits are returned in chronological order. Pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats. The response also includes details on the files that were changed between the two commits. This includes the status of the change (for example, if a file was added, removed, modified, or renamed), and details of the change itself. For example, files with a \`renamed\` status have a \`previous_filename\` field showing the previous filename of the file, and files with a \`modified\` status have a \`patch\` field showing the changes made to the file. **Working with large comparisons** The response will include a comparison of up to 250 commits. If you are working with a larger commit range, you can use the [List commits](https://docs.github.com/rest/reference/repos#list-commits) to enumerate all commits in the range. For comparisons with extremely large diffs, you may receive an error response indicating that the diff took too long to generate. You can typically resolve this error by using a smaller commit range. **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * + * @tags repos + * @name ReposCompareCommits + * @summary Compare two commits + * @request GET:/repos/{owner}/{repo}/compare/{base}...{head} + */ + reposCompareCommits: (owner: string, repo: string, base: string, head: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/compare/\${base}...\${head}\`, + method: "GET", + ...params, + }), + + /** + * @description Create a comment for a commit using its \`:commit_sha\`. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * + * @tags repos + * @name ReposCreateCommitComment + * @summary Create a commit comment + * @request POST:/repos/{owner}/{repo}/commits/{commit_sha}/comments + */ + reposCreateCommitComment: ( + owner: string, + repo: string, + commitSha: string, + data: ReposCreateCommitCommentPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${commitSha}/comments\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits. + * + * @tags repos + * @name ReposCreateCommitSignatureProtection + * @summary Create commit signature protection + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + */ + reposCreateCommitSignatureProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_signatures\`, + method: "POST", + ...params, + }), + + /** + * @description Users with push access in a repository can create commit statuses for a given SHA. Note: there is a limit of 1000 statuses per \`sha\` and \`context\` within a repository. Attempts to create more than 1000 statuses will result in a validation error. + * + * @tags repos + * @name ReposCreateCommitStatus + * @summary Create a commit status + * @request POST:/repos/{owner}/{repo}/statuses/{sha} + */ + reposCreateCommitStatus: ( + owner: string, + repo: string, + sha: string, + data: ReposCreateCommitStatusPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/statuses/\${sha}\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description You can create a read-only deploy key. + * + * @tags repos + * @name ReposCreateDeployKey + * @summary Create a deploy key + * @request POST:/repos/{owner}/{repo}/keys + */ + reposCreateDeployKey: ( + owner: string, + repo: string, + data: ReposCreateDeployKeyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/keys\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Deployments offer a few configurable parameters with certain defaults. The \`ref\` parameter can be any named branch, tag, or SHA. At GitHub we often deploy branches and verify them before we merge a pull request. The \`environment\` parameter allows deployments to be issued to different runtime environments. Teams often have multiple environments for verifying their applications, such as \`production\`, \`staging\`, and \`qa\`. This parameter makes it easier to track which environments have requested deployments. The default environment is \`production\`. The \`auto_merge\` parameter is used to ensure that the requested ref is not behind the repository's default branch. If the ref _is_ behind the default branch for the repository, we will attempt to merge it for you. If the merge succeeds, the API will return a successful merge commit. If merge conflicts prevent the merge from succeeding, the API will return a failure response. By default, [commit statuses](https://docs.github.com/rest/reference/repos#statuses) for every submitted context must be in a \`success\` state. The \`required_contexts\` parameter allows you to specify a subset of contexts that must be \`success\`, or to specify contexts that have not yet been submitted. You are not required to use commit statuses to deploy. If you do not require any contexts or create any commit statuses, the deployment will always succeed. The \`payload\` parameter is available for any extra information that a deployment system might need. It is a JSON text field that will be passed on when a deployment event is dispatched. The \`task\` parameter is used by the deployment system to allow different execution paths. In the web world this might be \`deploy:migrations\` to run schema changes on the system. In the compiled world this could be a flag to compile an application with debugging enabled. Users with \`repo\` or \`repo_deployment\` scopes can create a deployment for a given ref. #### Merged branch response You will see this response when GitHub automatically merges the base branch into the topic branch instead of creating a deployment. This auto-merge happens when: * Auto-merge option is enabled in the repository * Topic branch does not include the latest changes on the base branch, which is \`master\` in the response example * There are no merge conflicts If there are no new commits in the base branch, a new request to create a deployment should give a successful response. #### Merge conflict response This error happens when the \`auto_merge\` option is enabled and when the default branch (in this case \`master\`), can't be merged into the branch that's being deployed (in this case \`topic-branch\`), due to merge conflicts. #### Failed commit status checks This error happens when the \`required_contexts\` parameter indicates that one or more contexts need to have a \`success\` status for the commit to be deployed, but one or more of the required contexts do not have a state of \`success\`. + * + * @tags repos + * @name ReposCreateDeployment + * @summary Create a deployment + * @request POST:/repos/{owner}/{repo}/deployments + */ + reposCreateDeployment: ( + owner: string, + repo: string, + data: ReposCreateDeploymentPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Users with \`push\` access can create deployment statuses for a given deployment. GitHub Apps require \`read & write\` access to "Deployments" and \`read-only\` access to "Repo contents" (for private repos). OAuth Apps require the \`repo_deployment\` scope. + * + * @tags repos + * @name ReposCreateDeploymentStatus + * @summary Create a deployment status + * @request POST:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses + */ + reposCreateDeploymentStatus: ( + owner: string, + repo: string, + deploymentId: number, + data: ReposCreateDeploymentStatusPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments/\${deploymentId}/statuses\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description You can use this endpoint to trigger a webhook event called \`repository_dispatch\` when you want activity that happens outside of GitHub to trigger a GitHub Actions workflow or GitHub App webhook. You must configure your GitHub Actions workflow or GitHub App to run when the \`repository_dispatch\` event occurs. For an example \`repository_dispatch\` webhook payload, see "[RepositoryDispatchEvent](https://docs.github.com/webhooks/event-payloads/#repository_dispatch)." The \`client_payload\` parameter is available for any extra information that your workflow might need. This parameter is a JSON payload that will be passed on when the webhook event is dispatched. For example, the \`client_payload\` can include a message that a user would like to send using a GitHub Actions workflow. Or the \`client_payload\` can be used as a test to debug your workflow. This endpoint requires write access to the repository by providing either: - Personal access tokens with \`repo\` scope. For more information, see "[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line)" in the GitHub Help documentation. - GitHub Apps with both \`metadata:read\` and \`contents:read&write\` permissions. This input example shows how you can use the \`client_payload\` as a test to debug your workflow. + * + * @tags repos + * @name ReposCreateDispatchEvent + * @summary Create a repository dispatch event + * @request POST:/repos/{owner}/{repo}/dispatches + */ + reposCreateDispatchEvent: ( + owner: string, + repo: string, + data: ReposCreateDispatchEventPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/dispatches\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Create a fork for the authenticated user. **Note**: Forking a Repository happens asynchronously. You may have to wait a short period of time before you can access the git objects. If this takes longer than 5 minutes, be sure to contact [GitHub Support](https://support.github.com/contact) or [GitHub Premium Support](https://premium.githubsupport.com). + * + * @tags repos + * @name ReposCreateFork + * @summary Create a fork + * @request POST:/repos/{owner}/{repo}/forks + */ + reposCreateFork: (owner: string, repo: string, data: ReposCreateForkPayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/forks\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Creates a new file or replaces an existing file in a repository. + * + * @tags repos + * @name ReposCreateOrUpdateFileContents + * @summary Create or update file contents + * @request PUT:/repos/{owner}/{repo}/contents/{path} + */ + reposCreateOrUpdateFileContents: ( + owner: string, + repo: string, + path: string, + data: ReposCreateOrUpdateFileContentsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Configures a GitHub Pages site. For more information, see "[About GitHub Pages](/github/working-with-github-pages/about-github-pages)." + * + * @tags repos + * @name ReposCreatePagesSite + * @summary Create a GitHub Pages site + * @request POST:/repos/{owner}/{repo}/pages + */ + reposCreatePagesSite: ( + owner: string, + repo: string, + data: ReposCreatePagesSitePayload, + params: RequestParams = {}, + ) => + this.request< + ReposCreatePagesSiteData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/pages\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Users with push access to the repository can create a release. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * + * @tags repos + * @name ReposCreateRelease + * @summary Create a release + * @request POST:/repos/{owner}/{repo}/releases + */ + reposCreateRelease: (owner: string, repo: string, data: ReposCreateReleasePayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Creates a new repository using a repository template. Use the \`template_owner\` and \`template_repo\` route parameters to specify the repository to use as the template. The authenticated user must own or be a member of an organization that owns the repository. To check if a repository is available to use as a template, get the repository's information using the [Get a repository](https://docs.github.com/rest/reference/repos#get-a-repository) endpoint and check that the \`is_template\` key is \`true\`. **OAuth scope requirements** When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include: * \`public_repo\` scope or \`repo\` scope to create a public repository * \`repo\` scope to create a private repository + * + * @tags repos + * @name ReposCreateUsingTemplate + * @summary Create a repository using a template + * @request POST:/repos/{template_owner}/{template_repo}/generate + */ + reposCreateUsingTemplate: ( + templateOwner: string, + templateRepo: string, + data: ReposCreateUsingTemplatePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${templateOwner}/\${templateRepo}/generate\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Repositories can have multiple webhooks installed. Each webhook should have a unique \`config\`. Multiple webhooks can share the same \`config\` as long as those webhooks do not have any \`events\` that overlap. + * + * @tags repos + * @name ReposCreateWebhook + * @summary Create a repository webhook + * @request POST:/repos/{owner}/{repo}/hooks + */ + reposCreateWebhook: (owner: string, repo: string, data: ReposCreateWebhookPayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Deleting a repository requires admin access. If OAuth is used, the \`delete_repo\` scope is required. If an organization owner has configured the organization to prevent members from deleting organization-owned repositories, you will get a \`403 Forbidden\` response. + * + * @tags repos + * @name ReposDelete + * @summary Delete a repository + * @request DELETE:/repos/{owner}/{repo} + */ + reposDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Disables the ability to restrict who can push to this branch. + * + * @tags repos + * @name ReposDeleteAccessRestrictions + * @summary Delete access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions + */ + reposDeleteAccessRestrictions: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions\`, + method: "DELETE", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removing admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled. + * + * @tags repos + * @name ReposDeleteAdminBranchProtection + * @summary Delete admin branch protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + */ + reposDeleteAdminBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/enforce_admins\`, + method: "DELETE", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposDeleteBranchProtection + * @summary Delete branch protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection + */ + reposDeleteBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposDeleteCommitComment + * @summary Delete a commit comment + * @request DELETE:/repos/{owner}/{repo}/comments/{comment_id} + */ + reposDeleteCommitComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to disable required signed commits on a branch. You must enable branch protection to require signed commits. + * + * @tags repos + * @name ReposDeleteCommitSignatureProtection + * @summary Delete commit signature protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + */ + reposDeleteCommitSignatureProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_signatures\`, + method: "DELETE", + ...params, + }), + + /** + * @description Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead. + * + * @tags repos + * @name ReposDeleteDeployKey + * @summary Delete a deploy key + * @request DELETE:/repos/{owner}/{repo}/keys/{key_id} + */ + reposDeleteDeployKey: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description To ensure there can always be an active deployment, you can only delete an _inactive_ deployment. Anyone with \`repo\` or \`repo_deployment\` scopes can delete an inactive deployment. To set a deployment as inactive, you must: * Create a new deployment that is active so that the system has a record of the current state, then delete the previously active deployment. * Mark the active deployment as inactive by adding any non-successful deployment status. For more information, see "[Create a deployment](https://docs.github.com/rest/reference/repos/#create-a-deployment)" and "[Create a deployment status](https://docs.github.com/rest/reference/repos#create-a-deployment-status)." + * + * @tags repos + * @name ReposDeleteDeployment + * @summary Delete a deployment + * @request DELETE:/repos/{owner}/{repo}/deployments/{deployment_id} + */ + reposDeleteDeployment: (owner: string, repo: string, deploymentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments/\${deploymentId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Deletes a file in a repository. You can provide an additional \`committer\` parameter, which is an object containing information about the committer. Or, you can provide an \`author\` parameter, which is an object containing information about the author. The \`author\` section is optional and is filled in with the \`committer\` information if omitted. If the \`committer\` information is omitted, the authenticated user's information is used. You must provide values for both \`name\` and \`email\`, whether you choose to use \`author\` or \`committer\`. Otherwise, you'll receive a \`422\` status code. + * + * @tags repos + * @name ReposDeleteFile + * @summary Delete a file + * @request DELETE:/repos/{owner}/{repo}/contents/{path} + */ + reposDeleteFile: ( + owner: string, + repo: string, + path: string, + data: ReposDeleteFilePayload, + params: RequestParams = {}, + ) => + this.request< + ReposDeleteFileData, + | BasicError + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposDeleteInvitation + * @summary Delete a repository invitation + * @request DELETE:/repos/{owner}/{repo}/invitations/{invitation_id} + */ + reposDeleteInvitation: (owner: string, repo: string, invitationId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/invitations/\${invitationId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposDeletePagesSite + * @summary Delete a GitHub Pages site + * @request DELETE:/repos/{owner}/{repo}/pages + */ + reposDeletePagesSite: (owner: string, repo: string, params: RequestParams = {}) => + this.request< + ReposDeletePagesSiteData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/pages\`, + method: "DELETE", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposDeletePullRequestReviewProtection + * @summary Delete pull request review protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + */ + reposDeletePullRequestReviewProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_pull_request_reviews\`, + method: "DELETE", + ...params, + }), + + /** + * @description Users with push access to the repository can delete a release. + * + * @tags repos + * @name ReposDeleteRelease + * @summary Delete a release + * @request DELETE:/repos/{owner}/{repo}/releases/{release_id} + */ + reposDeleteRelease: (owner: string, repo: string, releaseId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/\${releaseId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposDeleteReleaseAsset + * @summary Delete a release asset + * @request DELETE:/repos/{owner}/{repo}/releases/assets/{asset_id} + */ + reposDeleteReleaseAsset: (owner: string, repo: string, assetId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/assets/\${assetId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposDeleteWebhook + * @summary Delete a repository webhook + * @request DELETE:/repos/{owner}/{repo}/hooks/{hook_id} + */ + reposDeleteWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Disables automated security fixes for a repository. The authenticated user must have admin access to the repository. For more information, see "[Configuring automated security fixes](https://help.github.com/en/articles/configuring-automated-security-fixes)". + * + * @tags repos + * @name ReposDisableAutomatedSecurityFixes + * @summary Disable automated security fixes + * @request DELETE:/repos/{owner}/{repo}/automated-security-fixes + */ + reposDisableAutomatedSecurityFixes: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/automated-security-fixes\`, + method: "DELETE", + ...params, + }), + + /** + * @description Disables dependency alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "[About security alerts for vulnerable dependencies](https://help.github.com/en/articles/about-security-alerts-for-vulnerable-dependencies)". + * + * @tags repos + * @name ReposDisableVulnerabilityAlerts + * @summary Disable vulnerability alerts + * @request DELETE:/repos/{owner}/{repo}/vulnerability-alerts + */ + reposDisableVulnerabilityAlerts: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/vulnerability-alerts\`, + method: "DELETE", + ...params, + }), + + /** + * @description Gets a redirect URL to download a tar archive for a repository. If you omit \`:ref\`, the repository’s default branch (usually \`master\`) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use the \`Location\` header to make a second \`GET\` request. **Note**: For private repositories, these links are temporary and expire after five minutes. + * + * @tags repos + * @name ReposDownloadTarballArchive + * @summary Download a repository archive (tar) + * @request GET:/repos/{owner}/{repo}/tarball/{ref} + */ + reposDownloadTarballArchive: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/tarball/\${ref}\`, + method: "GET", + ...params, + }), + + /** + * @description Gets a redirect URL to download a zip archive for a repository. If you omit \`:ref\`, the repository’s default branch (usually \`master\`) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use the \`Location\` header to make a second \`GET\` request. **Note**: For private repositories, these links are temporary and expire after five minutes. + * + * @tags repos + * @name ReposDownloadZipballArchive + * @summary Download a repository archive (zip) + * @request GET:/repos/{owner}/{repo}/zipball/{ref} + */ + reposDownloadZipballArchive: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/zipball/\${ref}\`, + method: "GET", + ...params, + }), + + /** + * @description Enables automated security fixes for a repository. The authenticated user must have admin access to the repository. For more information, see "[Configuring automated security fixes](https://help.github.com/en/articles/configuring-automated-security-fixes)". + * + * @tags repos + * @name ReposEnableAutomatedSecurityFixes + * @summary Enable automated security fixes + * @request PUT:/repos/{owner}/{repo}/automated-security-fixes + */ + reposEnableAutomatedSecurityFixes: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/automated-security-fixes\`, + method: "PUT", + ...params, + }), + + /** + * @description Enables dependency alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "[About security alerts for vulnerable dependencies](https://help.github.com/en/articles/about-security-alerts-for-vulnerable-dependencies)". + * + * @tags repos + * @name ReposEnableVulnerabilityAlerts + * @summary Enable vulnerability alerts + * @request PUT:/repos/{owner}/{repo}/vulnerability-alerts + */ + reposEnableVulnerabilityAlerts: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/vulnerability-alerts\`, + method: "PUT", + ...params, + }), + + /** + * @description When you pass the \`scarlet-witch-preview\` media type, requests to get a repository will also return the repository's code of conduct if it can be detected from the repository's code of conduct file. The \`parent\` and \`source\` objects are present when the repository is a fork. \`parent\` is the repository this repository was forked from, \`source\` is the ultimate source for the network. + * + * @tags repos + * @name ReposGet + * @summary Get a repository + * @request GET:/repos/{owner}/{repo} + */ + reposGet: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}\`, + method: "GET", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists who has access to this protected branch. **Note**: Users, apps, and teams \`restrictions\` are only available for organization-owned repositories. + * + * @tags repos + * @name ReposGetAccessRestrictions + * @summary Get access restrictions + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions + */ + reposGetAccessRestrictions: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions\`, + method: "GET", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposGetAdminBranchProtection + * @summary Get admin branch protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + */ + reposGetAdminBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/enforce_admins\`, + method: "GET", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposGetAllStatusCheckContexts + * @summary Get all status check contexts + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + */ + reposGetAllStatusCheckContexts: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks/contexts\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposGetAllTopics + * @summary Get all repository topics + * @request GET:/repos/{owner}/{repo}/topics + */ + reposGetAllTopics: (owner: string, repo: string, params: RequestParams = {}) => + this.request< + ReposGetAllTopicsData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/topics\`, + method: "GET", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists the GitHub Apps that have push access to this branch. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. + * + * @tags repos + * @name ReposGetAppsWithAccessToProtectedBranch + * @summary Get apps with access to the protected branch + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + */ + reposGetAppsWithAccessToProtectedBranch: ( + owner: string, + repo: string, + branch: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/apps\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposGetBranch + * @summary Get a branch + * @request GET:/repos/{owner}/{repo}/branches/{branch} + */ + reposGetBranch: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request< + ReposGetBranchData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}\`, + method: "GET", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposGetBranchProtection + * @summary Get branch protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection + */ + reposGetBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection\`, + method: "GET", + ...params, + }), + + /** + * @description Get the total number of clones and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday. + * + * @tags repos + * @name ReposGetClones + * @summary Get repository clones + * @request GET:/repos/{owner}/{repo}/traffic/clones + */ + reposGetClones: ({ owner, repo, ...query }: ReposGetClonesParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/traffic/clones\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Returns a weekly aggregate of the number of additions and deletions pushed to a repository. + * + * @tags repos + * @name ReposGetCodeFrequencyStats + * @summary Get the weekly commit activity + * @request GET:/repos/{owner}/{repo}/stats/code_frequency + */ + reposGetCodeFrequencyStats: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stats/code_frequency\`, + method: "GET", + ...params, + }), + + /** + * @description Checks the repository permission of a collaborator. The possible repository permissions are \`admin\`, \`write\`, \`read\`, and \`none\`. + * + * @tags repos + * @name ReposGetCollaboratorPermissionLevel + * @summary Get repository permissions for a user + * @request GET:/repos/{owner}/{repo}/collaborators/{username}/permission + */ + reposGetCollaboratorPermissionLevel: (owner: string, repo: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/collaborators/\${username}/permission\`, + method: "GET", + ...params, + }), + + /** + * @description Users with pull access in a repository can access a combined view of commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name. The most recent status for each context is returned, up to 100. This field [paginates](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination) if there are over 100 contexts. Additionally, a combined \`state\` is returned. The \`state\` is one of: * **failure** if any of the contexts report as \`error\` or \`failure\` * **pending** if there are no statuses or a context is \`pending\` * **success** if the latest status for all contexts is \`success\` + * + * @tags repos + * @name ReposGetCombinedStatusForRef + * @summary Get the combined status for a specific reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/status + */ + reposGetCombinedStatusForRef: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/status\`, + method: "GET", + ...params, + }), + + /** + * @description Returns the contents of a single commit reference. You must have \`read\` access for the repository to use this endpoint. **Note:** If there are more than 300 files in the commit diff, the response will include pagination link headers for the remaining files, up to a limit of 3000 files. Each page contains the static commit information, and the only changes are to the file listing. You can pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch \`diff\` and \`patch\` formats. Diffs with binary data will have no \`patch\` property. To return only the SHA-1 hash of the commit reference, you can provide the \`sha\` custom [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) in the \`Accept\` header. You can use this endpoint to check if a remote reference's SHA-1 hash is the same as your local reference's SHA-1 hash by providing the local SHA-1 reference as the ETag. **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * + * @tags repos + * @name ReposGetCommit + * @summary Get a commit + * @request GET:/repos/{owner}/{repo}/commits/{ref} + */ + reposGetCommit: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${ref}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns the last year of commit activity grouped by week. The \`days\` array is a group of commits per day, starting on \`Sunday\`. + * + * @tags repos + * @name ReposGetCommitActivityStats + * @summary Get the last year of commit activity + * @request GET:/repos/{owner}/{repo}/stats/commit_activity + */ + reposGetCommitActivityStats: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stats/commit_activity\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposGetCommitComment + * @summary Get a commit comment + * @request GET:/repos/{owner}/{repo}/comments/{comment_id} + */ + reposGetCommitComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, + method: "GET", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to check whether a branch requires signed commits. An enabled status of \`true\` indicates you must sign commits on this branch. For more information, see [Signing commits with GPG](https://help.github.com/articles/signing-commits-with-gpg) in GitHub Help. **Note**: You must enable branch protection to require signed commits. + * + * @tags repos + * @name ReposGetCommitSignatureProtection + * @summary Get commit signature protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + */ + reposGetCommitSignatureProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_signatures\`, + method: "GET", + ...params, + }), + + /** + * @description This endpoint will return all community profile metrics, including an overall health score, repository description, the presence of documentation, detected code of conduct, detected license, and the presence of ISSUE\\_TEMPLATE, PULL\\_REQUEST\\_TEMPLATE, README, and CONTRIBUTING files. The \`health_percentage\` score is defined as a percentage of how many of these four documents are present: README, CONTRIBUTING, LICENSE, and CODE_OF_CONDUCT. For example, if all four documents are present, then the \`health_percentage\` is \`100\`. If only one is present, then the \`health_percentage\` is \`25\`. \`content_reports_enabled\` is only returned for organization-owned repositories. + * + * @tags repos + * @name ReposGetCommunityProfileMetrics + * @summary Get community profile metrics + * @request GET:/repos/{owner}/{repo}/community/profile + */ + reposGetCommunityProfileMetrics: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/community/profile\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the contents of a file or directory in a repository. Specify the file path or directory in \`:path\`. If you omit \`:path\`, you will receive the contents of the repository's root directory. See the description below regarding what the API response includes for directories. Files and symlinks support [a custom media type](https://docs.github.com/rest/reference/repos#custom-media-types) for retrieving the raw content or rendered HTML (when supported). All content types support [a custom media type](https://docs.github.com/rest/reference/repos#custom-media-types) to ensure the content is returned in a consistent object format. **Note**: * To get a repository's contents recursively, you can [recursively get the tree](https://docs.github.com/rest/reference/git#trees). * This API has an upper limit of 1,000 files for a directory. If you need to retrieve more files, use the [Git Trees API](https://docs.github.com/rest/reference/git#get-a-tree). * This API supports files up to 1 megabyte in size. #### If the content is a directory The response will be an array of objects, one object for each item in the directory. When listing the contents of a directory, submodules have their "type" specified as "file". Logically, the value _should_ be "submodule". This behavior exists in API v3 [for backwards compatibility purposes](https://git.io/v1YCW). In the next major version of the API, the type will be returned as "submodule". #### If the content is a symlink If the requested \`:path\` points to a symlink, and the symlink's target is a normal file in the repository, then the API responds with the content of the file (in the format shown in the example. Otherwise, the API responds with an object describing the symlink itself. #### If the content is a submodule The \`submodule_git_url\` identifies the location of the submodule repository, and the \`sha\` identifies a specific commit within the submodule repository. Git uses the given URL when cloning the submodule repository, and checks out the submodule at that specific commit. If the submodule repository is not hosted on github.com, the Git URLs (\`git_url\` and \`_links["git"]\`) and the github.com URLs (\`html_url\` and \`_links["html"]\`) will have null values. + * + * @tags repos + * @name ReposGetContent + * @summary Get repository content + * @request GET:/repos/{owner}/{repo}/contents/{path} + */ + reposGetContent: ({ owner, repo, path, ...query }: ReposGetContentParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Returns the \`total\` number of commits authored by the contributor. In addition, the response includes a Weekly Hash (\`weeks\` array) with the following information: * \`w\` - Start of the week, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). * \`a\` - Number of additions * \`d\` - Number of deletions * \`c\` - Number of commits + * + * @tags repos + * @name ReposGetContributorsStats + * @summary Get all contributor commit activity + * @request GET:/repos/{owner}/{repo}/stats/contributors + */ + reposGetContributorsStats: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stats/contributors\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposGetDeployKey + * @summary Get a deploy key + * @request GET:/repos/{owner}/{repo}/keys/{key_id} + */ + reposGetDeployKey: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposGetDeployment + * @summary Get a deployment + * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id} + */ + reposGetDeployment: (owner: string, repo: string, deploymentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments/\${deploymentId}\`, + method: "GET", + ...params, + }), + + /** + * @description Users with pull access can view a deployment status for a deployment: + * + * @tags repos + * @name ReposGetDeploymentStatus + * @summary Get a deployment status + * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id} + */ + reposGetDeploymentStatus: ( + owner: string, + repo: string, + deploymentId: number, + statusId: number, + params: RequestParams = {}, + ) => + this.request< + ReposGetDeploymentStatusData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/deployments/\${deploymentId}/statuses/\${statusId}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposGetLatestPagesBuild + * @summary Get latest Pages build + * @request GET:/repos/{owner}/{repo}/pages/builds/latest + */ + reposGetLatestPagesBuild: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pages/builds/latest\`, + method: "GET", + ...params, + }), + + /** + * @description View the latest published full release for the repository. The latest release is the most recent non-prerelease, non-draft release, sorted by the \`created_at\` attribute. The \`created_at\` attribute is the date of the commit used for the release, and not the date when the release was drafted or published. + * + * @tags repos + * @name ReposGetLatestRelease + * @summary Get the latest release + * @request GET:/repos/{owner}/{repo}/releases/latest + */ + reposGetLatestRelease: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/latest\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposGetPages + * @summary Get a GitHub Pages site + * @request GET:/repos/{owner}/{repo}/pages + */ + reposGetPages: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pages\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposGetPagesBuild + * @summary Get GitHub Pages build + * @request GET:/repos/{owner}/{repo}/pages/builds/{build_id} + */ + reposGetPagesBuild: (owner: string, repo: string, buildId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pages/builds/\${buildId}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns the total commit counts for the \`owner\` and total commit counts in \`all\`. \`all\` is everyone combined, including the \`owner\` in the last 52 weeks. If you'd like to get the commit counts for non-owners, you can subtract \`owner\` from \`all\`. The array order is oldest week (index 0) to most recent week. + * + * @tags repos + * @name ReposGetParticipationStats + * @summary Get the weekly commit count + * @request GET:/repos/{owner}/{repo}/stats/participation + */ + reposGetParticipationStats: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stats/participation\`, + method: "GET", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposGetPullRequestReviewProtection + * @summary Get pull request review protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + */ + reposGetPullRequestReviewProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_pull_request_reviews\`, + method: "GET", + ...params, + }), + + /** + * @description Each array contains the day number, hour number, and number of commits: * \`0-6\`: Sunday - Saturday * \`0-23\`: Hour of day * Number of commits For example, \`[2, 14, 25]\` indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits. + * + * @tags repos + * @name ReposGetPunchCardStats + * @summary Get the hourly commit count for each day + * @request GET:/repos/{owner}/{repo}/stats/punch_card + */ + reposGetPunchCardStats: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stats/punch_card\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the preferred README for a repository. READMEs support [custom media types](https://docs.github.com/rest/reference/repos#custom-media-types) for retrieving the raw content or rendered HTML. + * + * @tags repos + * @name ReposGetReadme + * @summary Get a repository README + * @request GET:/repos/{owner}/{repo}/readme + */ + reposGetReadme: ({ owner, repo, ...query }: ReposGetReadmeParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/readme\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Note:** This returns an \`upload_url\` key corresponding to the endpoint for uploading release assets. This key is a [hypermedia resource](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia). + * + * @tags repos + * @name ReposGetRelease + * @summary Get a release + * @request GET:/repos/{owner}/{repo}/releases/{release_id} + */ + reposGetRelease: (owner: string, repo: string, releaseId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/\${releaseId}\`, + method: "GET", + ...params, + }), + + /** + * @description To download the asset's binary content, set the \`Accept\` header of the request to [\`application/octet-stream\`](https://docs.github.com/rest/overview/media-types). The API will either redirect the client to the location, or stream it directly if possible. API clients should handle both a \`200\` or \`302\` response. + * + * @tags repos + * @name ReposGetReleaseAsset + * @summary Get a release asset + * @request GET:/repos/{owner}/{repo}/releases/assets/{asset_id} + */ + reposGetReleaseAsset: (owner: string, repo: string, assetId: number, params: RequestParams = {}) => + this.request< + ReposGetReleaseAssetData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/releases/assets/\${assetId}\`, + method: "GET", + ...params, + }), + + /** + * @description Get a published release with the specified tag. + * + * @tags repos + * @name ReposGetReleaseByTag + * @summary Get a release by tag name + * @request GET:/repos/{owner}/{repo}/releases/tags/{tag} + */ + reposGetReleaseByTag: (owner: string, repo: string, tag: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/tags/\${tag}\`, + method: "GET", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposGetStatusChecksProtection + * @summary Get status checks protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + */ + reposGetStatusChecksProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks\`, + method: "GET", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists the teams who have push access to this branch. The list includes child teams. + * + * @tags repos + * @name ReposGetTeamsWithAccessToProtectedBranch + * @summary Get teams with access to the protected branch + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + */ + reposGetTeamsWithAccessToProtectedBranch: ( + owner: string, + repo: string, + branch: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/teams\`, + method: "GET", + ...params, + }), + + /** + * @description Get the top 10 popular contents over the last 14 days. + * + * @tags repos + * @name ReposGetTopPaths + * @summary Get top referral paths + * @request GET:/repos/{owner}/{repo}/traffic/popular/paths + */ + reposGetTopPaths: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/traffic/popular/paths\`, + method: "GET", + ...params, + }), + + /** + * @description Get the top 10 referrers over the last 14 days. + * + * @tags repos + * @name ReposGetTopReferrers + * @summary Get top referral sources + * @request GET:/repos/{owner}/{repo}/traffic/popular/referrers + */ + reposGetTopReferrers: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/traffic/popular/referrers\`, + method: "GET", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists the people who have push access to this branch. + * + * @tags repos + * @name ReposGetUsersWithAccessToProtectedBranch + * @summary Get users with access to the protected branch + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + */ + reposGetUsersWithAccessToProtectedBranch: ( + owner: string, + repo: string, + branch: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/users\`, + method: "GET", + ...params, + }), + + /** + * @description Get the total number of views and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday. + * + * @tags repos + * @name ReposGetViews + * @summary Get page views + * @request GET:/repos/{owner}/{repo}/traffic/views + */ + reposGetViews: ({ owner, repo, ...query }: ReposGetViewsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/traffic/views\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Returns a webhook configured in a repository. To get only the webhook \`config\` properties, see "[Get a webhook configuration for a repository](/rest/reference/repos#get-a-webhook-configuration-for-a-repository)." + * + * @tags repos + * @name ReposGetWebhook + * @summary Get a repository webhook + * @request GET:/repos/{owner}/{repo}/hooks/{hook_id} + */ + reposGetWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns the webhook configuration for a repository. To get more information about the webhook, including the \`active\` state and \`events\`, use "[Get a repository webhook](/rest/reference/orgs#get-a-repository-webhook)." Access tokens must have the \`read:repo_hook\` or \`repo\` scope, and GitHub Apps must have the \`repository_hooks:read\` permission. + * + * @tags repos + * @name ReposGetWebhookConfigForRepo + * @summary Get a webhook configuration for a repository + * @request GET:/repos/{owner}/{repo}/hooks/{hook_id}/config + */ + reposGetWebhookConfigForRepo: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/config\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposListBranches + * @summary List branches + * @request GET:/repos/{owner}/{repo}/branches + */ + reposListBranches: ({ owner, repo, ...query }: ReposListBranchesParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Returns all branches where the given commit SHA is the HEAD, or latest commit for the branch. + * + * @tags repos + * @name ReposListBranchesForHeadCommit + * @summary List branches for HEAD commit + * @request GET:/repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head + */ + reposListBranchesForHeadCommit: (owner: string, repo: string, commitSha: string, params: RequestParams = {}) => + this.request< + ReposListBranchesForHeadCommitData, + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/commits/\${commitSha}/branches-where-head\`, + method: "GET", + ...params, + }), + + /** + * @description For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. Team members will include the members of child teams. + * + * @tags repos + * @name ReposListCollaborators + * @summary List repository collaborators + * @request GET:/repos/{owner}/{repo}/collaborators + */ + reposListCollaborators: ({ owner, repo, ...query }: ReposListCollaboratorsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/collaborators\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Use the \`:commit_sha\` to specify the commit that will have its comments listed. + * + * @tags repos + * @name ReposListCommentsForCommit + * @summary List commit comments + * @request GET:/repos/{owner}/{repo}/commits/{commit_sha}/comments + */ + reposListCommentsForCommit: ( + { owner, repo, commitSha, ...query }: ReposListCommentsForCommitParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${commitSha}/comments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Commit Comments use [these custom media types](https://docs.github.com/rest/reference/repos#custom-media-types). You can read more about the use of media types in the API [here](https://docs.github.com/rest/overview/media-types/). Comments are ordered by ascending ID. + * + * @tags repos + * @name ReposListCommitCommentsForRepo + * @summary List commit comments for a repository + * @request GET:/repos/{owner}/{repo}/comments + */ + reposListCommitCommentsForRepo: ( + { owner, repo, ...query }: ReposListCommitCommentsForRepoParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/comments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | + * + * @tags repos + * @name ReposListCommits + * @summary List commits + * @request GET:/repos/{owner}/{repo}/commits + */ + reposListCommits: ({ owner, repo, ...query }: ReposListCommitsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/commits\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Users with pull access in a repository can view commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name. Statuses are returned in reverse chronological order. The first status in the list will be the latest one. This resource is also available via a legacy route: \`GET /repos/:owner/:repo/statuses/:ref\`. + * + * @tags repos + * @name ReposListCommitStatusesForRef + * @summary List commit statuses for a reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/statuses + */ + reposListCommitStatusesForRef: ( + { owner, repo, ref, ...query }: ReposListCommitStatusesForRefParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/statuses\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists contributors to the specified repository and sorts them by the number of commits per contributor in descending order. This endpoint may return information that is a few hours old because the GitHub REST API v3 caches contributor data to improve performance. GitHub identifies contributors by author email address. This endpoint groups contribution counts by GitHub user, which includes all associated email addresses. To improve performance, only the first 500 author email addresses in the repository link to GitHub users. The rest will appear as anonymous contributors without associated GitHub user information. + * + * @tags repos + * @name ReposListContributors + * @summary List repository contributors + * @request GET:/repos/{owner}/{repo}/contributors + */ + reposListContributors: ({ owner, repo, ...query }: ReposListContributorsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/contributors\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposListDeployKeys + * @summary List deploy keys + * @request GET:/repos/{owner}/{repo}/keys + */ + reposListDeployKeys: ({ owner, repo, ...query }: ReposListDeployKeysParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/keys\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Simple filtering of deployments is available via query parameters: + * + * @tags repos + * @name ReposListDeployments + * @summary List deployments + * @request GET:/repos/{owner}/{repo}/deployments + */ + reposListDeployments: ({ owner, repo, ...query }: ReposListDeploymentsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Users with pull access can view deployment statuses for a deployment: + * + * @tags repos + * @name ReposListDeploymentStatuses + * @summary List deployment statuses + * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses + */ + reposListDeploymentStatuses: ( + { owner, repo, deploymentId, ...query }: ReposListDeploymentStatusesParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments/\${deploymentId}/statuses\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposListForks + * @summary List forks + * @request GET:/repos/{owner}/{repo}/forks + */ + reposListForks: ({ owner, repo, ...query }: ReposListForksParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/forks\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations. + * + * @tags repos + * @name ReposListInvitations + * @summary List repository invitations + * @request GET:/repos/{owner}/{repo}/invitations + */ + reposListInvitations: ({ owner, repo, ...query }: ReposListInvitationsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/invitations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language. + * + * @tags repos + * @name ReposListLanguages + * @summary List repository languages + * @request GET:/repos/{owner}/{repo}/languages + */ + reposListLanguages: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/languages\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposListPagesBuilds + * @summary List GitHub Pages builds + * @request GET:/repos/{owner}/{repo}/pages/builds + */ + reposListPagesBuilds: ({ owner, repo, ...query }: ReposListPagesBuildsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pages/builds\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all pull requests containing the provided commit SHA, which can be from any point in the commit history. The results will include open and closed pull requests. Additional preview headers may be required to see certain details for associated pull requests, such as whether a pull request is in a draft state. For more information about previews that might affect this endpoint, see the [List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests) endpoint. + * + * @tags repos + * @name ReposListPullRequestsAssociatedWithCommit + * @summary List pull requests associated with a commit + * @request GET:/repos/{owner}/{repo}/commits/{commit_sha}/pulls + */ + reposListPullRequestsAssociatedWithCommit: ( + { owner, repo, commitSha, ...query }: ReposListPullRequestsAssociatedWithCommitParams, + params: RequestParams = {}, + ) => + this.request< + ReposListPullRequestsAssociatedWithCommitData, + { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/commits/\${commitSha}/pulls\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposListReleaseAssets + * @summary List release assets + * @request GET:/repos/{owner}/{repo}/releases/{release_id}/assets + */ + reposListReleaseAssets: ( + { owner, repo, releaseId, ...query }: ReposListReleaseAssetsParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/\${releaseId}/assets\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description This returns a list of releases, which does not include regular Git tags that have not been associated with a release. To get a list of Git tags, use the [Repository Tags API](https://docs.github.com/rest/reference/repos#list-repository-tags). Information about published releases are available to everyone. Only users with push access will receive listings for draft releases. + * + * @tags repos + * @name ReposListReleases + * @summary List releases + * @request GET:/repos/{owner}/{repo}/releases + */ + reposListReleases: ({ owner, repo, ...query }: ReposListReleasesParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposListTags + * @summary List repository tags + * @request GET:/repos/{owner}/{repo}/tags + */ + reposListTags: ({ owner, repo, ...query }: ReposListTagsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/tags\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposListTeams + * @summary List repository teams + * @request GET:/repos/{owner}/{repo}/teams + */ + reposListTeams: ({ owner, repo, ...query }: ReposListTeamsParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/teams\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposListWebhooks + * @summary List repository webhooks + * @request GET:/repos/{owner}/{repo}/hooks + */ + reposListWebhooks: ({ owner, repo, ...query }: ReposListWebhooksParams, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposMerge + * @summary Merge a branch + * @request POST:/repos/{owner}/{repo}/merges + */ + reposMerge: (owner: string, repo: string, data: ReposMergePayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/merges\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description This will trigger a [ping event](https://docs.github.com/webhooks/#ping-event) to be sent to the hook. + * + * @tags repos + * @name ReposPingWebhook + * @summary Ping a repository webhook + * @request POST:/repos/{owner}/{repo}/hooks/{hook_id}/pings + */ + reposPingWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/pings\`, + method: "POST", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of an app to push to this branch. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | The GitHub Apps that have push access to this branch. Use the app's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * + * @tags repos + * @name ReposRemoveAppAccessRestrictions + * @summary Remove app access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + */ + reposRemoveAppAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: ReposRemoveAppAccessRestrictionsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/apps\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposRemoveCollaborator + * @summary Remove a repository collaborator + * @request DELETE:/repos/{owner}/{repo}/collaborators/{username} + */ + reposRemoveCollaborator: (owner: string, repo: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/collaborators/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposRemoveStatusCheckContexts + * @summary Remove status check contexts + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + */ + reposRemoveStatusCheckContexts: ( + owner: string, + repo: string, + branch: string, + data: ReposRemoveStatusCheckContextsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks/contexts\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposRemoveStatusCheckProtection + * @summary Remove status check protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + */ + reposRemoveStatusCheckProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks\`, + method: "DELETE", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of a team to push to this branch. You can also remove push access for child teams. | Type | Description | | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Teams that should no longer have push access. Use the team's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * + * @tags repos + * @name ReposRemoveTeamAccessRestrictions + * @summary Remove team access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + */ + reposRemoveTeamAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: ReposRemoveTeamAccessRestrictionsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/teams\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of a user to push to this branch. | Type | Description | | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Usernames of the people who should no longer have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * + * @tags repos + * @name ReposRemoveUserAccessRestrictions + * @summary Remove user access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + */ + reposRemoveUserAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: ReposRemoveUserAccessRestrictionsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/users\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Renames a branch in a repository. **Note:** Although the API responds immediately, the branch rename process might take some extra time to complete in the background. You won't be able to push to the old branch name while the rename process is in progress. For more information, see "[Renaming a branch](https://docs.github.com/github/administering-a-repository/renaming-a-branch)". The permissions required to use this endpoint depends on whether you are renaming the default branch. To rename a non-default branch: * Users must have push access. * GitHub Apps must have the \`contents:write\` repository permission. To rename the default branch: * Users must have admin or owner permissions. * GitHub Apps must have the \`administration:write\` repository permission. + * + * @tags repos + * @name ReposRenameBranch + * @summary Rename a branch + * @request POST:/repos/{owner}/{repo}/branches/{branch}/rename + */ + reposRenameBranch: ( + owner: string, + repo: string, + branch: string, + data: ReposRenameBranchPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/rename\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposReplaceAllTopics + * @summary Replace all repository topics + * @request PUT:/repos/{owner}/{repo}/topics + */ + reposReplaceAllTopics: ( + owner: string, + repo: string, + data: ReposReplaceAllTopicsPayload, + params: RequestParams = {}, + ) => + this.request< + ReposReplaceAllTopicsData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationErrorSimple + >({ + path: \`/repos/\${owner}/\${repo}/topics\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description You can request that your site be built from the latest revision on the default branch. This has the same effect as pushing a commit to your default branch, but does not require an additional commit. Manually triggering page builds can be helpful when diagnosing build warnings and failures. Build requests are limited to one concurrent build per repository and one concurrent build per requester. If you request a build while another is still in progress, the second request will be queued until the first completes. + * + * @tags repos + * @name ReposRequestPagesBuild + * @summary Request a GitHub Pages build + * @request POST:/repos/{owner}/{repo}/pages/builds + */ + reposRequestPagesBuild: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pages/builds\`, + method: "POST", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Adding admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled. + * + * @tags repos + * @name ReposSetAdminBranchProtection + * @summary Set admin branch protection + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + */ + reposSetAdminBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/enforce_admins\`, + method: "POST", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Replaces the list of apps that have push access to this branch. This removes all apps that previously had push access and grants push access to the new list of apps. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | The GitHub Apps that have push access to this branch. Use the app's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * + * @tags repos + * @name ReposSetAppAccessRestrictions + * @summary Set app access restrictions + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + */ + reposSetAppAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: ReposSetAppAccessRestrictionsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/apps\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposSetStatusCheckContexts + * @summary Set status check contexts + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + */ + reposSetStatusCheckContexts: ( + owner: string, + repo: string, + branch: string, + data: ReposSetStatusCheckContextsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks/contexts\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Replaces the list of teams that have push access to this branch. This removes all teams that previously had push access and grants push access to the new list of teams. Team restrictions include child teams. | Type | Description | | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | \`array\` | The teams that can have push access. Use the team's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * + * @tags repos + * @name ReposSetTeamAccessRestrictions + * @summary Set team access restrictions + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + */ + reposSetTeamAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: ReposSetTeamAccessRestrictionsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/teams\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Replaces the list of people that have push access to this branch. This removes all people that previously had push access and grants push access to the new list of people. | Type | Description | | ------- | ----------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Usernames for people who can have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * + * @tags repos + * @name ReposSetUserAccessRestrictions + * @summary Set user access restrictions + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + */ + reposSetUserAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: ReposSetUserAccessRestrictionsPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/users\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description This will trigger the hook with the latest push to the current repository if the hook is subscribed to \`push\` events. If the hook is not subscribed to \`push\` events, the server will respond with 204 but no test POST will be generated. **Note**: Previously \`/repos/:owner/:repo/hooks/:hook_id/test\` + * + * @tags repos + * @name ReposTestPushWebhook + * @summary Test the push repository webhook + * @request POST:/repos/{owner}/{repo}/hooks/{hook_id}/tests + */ + reposTestPushWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/tests\`, + method: "POST", + ...params, + }), + + /** + * @description A transfer request will need to be accepted by the new owner when transferring a personal repository to another user. The response will contain the original \`owner\`, and the transfer will continue asynchronously. For more details on the requirements to transfer personal and organization-owned repositories, see [about repository transfers](https://help.github.com/articles/about-repository-transfers/). + * + * @tags repos + * @name ReposTransfer + * @summary Transfer a repository + * @request POST:/repos/{owner}/{repo}/transfer + */ + reposTransfer: (owner: string, repo: string, data: ReposTransferPayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/transfer\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note**: To edit a repository's topics, use the [Replace all repository topics](https://docs.github.com/rest/reference/repos#replace-all-repository-topics) endpoint. + * + * @tags repos + * @name ReposUpdate + * @summary Update a repository + * @request PATCH:/repos/{owner}/{repo} + */ + reposUpdate: (owner: string, repo: string, data: ReposUpdatePayload, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Protecting a branch requires admin or owner permissions to the repository. **Note**: Passing new arrays of \`users\` and \`teams\` replaces their previous values. **Note**: The list of users, apps, and teams in total is limited to 100 items. + * + * @tags repos + * @name ReposUpdateBranchProtection + * @summary Update branch protection + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection + */ + reposUpdateBranchProtection: ( + owner: string, + repo: string, + branch: string, + data: ReposUpdateBranchProtectionPayload, + params: RequestParams = {}, + ) => + this.request< + ReposUpdateBranchProtectionData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationErrorSimple + >({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposUpdateCommitComment + * @summary Update a commit comment + * @request PATCH:/repos/{owner}/{repo}/comments/{comment_id} + */ + reposUpdateCommitComment: ( + owner: string, + repo: string, + commentId: number, + data: ReposUpdateCommitCommentPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Updates information for a GitHub Pages site. For more information, see "[About GitHub Pages](/github/working-with-github-pages/about-github-pages). + * + * @tags repos + * @name ReposUpdateInformationAboutPagesSite + * @summary Update information about a GitHub Pages site + * @request PUT:/repos/{owner}/{repo}/pages + */ + reposUpdateInformationAboutPagesSite: ( + owner: string, + repo: string, + data: ReposUpdateInformationAboutPagesSitePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pages\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposUpdateInvitation + * @summary Update a repository invitation + * @request PATCH:/repos/{owner}/{repo}/invitations/{invitation_id} + */ + reposUpdateInvitation: ( + owner: string, + repo: string, + invitationId: number, + data: ReposUpdateInvitationPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/invitations/\${invitationId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Updating pull request review enforcement requires admin or owner permissions to the repository and branch protection to be enabled. **Note**: Passing new arrays of \`users\` and \`teams\` replaces their previous values. + * + * @tags repos + * @name ReposUpdatePullRequestReviewProtection + * @summary Update pull request review protection + * @request PATCH:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + */ + reposUpdatePullRequestReviewProtection: ( + owner: string, + repo: string, + branch: string, + data: ReposUpdatePullRequestReviewProtectionPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_pull_request_reviews\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Users with push access to the repository can edit a release. + * + * @tags repos + * @name ReposUpdateRelease + * @summary Update a release + * @request PATCH:/repos/{owner}/{repo}/releases/{release_id} + */ + reposUpdateRelease: ( + owner: string, + repo: string, + releaseId: number, + data: ReposUpdateReleasePayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/\${releaseId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Users with push access to the repository can edit a release asset. + * + * @tags repos + * @name ReposUpdateReleaseAsset + * @summary Update a release asset + * @request PATCH:/repos/{owner}/{repo}/releases/assets/{asset_id} + */ + reposUpdateReleaseAsset: ( + owner: string, + repo: string, + assetId: number, + data: ReposUpdateReleaseAssetPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/assets/\${assetId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Updating required status checks requires admin or owner permissions to the repository and branch protection to be enabled. + * + * @tags repos + * @name ReposUpdateStatusCheckProtection + * @summary Update status check protection + * @request PATCH:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + */ + reposUpdateStatusCheckProtection: ( + owner: string, + repo: string, + branch: string, + data: ReposUpdateStatusCheckProtectionPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Updates a webhook configured in a repository. If you previously had a \`secret\` set, you must provide the same \`secret\` or set a new \`secret\` or the secret will be removed. If you are only updating individual webhook \`config\` properties, use "[Update a webhook configuration for a repository](/rest/reference/repos#update-a-webhook-configuration-for-a-repository)." + * + * @tags repos + * @name ReposUpdateWebhook + * @summary Update a repository webhook + * @request PATCH:/repos/{owner}/{repo}/hooks/{hook_id} + */ + reposUpdateWebhook: ( + owner: string, + repo: string, + hookId: number, + data: ReposUpdateWebhookPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Updates the webhook configuration for a repository. To update more information about the webhook, including the \`active\` state and \`events\`, use "[Update a repository webhook](/rest/reference/orgs#update-a-repository-webhook)." Access tokens must have the \`write:repo_hook\` or \`repo\` scope, and GitHub Apps must have the \`repository_hooks:write\` permission. + * + * @tags repos + * @name ReposUpdateWebhookConfigForRepo + * @summary Update a webhook configuration for a repository + * @request PATCH:/repos/{owner}/{repo}/hooks/{hook_id}/config + */ + reposUpdateWebhookConfigForRepo: ( + owner: string, + repo: string, + hookId: number, + data: ReposUpdateWebhookConfigForRepoPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/config\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description This endpoint makes use of [a Hypermedia relation](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia) to determine which URL to access. The endpoint you call to upload release assets is specific to your release. Use the \`upload_url\` returned in the response of the [Create a release endpoint](https://docs.github.com/rest/reference/repos#create-a-release) to upload a release asset. You need to use an HTTP client which supports [SNI](http://en.wikipedia.org/wiki/Server_Name_Indication) to make calls to this endpoint. Most libraries will set the required \`Content-Length\` header automatically. Use the required \`Content-Type\` header to provide the media type of the asset. For a list of media types, see [Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml). For example: \`application/zip\` GitHub expects the asset data in its raw binary form, rather than JSON. You will send the raw binary content of the asset as the request body. Everything else about the endpoint is the same as the rest of the API. For example, you'll still need to pass your authentication to be able to upload an asset. When an upstream failure occurs, you will receive a \`502 Bad Gateway\` status. This may leave an empty asset with a state of \`starter\`. It can be safely deleted. **Notes:** * GitHub renames asset filenames that have special characters, non-alphanumeric characters, and leading or trailing periods. The "[List assets for a release](https://docs.github.com/rest/reference/repos#list-assets-for-a-release)" endpoint lists the renamed filenames. For more information and help, contact [GitHub Support](https://support.github.com/contact). * If you upload an asset with the same filename as another uploaded asset, you'll receive an error and must delete the old file before you can re-upload the new asset. + * + * @tags repos + * @name ReposUploadReleaseAsset + * @summary Upload a release asset + * @request POST:/repos/{owner}/{repo}/releases/{release_id}/assets + */ + reposUploadReleaseAsset: ( + { owner, repo, releaseId, ...query }: ReposUploadReleaseAssetParams, + data: ReposUploadReleaseAssetPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/\${releaseId}/assets\`, + method: "POST", + query: query, + body: data, + ...params, + }), + + /** + * @description Gets a single secret scanning alert detected in a private repository. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the \`repo\` scope or \`security_events\` scope. GitHub Apps must have the \`secret_scanning_alerts\` read permission to use this endpoint. + * + * @tags secret-scanning + * @name SecretScanningGetAlert + * @summary Get a secret scanning alert + * @request GET:/repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} + */ + secretScanningGetAlert: (owner: string, repo: string, alertNumber: AlertNumber, params: RequestParams = {}) => + this.request< + SecretScanningGetAlertData, + void | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/secret-scanning/alerts/\${alertNumber}\`, + method: "GET", + ...params, + }), + + /** + * @description Lists all secret scanning alerts for a private repository, from newest to oldest. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the \`repo\` scope or \`security_events\` scope. GitHub Apps must have the \`secret_scanning_alerts\` read permission to use this endpoint. + * + * @tags secret-scanning + * @name SecretScanningListAlertsForRepo + * @summary List secret scanning alerts for a repository + * @request GET:/repos/{owner}/{repo}/secret-scanning/alerts + */ + secretScanningListAlertsForRepo: ( + { owner, repo, ...query }: SecretScanningListAlertsForRepoParams, + params: RequestParams = {}, + ) => + this.request< + SecretScanningListAlertsForRepoData, + void | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/secret-scanning/alerts\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Updates the status of a secret scanning alert in a private repository. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the \`repo\` scope or \`security_events\` scope. GitHub Apps must have the \`secret_scanning_alerts\` write permission to use this endpoint. + * + * @tags secret-scanning + * @name SecretScanningUpdateAlert + * @summary Update a secret scanning alert + * @request PATCH:/repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} + */ + secretScanningUpdateAlert: ( + owner: string, + repo: string, + alertNumber: AlertNumber, + data: SecretScanningUpdateAlertPayload, + params: RequestParams = {}, + ) => + this.request< + SecretScanningUpdateAlertData, + void | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/secret-scanning/alerts/\${alertNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; + repositories = { + /** + * @description Lists all public repositories in the order that they were created. Note: Pagination is powered exclusively by the \`since\` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of repositories. + * + * @tags repos + * @name ReposListPublic + * @summary List public repositories + * @request GET:/repositories + */ + reposListPublic: (query: ReposListPublicParams, params: RequestParams = {}) => + this.request({ + path: \`/repositories\`, + method: "GET", + query: query, + ...params, + }), + }; + scim = { + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * + * @tags enterprise-admin + * @name EnterpriseAdminDeleteScimGroupFromEnterprise + * @summary Delete a SCIM group from an enterprise + * @request DELETE:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} + */ + enterpriseAdminDeleteScimGroupFromEnterprise: ( + enterprise: string, + scimGroupId: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups/\${scimGroupId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * + * @tags enterprise-admin + * @name EnterpriseAdminDeleteUserFromEnterprise + * @summary Delete a SCIM user from an enterprise + * @request DELETE:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + */ + enterpriseAdminDeleteUserFromEnterprise: (enterprise: string, scimUserId: string, params: RequestParams = {}) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users/\${scimUserId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * + * @tags enterprise-admin + * @name EnterpriseAdminGetProvisioningInformationForEnterpriseGroup + * @summary Get SCIM provisioning information for an enterprise group + * @request GET:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} + */ + enterpriseAdminGetProvisioningInformationForEnterpriseGroup: ( + enterprise: string, + scimGroupId: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups/\${scimGroupId}\`, + method: "GET", + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * + * @tags enterprise-admin + * @name EnterpriseAdminGetProvisioningInformationForEnterpriseUser + * @summary Get SCIM provisioning information for an enterprise user + * @request GET:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + */ + enterpriseAdminGetProvisioningInformationForEnterpriseUser: ( + enterprise: string, + scimUserId: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users/\${scimUserId}\`, + method: "GET", + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * + * @tags enterprise-admin + * @name EnterpriseAdminListProvisionedGroupsEnterprise + * @summary List provisioned SCIM groups for an enterprise + * @request GET:/scim/v2/enterprises/{enterprise}/Groups + */ + enterpriseAdminListProvisionedGroupsEnterprise: ( + { enterprise, ...query }: EnterpriseAdminListProvisionedGroupsEnterpriseParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Retrieves a paginated list of all provisioned enterprise members, including pending invitations. When a user with a SAML-provisioned external identity leaves (or is removed from) an enterprise, the account's metadata is immediately removed. However, the returned list of user accounts might not always match the organization or enterprise member list you see on GitHub. This can happen in certain cases where an external identity associated with an organization will not match an organization member: - When a user with a SCIM-provisioned external identity is removed from an enterprise, the account's metadata is preserved to allow the user to re-join the organization in the future. - When inviting a user to join an organization, you can expect to see their external identity in the results before they accept the invitation, or if the invitation is cancelled (or never accepted). - When a user is invited over SCIM, an external identity is created that matches with the invitee's email address. However, this identity is only linked to a user account when the user accepts the invitation by going through SAML SSO. The returned list of external identities can include an entry for a \`null\` user. These are unlinked SAML identities that are created when a user goes through the following Single Sign-On (SSO) process but does not sign in to their GitHub account after completing SSO: 1. The user is granted access by the IdP and is not a member of the GitHub enterprise. 1. The user attempts to access the GitHub enterprise and initiates the SAML SSO process, and is not currently signed in to their GitHub account. 1. After successfully authenticating with the SAML SSO IdP, the \`null\` external identity entry is created and the user is prompted to sign in to their GitHub account: - If the user signs in, their GitHub account is linked to this entry. - If the user does not sign in (or does not create a new account when prompted), they are not added to the GitHub enterprise, and the external identity \`null\` entry remains in place. + * + * @tags enterprise-admin + * @name EnterpriseAdminListProvisionedIdentitiesEnterprise + * @summary List SCIM provisioned identities for an enterprise + * @request GET:/scim/v2/enterprises/{enterprise}/Users + */ + enterpriseAdminListProvisionedIdentitiesEnterprise: ( + { enterprise, ...query }: EnterpriseAdminListProvisionedIdentitiesEnterpriseParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Provision an enterprise group, and invite users to the group. This sends invitation emails to the email address of the invited users to join the GitHub organization that the SCIM group corresponds to. + * + * @tags enterprise-admin + * @name EnterpriseAdminProvisionAndInviteEnterpriseGroup + * @summary Provision a SCIM enterprise group and invite users + * @request POST:/scim/v2/enterprises/{enterprise}/Groups + */ + enterpriseAdminProvisionAndInviteEnterpriseGroup: ( + enterprise: string, + data: EnterpriseAdminProvisionAndInviteEnterpriseGroupPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Provision enterprise membership for a user, and send organization invitation emails to the email address. You can optionally include the groups a user will be invited to join. If you do not provide a list of \`groups\`, the user is provisioned for the enterprise, but no organization invitation emails will be sent. + * + * @tags enterprise-admin + * @name EnterpriseAdminProvisionAndInviteEnterpriseUser + * @summary Provision and invite a SCIM enterprise user + * @request POST:/scim/v2/enterprises/{enterprise}/Users + */ + enterpriseAdminProvisionAndInviteEnterpriseUser: ( + enterprise: string, + data: EnterpriseAdminProvisionAndInviteEnterpriseUserPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Replaces an existing provisioned group’s information. You must provide all the information required for the group as if you were provisioning it for the first time. Any existing group information that you don't provide will be removed, including group membership. If you want to only update a specific attribute, use the [Update an attribute for a SCIM enterprise group](#update-an-attribute-for-a-scim-enterprise-group) endpoint instead. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetInformationForProvisionedEnterpriseGroup + * @summary Set SCIM information for a provisioned enterprise group + * @request PUT:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} + */ + enterpriseAdminSetInformationForProvisionedEnterpriseGroup: ( + enterprise: string, + scimGroupId: string, + data: EnterpriseAdminSetInformationForProvisionedEnterpriseGroupPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups/\${scimGroupId}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Replaces an existing provisioned user's information. You must provide all the information required for the user as if you were provisioning them for the first time. Any existing user information that you don't provide will be removed. If you want to only update a specific attribute, use the [Update an attribute for a SCIM user](#update-an-attribute-for-an-enterprise-scim-user) endpoint instead. You must at least provide the required values for the user: \`userName\`, \`name\`, and \`emails\`. **Warning:** Setting \`active: false\` removes the user from the enterprise, deletes the external identity, and deletes the associated \`{scim_user_id}\`. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetInformationForProvisionedEnterpriseUser + * @summary Set SCIM information for a provisioned enterprise user + * @request PUT:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + */ + enterpriseAdminSetInformationForProvisionedEnterpriseUser: ( + enterprise: string, + scimUserId: string, + data: EnterpriseAdminSetInformationForProvisionedEnterpriseUserPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users/\${scimUserId}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Allows you to change a provisioned group’s individual attributes. To change a group’s values, you must provide a specific Operations JSON format that contains at least one of the add, remove, or replace operations. For examples and more information on the SCIM operations format, see the [SCIM specification](https://tools.ietf.org/html/rfc7644#section-3.5.2). + * + * @tags enterprise-admin + * @name EnterpriseAdminUpdateAttributeForEnterpriseGroup + * @summary Update an attribute for a SCIM enterprise group + * @request PATCH:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} + */ + enterpriseAdminUpdateAttributeForEnterpriseGroup: ( + enterprise: string, + scimGroupId: string, + data: EnterpriseAdminUpdateAttributeForEnterpriseGroupPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups/\${scimGroupId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Allows you to change a provisioned user's individual attributes. To change a user's values, you must provide a specific \`Operations\` JSON format that contains at least one of the \`add\`, \`remove\`, or \`replace\` operations. For examples and more information on the SCIM operations format, see the [SCIM specification](https://tools.ietf.org/html/rfc7644#section-3.5.2). **Note:** Complicated SCIM \`path\` selectors that include filters are not supported. For example, a \`path\` selector defined as \`"path": "emails[type eq \\"work\\"]"\` will not work. **Warning:** If you set \`active:false\` using the \`replace\` operation (as shown in the JSON example below), it removes the user from the enterprise, deletes the external identity, and deletes the associated \`:scim_user_id\`. \`\`\` { "Operations":[{ "op":"replace", "value":{ "active":false } }] } \`\`\` + * + * @tags enterprise-admin + * @name EnterpriseAdminUpdateAttributeForEnterpriseUser + * @summary Update an attribute for a SCIM enterprise user + * @request PATCH:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + */ + enterpriseAdminUpdateAttributeForEnterpriseUser: ( + enterprise: string, + scimUserId: string, + data: EnterpriseAdminUpdateAttributeForEnterpriseUserPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users/\${scimUserId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags scim + * @name ScimDeleteUserFromOrg + * @summary Delete a SCIM user from an organization + * @request DELETE:/scim/v2/organizations/{org}/Users/{scim_user_id} + */ + scimDeleteUserFromOrg: (org: string, scimUserId: string, params: RequestParams = {}) => + this.request({ + path: \`/scim/v2/organizations/\${org}/Users/\${scimUserId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags scim + * @name ScimGetProvisioningInformationForUser + * @summary Get SCIM provisioning information for a user + * @request GET:/scim/v2/organizations/{org}/Users/{scim_user_id} + */ + scimGetProvisioningInformationForUser: (org: string, scimUserId: string, params: RequestParams = {}) => + this.request({ + path: \`/scim/v2/organizations/\${org}/Users/\${scimUserId}\`, + method: "GET", + ...params, + }), + + /** + * @description Retrieves a paginated list of all provisioned organization members, including pending invitations. If you provide the \`filter\` parameter, the resources for all matching provisions members are returned. When a user with a SAML-provisioned external identity leaves (or is removed from) an organization, the account's metadata is immediately removed. However, the returned list of user accounts might not always match the organization or enterprise member list you see on GitHub. This can happen in certain cases where an external identity associated with an organization will not match an organization member: - When a user with a SCIM-provisioned external identity is removed from an organization, the account's metadata is preserved to allow the user to re-join the organization in the future. - When inviting a user to join an organization, you can expect to see their external identity in the results before they accept the invitation, or if the invitation is cancelled (or never accepted). - When a user is invited over SCIM, an external identity is created that matches with the invitee's email address. However, this identity is only linked to a user account when the user accepts the invitation by going through SAML SSO. The returned list of external identities can include an entry for a \`null\` user. These are unlinked SAML identities that are created when a user goes through the following Single Sign-On (SSO) process but does not sign in to their GitHub account after completing SSO: 1. The user is granted access by the IdP and is not a member of the GitHub organization. 1. The user attempts to access the GitHub organization and initiates the SAML SSO process, and is not currently signed in to their GitHub account. 1. After successfully authenticating with the SAML SSO IdP, the \`null\` external identity entry is created and the user is prompted to sign in to their GitHub account: - If the user signs in, their GitHub account is linked to this entry. - If the user does not sign in (or does not create a new account when prompted), they are not added to the GitHub organization, and the external identity \`null\` entry remains in place. + * + * @tags scim + * @name ScimListProvisionedIdentities + * @summary List SCIM provisioned identities + * @request GET:/scim/v2/organizations/{org}/Users + */ + scimListProvisionedIdentities: ( + { org, ...query }: ScimListProvisionedIdentitiesParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/organizations/\${org}/Users\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Provision organization membership for a user, and send an activation email to the email address. + * + * @tags scim + * @name ScimProvisionAndInviteUser + * @summary Provision and invite a SCIM user + * @request POST:/scim/v2/organizations/{org}/Users + */ + scimProvisionAndInviteUser: (org: string, data: ScimProvisionAndInviteUserPayload, params: RequestParams = {}) => + this.request({ + path: \`/scim/v2/organizations/\${org}/Users\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Replaces an existing provisioned user's information. You must provide all the information required for the user as if you were provisioning them for the first time. Any existing user information that you don't provide will be removed. If you want to only update a specific attribute, use the [Update an attribute for a SCIM user](https://docs.github.com/rest/reference/scim#update-an-attribute-for-a-scim-user) endpoint instead. You must at least provide the required values for the user: \`userName\`, \`name\`, and \`emails\`. **Warning:** Setting \`active: false\` removes the user from the organization, deletes the external identity, and deletes the associated \`{scim_user_id}\`. + * + * @tags scim + * @name ScimSetInformationForProvisionedUser + * @summary Update a provisioned organization membership + * @request PUT:/scim/v2/organizations/{org}/Users/{scim_user_id} + */ + scimSetInformationForProvisionedUser: ( + org: string, + scimUserId: string, + data: ScimSetInformationForProvisionedUserPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/organizations/\${org}/Users/\${scimUserId}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Allows you to change a provisioned user's individual attributes. To change a user's values, you must provide a specific \`Operations\` JSON format that contains at least one of the \`add\`, \`remove\`, or \`replace\` operations. For examples and more information on the SCIM operations format, see the [SCIM specification](https://tools.ietf.org/html/rfc7644#section-3.5.2). **Note:** Complicated SCIM \`path\` selectors that include filters are not supported. For example, a \`path\` selector defined as \`"path": "emails[type eq \\"work\\"]"\` will not work. **Warning:** If you set \`active:false\` using the \`replace\` operation (as shown in the JSON example below), it removes the user from the organization, deletes the external identity, and deletes the associated \`:scim_user_id\`. \`\`\` { "Operations":[{ "op":"replace", "value":{ "active":false } }] } \`\`\` + * + * @tags scim + * @name ScimUpdateAttributeForUser + * @summary Update an attribute for a SCIM user + * @request PATCH:/scim/v2/organizations/{org}/Users/{scim_user_id} + */ + scimUpdateAttributeForUser: ( + org: string, + scimUserId: string, + data: ScimUpdateAttributeForUserPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/organizations/\${org}/Users/\${scimUserId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; + search = { + /** + * @description Searches for query terms inside of a file. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for code, you can get text match metadata for the file **content** and file **path** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find the definition of the \`addClass\` function inside [jQuery](https://github.com/jquery/jquery) repository, your query would look something like this: \`q=addClass+in:file+language:js+repo:jquery/jquery\` This query searches for the keyword \`addClass\` within a file's contents. The query limits the search to files where the language is JavaScript in the \`jquery/jquery\` repository. #### Considerations for code search Due to the complexity of searching code, there are a few restrictions on how searches are performed: * Only the _default branch_ is considered. In most cases, this will be the \`master\` branch. * Only files smaller than 384 KB are searchable. * You must always include at least one search term when searching source code. For example, searching for [\`language:go\`](https://github.com/search?utf8=%E2%9C%93&q=language%3Ago&type=Code) is not valid, while [\`amazing language:go\`](https://github.com/search?utf8=%E2%9C%93&q=amazing+language%3Ago&type=Code) is. + * + * @tags search + * @name SearchCode + * @summary Search code + * @request GET:/search/code + */ + searchCode: (query: SearchCodeParams, params: RequestParams = {}) => + this.request< + SearchCodeData, + | BasicError + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/search/code\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Find commits via various criteria on the default branch (usually \`master\`). This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for commits, you can get text match metadata for the **message** field when you provide the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find commits related to CSS in the [octocat/Spoon-Knife](https://github.com/octocat/Spoon-Knife) repository. Your query would look something like this: \`q=repo:octocat/Spoon-Knife+css\` + * + * @tags search + * @name SearchCommits + * @summary Search commits + * @request GET:/search/commits + */ + searchCommits: (query: SearchCommitsParams, params: RequestParams = {}) => + this.request< + SearchCommitsData, + { + documentation_url: string; + message: string; + } + >({ + path: \`/search/commits\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Find issues by state and keyword. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for issues, you can get text match metadata for the issue **title**, issue **body**, and issue **comment body** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find the oldest unresolved Python bugs on Windows. Your query might look something like this. \`q=windows+label:bug+language:python+state:open&sort=created&order=asc\` This query searches for the keyword \`windows\`, within any open issue that is labeled as \`bug\`. The search runs across repositories whose primary language is Python. The results are sorted by creation date in ascending order, which means the oldest issues appear first in the search results. **Note:** For [user-to-server](https://docs.github.com/developers/apps/identifying-and-authorizing-users-for-github-apps#user-to-server-requests) GitHub App requests, you can't retrieve a combination of issues and pull requests in a single query. Requests that don't include the \`is:issue\` or \`is:pull-request\` qualifier will receive an HTTP \`422 Unprocessable Entity\` response. To get results for both issues and pull requests, you must send separate queries for issues and pull requests. For more information about the \`is\` qualifier, see "[Searching only issues or pull requests](https://docs.github.com/github/searching-for-information-on-github/searching-issues-and-pull-requests#search-only-issues-or-pull-requests)." + * + * @tags search + * @name SearchIssuesAndPullRequests + * @summary Search issues and pull requests + * @request GET:/search/issues + */ + searchIssuesAndPullRequests: (query: SearchIssuesAndPullRequestsParams, params: RequestParams = {}) => + this.request< + SearchIssuesAndPullRequestsData, + | BasicError + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/search/issues\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for labels, you can get text match metadata for the label **name** and **description** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find labels in the \`linguist\` repository that match \`bug\`, \`defect\`, or \`enhancement\`. Your query might look like this: \`q=bug+defect+enhancement&repository_id=64778136\` The labels that best match the query appear first in the search results. + * + * @tags search + * @name SearchLabels + * @summary Search labels + * @request GET:/search/labels + */ + searchLabels: (query: SearchLabelsParams, params: RequestParams = {}) => + this.request({ + path: \`/search/labels\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Find repositories via various criteria. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for repositories, you can get text match metadata for the **name** and **description** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to search for popular Tetris repositories written in assembly code, your query might look like this: \`q=tetris+language:assembly&sort=stars&order=desc\` This query searches for repositories with the word \`tetris\` in the name, the description, or the README. The results are limited to repositories where the primary language is assembly. The results are sorted by stars in descending order, so that the most popular repositories appear first in the search results. When you include the \`mercy\` preview header, you can also search for multiple topics by adding more \`topic:\` instances. For example, your query might look like this: \`q=topic:ruby+topic:rails\` + * + * @tags search + * @name SearchRepos + * @summary Search repositories + * @request GET:/search/repositories + */ + searchRepos: (query: SearchReposParams, params: RequestParams = {}) => + this.request< + SearchReposData, + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/search/repositories\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Find topics via various criteria. Results are sorted by best match. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). See "[Searching topics](https://help.github.com/articles/searching-topics/)" for a detailed list of qualifiers. When searching for topics, you can get text match metadata for the topic's **short\\_description**, **description**, **name**, or **display\\_name** field when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to search for topics related to Ruby that are featured on https://github.com/topics. Your query might look like this: \`q=ruby+is:featured\` This query searches for topics with the keyword \`ruby\` and limits the results to find only topics that are featured. The topics that are the best match for the query appear first in the search results. + * + * @tags search + * @name SearchTopics + * @summary Search topics + * @request GET:/search/topics + */ + searchTopics: (query: SearchTopicsParams, params: RequestParams = {}) => + this.request< + SearchTopicsData, + { + documentation_url: string; + message: string; + } + >({ + path: \`/search/topics\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Find users via various criteria. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for users, you can get text match metadata for the issue **login**, **email**, and **name** fields when you pass the \`text-match\` media type. For more details about highlighting search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you're looking for a list of popular users, you might try this query: \`q=tom+repos:%3E42+followers:%3E1000\` This query searches for users with the name \`tom\`. The results are restricted to users with more than 42 repositories and over 1,000 followers. + * + * @tags search + * @name SearchUsers + * @summary Search users + * @request GET:/search/users + */ + searchUsers: (query: SearchUsersParams, params: RequestParams = {}) => + this.request< + SearchUsersData, + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/search/users\`, + method: "GET", + query: query, + ...params, + }), + }; + teams = { + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new "[Create reaction for a team discussion comment](https://docs.github.com/rest/reference/reactions#create-reaction-for-a-team-discussion-comment)" endpoint. Create a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion comment. + * + * @tags reactions + * @name ReactionsCreateForTeamDiscussionCommentLegacy + * @summary Create reaction for a team discussion comment (Legacy) + * @request POST:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions + * @deprecated + */ + reactionsCreateForTeamDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + commentNumber: number, + data: ReactionsCreateForTeamDiscussionCommentLegacyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments/\${commentNumber}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`Create reaction for a team discussion\`](https://docs.github.com/rest/reference/reactions#create-reaction-for-a-team-discussion) endpoint. Create a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion. + * + * @tags reactions + * @name ReactionsCreateForTeamDiscussionLegacy + * @summary Create reaction for a team discussion (Legacy) + * @request POST:/teams/{team_id}/discussions/{discussion_number}/reactions + * @deprecated + */ + reactionsCreateForTeamDiscussionLegacy: ( + teamId: number, + discussionNumber: number, + data: ReactionsCreateForTeamDiscussionLegacyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List reactions for a team discussion comment\`](https://docs.github.com/rest/reference/reactions#list-reactions-for-a-team-discussion-comment) endpoint. List the reactions to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags reactions + * @name ReactionsListForTeamDiscussionCommentLegacy + * @summary List reactions for a team discussion comment (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions + * @deprecated + */ + reactionsListForTeamDiscussionCommentLegacy: ( + { teamId, discussionNumber, commentNumber, ...query }: ReactionsListForTeamDiscussionCommentLegacyParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments/\${commentNumber}/reactions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List reactions for a team discussion\`](https://docs.github.com/rest/reference/reactions#list-reactions-for-a-team-discussion) endpoint. List the reactions to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags reactions + * @name ReactionsListForTeamDiscussionLegacy + * @summary List reactions for a team discussion (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/reactions + * @deprecated + */ + reactionsListForTeamDiscussionLegacy: ( + { teamId, discussionNumber, ...query }: ReactionsListForTeamDiscussionLegacyParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/reactions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description The "Add team member" endpoint (described below) is deprecated. We recommend using the [Add or update team membership for a user](https://docs.github.com/rest/reference/teams#add-or-update-team-membership-for-a-user) endpoint instead. It allows you to invite new organization members to your teams. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To add someone to a team, the authenticated user must be an organization owner or a team maintainer in the team they're changing. The person being added to the team must be a member of the team's organization. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * + * @tags teams + * @name TeamsAddMemberLegacy + * @summary Add team member (Legacy) + * @request PUT:/teams/{team_id}/members/{username} + * @deprecated + */ + teamsAddMemberLegacy: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/members/\${username}\`, + method: "PUT", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Add or update team membership for a user](https://docs.github.com/rest/reference/teams#add-or-update-team-membership-for-a-user) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. If the user is already a member of the team's organization, this endpoint will add the user to the team. To add a membership between an organization member and a team, the authenticated user must be an organization owner or a team maintainer. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." If the user is unaffiliated with the team's organization, this endpoint will send an invitation to the user via email. This newly-created membership will be in the "pending" state until the user accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. To add a membership between an unaffiliated user and a team, the authenticated user must be an organization owner. If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer. + * + * @tags teams + * @name TeamsAddOrUpdateMembershipForUserLegacy + * @summary Add or update team membership for a user (Legacy) + * @request PUT:/teams/{team_id}/memberships/{username} + * @deprecated + */ + teamsAddOrUpdateMembershipForUserLegacy: ( + teamId: number, + username: string, + data: TeamsAddOrUpdateMembershipForUserLegacyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/memberships/\${username}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Add or update team project permissions](https://docs.github.com/rest/reference/teams#add-or-update-team-project-permissions) endpoint. Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have \`admin\` permissions for the project. The project and team must be part of the same organization. + * + * @tags teams + * @name TeamsAddOrUpdateProjectPermissionsLegacy + * @summary Add or update team project permissions (Legacy) + * @request PUT:/teams/{team_id}/projects/{project_id} + * @deprecated + */ + teamsAddOrUpdateProjectPermissionsLegacy: ( + teamId: number, + projectId: number, + data: TeamsAddOrUpdateProjectPermissionsLegacyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/projects/\${projectId}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new "[Add or update team repository permissions](https://docs.github.com/rest/reference/teams#add-or-update-team-repository-permissions)" endpoint. To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a \`422 Unprocessable Entity\` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * + * @tags teams + * @name TeamsAddOrUpdateRepoPermissionsLegacy + * @summary Add or update team repository permissions (Legacy) + * @request PUT:/teams/{team_id}/repos/{owner}/{repo} + * @deprecated + */ + teamsAddOrUpdateRepoPermissionsLegacy: ( + teamId: number, + owner: string, + repo: string, + data: TeamsAddOrUpdateRepoPermissionsLegacyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Check team permissions for a project](https://docs.github.com/rest/reference/teams#check-team-permissions-for-a-project) endpoint. Checks whether a team has \`read\`, \`write\`, or \`admin\` permissions for an organization project. The response includes projects inherited from a parent team. + * + * @tags teams + * @name TeamsCheckPermissionsForProjectLegacy + * @summary Check team permissions for a project (Legacy) + * @request GET:/teams/{team_id}/projects/{project_id} + * @deprecated + */ + teamsCheckPermissionsForProjectLegacy: (teamId: number, projectId: number, params: RequestParams = {}) => + this.request< + TeamsCheckPermissionsForProjectLegacyData, + void | { + documentation_url: string; + message: string; + } + >({ + path: \`/teams/\${teamId}/projects/\${projectId}\`, + method: "GET", + ...params, + }), + + /** + * @description **Note**: Repositories inherited through a parent team will also be checked. **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Check team permissions for a repository](https://docs.github.com/rest/reference/teams#check-team-permissions-for-a-repository) endpoint. You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: + * + * @tags teams + * @name TeamsCheckPermissionsForRepoLegacy + * @summary Check team permissions for a repository (Legacy) + * @request GET:/teams/{team_id}/repos/{owner}/{repo} + * @deprecated + */ + teamsCheckPermissionsForRepoLegacy: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, + method: "GET", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Create a discussion comment](https://docs.github.com/rest/reference/teams#create-a-discussion-comment) endpoint. Creates a new comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * + * @tags teams + * @name TeamsCreateDiscussionCommentLegacy + * @summary Create a discussion comment (Legacy) + * @request POST:/teams/{team_id}/discussions/{discussion_number}/comments + * @deprecated + */ + teamsCreateDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + data: TeamsCreateDiscussionCommentLegacyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`Create a discussion\`](https://docs.github.com/rest/reference/teams#create-a-discussion) endpoint. Creates a new discussion post on a team's page. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * + * @tags teams + * @name TeamsCreateDiscussionLegacy + * @summary Create a discussion (Legacy) + * @request POST:/teams/{team_id}/discussions + * @deprecated + */ + teamsCreateDiscussionLegacy: ( + teamId: number, + data: TeamsCreateDiscussionLegacyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`Create or update IdP group connections\`](https://docs.github.com/rest/reference/teams#create-or-update-idp-group-connections) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty \`groups\` array will remove all connections for a team. + * + * @tags teams + * @name TeamsCreateOrUpdateIdpGroupConnectionsLegacy + * @summary Create or update IdP group connections (Legacy) + * @request PATCH:/teams/{team_id}/team-sync/group-mappings + * @deprecated + */ + teamsCreateOrUpdateIdpGroupConnectionsLegacy: ( + teamId: number, + data: TeamsCreateOrUpdateIdpGroupConnectionsLegacyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/team-sync/group-mappings\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Delete a discussion comment](https://docs.github.com/rest/reference/teams#delete-a-discussion-comment) endpoint. Deletes a comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags teams + * @name TeamsDeleteDiscussionCommentLegacy + * @summary Delete a discussion comment (Legacy) + * @request DELETE:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + * @deprecated + */ + teamsDeleteDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + commentNumber: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`Delete a discussion\`](https://docs.github.com/rest/reference/teams#delete-a-discussion) endpoint. Delete a discussion from a team's page. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags teams + * @name TeamsDeleteDiscussionLegacy + * @summary Delete a discussion (Legacy) + * @request DELETE:/teams/{team_id}/discussions/{discussion_number} + * @deprecated + */ + teamsDeleteDiscussionLegacy: (teamId: number, discussionNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Delete a team](https://docs.github.com/rest/reference/teams#delete-a-team) endpoint. To delete a team, the authenticated user must be an organization owner or team maintainer. If you are an organization owner, deleting a parent team will delete all of its child teams as well. + * + * @tags teams + * @name TeamsDeleteLegacy + * @summary Delete a team (Legacy) + * @request DELETE:/teams/{team_id} + * @deprecated + */ + teamsDeleteLegacy: (teamId: number, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get a discussion comment](https://docs.github.com/rest/reference/teams#get-a-discussion-comment) endpoint. Get a specific comment on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags teams + * @name TeamsGetDiscussionCommentLegacy + * @summary Get a discussion comment (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + * @deprecated + */ + teamsGetDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + commentNumber: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "GET", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get a discussion](https://docs.github.com/rest/reference/teams#get-a-discussion) endpoint. Get a specific discussion on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags teams + * @name TeamsGetDiscussionLegacy + * @summary Get a discussion (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number} + * @deprecated + */ + teamsGetDiscussionLegacy: (teamId: number, discussionNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}\`, + method: "GET", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the [Get a team by name](https://docs.github.com/rest/reference/teams#get-a-team-by-name) endpoint. + * + * @tags teams + * @name TeamsGetLegacy + * @summary Get a team (Legacy) + * @request GET:/teams/{team_id} + * @deprecated + */ + teamsGetLegacy: (teamId: number, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}\`, + method: "GET", + ...params, + }), + + /** + * @description The "Get team member" endpoint (described below) is deprecated. We recommend using the [Get team membership for a user](https://docs.github.com/rest/reference/teams#get-team-membership-for-a-user) endpoint instead. It allows you to get both active and pending memberships. To list members in a team, the team must be visible to the authenticated user. + * + * @tags teams + * @name TeamsGetMemberLegacy + * @summary Get team member (Legacy) + * @request GET:/teams/{team_id}/members/{username} + * @deprecated + */ + teamsGetMemberLegacy: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/members/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get team membership for a user](https://docs.github.com/rest/reference/teams#get-team-membership-for-a-user) endpoint. Team members will include the members of child teams. To get a user's membership with a team, the team must be visible to the authenticated user. **Note:** The \`role\` for organization owners returns as \`maintainer\`. For more information about \`maintainer\` roles, see [Create a team](https://docs.github.com/rest/reference/teams#create-a-team). + * + * @tags teams + * @name TeamsGetMembershipForUserLegacy + * @summary Get team membership for a user (Legacy) + * @request GET:/teams/{team_id}/memberships/{username} + * @deprecated + */ + teamsGetMembershipForUserLegacy: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/memberships/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List child teams\`](https://docs.github.com/rest/reference/teams#list-child-teams) endpoint. + * + * @tags teams + * @name TeamsListChildLegacy + * @summary List child teams (Legacy) + * @request GET:/teams/{team_id}/teams + * @deprecated + */ + teamsListChildLegacy: ({ teamId, ...query }: TeamsListChildLegacyParams, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/teams\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [List discussion comments](https://docs.github.com/rest/reference/teams#list-discussion-comments) endpoint. List all comments on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags teams + * @name TeamsListDiscussionCommentsLegacy + * @summary List discussion comments (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments + * @deprecated + */ + teamsListDiscussionCommentsLegacy: ( + { teamId, discussionNumber, ...query }: TeamsListDiscussionCommentsLegacyParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List discussions\`](https://docs.github.com/rest/reference/teams#list-discussions) endpoint. List all discussions on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags teams + * @name TeamsListDiscussionsLegacy + * @summary List discussions (Legacy) + * @request GET:/teams/{team_id}/discussions + * @deprecated + */ + teamsListDiscussionsLegacy: ({ teamId, ...query }: TeamsListDiscussionsLegacyParams, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/discussions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List IdP groups for a team\`](https://docs.github.com/rest/reference/teams#list-idp-groups-for-a-team) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups connected to a team on GitHub. + * + * @tags teams + * @name TeamsListIdpGroupsForLegacy + * @summary List IdP groups for a team (Legacy) + * @request GET:/teams/{team_id}/team-sync/group-mappings + * @deprecated + */ + teamsListIdpGroupsForLegacy: (teamId: number, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/team-sync/group-mappings\`, + method: "GET", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List team members\`](https://docs.github.com/rest/reference/teams#list-team-members) endpoint. Team members will include the members of child teams. + * + * @tags teams + * @name TeamsListMembersLegacy + * @summary List team members (Legacy) + * @request GET:/teams/{team_id}/members + * @deprecated + */ + teamsListMembersLegacy: ({ teamId, ...query }: TeamsListMembersLegacyParams, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/members\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List pending team invitations\`](https://docs.github.com/rest/reference/teams#list-pending-team-invitations) endpoint. The return hash contains a \`role\` field which refers to the Organization Invitation role and will be one of the following values: \`direct_member\`, \`admin\`, \`billing_manager\`, \`hiring_manager\`, or \`reinstate\`. If the invitee is not a GitHub member, the \`login\` field in the return hash will be \`null\`. + * + * @tags teams + * @name TeamsListPendingInvitationsLegacy + * @summary List pending team invitations (Legacy) + * @request GET:/teams/{team_id}/invitations + * @deprecated + */ + teamsListPendingInvitationsLegacy: ( + { teamId, ...query }: TeamsListPendingInvitationsLegacyParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/invitations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List team projects\`](https://docs.github.com/rest/reference/teams#list-team-projects) endpoint. Lists the organization projects for a team. + * + * @tags teams + * @name TeamsListProjectsLegacy + * @summary List team projects (Legacy) + * @request GET:/teams/{team_id}/projects + * @deprecated + */ + teamsListProjectsLegacy: ({ teamId, ...query }: TeamsListProjectsLegacyParams, params: RequestParams = {}) => + this.request< + TeamsListProjectsLegacyData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/teams/\${teamId}/projects\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [List team repositories](https://docs.github.com/rest/reference/teams#list-team-repositories) endpoint. + * + * @tags teams + * @name TeamsListReposLegacy + * @summary List team repositories (Legacy) + * @request GET:/teams/{team_id}/repos + * @deprecated + */ + teamsListReposLegacy: ({ teamId, ...query }: TeamsListReposLegacyParams, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/repos\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description The "Remove team member" endpoint (described below) is deprecated. We recommend using the [Remove team membership for a user](https://docs.github.com/rest/reference/teams#remove-team-membership-for-a-user) endpoint instead. It allows you to remove both active and pending memberships. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To remove a team member, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. Removing a team member does not delete the user, it just removes them from the team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." + * + * @tags teams + * @name TeamsRemoveMemberLegacy + * @summary Remove team member (Legacy) + * @request DELETE:/teams/{team_id}/members/{username} + * @deprecated + */ + teamsRemoveMemberLegacy: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/members/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove team membership for a user](https://docs.github.com/rest/reference/teams#remove-team-membership-for-a-user) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." + * + * @tags teams + * @name TeamsRemoveMembershipForUserLegacy + * @summary Remove team membership for a user (Legacy) + * @request DELETE:/teams/{team_id}/memberships/{username} + * @deprecated + */ + teamsRemoveMembershipForUserLegacy: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/memberships/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove a project from a team](https://docs.github.com/rest/reference/teams#remove-a-project-from-a-team) endpoint. Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have \`read\` access to both the team and project, or \`admin\` access to the team or project. **Note:** This endpoint removes the project from the team, but does not delete it. + * + * @tags teams + * @name TeamsRemoveProjectLegacy + * @summary Remove a project from a team (Legacy) + * @request DELETE:/teams/{team_id}/projects/{project_id} + * @deprecated + */ + teamsRemoveProjectLegacy: (teamId: number, projectId: number, params: RequestParams = {}) => + this.request< + TeamsRemoveProjectLegacyData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/teams/\${teamId}/projects/\${projectId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove a repository from a team](https://docs.github.com/rest/reference/teams#remove-a-repository-from-a-team) endpoint. If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. NOTE: This does not delete the repository, it just removes it from the team. + * + * @tags teams + * @name TeamsRemoveRepoLegacy + * @summary Remove a repository from a team (Legacy) + * @request DELETE:/teams/{team_id}/repos/{owner}/{repo} + * @deprecated + */ + teamsRemoveRepoLegacy: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a discussion comment](https://docs.github.com/rest/reference/teams#update-a-discussion-comment) endpoint. Edits the body text of a discussion comment. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags teams + * @name TeamsUpdateDiscussionCommentLegacy + * @summary Update a discussion comment (Legacy) + * @request PATCH:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + * @deprecated + */ + teamsUpdateDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + commentNumber: number, + data: TeamsUpdateDiscussionCommentLegacyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a discussion](https://docs.github.com/rest/reference/teams#update-a-discussion) endpoint. Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags teams + * @name TeamsUpdateDiscussionLegacy + * @summary Update a discussion (Legacy) + * @request PATCH:/teams/{team_id}/discussions/{discussion_number} + * @deprecated + */ + teamsUpdateDiscussionLegacy: ( + teamId: number, + discussionNumber: number, + data: TeamsUpdateDiscussionLegacyPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a team](https://docs.github.com/rest/reference/teams#update-a-team) endpoint. To edit a team, the authenticated user must either be an organization owner or a team maintainer. **Note:** With nested teams, the \`privacy\` for parent teams cannot be \`secret\`. + * + * @tags teams + * @name TeamsUpdateLegacy + * @summary Update a team (Legacy) + * @request PATCH:/teams/{team_id} + * @deprecated + */ + teamsUpdateLegacy: (teamId: number, data: TeamsUpdateLegacyPayload, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; + user = { + /** + * No description + * + * @tags activity + * @name ActivityCheckRepoIsStarredByAuthenticatedUser + * @summary Check if a repository is starred by the authenticated user + * @request GET:/user/starred/{owner}/{repo} + */ + activityCheckRepoIsStarredByAuthenticatedUser: (owner: string, repo: string, params: RequestParams = {}) => + this.request< + ActivityCheckRepoIsStarredByAuthenticatedUserData, + ActivityCheckRepoIsStarredByAuthenticatedUserError + >({ + path: \`/user/starred/\${owner}/\${repo}\`, + method: "GET", + ...params, + }), + + /** + * @description Lists repositories the authenticated user has starred. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: + * + * @tags activity + * @name ActivityListReposStarredByAuthenticatedUser + * @summary List repositories starred by the authenticated user + * @request GET:/user/starred + */ + activityListReposStarredByAuthenticatedUser: ( + query: ActivityListReposStarredByAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/starred\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists repositories the authenticated user is watching. + * + * @tags activity + * @name ActivityListWatchedReposForAuthenticatedUser + * @summary List repositories watched by the authenticated user + * @request GET:/user/subscriptions + */ + activityListWatchedReposForAuthenticatedUser: ( + query: ActivityListWatchedReposForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/subscriptions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * + * @tags activity + * @name ActivityStarRepoForAuthenticatedUser + * @summary Star a repository for the authenticated user + * @request PUT:/user/starred/{owner}/{repo} + */ + activityStarRepoForAuthenticatedUser: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/user/starred/\${owner}/\${repo}\`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityUnstarRepoForAuthenticatedUser + * @summary Unstar a repository for the authenticated user + * @request DELETE:/user/starred/{owner}/{repo} + */ + activityUnstarRepoForAuthenticatedUser: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/user/starred/\${owner}/\${repo}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Add a single repository to an installation. The authenticated user must have admin access to the repository. You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint. + * + * @tags apps + * @name AppsAddRepoToInstallation + * @summary Add a repository to an app installation + * @request PUT:/user/installations/{installation_id}/repositories/{repository_id} + */ + appsAddRepoToInstallation: (installationId: number, repositoryId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/installations/\${installationId}/repositories/\${repositoryId}\`, + method: "PUT", + ...params, + }), + + /** + * @description List repositories that the authenticated user has explicit permission (\`:read\`, \`:write\`, or \`:admin\`) to access for an installation. The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. The access the user has to each repository is included in the hash under the \`permissions\` key. + * + * @tags apps + * @name AppsListInstallationReposForAuthenticatedUser + * @summary List repositories accessible to the user access token + * @request GET:/user/installations/{installation_id}/repositories + */ + appsListInstallationReposForAuthenticatedUser: ( + { installationId, ...query }: AppsListInstallationReposForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/installations/\${installationId}/repositories\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists installations of your GitHub App that the authenticated user has explicit permission (\`:read\`, \`:write\`, or \`:admin\`) to access. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. You can find the permissions for the installation under the \`permissions\` key. + * + * @tags apps + * @name AppsListInstallationsForAuthenticatedUser + * @summary List app installations accessible to the user access token + * @request GET:/user/installations + */ + appsListInstallationsForAuthenticatedUser: ( + query: AppsListInstallationsForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request< + AppsListInstallationsForAuthenticatedUserData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/user/installations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the active subscriptions for the authenticated user. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an [OAuth token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/). + * + * @tags apps + * @name AppsListSubscriptionsForAuthenticatedUser + * @summary List subscriptions for the authenticated user + * @request GET:/user/marketplace_purchases + */ + appsListSubscriptionsForAuthenticatedUser: ( + query: AppsListSubscriptionsForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/marketplace_purchases\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the active subscriptions for the authenticated user. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an [OAuth token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/). + * + * @tags apps + * @name AppsListSubscriptionsForAuthenticatedUserStubbed + * @summary List subscriptions for the authenticated user (stubbed) + * @request GET:/user/marketplace_purchases/stubbed + */ + appsListSubscriptionsForAuthenticatedUserStubbed: ( + query: AppsListSubscriptionsForAuthenticatedUserStubbedParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/marketplace_purchases/stubbed\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Remove a single repository from an installation. The authenticated user must have admin access to the repository. You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint. + * + * @tags apps + * @name AppsRemoveRepoFromInstallation + * @summary Remove a repository from an app installation + * @request DELETE:/user/installations/{installation_id}/repositories/{repository_id} + */ + appsRemoveRepoFromInstallation: (installationId: number, repositoryId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/installations/\${installationId}/repositories/\${repositoryId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Shows which type of GitHub user can interact with your public repositories and when the restriction expires. If there are no restrictions, you will see an empty response. + * + * @tags interactions + * @name InteractionsGetRestrictionsForAuthenticatedUser + * @summary Get interaction restrictions for your public repositories + * @request GET:/user/interaction-limits + */ + interactionsGetRestrictionsForAuthenticatedUser: (params: RequestParams = {}) => + this.request({ + path: \`/user/interaction-limits\`, + method: "GET", + ...params, + }), + + /** + * @description Removes any interaction restrictions from your public repositories. + * + * @tags interactions + * @name InteractionsRemoveRestrictionsForAuthenticatedUser + * @summary Remove interaction restrictions from your public repositories + * @request DELETE:/user/interaction-limits + */ + interactionsRemoveRestrictionsForAuthenticatedUser: (params: RequestParams = {}) => + this.request({ + path: \`/user/interaction-limits\`, + method: "DELETE", + ...params, + }), + + /** + * @description Temporarily restricts which type of GitHub user can interact with your public repositories. Setting the interaction limit at the user level will overwrite any interaction limits that are set for individual repositories owned by the user. + * + * @tags interactions + * @name InteractionsSetRestrictionsForAuthenticatedUser + * @summary Set interaction restrictions for your public repositories + * @request PUT:/user/interaction-limits + */ + interactionsSetRestrictionsForAuthenticatedUser: (data: InteractionLimit, params: RequestParams = {}) => + this.request({ + path: \`/user/interaction-limits\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description List issues across owned and member repositories assigned to the authenticated user. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * + * @tags issues + * @name IssuesListForAuthenticatedUser + * @summary List user account issues assigned to the authenticated user + * @request GET:/user/issues + */ + issuesListForAuthenticatedUser: (query: IssuesListForAuthenticatedUserParams, params: RequestParams = {}) => + this.request({ + path: \`/user/issues\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Deletes a previous migration archive. Downloadable migration archives are automatically deleted after seven days. Migration metadata, which is returned in the [List user migrations](https://docs.github.com/rest/reference/migrations#list-user-migrations) and [Get a user migration status](https://docs.github.com/rest/reference/migrations#get-a-user-migration-status) endpoints, will continue to be available even after an archive is deleted. + * + * @tags migrations + * @name MigrationsDeleteArchiveForAuthenticatedUser + * @summary Delete a user migration archive + * @request DELETE:/user/migrations/{migration_id}/archive + */ + migrationsDeleteArchiveForAuthenticatedUser: (migrationId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/migrations/\${migrationId}/archive\`, + method: "DELETE", + ...params, + }), + + /** + * @description Fetches the URL to download the migration archive as a \`tar.gz\` file. Depending on the resources your repository uses, the migration archive can contain JSON files with data for these objects: * attachments * bases * commit\\_comments * issue\\_comments * issue\\_events * issues * milestones * organizations * projects * protected\\_branches * pull\\_request\\_reviews * pull\\_requests * releases * repositories * review\\_comments * schema * users The archive will also contain an \`attachments\` directory that includes all attachment files uploaded to GitHub.com and a \`repositories\` directory that contains the repository's Git data. + * + * @tags migrations + * @name MigrationsGetArchiveForAuthenticatedUser + * @summary Download a user migration archive + * @request GET:/user/migrations/{migration_id}/archive + */ + migrationsGetArchiveForAuthenticatedUser: (migrationId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/migrations/\${migrationId}/archive\`, + method: "GET", + ...params, + }), + + /** + * @description Fetches a single user migration. The response includes the \`state\` of the migration, which can be one of the following values: * \`pending\` - the migration hasn't started yet. * \`exporting\` - the migration is in progress. * \`exported\` - the migration finished successfully. * \`failed\` - the migration failed. Once the migration has been \`exported\` you can [download the migration archive](https://docs.github.com/rest/reference/migrations#download-a-user-migration-archive). + * + * @tags migrations + * @name MigrationsGetStatusForAuthenticatedUser + * @summary Get a user migration status + * @request GET:/user/migrations/{migration_id} + */ + migrationsGetStatusForAuthenticatedUser: ( + { migrationId, ...query }: MigrationsGetStatusForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/migrations/\${migrationId}\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all migrations a user has started. + * + * @tags migrations + * @name MigrationsListForAuthenticatedUser + * @summary List user migrations + * @request GET:/user/migrations + */ + migrationsListForAuthenticatedUser: (query: MigrationsListForAuthenticatedUserParams, params: RequestParams = {}) => + this.request({ + path: \`/user/migrations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all the repositories for this user migration. + * + * @tags migrations + * @name MigrationsListReposForUser + * @summary List repositories for a user migration + * @request GET:/user/migrations/{migration_id}/repositories + */ + migrationsListReposForUser: ( + { migrationId, ...query }: MigrationsListReposForUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/migrations/\${migrationId}/repositories\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Initiates the generation of a user migration archive. + * + * @tags migrations + * @name MigrationsStartForAuthenticatedUser + * @summary Start a user migration + * @request POST:/user/migrations + */ + migrationsStartForAuthenticatedUser: ( + data: MigrationsStartForAuthenticatedUserPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/migrations\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Unlocks a repository. You can lock repositories when you [start a user migration](https://docs.github.com/rest/reference/migrations#start-a-user-migration). Once the migration is complete you can unlock each repository to begin using it again or [delete the repository](https://docs.github.com/rest/reference/repos#delete-a-repository) if you no longer need the source data. Returns a status of \`404 Not Found\` if the repository is not locked. + * + * @tags migrations + * @name MigrationsUnlockRepoForAuthenticatedUser + * @summary Unlock a user repository + * @request DELETE:/user/migrations/{migration_id}/repos/{repo_name}/lock + */ + migrationsUnlockRepoForAuthenticatedUser: (migrationId: number, repoName: string, params: RequestParams = {}) => + this.request({ + path: \`/user/migrations/\${migrationId}/repos/\${repoName}/lock\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsGetMembershipForAuthenticatedUser + * @summary Get an organization membership for the authenticated user + * @request GET:/user/memberships/orgs/{org} + */ + orgsGetMembershipForAuthenticatedUser: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/user/memberships/orgs/\${org}\`, + method: "GET", + ...params, + }), + + /** + * @description List organizations for the authenticated user. **OAuth scope requirements** This only lists organizations that your authorization allows you to operate on in some way (e.g., you can list teams with \`read:org\` scope, you can publicize your organization membership with \`user\` scope, etc.). Therefore, this API requires at least \`user\` or \`read:org\` scope. OAuth requests with insufficient scope receive a \`403 Forbidden\` response. + * + * @tags orgs + * @name OrgsListForAuthenticatedUser + * @summary List organizations for the authenticated user + * @request GET:/user/orgs + */ + orgsListForAuthenticatedUser: (query: OrgsListForAuthenticatedUserParams, params: RequestParams = {}) => + this.request({ + path: \`/user/orgs\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsListMembershipsForAuthenticatedUser + * @summary List organization memberships for the authenticated user + * @request GET:/user/memberships/orgs + */ + orgsListMembershipsForAuthenticatedUser: ( + query: OrgsListMembershipsForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/memberships/orgs\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsUpdateMembershipForAuthenticatedUser + * @summary Update an organization membership for the authenticated user + * @request PATCH:/user/memberships/orgs/{org} + */ + orgsUpdateMembershipForAuthenticatedUser: ( + org: string, + data: OrgsUpdateMembershipForAuthenticatedUserPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/memberships/orgs/\${org}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsCreateForAuthenticatedUser + * @summary Create a user project + * @request POST:/user/projects + */ + projectsCreateForAuthenticatedUser: (data: ProjectsCreateForAuthenticatedUserPayload, params: RequestParams = {}) => + this.request< + ProjectsCreateForAuthenticatedUserData, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationErrorSimple + >({ + path: \`/user/projects\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposAcceptInvitation + * @summary Accept a repository invitation + * @request PATCH:/user/repository_invitations/{invitation_id} + */ + reposAcceptInvitation: (invitationId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/repository_invitations/\${invitationId}\`, + method: "PATCH", + ...params, + }), + + /** + * @description Creates a new repository for the authenticated user. **OAuth scope requirements** When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include: * \`public_repo\` scope or \`repo\` scope to create a public repository * \`repo\` scope to create a private repository + * + * @tags repos + * @name ReposCreateForAuthenticatedUser + * @summary Create a repository for the authenticated user + * @request POST:/user/repos + */ + reposCreateForAuthenticatedUser: (data: ReposCreateForAuthenticatedUserPayload, params: RequestParams = {}) => + this.request({ + path: \`/user/repos\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposDeclineInvitation + * @summary Decline a repository invitation + * @request DELETE:/user/repository_invitations/{invitation_id} + */ + reposDeclineInvitation: (invitationId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/repository_invitations/\${invitationId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists repositories that the authenticated user has explicit permission (\`:read\`, \`:write\`, or \`:admin\`) to access. The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. + * + * @tags repos + * @name ReposListForAuthenticatedUser + * @summary List repositories for the authenticated user + * @request GET:/user/repos + */ + reposListForAuthenticatedUser: (query: ReposListForAuthenticatedUserParams, params: RequestParams = {}) => + this.request({ + path: \`/user/repos\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description When authenticating as a user, this endpoint will list all currently open repository invitations for that user. + * + * @tags repos + * @name ReposListInvitationsForAuthenticatedUser + * @summary List repository invitations for the authenticated user + * @request GET:/user/repository_invitations + */ + reposListInvitationsForAuthenticatedUser: ( + query: ReposListInvitationsForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/repository_invitations\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires \`user\`, \`repo\`, or \`read:org\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/) when authenticating via [OAuth](https://docs.github.com/apps/building-oauth-apps/). + * + * @tags teams + * @name TeamsListForAuthenticatedUser + * @summary List teams for the authenticated user + * @request GET:/user/teams + */ + teamsListForAuthenticatedUser: (query: TeamsListForAuthenticatedUserParams, params: RequestParams = {}) => + this.request({ + path: \`/user/teams\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description This endpoint is accessible with the \`user\` scope. + * + * @tags users + * @name UsersAddEmailForAuthenticated + * @summary Add an email address for the authenticated user + * @request POST:/user/emails + */ + usersAddEmailForAuthenticated: (data: UsersAddEmailForAuthenticatedPayload, params: RequestParams = {}) => + this.request({ + path: \`/user/emails\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags users + * @name UsersBlock + * @summary Block a user + * @request PUT:/user/blocks/{username} + */ + usersBlock: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/blocks/\${username}\`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @tags users + * @name UsersCheckBlocked + * @summary Check if a user is blocked by the authenticated user + * @request GET:/user/blocks/{username} + */ + usersCheckBlocked: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/blocks/\${username}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags users + * @name UsersCheckPersonIsFollowedByAuthenticated + * @summary Check if a person is followed by the authenticated user + * @request GET:/user/following/{username} + */ + usersCheckPersonIsFollowedByAuthenticated: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/following/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description Adds a GPG key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least \`write:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags users + * @name UsersCreateGpgKeyForAuthenticated + * @summary Create a GPG key for the authenticated user + * @request POST:/user/gpg_keys + */ + usersCreateGpgKeyForAuthenticated: (data: UsersCreateGpgKeyForAuthenticatedPayload, params: RequestParams = {}) => + this.request({ + path: \`/user/gpg_keys\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Adds a public SSH key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least \`write:public_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags users + * @name UsersCreatePublicSshKeyForAuthenticated + * @summary Create a public SSH key for the authenticated user + * @request POST:/user/keys + */ + usersCreatePublicSshKeyForAuthenticated: ( + data: UsersCreatePublicSshKeyForAuthenticatedPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/keys\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description This endpoint is accessible with the \`user\` scope. + * + * @tags users + * @name UsersDeleteEmailForAuthenticated + * @summary Delete an email address for the authenticated user + * @request DELETE:/user/emails + */ + usersDeleteEmailForAuthenticated: (data: UsersDeleteEmailForAuthenticatedPayload, params: RequestParams = {}) => + this.request({ + path: \`/user/emails\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Removes a GPG key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least \`admin:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags users + * @name UsersDeleteGpgKeyForAuthenticated + * @summary Delete a GPG key for the authenticated user + * @request DELETE:/user/gpg_keys/{gpg_key_id} + */ + usersDeleteGpgKeyForAuthenticated: (gpgKeyId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/gpg_keys/\${gpgKeyId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Removes a public SSH key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least \`admin:public_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags users + * @name UsersDeletePublicSshKeyForAuthenticated + * @summary Delete a public SSH key for the authenticated user + * @request DELETE:/user/keys/{key_id} + */ + usersDeletePublicSshKeyForAuthenticated: (keyId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/keys/\${keyId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the \`user:follow\` scope. + * + * @tags users + * @name UsersFollow + * @summary Follow a user + * @request PUT:/user/following/{username} + */ + usersFollow: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/following/\${username}\`, + method: "PUT", + ...params, + }), + + /** + * @description If the authenticated user is authenticated through basic authentication or OAuth with the \`user\` scope, then the response lists public and private profile information. If the authenticated user is authenticated through OAuth without the \`user\` scope, then the response lists only public profile information. + * + * @tags users + * @name UsersGetAuthenticated + * @summary Get the authenticated user + * @request GET:/user + */ + usersGetAuthenticated: (params: RequestParams = {}) => + this.request({ + path: \`/user\`, + method: "GET", + ...params, + }), + + /** + * @description View extended details for a single GPG key. Requires that you are authenticated via Basic Auth or via OAuth with at least \`read:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags users + * @name UsersGetGpgKeyForAuthenticated + * @summary Get a GPG key for the authenticated user + * @request GET:/user/gpg_keys/{gpg_key_id} + */ + usersGetGpgKeyForAuthenticated: (gpgKeyId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/gpg_keys/\${gpgKeyId}\`, + method: "GET", + ...params, + }), + + /** + * @description View extended details for a single public SSH key. Requires that you are authenticated via Basic Auth or via OAuth with at least \`read:public_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags users + * @name UsersGetPublicSshKeyForAuthenticated + * @summary Get a public SSH key for the authenticated user + * @request GET:/user/keys/{key_id} + */ + usersGetPublicSshKeyForAuthenticated: (keyId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/keys/\${keyId}\`, + method: "GET", + ...params, + }), + + /** + * @description List the users you've blocked on your personal account. + * + * @tags users + * @name UsersListBlockedByAuthenticated + * @summary List users blocked by the authenticated user + * @request GET:/user/blocks + */ + usersListBlockedByAuthenticated: (params: RequestParams = {}) => + this.request< + UsersListBlockedByAuthenticatedData, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/user/blocks\`, + method: "GET", + ...params, + }), + + /** + * @description Lists all of your email addresses, and specifies which one is visible to the public. This endpoint is accessible with the \`user:email\` scope. + * + * @tags users + * @name UsersListEmailsForAuthenticated + * @summary List email addresses for the authenticated user + * @request GET:/user/emails + */ + usersListEmailsForAuthenticated: (query: UsersListEmailsForAuthenticatedParams, params: RequestParams = {}) => + this.request({ + path: \`/user/emails\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the people who the authenticated user follows. + * + * @tags users + * @name UsersListFollowedByAuthenticated + * @summary List the people the authenticated user follows + * @request GET:/user/following + */ + usersListFollowedByAuthenticated: (query: UsersListFollowedByAuthenticatedParams, params: RequestParams = {}) => + this.request({ + path: \`/user/following\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the people following the authenticated user. + * + * @tags users + * @name UsersListFollowersForAuthenticatedUser + * @summary List followers of the authenticated user + * @request GET:/user/followers + */ + usersListFollowersForAuthenticatedUser: ( + query: UsersListFollowersForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/followers\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the current user's GPG keys. Requires that you are authenticated via Basic Auth or via OAuth with at least \`read:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags users + * @name UsersListGpgKeysForAuthenticated + * @summary List GPG keys for the authenticated user + * @request GET:/user/gpg_keys + */ + usersListGpgKeysForAuthenticated: (query: UsersListGpgKeysForAuthenticatedParams, params: RequestParams = {}) => + this.request({ + path: \`/user/gpg_keys\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists your publicly visible email address, which you can set with the [Set primary email visibility for the authenticated user](https://docs.github.com/rest/reference/users#set-primary-email-visibility-for-the-authenticated-user) endpoint. This endpoint is accessible with the \`user:email\` scope. + * + * @tags users + * @name UsersListPublicEmailsForAuthenticated + * @summary List public email addresses for the authenticated user + * @request GET:/user/public_emails + */ + usersListPublicEmailsForAuthenticated: ( + query: UsersListPublicEmailsForAuthenticatedParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/public_emails\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the public SSH keys for the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least \`read:public_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags users + * @name UsersListPublicSshKeysForAuthenticated + * @summary List public SSH keys for the authenticated user + * @request GET:/user/keys + */ + usersListPublicSshKeysForAuthenticated: ( + query: UsersListPublicSshKeysForAuthenticatedParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/keys\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Sets the visibility for your primary email addresses. + * + * @tags users + * @name UsersSetPrimaryEmailVisibilityForAuthenticated + * @summary Set primary email visibility for the authenticated user + * @request PATCH:/user/email/visibility + */ + usersSetPrimaryEmailVisibilityForAuthenticated: ( + data: UsersSetPrimaryEmailVisibilityForAuthenticatedPayload, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/email/visibility\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags users + * @name UsersUnblock + * @summary Unblock a user + * @request DELETE:/user/blocks/{username} + */ + usersUnblock: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/blocks/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the \`user:follow\` scope. + * + * @tags users + * @name UsersUnfollow + * @summary Unfollow a user + * @request DELETE:/user/following/{username} + */ + usersUnfollow: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/following/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note:** If your email is set to private and you send an \`email\` parameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API. + * + * @tags users + * @name UsersUpdateAuthenticated + * @summary Update the authenticated user + * @request PATCH:/user + */ + usersUpdateAuthenticated: (data: UsersUpdateAuthenticatedPayload, params: RequestParams = {}) => + this.request({ + path: \`/user\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; + users = { + /** + * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. + * + * @tags activity + * @name ActivityListEventsForAuthenticatedUser + * @summary List events for the authenticated user + * @request GET:/users/{username}/events + */ + activityListEventsForAuthenticatedUser: ( + { username, ...query }: ActivityListEventsForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/events\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description This is the user's organization dashboard. You must be authenticated as the user to view this. + * + * @tags activity + * @name ActivityListOrgEventsForAuthenticatedUser + * @summary List organization events for the authenticated user + * @request GET:/users/{username}/events/orgs/{org} + */ + activityListOrgEventsForAuthenticatedUser: ( + { username, org, ...query }: ActivityListOrgEventsForAuthenticatedUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/events/orgs/\${org}\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityListPublicEventsForUser + * @summary List public events for a user + * @request GET:/users/{username}/events/public + */ + activityListPublicEventsForUser: ( + { username, ...query }: ActivityListPublicEventsForUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/events/public\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description These are events that you've received by watching repos and following users. If you are authenticated as the given user, you will see private events. Otherwise, you'll only see public events. + * + * @tags activity + * @name ActivityListReceivedEventsForUser + * @summary List events received by the authenticated user + * @request GET:/users/{username}/received_events + */ + activityListReceivedEventsForUser: ( + { username, ...query }: ActivityListReceivedEventsForUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/received_events\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityListReceivedPublicEventsForUser + * @summary List public events received by a user + * @request GET:/users/{username}/received_events/public + */ + activityListReceivedPublicEventsForUser: ( + { username, ...query }: ActivityListReceivedPublicEventsForUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/received_events/public\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists repositories a user has starred. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: + * + * @tags activity + * @name ActivityListReposStarredByUser + * @summary List repositories starred by a user + * @request GET:/users/{username}/starred + */ + activityListReposStarredByUser: ( + { username, ...query }: ActivityListReposStarredByUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/starred\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists repositories a user is watching. + * + * @tags activity + * @name ActivityListReposWatchedByUser + * @summary List repositories watched by a user + * @request GET:/users/{username}/subscriptions + */ + activityListReposWatchedByUser: ( + { username, ...query }: ActivityListReposWatchedByUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/subscriptions\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Enables an authenticated GitHub App to find the user’s installation information. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsGetUserInstallation + * @summary Get a user installation for the authenticated app + * @request GET:/users/{username}/installation + */ + appsGetUserInstallation: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/installation\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Access tokens must have the \`user\` scope. + * + * @tags billing + * @name BillingGetGithubActionsBillingUser + * @summary Get GitHub Actions billing for a user + * @request GET:/users/{username}/settings/billing/actions + */ + billingGetGithubActionsBillingUser: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/settings/billing/actions\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the free and paid storage used for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`user\` scope. + * + * @tags billing + * @name BillingGetGithubPackagesBillingUser + * @summary Get GitHub Packages billing for a user + * @request GET:/users/{username}/settings/billing/packages + */ + billingGetGithubPackagesBillingUser: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/settings/billing/packages\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`user\` scope. + * + * @tags billing + * @name BillingGetSharedStorageBillingUser + * @summary Get shared storage billing for a user + * @request GET:/users/{username}/settings/billing/shared-storage + */ + billingGetSharedStorageBillingUser: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/settings/billing/shared-storage\`, + method: "GET", + ...params, + }), + + /** + * @description Lists public gists for the specified user: + * + * @tags gists + * @name GistsListForUser + * @summary List gists for a user + * @request GET:/users/{username}/gists + */ + gistsListForUser: ({ username, ...query }: GistsListForUserParams, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/gists\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description List [public organization memberships](https://help.github.com/articles/publicizing-or-concealing-organization-membership) for the specified user. This method only lists _public_ memberships, regardless of authentication. If you need to fetch all of the organization memberships (public and private) for the authenticated user, use the [List organizations for the authenticated user](https://docs.github.com/rest/reference/orgs#list-organizations-for-the-authenticated-user) API instead. + * + * @tags orgs + * @name OrgsListForUser + * @summary List organizations for a user + * @request GET:/users/{username}/orgs + */ + orgsListForUser: ({ username, ...query }: OrgsListForUserParams, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/orgs\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsListForUser + * @summary List user projects + * @request GET:/users/{username}/projects + */ + projectsListForUser: ({ username, ...query }: ProjectsListForUserParams, params: RequestParams = {}) => + this.request< + ProjectsListForUserData, + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/users/\${username}/projects\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists public repositories for the specified user. + * + * @tags repos + * @name ReposListForUser + * @summary List repositories for a user + * @request GET:/users/{username}/repos + */ + reposListForUser: ({ username, ...query }: ReposListForUserParams, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/repos\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags users + * @name UsersCheckFollowingForUser + * @summary Check if a user follows another user + * @request GET:/users/{username}/following/{target_user} + */ + usersCheckFollowingForUser: (username: string, targetUser: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/following/\${targetUser}\`, + method: "GET", + ...params, + }), + + /** + * @description Provides publicly available information about someone with a GitHub account. GitHub Apps with the \`Plan\` user permission can use this endpoint to retrieve information about a user's GitHub plan. The GitHub App must be authenticated as a user. See "[Identifying and authorizing users for GitHub Apps](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/)" for details about authentication. For an example response, see 'Response with GitHub plan information' below" The \`email\` key in the following response is the publicly visible email address from your GitHub [profile page](https://github.com/settings/profile). When setting up your profile, you can select a primary email address to be “public” which provides an email entry for this endpoint. If you do not set a public email address for \`email\`, then it will have a value of \`null\`. You only see publicly visible email addresses when authenticated with GitHub. For more information, see [Authentication](https://docs.github.com/rest/overview/resources-in-the-rest-api#authentication). The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see "[Emails API](https://docs.github.com/rest/reference/users#emails)". + * + * @tags users + * @name UsersGetByUsername + * @summary Get a user + * @request GET:/users/{username} + */ + usersGetByUsername: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description Provides hovercard information when authenticated through basic auth or OAuth with the \`repo\` scope. You can find out more about someone in relation to their pull requests, issues, repositories, and organizations. The \`subject_type\` and \`subject_id\` parameters provide context for the person's hovercard, which returns more information than without the parameters. For example, if you wanted to find out more about \`octocat\` who owns the \`Spoon-Knife\` repository via cURL, it would look like this: \`\`\`shell curl -u username:token https://api.github.com/users/octocat/hovercard?subject_type=repository&subject_id=1300192 \`\`\` + * + * @tags users + * @name UsersGetContextForUser + * @summary Get contextual information for a user + * @request GET:/users/{username}/hovercard + */ + usersGetContextForUser: ({ username, ...query }: UsersGetContextForUserParams, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/hovercard\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts. Note: Pagination is powered exclusively by the \`since\` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of users. + * + * @tags users + * @name UsersList + * @summary List users + * @request GET:/users + */ + usersList: (query: UsersListParams, params: RequestParams = {}) => + this.request({ + path: \`/users\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the people following the specified user. + * + * @tags users + * @name UsersListFollowersForUser + * @summary List followers of a user + * @request GET:/users/{username}/followers + */ + usersListFollowersForUser: ({ username, ...query }: UsersListFollowersForUserParams, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/followers\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the people who the specified user follows. + * + * @tags users + * @name UsersListFollowingForUser + * @summary List the people a user follows + * @request GET:/users/{username}/following + */ + usersListFollowingForUser: ({ username, ...query }: UsersListFollowingForUserParams, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/following\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the GPG keys for a user. This information is accessible by anyone. + * + * @tags users + * @name UsersListGpgKeysForUser + * @summary List GPG keys for a user + * @request GET:/users/{username}/gpg_keys + */ + usersListGpgKeysForUser: ({ username, ...query }: UsersListGpgKeysForUserParams, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/gpg_keys\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description Lists the _verified_ public SSH keys for a user. This is accessible by anyone. + * + * @tags users + * @name UsersListPublicKeysForUser + * @summary List public keys for a user + * @request GET:/users/{username}/keys + */ + usersListPublicKeysForUser: ( + { username, ...query }: UsersListPublicKeysForUserParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/keys\`, + method: "GET", + query: query, + ...params, + }), + }; + zen = { + /** + * @description Get a random sentence from the Zen of GitHub + * + * @tags meta + * @name MetaGetZen + * @summary Get the Zen of GitHub + * @request GET:/zen + */ + metaGetZen: (params: RequestParams = {}) => + this.request({ + path: \`/zen\`, + method: "GET", + ...params, + }), + }; +} +" +`; + +exports[`extended > 'furkot-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Step { + /** address of the stop */ + address?: string; + /** + * arrival at the stop in its local timezone as YYYY-MM-DDThh:mm + * @format date-time + */ + arrival?: string; + /** geographical coordinates of the stop */ + coordinates?: { + /** + * latitude + * @format float + */ + lat?: number; + /** + * longitude + * @format float + */ + lon?: number; + }; + /** + * departure from the stop in its local timezone as YYYY-MM-DDThh:mm + * @format date-time + */ + departure?: string; + /** name of the stop */ + name?: string; + /** + * number of nights + * @format int64 + */ + nights?: number; + /** route leading to the stop */ + route?: { + /** + * route distance in meters + * @format int64 + */ + distance?: number; + /** + * route duration in seconds + * @format int64 + */ + duration?: number; + /** travel mode */ + mode?: StepModeEnum; + /** route path compatible with Google polyline encoding algorithm */ + polyline?: string; + }; + /** url of the page with more information about the stop */ + url?: string; +} + +/** travel mode */ +export enum StepModeEnum { + Car = "car", + Motorcycle = "motorcycle", + Bicycle = "bicycle", + Walk = "walk", + Other = "other", +} + +export type StopDetailData = Step[]; + +export interface Trip { + /** + * begin of the trip in its local timezone as YYYY-MM-DDThh:mm + * @format date-time + */ + begin?: string; + /** description of the trip (truncated to 200 characters) */ + description?: string; + /** + * end of the trip in its local timezone as YYYY-MM-DDThh:mm + * @format date-time + */ + end?: string; + /** Unique ID of the trip */ + id?: string; + /** name of the trip */ + name?: string; +} + +export type TripListData = Trip[]; + +export namespace Trip { + /** + * @description list stops for a trip identified by {trip_id} + * @name StopDetail + * @request GET:/trip/{trip_id}/stop + * @secure + */ + export namespace StopDetail { + export type RequestParams = { + /** id of the trip */ + tripId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = StopDetailData; + } + /** + * @description list user's trips + * @name TripList + * @request GET:/trip + * @secure + */ + export namespace TripList { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TripListData; + } +} + +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://trips.furkot.com/pub/api"; + 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.clone() 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 Furkot Trips + * @version 1.0.0 + * @baseUrl https://trips.furkot.com/pub/api + * @externalDocs https://help.furkot.com/widgets/furkot-api.html + * @contact + * + * Furkot provides Rest API to access user trip data. + * Using Furkot API an application can list user trips and display stops for a specific trip. + * Furkot API uses OAuth2 protocol to authorize applications to access data on behalf of users. + */ +export class Api extends HttpClient { + trip = { + /** + * @description list stops for a trip identified by {trip_id} + * + * @name StopDetail + * @request GET:/trip/{trip_id}/stop + * @secure + */ + stopDetail: (tripId: string, params: RequestParams = {}) => + this.request({ + path: \`/trip/\${tripId}/stop\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description list user's trips + * + * @name TripList + * @request GET:/trip + * @secure + */ + tripList: (params: RequestParams = {}) => + this.request({ + path: \`/trip\`, + method: "GET", + secure: true, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'giphy' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** Your request was formatted incorrectly or missing required parameters. */ +export type BadRequest = any; + +/** You weren't authorized to make your request; most likely this indicates an issue with your API Key. */ +export type Forbidden = any; + +export interface GetGifByIdData { + data?: Gif; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; +} + +export interface GetGifsByIdData { + data?: Gif[]; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ + pagination?: Pagination; +} + +export interface GetGifsByIdParams { + /** Filters results by specified GIF IDs, separated by commas. */ + ids?: string; +} + +export interface Gif { + /** + * The unique bit.ly URL for this GIF + * @example "http://gph.is/1gsWDcL" + */ + bitly_url?: string; + /** Currently unused */ + content_url?: string; + /** + * The date this GIF was added to the GIPHY database. + * @format date-time + * @example "2013-08-01 12:41:48" + */ + create_datetime?: string; + /** + * A URL used for embedding this GIF + * @example "http://giphy.com/embed/YsTs5ltWtEhnq" + */ + embded_url?: string; + /** An array of featured tags for this GIF (Note: Not available when using the Public Beta Key) */ + featured_tags?: string[]; + /** + * This GIF's unique ID + * @example "YsTs5ltWtEhnq" + */ + id?: string; + /** An object containing data for various available formats and sizes of this GIF. */ + images?: { + /** Data surrounding a version of this GIF downsized to be under 2mb. */ + downsized?: Image; + /** Data surrounding a version of this GIF downsized to be under 8mb. */ + downsized_large?: Image; + /** Data surrounding a version of this GIF downsized to be under 5mb. */ + downsized_medium?: Image; + /** Data surrounding a version of this GIF downsized to be under 200kb. */ + downsized_small?: Image; + /** Data surrounding a static preview image of the downsized version of this GIF. */ + downsized_still?: Image; + /** Data surrounding versions of this GIF with a fixed height of 200 pixels. Good for mobile use. */ + fixed_height?: Image; + /** Data surrounding versions of this GIF with a fixed height of 200 pixels and the number of frames reduced to 6. */ + fixed_height_downsampled?: Image; + /** Data surrounding versions of this GIF with a fixed height of 100 pixels. Good for mobile keyboards. */ + fixed_height_small?: Image; + /** Data surrounding a static image of this GIF with a fixed height of 100 pixels. */ + fixed_height_small_still?: Image; + /** Data surrounding a static image of this GIF with a fixed height of 200 pixels. */ + fixed_height_still?: Image; + /** Data surrounding versions of this GIF with a fixed width of 200 pixels. Good for mobile use. */ + fixed_width?: Image; + /** Data surrounding versions of this GIF with a fixed width of 200 pixels and the number of frames reduced to 6. */ + fixed_width_downsampled?: Image; + /** Data surrounding versions of this GIF with a fixed width of 100 pixels. Good for mobile keyboards. */ + fixed_width_small?: Image; + /** Data surrounding a static image of this GIF with a fixed width of 100 pixels. */ + fixed_width_small_still?: Image; + /** Data surrounding a static image of this GIF with a fixed width of 200 pixels. */ + fixed_width_still?: Image; + /** Data surrounding a version of this GIF set to loop for 15 seconds. */ + looping?: Image; + /** Data surrounding the original version of this GIF. Good for desktop use. */ + original?: Image; + /** Data surrounding a static preview image of the original GIF. */ + original_still?: Image; + /** Data surrounding a version of this GIF in .MP4 format limited to 50kb that displays the first 1-2 seconds of the GIF. */ + preview?: Image; + /** Data surrounding a version of this GIF limited to 50kb that displays the first 1-2 seconds of the GIF. */ + preview_gif?: Image; + }; + /** + * The creation or upload date from this GIF's source. + * @format date-time + * @example "2013-08-01 12:41:48" + */ + import_datetime?: string; + /** + * The MPAA-style rating for this content. Examples include Y, G, PG, PG-13 and R + * @example "g" + */ + rating?: string; + /** + * The unique slug used in this GIF's URL + * @example "confused-flying-YsTs5ltWtEhnq" + */ + slug?: string; + /** + * The page on which this GIF was found + * @example "http://www.reddit.com/r/reactiongifs/comments/1xpyaa/superman_goes_to_hollywood/" + */ + source?: string; + /** + * The URL of the webpage on which this GIF was found. + * @example "http://cheezburger.com/5282328320" + */ + source_post_url?: string; + /** + * The top level domain of the source URL. + * @example "cheezburger.com" + */ + source_tld?: string; + /** An array of tags for this GIF (Note: Not available when using the Public Beta Key) */ + tags?: string[]; + /** + * The date on which this gif was marked trending, if applicable. + * @format date-time + * @example "2013-08-01 12:41:48" + */ + trending_datetime?: string; + /** + * Type of the gif. By default, this is almost always gif + * @default "gif" + */ + type?: GifTypeEnum; + /** + * The date on which this GIF was last updated. + * @format date-time + * @example "2013-08-01 12:41:48" + */ + update_datetime?: string; + /** + * The unique URL for this GIF + * @example "http://giphy.com/gifs/confused-flying-YsTs5ltWtEhnq" + */ + url?: string; + /** The User Object contains information about the user associated with a GIF and URLs to assets such as that user's avatar image, profile, and more. */ + user?: User; + /** + * The username this GIF is attached to, if applicable + * @example "JoeCool4000" + */ + username?: string; +} + +/** + * Type of the gif. By default, this is almost always gif + * @default "gif" + */ +export enum GifTypeEnum { + Gif = "gif", +} + +export interface Image { + /** + * The URL for this GIF in .MP4 format. + * @example "https://media1.giphy.com/media/cZ7rmKfFYOvYI/giphy.mp4" + */ + mp4?: string; + /** + * The size in bytes of the .MP4 file corresponding to this GIF. + * @example "25123" + */ + mp4_size?: string; + /** + * The number of frames in this GIF. + * @example "15" + */ + frames?: string; + /** + * The height of this GIF in pixels. + * @example "200" + */ + height?: string; + /** + * The size of this GIF in bytes. + * @example "32381" + */ + size?: string; + /** + * The publicly-accessible direct URL for this GIF. + * @example "https://media1.giphy.com/media/cZ7rmKfFYOvYI/200.gif" + */ + url?: string; + /** + * The URL for this GIF in .webp format. + * @example "https://media1.giphy.com/media/cZ7rmKfFYOvYI/giphy.webp" + */ + webp?: string; + /** + * The size in bytes of the .webp file corresponding to this GIF. + * @example "12321" + */ + webp_size?: string; + /** + * The width of this GIF in pixels. + * @example "320" + */ + width?: string; +} + +/** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ +export interface Meta { + /** + * HTTP Response Message + * @example "OK" + */ + msg?: string; + /** + * A unique ID paired with this response from the API. + * @example "57eea03c72381f86e05c35d2" + */ + response_id?: string; + /** + * HTTP Response Code + * @format int32 + * @example 200 + */ + status?: number; +} + +/** The particular GIF you are requesting was not found. This occurs, for example, if you request a GIF by an id that does not exist. */ +export type NotFound = any; + +/** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ +export interface Pagination { + /** + * Total number of items returned. + * @format int32 + * @example 25 + */ + count?: number; + /** + * Position in pagination. + * @format int32 + * @example 75 + */ + offset?: number; + /** + * Total number of items available. + * @format int32 + * @example 250 + */ + total_count?: number; +} + +export interface RandomGifData { + data?: Gif; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; +} + +export interface RandomGifParams { + /** Filters results by specified rating. */ + rating?: string; + /** Filters results by specified tag. */ + tag?: string; +} + +export interface RandomStickerData { + data?: Gif; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; +} + +export interface RandomStickerParams { + /** Filters results by specified rating. */ + rating?: string; + /** Filters results by specified tag. */ + tag?: string; +} + +export interface SearchGifsData { + data?: Gif[]; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ + pagination?: Pagination; +} + +export interface SearchGifsParams { + /** Specify default language for regional content; use a 2-letter ISO 639-1 language code. */ + lang?: string; + /** + * The maximum number of records to return. + * @format int32 + * @default 25 + */ + limit?: number; + /** + * An optional results offset. + * @format int32 + * @default 0 + */ + offset?: number; + /** Search query term or prhase. */ + q: string; + /** Filters results by specified rating. */ + rating?: string; +} + +export interface SearchStickersData { + data?: Gif[]; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ + pagination?: Pagination; +} + +export interface SearchStickersParams { + /** Specify default language for regional content; use a 2-letter ISO 639-1 language code. */ + lang?: string; + /** + * The maximum number of records to return. + * @format int32 + * @default 25 + */ + limit?: number; + /** + * An optional results offset. + * @format int32 + * @default 0 + */ + offset?: number; + /** Search query term or prhase. */ + q: string; + /** Filters results by specified rating. */ + rating?: string; +} + +/** Your API Key is making too many requests. Read about [requesting a Production Key](https://developers.giphy.com/docs/#access) to upgrade your API Key rate limits. */ +export type TooManyRequests = any; + +export interface TranslateGifData { + data?: Gif; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; +} + +export interface TranslateGifParams { + /** Search term. */ + s: string; +} + +export interface TranslateStickerData { + data?: Gif; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; +} + +export interface TranslateStickerParams { + /** Search term. */ + s: string; +} + +export interface TrendingGifsData { + data?: Gif[]; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ + pagination?: Pagination; +} + +export interface TrendingGifsParams { + /** + * The maximum number of records to return. + * @format int32 + * @default 25 + */ + limit?: number; + /** + * An optional results offset. + * @format int32 + * @default 0 + */ + offset?: number; + /** Filters results by specified rating. */ + rating?: string; +} + +export interface TrendingStickersData { + data?: Gif[]; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ + pagination?: Pagination; +} + +export interface TrendingStickersParams { + /** + * The maximum number of records to return. + * @format int32 + * @default 25 + */ + limit?: number; + /** + * An optional results offset. + * @format int32 + * @default 0 + */ + offset?: number; + /** Filters results by specified rating. */ + rating?: string; +} + +/** The User Object contains information about the user associated with a GIF and URLs to assets such as that user's avatar image, profile, and more. */ +export interface User { + /** + * The URL for this user's avatar image. + * @example "https://media1.giphy.com/avatars/election2016/XwYrZi5H87o6.gif" + */ + avatar_url?: string; + /** + * The URL for the banner image that appears atop this user's profile page. + * @example "https://media4.giphy.com/avatars/cheezburger/XkuejOhoGLE6.jpg" + */ + banner_url?: string; + /** + * The display name associated with this user (contains formatting the base username might not). + * @example "JoeCool4000" + */ + display_name?: string; + /** + * The URL for this user's profile. + * @example "https://giphy.com/cheezburger/" + */ + profile_url?: string; + /** + * The Twitter username associated with this user, if applicable. + * @example "@joecool4000" + */ + twitter?: string; + /** + * The username associated with this user. + * @example "joecool4000" + */ + username?: string; +} + +export namespace Gifs { + /** + * @description Returns a GIF given that GIF's unique ID + * @tags gifs + * @name GetGifById + * @summary Get GIF by Id + * @request GET:/gifs/{gifId} + * @secure + */ + export namespace GetGifById { + export type RequestParams = { + /** + * Filters results by specified GIF ID. + * @format int32 + */ + gifId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetGifByIdData; + } + /** + * @description A multiget version of the get GIF by ID endpoint. + * @tags gifs + * @name GetGifsById + * @summary Get GIFs by ID + * @request GET:/gifs + * @secure + */ + export namespace GetGifsById { + export type RequestParams = {}; + export type RequestQuery = { + /** Filters results by specified GIF IDs, separated by commas. */ + ids?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetGifsByIdData; + } + /** + * @description Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. + * @tags gifs + * @name RandomGif + * @summary Random GIF + * @request GET:/gifs/random + * @secure + */ + export namespace RandomGif { + export type RequestParams = {}; + export type RequestQuery = { + /** Filters results by specified rating. */ + rating?: string; + /** Filters results by specified tag. */ + tag?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = RandomGifData; + } + /** + * @description Search all GIPHY GIFs for a word or phrase. Punctuation will be stripped and ignored. Use a plus or url encode for phrases. Example paul+rudd, ryan+gosling or american+psycho. + * @tags gifs + * @name SearchGifs + * @summary Search GIFs + * @request GET:/gifs/search + * @secure + */ + export namespace SearchGifs { + export type RequestParams = {}; + export type RequestQuery = { + /** Specify default language for regional content; use a 2-letter ISO 639-1 language code. */ + lang?: string; + /** + * The maximum number of records to return. + * @format int32 + * @default 25 + */ + limit?: number; + /** + * An optional results offset. + * @format int32 + * @default 0 + */ + offset?: number; + /** Search query term or prhase. */ + q: string; + /** Filters results by specified rating. */ + rating?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SearchGifsData; + } + /** + * @description The translate API draws on search, but uses the GIPHY \`special sauce\` to handle translating from one vocabulary to another. In this case, words and phrases to GIF + * @tags gifs + * @name TranslateGif + * @summary Translate phrase to GIF + * @request GET:/gifs/translate + * @secure + */ + export namespace TranslateGif { + export type RequestParams = {}; + export type RequestQuery = { + /** Search term. */ + s: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TranslateGifData; + } + /** + * @description Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the GIPHY homepage. Returns 25 results by default. + * @tags gifs + * @name TrendingGifs + * @summary Trending GIFs + * @request GET:/gifs/trending + * @secure + */ + export namespace TrendingGifs { + export type RequestParams = {}; + export type RequestQuery = { + /** + * The maximum number of records to return. + * @format int32 + * @default 25 + */ + limit?: number; + /** + * An optional results offset. + * @format int32 + * @default 0 + */ + offset?: number; + /** Filters results by specified rating. */ + rating?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TrendingGifsData; + } +} + +export namespace Stickers { + /** + * @description Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. + * @tags stickers + * @name RandomSticker + * @summary Random Sticker + * @request GET:/stickers/random + * @secure + */ + export namespace RandomSticker { + export type RequestParams = {}; + export type RequestQuery = { + /** Filters results by specified rating. */ + rating?: string; + /** Filters results by specified tag. */ + tag?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = RandomStickerData; + } + /** + * @description Replicates the functionality and requirements of the classic GIPHY search, but returns animated stickers rather than GIFs. + * @tags stickers + * @name SearchStickers + * @summary Search Stickers + * @request GET:/stickers/search + * @secure + */ + export namespace SearchStickers { + export type RequestParams = {}; + export type RequestQuery = { + /** Specify default language for regional content; use a 2-letter ISO 639-1 language code. */ + lang?: string; + /** + * The maximum number of records to return. + * @format int32 + * @default 25 + */ + limit?: number; + /** + * An optional results offset. + * @format int32 + * @default 0 + */ + offset?: number; + /** Search query term or prhase. */ + q: string; + /** Filters results by specified rating. */ + rating?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = SearchStickersData; + } + /** + * @description The translate API draws on search, but uses the GIPHY \`special sauce\` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. + * @tags stickers + * @name TranslateSticker + * @summary Translate phrase to Sticker + * @request GET:/stickers/translate + * @secure + */ + export namespace TranslateSticker { + export type RequestParams = {}; + export type RequestQuery = { + /** Search term. */ + s: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TranslateStickerData; + } + /** + * @description Fetch Stickers currently trending online. Hand curated by the GIPHY editorial team. Returns 25 results by default. + * @tags stickers + * @name TrendingStickers + * @summary Trending Stickers + * @request GET:/stickers/trending + * @secure + */ + export namespace TrendingStickers { + export type RequestParams = {}; + export type RequestQuery = { + /** + * The maximum number of records to return. + * @format int32 + * @default 25 + */ + limit?: number; + /** + * An optional results offset. + * @format int32 + * @default 0 + */ + offset?: number; + /** Filters results by specified rating. */ + rating?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TrendingStickersData; + } +} + +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://api.giphy.com/v1"; + 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.clone() 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 Giphy + * @version 1.0 + * @termsOfService https://developers.giphy.com/ + * @baseUrl https://api.giphy.com/v1 + * @externalDocs https://developers.giphy.com/docs/ + * @contact + * + * Giphy API + */ +export class Api extends HttpClient { + gifs = { + /** + * @description Returns a GIF given that GIF's unique ID + * + * @tags gifs + * @name GetGifById + * @summary Get GIF by Id + * @request GET:/gifs/{gifId} + * @secure + */ + getGifById: (gifId: number, params: RequestParams = {}) => + this.request({ + path: \`/gifs/\${gifId}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description A multiget version of the get GIF by ID endpoint. + * + * @tags gifs + * @name GetGifsById + * @summary Get GIFs by ID + * @request GET:/gifs + * @secure + */ + getGifsById: (query: GetGifsByIdParams, params: RequestParams = {}) => + this.request({ + path: \`/gifs\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. + * + * @tags gifs + * @name RandomGif + * @summary Random GIF + * @request GET:/gifs/random + * @secure + */ + randomGif: (query: RandomGifParams, params: RequestParams = {}) => + this.request({ + path: \`/gifs/random\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Search all GIPHY GIFs for a word or phrase. Punctuation will be stripped and ignored. Use a plus or url encode for phrases. Example paul+rudd, ryan+gosling or american+psycho. + * + * @tags gifs + * @name SearchGifs + * @summary Search GIFs + * @request GET:/gifs/search + * @secure + */ + searchGifs: (query: SearchGifsParams, params: RequestParams = {}) => + this.request({ + path: \`/gifs/search\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description The translate API draws on search, but uses the GIPHY \`special sauce\` to handle translating from one vocabulary to another. In this case, words and phrases to GIF + * + * @tags gifs + * @name TranslateGif + * @summary Translate phrase to GIF + * @request GET:/gifs/translate + * @secure + */ + translateGif: (query: TranslateGifParams, params: RequestParams = {}) => + this.request({ + path: \`/gifs/translate\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the GIPHY homepage. Returns 25 results by default. + * + * @tags gifs + * @name TrendingGifs + * @summary Trending GIFs + * @request GET:/gifs/trending + * @secure + */ + trendingGifs: (query: TrendingGifsParams, params: RequestParams = {}) => + this.request({ + path: \`/gifs/trending\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + }; + stickers = { + /** + * @description Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. + * + * @tags stickers + * @name RandomSticker + * @summary Random Sticker + * @request GET:/stickers/random + * @secure + */ + randomSticker: (query: RandomStickerParams, params: RequestParams = {}) => + this.request({ + path: \`/stickers/random\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Replicates the functionality and requirements of the classic GIPHY search, but returns animated stickers rather than GIFs. + * + * @tags stickers + * @name SearchStickers + * @summary Search Stickers + * @request GET:/stickers/search + * @secure + */ + searchStickers: (query: SearchStickersParams, params: RequestParams = {}) => + this.request({ + path: \`/stickers/search\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description The translate API draws on search, but uses the GIPHY \`special sauce\` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. + * + * @tags stickers + * @name TranslateSticker + * @summary Translate phrase to Sticker + * @request GET:/stickers/translate + * @secure + */ + translateSticker: (query: TranslateStickerParams, params: RequestParams = {}) => + this.request({ + path: \`/stickers/translate\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Fetch Stickers currently trending online. Hand curated by the GIPHY editorial team. Returns 25 results by default. + * + * @tags stickers + * @name TrendingStickers + * @summary Trending Stickers + * @request GET:/stickers/trending + * @secure + */ + trendingStickers: (query: TrendingStickersParams, params: RequestParams = {}) => + this.request({ + path: \`/stickers/trending\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'link-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type GetPullRequestsByIdData = Pullrequest; + +export type GetPullRequestsByRepositoryData = Pullrequest[]; + +export interface GetPullRequestsByRepositoryParams { + slug: string; + state?: StateEnum; + username: string; +} + +export enum GetPullRequestsByRepositoryParams1StateEnum { + Open = "open", + Merged = "merged", + Declined = "declined", +} + +export type GetRepositoriesByOwnerData = Repository[]; + +export type GetRepositoryData = Repository; + +export type GetUserByNameData = User; + +export type MergePullRequestData = any; + +export interface Pullrequest { + author?: User; + id?: number; + repository?: Repository; + title?: string; +} + +export interface Repository { + owner?: User; + slug?: string; +} + +export enum StateEnum { + Open = "open", + Merged = "merged", + Declined = "declined", +} + +export interface User { + username?: string; + uuid?: string; +} + +export namespace V20 { + /** + * No description + * @name GetPullRequestsById + * @request GET:/2.0/repositories/{username}/{slug}/pullrequests/{pid} + */ + export namespace GetPullRequestsById { + export type RequestParams = { + pid: string; + slug: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetPullRequestsByIdData; + } + /** + * No description + * @name GetPullRequestsByRepository + * @request GET:/2.0/repositories/{username}/{slug}/pullrequests + */ + export namespace GetPullRequestsByRepository { + export type RequestParams = { + slug: string; + username: string; + }; + export type RequestQuery = { + state?: GetPullRequestsByRepositoryParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetPullRequestsByRepositoryData; + } + /** + * No description + * @name GetRepositoriesByOwner + * @request GET:/2.0/repositories/{username} + */ + export namespace GetRepositoriesByOwner { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetRepositoriesByOwnerData; + } + /** + * No description + * @name GetRepository + * @request GET:/2.0/repositories/{username}/{slug} + */ + export namespace GetRepository { + export type RequestParams = { + slug: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetRepositoryData; + } + /** + * No description + * @name GetUserByName + * @request GET:/2.0/users/{username} + */ + export namespace GetUserByName { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetUserByNameData; + } + /** + * No description + * @name MergePullRequest + * @request POST:/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge + */ + export namespace MergePullRequest { + export type RequestParams = { + pid: string; + slug: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MergePullRequestData; + } +} + +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.clone() 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 Link Example + * @version 1.0.0 + */ +export class Api extends HttpClient { + v20 = { + /** + * No description + * + * @name GetPullRequestsById + * @request GET:/2.0/repositories/{username}/{slug}/pullrequests/{pid} + */ + getPullRequestsById: (username: string, slug: string, pid: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests/\${pid}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name GetPullRequestsByRepository + * @request GET:/2.0/repositories/{username}/{slug}/pullrequests + */ + getPullRequestsByRepository: ( + { username, slug, ...query }: GetPullRequestsByRepositoryParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @name GetRepositoriesByOwner + * @request GET:/2.0/repositories/{username} + */ + getRepositoriesByOwner: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name GetRepository + * @request GET:/2.0/repositories/{username}/{slug} + */ + getRepository: (username: string, slug: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name GetUserByName + * @request GET:/2.0/users/{username} + */ + getUserByName: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/users/\${username}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name MergePullRequest + * @request POST:/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge + */ + mergePullRequest: (username: string, slug: string, pid: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests/\${pid}/merge\`, + method: "POST", + ...params, + }), + }; +} +" +`; + +exports[`extended > 'no-definitions-schema' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface BasicErrorModel { + /** + * @min 100 + * @max 600 + */ + code: number; + field?: string | null; + message: string; +} + +export type ExtendedErrorModel = BasicErrorModel & { + rootCause: string; +}; + +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.clone() 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 Empty schema example + * @version 1.0.0 + */ +export class Api extends HttpClient {} +" +`; + +exports[`extended > 'oneof-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Cat { + age?: number; + hunts?: boolean; +} + +export interface Dog { + bark?: boolean; + breed?: DogBreedEnum; +} + +export enum DogBreedEnum { + Dingo = "Dingo", + Husky = "Husky", + Retriever = "Retriever", + Shepherd = "Shepherd", +} + +export type PetsPartialUpdateData = any; + +export type PetsPartialUpdatePayload = Cat | Dog; + +export namespace Pets { + /** + * No description + * @name PetsPartialUpdate + * @request PATCH:/pets + */ + export namespace PetsPartialUpdate { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = PetsPartialUpdatePayload; + export type RequestHeaders = {}; + export type ResponseBody = PetsPartialUpdateData; + } +} + +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.clone() 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 Oneof Example + * @version 1.0.0 + */ +export class Api extends HttpClient { + pets = { + /** + * No description + * + * @name PetsPartialUpdate + * @request PATCH:/pets + */ + petsPartialUpdate: (data: PetsPartialUpdatePayload, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'path-args' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type ListPetsData = object; + +export interface ListPetsParams { + /** + * How many items to return at one time (max 100) + * @format int32 + */ + param1?: number; + /** + * How many items to return at one time (max 100) + * @format int32 + */ + param2?: number; + /** + * How many items to return at one time (max 100) + * @format int32 + */ + param3: number; + /** + * How many items to return at one time (max 100) + * @format int32 + */ + queryParam?: number; +} + +export namespace Pets { + /** + * No description + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/pets/{param1}/{param2}/{param3} + */ + export namespace ListPets { + export type RequestParams = { + /** + * How many items to return at one time (max 100) + * @format int32 + */ + param1?: number; + /** + * How many items to return at one time (max 100) + * @format int32 + */ + param2?: number; + /** + * How many items to return at one time (max 100) + * @format int32 + */ + param3: number; + }; + export type RequestQuery = { + /** + * How many items to return at one time (max 100) + * @format int32 + */ + queryParam?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ListPetsData; + } +} + +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 = "http://unknown.io/v666"; + 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.clone() 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 Path Args + * @version 1.0.0 + * @license MIT + * @baseUrl http://unknown.io/v666 + */ +export class Api extends HttpClient { + pets = { + /** + * No description + * + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/pets/{param1}/{param2}/{param3} + */ + listPets: ({ param1, param2, param3, ...query }: ListPetsParams, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${param1}/\${param2}/\${param3}\`, + method: "GET", + query: query, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'personal-api-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type AddJobData = string; + +export type AddProjectsData = string; + +export type AuthUserType = OmitIdUserType; + +export type DeleteJobData = any; + +export type DeleteProjectData = any; + +export type ExtractedProjectType = OmitProjectTypeJob & { + /** Information about job */ + job: JobType; +}; + +/** Information about job */ +export interface FooBar { + kind?: JobKind; +} + +/** Information about job */ +export interface FooBarBaz { + id?: string; + kind?: JobKind; + link?: string; + name?: string; + [key: string]: any; +} + +/** Information about job */ +export interface FooBaz { + link?: string; + name?: string; +} + +export type GetJobData = JobType; + +export type GetJobsData = JobType[]; + +export type GetProjectsData = ExtractedProjectType[]; + +/** + * FooBar + * @format int32 + */ +export enum IntEnumWithNames { + Unknown = 0, + String = 1, + Int32 = 2, + Int64 = 3, + Double = 4, + DateTime = 5, + Test2 = 6, + Test23 = 7, + Tess44 = 8, + BooFar = 9, +} + +export enum JobKind { + COMPANY = "COMPANY", + PERSONAL = "PERSONAL", + FREELANCE = "FREELANCE", + OPEN_SOURCE = "OPEN_SOURCE", +} + +/** Information about job */ +export interface JobType { + /** web site address */ + address?: string; + /** + * Exist only in open source jobs + * Format: \`\${username}/\${projectName}\` + */ + github?: string; + id: string; + /** + * Exist only in open source jobs + * Means project is dev. tool (like swagger code generator) + */ + isTool?: boolean; + kind: JobKind; + link?: string; + name?: string; + /** + * Exist only in open source jobs + * Format: \`\${orgname}/\${projectName}\` + */ + npm?: string; +} + +export type JobUpdateType = OmitIdJobType; + +export type LoginData = string; + +export interface NullableEnum { + /** @format int64 */ + id?: number; + legalCategory?: NullableEnumLegalCategoryEnum; +} + +export enum NullableEnumLegalCategoryEnum { + SARL = "SARL", + ASSOCIATION = "ASSOCIATION", +} + +export type OmitIdJobType = OmitJobTypeIdOrId; + +export type OmitIdProjectType = OmitProjectTypeIdOrId; + +export type OmitIdUserType = OmitUserTypeIdOrId; + +export type OmitJobTypeIdOrId = PickJobTypeExcludeKeysIdOrId; + +export type OmitProjectTypeIdOrId = PickProjectTypeExcludeKeysIdOrId; + +export type OmitProjectTypeJob = PickProjectTypeExcludeKeysJob; + +export type OmitUserTypeIdOrId = PickUserTypeExcludeKeysIdOrId; + +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickJobTypeExcludeKeysIdOrId { + /** web site address */ + address?: string; + /** + * Exist only in open source jobs + * Format: \`\${username}/\${projectName}\` + */ + github?: string; + /** + * Exist only in open source jobs + * Means project is dev. tool (like swagger code generator) + */ + isTool?: boolean; + kind: JobKind; + link?: string; + name?: string; + /** + * Exist only in open source jobs + * Format: \`\${orgname}/\${projectName}\` + */ + npm?: string; +} + +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickProjectTypeExcludeKeysIdOrId { + description: string; + job: string; + name?: string; + notImportant?: boolean; + prefix?: string; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickProjectTypeExcludeKeysJob { + description: string; + id: string; + name?: string; + notImportant?: boolean; + prefix?: string; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickUserTypeExcludeKeysIdOrId { + password: string; + username: string; +} + +export interface ProjectType { + description: string; + id: string; + job: string; + name?: string; + notImportant?: boolean; + prefix?: string; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +export type ProjectUpdateType = OmitIdProjectType; + +export type RefreshData = string; + +export type TestAllOfDc = (FooBarBaz & FooBar) & { + prop?: string; +}; + +export type TestAllOfDc2 = FooBarBaz & { + prop?: string; +}; + +export type TestAnyOfDc = (FooBarBaz | FooBar) & { + prop?: string; +}; + +export type TestOneOfDc = (FooBarBaz | FooBar) & { + prop?: string; +}; + +export type UpdateJobData = JobType; + +export type UpdateProjectData = ProjectType; + +export namespace Auth { + /** + * No description + * @tags Auth + * @name Login + * @request POST:/auth + */ + export namespace Login { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = AuthUserType; + export type RequestHeaders = {}; + export type ResponseBody = LoginData; + } + /** + * No description + * @tags Auth + * @name Refresh + * @request POST:/auth/refresh + * @secure + */ + export namespace Refresh { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = { + Authorization: string; + }; + export type ResponseBody = RefreshData; + } +} + +export namespace Jobs { + /** + * No description + * @tags Jobs + * @name AddJob + * @request POST:/jobs + * @secure + */ + export namespace AddJob { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = JobUpdateType; + export type RequestHeaders = {}; + export type ResponseBody = AddJobData; + } + /** + * No description + * @tags Jobs + * @name DeleteJob + * @request DELETE:/jobs/{id} + * @secure + */ + export namespace DeleteJob { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DeleteJobData; + } + /** + * No description + * @tags Jobs + * @name GetJob + * @request GET:/jobs/{id} + * @secure + */ + export namespace GetJob { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetJobData; + } + /** + * No description + * @tags Jobs + * @name GetJobs + * @request GET:/jobs + * @secure + */ + export namespace GetJobs { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetJobsData; + } + /** + * No description + * @tags Jobs + * @name UpdateJob + * @request PATCH:/jobs/{id} + * @secure + */ + export namespace UpdateJob { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = JobUpdateType; + export type RequestHeaders = {}; + export type ResponseBody = UpdateJobData; + } +} + +export namespace Projects { + /** + * No description + * @tags Projects + * @name AddProjects + * @request POST:/projects + * @secure + */ + export namespace AddProjects { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = ProjectUpdateType; + export type RequestHeaders = {}; + export type ResponseBody = AddProjectsData; + } + /** + * No description + * @tags Projects + * @name DeleteProject + * @request DELETE:/projects/{id} + */ + export namespace DeleteProject { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DeleteProjectData; + } + /** + * No description + * @tags Projects + * @name GetProjects + * @request GET:/projects + */ + export namespace GetProjects { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetProjectsData; + } + /** + * No description + * @tags Projects + * @name UpdateProject + * @request PATCH:/projects/{id} + * @secure + */ + export namespace UpdateProject { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectUpdateType; + export type RequestHeaders = {}; + export type ResponseBody = UpdateProjectData; + } +} + +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 = "http://localhost:8080/api/v1"; + 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.clone() 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 http://localhost:8080/api/v1 + */ +export class Api extends HttpClient { + auth = { + /** + * No description + * + * @tags Auth + * @name Login + * @request POST:/auth + */ + login: (data: AuthUserType, params: RequestParams = {}) => + this.request({ + path: \`/auth\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Auth + * @name Refresh + * @request POST:/auth/refresh + * @secure + */ + refresh: (params: RequestParams = {}) => + this.request({ + path: \`/auth/refresh\`, + method: "POST", + secure: true, + ...params, + }), + }; + jobs = { + /** + * No description + * + * @tags Jobs + * @name AddJob + * @request POST:/jobs + * @secure + */ + addJob: (data: JobUpdateType, params: RequestParams = {}) => + this.request({ + path: \`/jobs\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Jobs + * @name DeleteJob + * @request DELETE:/jobs/{id} + * @secure + */ + deleteJob: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Jobs + * @name GetJob + * @request GET:/jobs/{id} + * @secure + */ + getJob: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Jobs + * @name GetJobs + * @request GET:/jobs + * @secure + */ + getJobs: (params: RequestParams = {}) => + this.request({ + path: \`/jobs\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Jobs + * @name UpdateJob + * @request PATCH:/jobs/{id} + * @secure + */ + updateJob: (id: string, params: JobUpdateType, requestParams: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, + method: "PATCH", + body: params, + secure: true, + type: ContentType.Json, + ...requestParams, + }), + }; + projects = { + /** + * No description + * + * @tags Projects + * @name AddProjects + * @request POST:/projects + * @secure + */ + addProjects: (data: ProjectUpdateType, params: RequestParams = {}) => + this.request({ + path: \`/projects\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Projects + * @name DeleteProject + * @request DELETE:/projects/{id} + */ + deleteProject: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${id}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags Projects + * @name GetProjects + * @request GET:/projects + */ + getProjects: (params: RequestParams = {}) => + this.request({ + path: \`/projects\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags Projects + * @name UpdateProject + * @request PATCH:/projects/{id} + * @secure + */ + updateProject: (id: string, data: ProjectUpdateType, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${id}\`, + method: "PATCH", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'petstore' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type CreatePetsData = any; + +export type CreatePetsError = Error; + +export interface Error { + /** @format int32 */ + code: number; + message: string; +} + +export type ListPetsData = Pets; + +export type ListPetsError = Error; + +export interface ListPetsParams { + /** + * How many items to return at one time (max 100) + * @format int32 + */ + limit?: number; +} + +export interface Pet { + /** @format int64 */ + id: number; + name: string; + tag?: string; +} + +export type Pets = Pet[]; + +export type ShowPetByIdData = Pet; + +export type ShowPetByIdError = Error; + +export type StringNullable = string | null; + +export namespace Pets { + /** + * No description + * @tags pets + * @name CreatePets + * @summary Create a pet + * @request POST:/pets + */ + export namespace CreatePets { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CreatePetsData; + } + /** + * No description + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/pets + */ + export namespace ListPets { + export type RequestParams = {}; + export type RequestQuery = { + /** + * How many items to return at one time (max 100) + * @format int32 + */ + limit?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ListPetsData; + } + /** + * No description + * @tags pets + * @name ShowPetById + * @summary Info for a specific pet + * @request GET:/pets/{petId} + */ + export namespace ShowPetById { + export type RequestParams = { + /** The id of the pet to retrieve */ + petId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ShowPetByIdData; + } +} + +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 = "http://petstore.swagger.io/v1"; + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license MIT + * @baseUrl http://petstore.swagger.io/v1 + */ +export class Api extends HttpClient { + pets = { + /** + * No description + * + * @tags pets + * @name CreatePets + * @summary Create a pet + * @request POST:/pets + */ + createPets: (params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/pets + */ + listPets: (query: ListPetsParams, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags pets + * @name ShowPetById + * @summary Info for a specific pet + * @request GET:/pets/{petId} + */ + showPetById: (petId: string, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${petId}\`, + method: "GET", + ...params, + }), + }; +} +" +`; + +exports[`extended > 'petstore' 2`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type CreatePetsData = any; + +export type CreatePetsError = Error; + +export interface Error { + /** @format int32 */ + code: number; + message: string; +} + +export type ListPetsData = Pets; + +export type ListPetsError = Error; + +export interface ListPetsParams { + /** + * How many items to return at one time (max 100) + * @format int32 + */ + limit?: number; +} + +export interface Pet { + /** @format int64 */ + id: number; + name: string; + tag?: string; +} + +export type Pets = Pet[]; + +export type ShowPetByIdData = Pets; + +export type ShowPetByIdError = Error; + +export namespace Pets { + /** + * No description + * @tags pets + * @name CreatePets + * @summary Create a pet + * @request POST:/pets + */ + export namespace CreatePets { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CreatePetsData; + } + /** + * No description + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/pets + */ + export namespace ListPets { + export type RequestParams = {}; + export type RequestQuery = { + /** + * How many items to return at one time (max 100) + * @format int32 + */ + limit?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ListPetsData; + } + /** + * No description + * @tags pets + * @name ShowPetById + * @summary Info for a specific pet + * @request GET:/pets/{petId} + */ + export namespace ShowPetById { + export type RequestParams = { + /** The id of the pet to retrieve */ + petId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ShowPetByIdData; + } +} + +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 = "http://petstore.swagger.io/v1"; + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license MIT + * @baseUrl http://petstore.swagger.io/v1 + */ +export class Api extends HttpClient { + pets = { + /** + * No description + * + * @tags pets + * @name CreatePets + * @summary Create a pet + * @request POST:/pets + */ + createPets: (params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "POST", + ...params, + }), + + /** + * No description + * + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/pets + */ + listPets: (query: ListPetsParams, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags pets + * @name ShowPetById + * @summary Info for a specific pet + * @request GET:/pets/{petId} + */ + showPetById: (petId: string, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${petId}\`, + method: "GET", + ...params, + }), + }; +} +" +`; + +exports[`extended > 'petstore-expanded' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type AddPetData = Pet; + +export type AddPetError = Error; + +export type DeletePetData = any; + +export type DeletePetError = Error; + +export interface Error { + /** @format int32 */ + code: number; + message: string; +} + +export type FindPetByIdData = Pet; + +export type FindPetByIdError = Error; + +export type FindPetsData = Pet[]; + +export type FindPetsError = Error; + +export interface FindPetsParams { + /** + * maximum number of results to return + * @format int32 + */ + limit?: number; + /** tags to filter by */ + tags?: string[]; +} + +export interface NewPet { + name: string; + tag?: string; +} + +export type Pet = NewPet & { + /** @format int64 */ + id: number; +}; + +export namespace Pets { + /** + * @description Creates a new pet in the store. Duplicates are allowed + * @name AddPet + * @request POST:/pets + */ + export namespace AddPet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = NewPet; + export type RequestHeaders = {}; + export type ResponseBody = AddPetData; + } + /** + * @description deletes a single pet based on the ID supplied + * @name DeletePet + * @request DELETE:/pets/{id} + */ + export namespace DeletePet { + export type RequestParams = { + /** + * ID of pet to delete + * @format int64 + */ + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DeletePetData; + } + /** + * @description Returns a user based on a single ID, if the user does not have access to the pet + * @name FindPetById + * @request GET:/pets/{id} + */ + export namespace FindPetById { + export type RequestParams = { + /** + * ID of pet to fetch + * @format int64 + */ + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetByIdData; + } + /** + * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + * @name FindPets + * @request GET:/pets + */ + export namespace FindPets { + export type RequestParams = {}; + export type RequestQuery = { + /** + * maximum number of results to return + * @format int32 + */ + limit?: number; + /** tags to filter by */ + tags?: string[]; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetsData; + } +} + +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 = "http://petstore.swagger.io/api"; + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/api + * @contact Swagger API Team (http://swagger.io) + * + * A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification + */ +export class Api extends HttpClient { + pets = { + /** + * @description Creates a new pet in the store. Duplicates are allowed + * + * @name AddPet + * @request POST:/pets + */ + addPet: (data: NewPet, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description deletes a single pet based on the ID supplied + * + * @name DeletePet + * @request DELETE:/pets/{id} + */ + deletePet: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Returns a user based on a single ID, if the user does not have access to the pet + * + * @name FindPetById + * @request GET:/pets/{id} + */ + findPetById: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + * + * @name FindPets + * @request GET:/pets + */ + findPets: (query: FindPetsParams, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "GET", + query: query, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'petstore-expanded' 2`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type AddPetData = Pet; + +export type AddPetError = Error; + +export type DeletePetData = any; + +export type DeletePetError = Error; + +export interface Error { + /** @format int32 */ + code: number; + message: string; +} + +export type FindPetByIdData = Pet; + +export type FindPetByIdError = Error; + +export type FindPetsData = Pet[]; + +export type FindPetsError = Error; + +export interface FindPetsParams { + /** + * maximum number of results to return + * @format int32 + */ + limit?: number; + /** tags to filter by */ + tags?: string[]; +} + +export interface NewPet { + name: string; + tag?: string; +} + +/** Page«TemplateResponseDto» */ +export interface PageTemplateResponseDto { + content?: any[]; + empty?: boolean; + first?: boolean; + last?: boolean; + /** @format int32 */ + number?: number; + /** @format int32 */ + numberOfElements?: number; + pageable?: any; + /** @format int32 */ + size?: number; + sort?: any; + /** @format int64 */ + totalElements?: number; + /** @format int32 */ + totalPages?: number; +} + +export type Pet = NewPet & { + /** @format int64 */ + id: number; +}; + +export namespace PathParams { + /** + * No description + * @name PathParamFooBarBazList + * @request GET:/path-params/{path-param}/{foo-bar-baz} + */ + export namespace PathParamFooBarBazList { + export type RequestParams = { + /** foo bar baz */ + fooBarBaz: string; + /** path-param */ + pathParam: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } +} + +export namespace Pets { + /** + * @description Creates a new pet in the store. Duplicates are allowed + * @name AddPet + * @request POST:/pets + */ + export namespace AddPet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = NewPet; + export type RequestHeaders = {}; + export type ResponseBody = AddPetData; + } + /** + * @description deletes a single pet based on the ID supplied + * @name DeletePet + * @request DELETE:/pets/{id} + */ + export namespace DeletePet { + export type RequestParams = { + /** + * ID of pet to delete + * @format int64 + */ + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DeletePetData; + } + /** + * @description Returns a user based on a single ID, if the user does not have access to the pet + * @name FindPetById + * @request GET:/pets/{id} + */ + export namespace FindPetById { + export type RequestParams = { + /** + * ID of pet to fetch + * @format int64 + */ + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetByIdData; + } + /** + * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + * @name FindPets + * @request GET:/pets + */ + export namespace FindPets { + export type RequestParams = {}; + export type RequestQuery = { + /** + * maximum number of results to return + * @format int32 + */ + limit?: number; + /** tags to filter by */ + tags?: string[]; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetsData; + } +} + +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 = "http://petstore.swagger.io/api"; + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/api + * @contact Swagger API Team (http://swagger.io) + * + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + */ +export class Api extends HttpClient { + pathParams = { + /** + * No description + * + * @name PathParamFooBarBazList + * @request GET:/path-params/{path-param}/{foo-bar-baz} + */ + pathParamFooBarBazList: (pathParam: string, fooBarBaz: string, params: RequestParams = {}) => + this.request({ + path: \`/path-params/\${pathParam}/\${fooBarBaz}\`, + method: "GET", + ...params, + }), + }; + pets = { + /** + * @description Creates a new pet in the store. Duplicates are allowed + * + * @name AddPet + * @request POST:/pets + */ + addPet: (pet: NewPet, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "POST", + body: pet, + type: ContentType.Json, + ...params, + }), + + /** + * @description deletes a single pet based on the ID supplied + * + * @name DeletePet + * @request DELETE:/pets/{id} + */ + deletePet: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Returns a user based on a single ID, if the user does not have access to the pet + * + * @name FindPetById + * @request GET:/pets/{id} + */ + findPetById: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + * + * @name FindPets + * @request GET:/pets + */ + findPets: (query: FindPetsParams, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "GET", + query: query, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'petstore-minimal' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Pet { + /** @format int64 */ + id: number; + multiple?: string | number; + name: string; + tag?: string; +} + +export type PetsListData = Pet[]; + +export namespace Pets { + /** + * @description Returns all pets from the system that the user has access to + * @name PetsList + * @request GET:/pets + */ + export namespace PetsList { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PetsListData; + } +} + +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 = "http://petstore.swagger.io/api"; + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license MIT + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/api + * @contact Swagger API Team + * + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + */ +export class Api extends HttpClient { + pets = { + /** + * @description Returns all pets from the system that the user has access to + * + * @name PetsList + * @request GET:/pets + */ + petsList: (params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "GET", + ...params, + }), + }; +} +" +`; + +exports[`extended > 'petstore-simple' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type AddPetData = Pet; + +export type AddPetError = ErrorModel; + +export type DeletePetData = any; + +export type DeletePetError = ErrorModel; + +export interface ErrorModel { + /** @format int32 */ + code: number; + message: string; +} + +export type FindPetByIdData = Pet; + +export type FindPetByIdError = ErrorModel; + +export type FindPetsData = Pet[]; + +export type FindPetsError = ErrorModel; + +export interface FindPetsParams { + /** + * maximum number of results to return + * @format int32 + */ + limit?: number; + /** tags to filter by */ + tags?: string[]; +} + +export interface NewPet { + name: string; + tag?: string; +} + +export type Pet = NewPet & { + /** @format int64 */ + id: number; +}; + +/** Description of Test type */ +export type Test = NewPet; + +export interface Test2 { + /** Field description */ + data?: NewPet; +} + +export namespace Pets { + /** + * @description Creates a new pet in the store. Duplicates are allowed + * @name AddPet + * @request POST:/pets + */ + export namespace AddPet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = NewPet; + export type RequestHeaders = {}; + export type ResponseBody = AddPetData; + } + /** + * @description deletes a single pet based on the ID supplied + * @name DeletePet + * @request DELETE:/pets/{id} + */ + export namespace DeletePet { + export type RequestParams = { + /** + * ID of pet to delete + * @format int64 + */ + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DeletePetData; + } + /** + * @description Returns a user based on a single ID, if the user does not have access to the pet + * @name FindPetById + * @request GET:/pets/{id} + */ + export namespace FindPetById { + export type RequestParams = { + /** + * ID of pet to fetch + * @format int64 + */ + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetByIdData; + } + /** + * @description Returns all pets from the system that the user has access to + * @name FindPets + * @request GET:/pets + */ + export namespace FindPets { + export type RequestParams = {}; + export type RequestQuery = { + /** + * maximum number of results to return + * @format int32 + */ + limit?: number; + /** tags to filter by */ + tags?: string[]; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetsData; + } +} + +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 = "http://petstore.swagger.io/api"; + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license MIT + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/api + * @contact Swagger API Team + * + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + */ +export class Api extends HttpClient { + pets = { + /** + * @description Creates a new pet in the store. Duplicates are allowed + * + * @name AddPet + * @request POST:/pets + */ + addPet: (pet: NewPet, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "POST", + body: pet, + type: ContentType.Json, + ...params, + }), + + /** + * @description deletes a single pet based on the ID supplied + * + * @name DeletePet + * @request DELETE:/pets/{id} + */ + deletePet: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Returns a user based on a single ID, if the user does not have access to the pet + * + * @name FindPetById + * @request GET:/pets/{id} + */ + findPetById: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns all pets from the system that the user has access to + * + * @name FindPets + * @request GET:/pets + */ + findPets: (query: FindPetsParams, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "GET", + query: query, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'petstore-swagger-io' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface ApiResponse { + /** @format int32 */ + code?: number; + message?: string; + type?: string; +} + +export interface Category { + /** @format int64 */ + id?: number; + name?: string; +} + +export type FindPetsByStatusData = Pet[]; + +export interface FindPetsByStatusParams { + /** Status values that need to be considered for filter */ + status: StatusEnum[]; +} + +/** @default "available" */ +export enum FindPetsByStatusParams1StatusEnum { + Available = "available", + Pending = "pending", + Sold = "sold", +} + +export type FindPetsByTagsData = Pet[]; + +export interface FindPetsByTagsParams { + /** Tags to filter by */ + tags: string[]; +} + +export type GetInventoryData = Record; + +export type GetOrderByIdData = Order; + +export type GetPetByIdData = Pet; + +export type GetUserByNameData = User; + +export type LoginUserData = string; + +export interface LoginUserParams { + /** The password for login in clear text */ + password: string; + /** The user name for login */ + username: string; +} + +export interface Order { + complete?: boolean; + /** @format int64 */ + id?: number; + /** @format int64 */ + petId?: number; + /** @format int32 */ + quantity?: number; + /** @format date-time */ + shipDate?: string; + /** Order Status */ + status?: OrderStatusEnum; +} + +/** Order Status */ +export enum OrderStatusEnum { + Placed = "placed", + Approved = "approved", + Delivered = "delivered", +} + +export interface Pet { + category?: Category; + /** @format int64 */ + id?: number; + /** @example "doggie" */ + name: string; + photoUrls: string[]; + /** pet status in the store */ + status?: PetStatusEnum; + tags?: Tag[]; +} + +/** pet status in the store */ +export enum PetStatusEnum { + Available = "available", + Pending = "pending", + Sold = "sold", +} + +export type PlaceOrderData = Order; + +/** @default "available" */ +export enum StatusEnum { + Available = "available", + Pending = "pending", + Sold = "sold", +} + +export interface Tag { + /** @format int64 */ + id?: number; + name?: string; +} + +export interface UpdatePetWithFormPayload { + /** Updated name of the pet */ + name?: string; + /** Updated status of the pet */ + status?: string; +} + +export type UploadFileData = ApiResponse; + +export interface UploadFilePayload { + /** Additional data to pass to server */ + additionalMetadata?: string; + /** file to upload */ + file?: File; +} + +export interface User { + email?: string; + firstName?: string; + /** @format int64 */ + id?: number; + lastName?: string; + password?: string; + phone?: string; + /** + * User Status + * @format int32 + */ + userStatus?: number; + username?: string; +} + +export namespace Pet { + /** + * No description + * @tags pet + * @name AddPet + * @summary Add a new pet to the store + * @request POST:/pet + * @secure + */ + export namespace AddPet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = Pet; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags pet + * @name DeletePet + * @summary Deletes a pet + * @request DELETE:/pet/{petId} + * @secure + */ + export namespace DeletePet { + export type RequestParams = { + /** + * Pet id to delete + * @format int64 + */ + petId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = { + api_key?: string; + }; + export type ResponseBody = any; + } + /** + * @description Multiple status values can be provided with comma separated strings + * @tags pet + * @name FindPetsByStatus + * @summary Finds Pets by status + * @request GET:/pet/findByStatus + * @secure + */ + export namespace FindPetsByStatus { + export type RequestParams = {}; + export type RequestQuery = { + /** Status values that need to be considered for filter */ + status: FindPetsByStatusParams1StatusEnum[]; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetsByStatusData; + } + /** + * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @tags pet + * @name FindPetsByTags + * @summary Finds Pets by tags + * @request GET:/pet/findByTags + * @deprecated + * @secure + */ + export namespace FindPetsByTags { + export type RequestParams = {}; + export type RequestQuery = { + /** Tags to filter by */ + tags: string[]; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetsByTagsData; + } + /** + * @description Returns a single pet + * @tags pet + * @name GetPetById + * @summary Find pet by ID + * @request GET:/pet/{petId} + * @secure + */ + export namespace GetPetById { + export type RequestParams = { + /** + * ID of pet to return + * @format int64 + */ + petId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetPetByIdData; + } + /** + * No description + * @tags pet + * @name UpdatePet + * @summary Update an existing pet + * @request PUT:/pet + * @secure + */ + export namespace UpdatePet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = Pet; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags pet + * @name UpdatePetWithForm + * @summary Updates a pet in the store with form data + * @request POST:/pet/{petId} + * @secure + */ + export namespace UpdatePetWithForm { + export type RequestParams = { + /** + * ID of pet that needs to be updated + * @format int64 + */ + petId: number; + }; + export type RequestQuery = {}; + export type RequestBody = UpdatePetWithFormPayload; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags pet + * @name UploadFile + * @summary uploads an image + * @request POST:/pet/{petId}/uploadImage + * @secure + */ + export namespace UploadFile { + export type RequestParams = { + /** + * ID of pet to update + * @format int64 + */ + petId: number; + }; + export type RequestQuery = {}; + export type RequestBody = UploadFilePayload; + export type RequestHeaders = {}; + export type ResponseBody = UploadFileData; + } +} + +export namespace Store { + /** + * @description For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors + * @tags store + * @name DeleteOrder + * @summary Delete purchase order by ID + * @request DELETE:/store/order/{orderId} + */ + export namespace DeleteOrder { + export type RequestParams = { + /** + * ID of the order that needs to be deleted + * @format int64 + * @min 1 + */ + orderId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description Returns a map of status codes to quantities + * @tags store + * @name GetInventory + * @summary Returns pet inventories by status + * @request GET:/store/inventory + * @secure + */ + export namespace GetInventory { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetInventoryData; + } + /** + * @description For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions + * @tags store + * @name GetOrderById + * @summary Find purchase order by ID + * @request GET:/store/order/{orderId} + */ + export namespace GetOrderById { + export type RequestParams = { + /** + * ID of pet that needs to be fetched + * @format int64 + * @min 1 + * @max 10 + */ + orderId: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetOrderByIdData; + } + /** + * No description + * @tags store + * @name PlaceOrder + * @summary Place an order for a pet + * @request POST:/store/order + */ + export namespace PlaceOrder { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = Order; + export type RequestHeaders = {}; + export type ResponseBody = PlaceOrderData; + } +} + +export namespace User { + /** + * @description This can only be done by the logged in user. + * @tags user + * @name CreateUser + * @summary Create user + * @request POST:/user + */ + export namespace CreateUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = User; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags user + * @name CreateUsersWithArrayInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithArray + */ + export namespace CreateUsersWithArrayInput { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = User[]; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags user + * @name CreateUsersWithListInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithList + */ + export namespace CreateUsersWithListInput { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = User[]; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description This can only be done by the logged in user. + * @tags user + * @name DeleteUser + * @summary Delete user + * @request DELETE:/user/{username} + */ + export namespace DeleteUser { + export type RequestParams = { + /** The name that needs to be deleted */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * No description + * @tags user + * @name GetUserByName + * @summary Get user by user name + * @request GET:/user/{username} + */ + export namespace GetUserByName { + export type RequestParams = { + /** The name that needs to be fetched. Use user1 for testing. */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetUserByNameData; + } + /** + * No description + * @tags user + * @name LoginUser + * @summary Logs user into the system + * @request GET:/user/login + */ + export namespace LoginUser { + export type RequestParams = {}; + export type RequestQuery = { + /** The password for login in clear text */ + password: string; + /** The user name for login */ + username: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = LoginUserData; + } + /** + * No description + * @tags user + * @name LogoutUser + * @summary Logs out current logged in user session + * @request GET:/user/logout + */ + export namespace LogoutUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = any; + } + /** + * @description This can only be done by the logged in user. + * @tags user + * @name UpdateUser + * @summary Updated user + * @request PUT:/user/{username} + */ + export namespace UpdateUser { + export type RequestParams = { + /** name that need to be updated */ + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = User; + export type RequestHeaders = {}; + export type ResponseBody = any; + } +} + +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://petstore.swagger.io/v2"; + 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.clone() 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 Swagger Petstore + * @version 1.0.3 + * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://swagger.io/terms/ + * @baseUrl https://petstore.swagger.io/v2 + * @externalDocs http://swagger.io + * @contact + * + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key \`special-key\` to test the authorization filters. + */ +export class Api extends HttpClient { + pet = { + /** + * No description + * + * @tags pet + * @name AddPet + * @summary Add a new pet to the store + * @request POST:/pet + * @secure + */ + addPet: (body: Pet, params: RequestParams = {}) => + this.request({ + path: \`/pet\`, + method: "POST", + body: body, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name DeletePet + * @summary Deletes a pet + * @request DELETE:/pet/{petId} + * @secure + */ + deletePet: (petId: number, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * @description Multiple status values can be provided with comma separated strings + * + * @tags pet + * @name FindPetsByStatus + * @summary Finds Pets by status + * @request GET:/pet/findByStatus + * @secure + */ + findPetsByStatus: (query: FindPetsByStatusParams, params: RequestParams = {}) => + this.request({ + path: \`/pet/findByStatus\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @tags pet + * @name FindPetsByTags + * @summary Finds Pets by tags + * @request GET:/pet/findByTags + * @deprecated + * @secure + */ + findPetsByTags: (query: FindPetsByTagsParams, params: RequestParams = {}) => + this.request({ + path: \`/pet/findByTags\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Returns a single pet + * + * @tags pet + * @name GetPetById + * @summary Find pet by ID + * @request GET:/pet/{petId} + * @secure + */ + getPetById: (petId: number, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name UpdatePet + * @summary Update an existing pet + * @request PUT:/pet + * @secure + */ + updatePet: (body: Pet, params: RequestParams = {}) => + this.request({ + path: \`/pet\`, + method: "PUT", + body: body, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name UpdatePetWithForm + * @summary Updates a pet in the store with form data + * @request POST:/pet/{petId} + * @secure + */ + updatePetWithForm: (petId: number, data: UpdatePetWithFormPayload, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}\`, + method: "POST", + body: data, + secure: true, + type: ContentType.FormData, + ...params, + }), + + /** + * No description + * + * @tags pet + * @name UploadFile + * @summary uploads an image + * @request POST:/pet/{petId}/uploadImage + * @secure + */ + uploadFile: (petId: number, data: UploadFilePayload, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}/uploadImage\`, + method: "POST", + body: data, + secure: true, + type: ContentType.FormData, + ...params, + }), + }; + store = { + /** + * @description For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors + * + * @tags store + * @name DeleteOrder + * @summary Delete purchase order by ID + * @request DELETE:/store/order/{orderId} + */ + deleteOrder: (orderId: number, params: RequestParams = {}) => + this.request({ + path: \`/store/order/\${orderId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Returns a map of status codes to quantities + * + * @tags store + * @name GetInventory + * @summary Returns pet inventories by status + * @request GET:/store/inventory + * @secure + */ + getInventory: (params: RequestParams = {}) => + this.request({ + path: \`/store/inventory\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions + * + * @tags store + * @name GetOrderById + * @summary Find purchase order by ID + * @request GET:/store/order/{orderId} + */ + getOrderById: (orderId: number, params: RequestParams = {}) => + this.request({ + path: \`/store/order/\${orderId}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags store + * @name PlaceOrder + * @summary Place an order for a pet + * @request POST:/store/order + */ + placeOrder: (body: Order, params: RequestParams = {}) => + this.request({ + path: \`/store/order\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + }; + user = { + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name CreateUser + * @summary Create user + * @request POST:/user + */ + createUser: (body: User, params: RequestParams = {}) => + this.request({ + path: \`/user\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags user + * @name CreateUsersWithArrayInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithArray + */ + createUsersWithArrayInput: (body: User[], params: RequestParams = {}) => + this.request({ + path: \`/user/createWithArray\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags user + * @name CreateUsersWithListInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithList + */ + createUsersWithListInput: (body: User[], params: RequestParams = {}) => + this.request({ + path: \`/user/createWithList\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name DeleteUser + * @summary Delete user + * @request DELETE:/user/{username} + */ + deleteUser: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags user + * @name GetUserByName + * @summary Get user by user name + * @request GET:/user/{username} + */ + getUserByName: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags user + * @name LoginUser + * @summary Logs user into the system + * @request GET:/user/login + */ + loginUser: (query: LoginUserParams, params: RequestParams = {}) => + this.request({ + path: \`/user/login\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @tags user + * @name LogoutUser + * @summary Logs out current logged in user session + * @request GET:/user/logout + */ + logoutUser: (params: RequestParams = {}) => + this.request({ + path: \`/user/logout\`, + method: "GET", + ...params, + }), + + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name UpdateUser + * @summary Updated user + * @request PUT:/user/{username} + */ + updateUser: (username: string, body: User, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "PUT", + body: body, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'petstore-with-external-docs' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type AddPetData = Pet; + +export type AddPetError = ErrorModel; + +export type DeletePetData = any; + +export type DeletePetError = ErrorModel; + +export interface ErrorModel { + /** @format int32 */ + code: number; + message: string; +} + +export type FindPetByIdData = Pet; + +export type FindPetByIdError = ErrorModel; + +export type FindPetsData = Pet[]; + +export type FindPetsError = ErrorModel; + +export interface FindPetsParams { + /** + * maximum number of results to return + * @format int32 + */ + limit?: number; + /** tags to filter by */ + tags?: string[]; +} + +export interface NewPet { + name: string; + tag?: string; +} + +export type Pet = NewPet & { + /** @format int64 */ + id: number; +}; + +export namespace Pets { + /** + * @description Creates a new pet in the store. Duplicates are allowed + * @name AddPet + * @request POST:/pets + */ + export namespace AddPet { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = NewPet; + export type RequestHeaders = {}; + export type ResponseBody = AddPetData; + } + /** + * @description deletes a single pet based on the ID supplied + * @name DeletePet + * @request DELETE:/pets/{id} + */ + export namespace DeletePet { + export type RequestParams = { + /** + * ID of pet to delete + * @format int64 + */ + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DeletePetData; + } + /** + * @description Returns a user based on a single ID, if the user does not have access to the pet + * @name FindPetById + * @request GET:/pets/{id} + */ + export namespace FindPetById { + export type RequestParams = { + /** + * ID of pet to fetch + * @format int64 + */ + id: number; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetByIdData; + } + /** + * @description Returns all pets from the system that the user has access to + * @name FindPets + * @request GET:/pets + */ + export namespace FindPets { + export type RequestParams = {}; + export type RequestQuery = { + /** + * maximum number of results to return + * @format int32 + */ + limit?: number; + /** tags to filter by */ + tags?: string[]; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = FindPetsData; + } +} + +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 = "http://petstore.swagger.io/api"; + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/api + * @externalDocs https://swagger.io/about + * @contact Swagger API Team (http://swagger.io) + * + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + */ +export class Api extends HttpClient { + pets = { + /** + * @description Creates a new pet in the store. Duplicates are allowed + * + * @name AddPet + * @request POST:/pets + */ + addPet: (pet: NewPet, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "POST", + body: pet, + type: ContentType.Json, + ...params, + }), + + /** + * @description deletes a single pet based on the ID supplied + * + * @name DeletePet + * @request DELETE:/pets/{id} + */ + deletePet: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Returns a user based on a single ID, if the user does not have access to the pet + * + * @name FindPetById + * @request GET:/pets/{id} + */ + findPetById: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, + method: "GET", + ...params, + }), + + /** + * @description Returns all pets from the system that the user has access to + * + * @name FindPets + * @request GET:/pets + */ + findPets: (query: FindPetsParams, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "GET", + query: query, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'query-path-param' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type ListPetsData = object; + +export interface ListPetsParams { + /** + * How many items to return at one time (max 100) + * @format int32 + */ + query?: number; + /** + * How many items to return at one time (max 100) + * @format int32 + */ + queryParam?: number; +} + +export namespace Foobarbaz { + /** + * No description + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/foobarbaz/{query} + */ + export namespace ListPets { + export type RequestParams = { + /** + * How many items to return at one time (max 100) + * @format int32 + */ + query?: number; + }; + export type RequestQuery = { + /** + * How many items to return at one time (max 100) + * @format int32 + */ + queryParam?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ListPetsData; + } +} + +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 = "http://unknown.io/v666"; + 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.clone() 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 Query Path Param + * @version 1.0.0 + * @license MIT + * @baseUrl http://unknown.io/v666 + */ +export class Api extends HttpClient { + foobarbaz = { + /** + * No description + * + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/foobarbaz/{query} + */ + listPets: ({ query, ...queryParams }: ListPetsParams, params: RequestParams = {}) => + this.request({ + path: \`/foobarbaz/\${query}\`, + method: "GET", + query: queryParams, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'recursive-schema' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** RECURSIVE */ +export interface RecursiveObject { + /** RECURSIVE */ + bar?: RecursiveObject; + /** + * Unique identifier of the GitHub app + * @example 37 + */ + id?: number; +} + +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.clone() 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 + */ +export class Api extends HttpClient {} +" +`; + +exports[`extended > 'responses' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface GetDataData { + data?: string; +} + +export namespace Api { + /** + * No description + * @name GetData + * @request GET:/api + */ + export namespace GetData { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetDataData; + } +} + +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.clone() 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 Title + * @version latest + * + * Description + */ +export class Api extends HttpClient { + api = { + /** + * No description + * + * @name GetData + * @request GET:/api + */ + getData: (params: RequestParams = {}) => + this.request({ + path: \`/api\`, + method: "GET", + ...params, + }), + }; +} +" +`; + +exports[`extended > 'swaggerhub-template' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type ExampleListData = any; + +export type PingListData = any; + +export namespace Example { + /** + * @description This is an example operation to show how security is applied to the call. + * @name ExampleList + * @summary Server example operation + * @request GET:/example + * @secure + */ + export namespace ExampleList { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ExampleListData; + } +} + +export namespace Ping { + /** + * @description This operation shows how to override the global security defined above, as we want to open it up for all users. + * @name PingList + * @summary Server heartbeat operation + * @request GET:/ping + */ + export namespace PingList { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PingListData; + } +} + +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://virtserver.swaggerhub.com/sdfsdfsffs/sdfff/1.0.0"; + 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.clone() 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 Sample Application Flow OAuth2 Project + * @version 1.0.0 + * @baseUrl https://virtserver.swaggerhub.com/sdfsdfsffs/sdfff/1.0.0 + * + * This is an example of using OAuth2 Application Flow in a specification to describe security to your API. + */ +export class Api extends HttpClient { + example = { + /** + * @description This is an example operation to show how security is applied to the call. + * + * @name ExampleList + * @summary Server example operation + * @request GET:/example + * @secure + */ + exampleList: (params: RequestParams = {}) => + this.request({ + path: \`/example\`, + method: "GET", + secure: true, + ...params, + }), + }; + ping = { + /** + * @description This operation shows how to override the global security defined above, as we want to open it up for all users. + * + * @name PingList + * @summary Server heartbeat operation + * @request GET:/ping + */ + pingList: (params: RequestParams = {}) => + this.request({ + path: \`/ping\`, + method: "GET", + ...params, + }), + }; +} +" +`; + +exports[`extended > 'tsoa-odd-types-3' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type AddJobData = string; + +export type AddJobResult = string; + +export type AddProjectsData = string; + +export type AddUserData = User; + +export interface AuthUser { + password: string; + username: string; +} + +export type DeleteJobData = any; + +export type DeleteUserData = any; + +export type GetJobData = Job; + +export type GetJobsData = Job[]; + +export type GetJobsResult = Job[]; + +export interface GetProfileBioDTO { + /** @format int32 */ + candidateId?: number; + cityName?: string | null; +} + +export type GetProjectsData = Project[]; + +export type GetUsersData = User[]; + +export interface Job { + address?: string | null; + github?: string | null; + id: string; + isTool?: boolean | null; + kind: Kind; + link?: string | null; + name?: string | null; + npm?: string | null; +} + +export type JobUpdate = OmitJobId | PickJobGithub | Record; + +export enum Kind { + COMPANY = "COMPANY", + PERSONAL = "PERSONAL", + FREELANCE = "FREELANCE", + OPEN_SOURCE = "OPEN_SOURCE", +} + +export type LoginData = string; + +export type OmitJobId = PickJobExcludeKeysId; + +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickJobExcludeKeysId { + address?: string; + github?: string; + isTool?: boolean; + kind: Kind; + link?: string; + name?: string; + 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; + name?: string; + notImportant?: boolean; + prefix?: string; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +export interface Project { + description: string; + id: string; + job: Job; + name?: string | null; + notImportant?: boolean | null; + prefix?: string | null; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +export interface ProjectUpdate { + description: string; + job: string; + name?: string | null; + notImportant?: boolean | null; + prefix?: string | null; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +export type RefreshData = string; + +export type UpdateJobData = UpdatedJob; + +export type UpdateProjectData = UpdatedProject; + +export type UpdateUserData = User; + +export type UpdatedJob = Job; + +export interface UpdatedProject { + description: string; + id: string; + job: string; + name?: string | null; + notImportant?: boolean | null; + prefix?: string | null; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +export interface User { + id: string; + username: string; +} + +export interface UserUpdate { + id?: string | null; + username?: string | null; +} + +export namespace Auth { + /** + * No description + * @tags Auth + * @name Login + * @request POST:/auth + */ + export namespace Login { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = AuthUser; + export type RequestHeaders = {}; + export type ResponseBody = LoginData; + } + /** + * No description + * @tags Auth + * @name Refresh + * @request POST:/auth/refresh + * @secure + */ + export namespace Refresh { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = { + Authorization: string; + }; + export type ResponseBody = RefreshData; + } +} + +export namespace Jobs { + /** + * No description + * @tags Jobs + * @name AddJob + * @request POST:/jobs + * @secure + */ + export namespace AddJob { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = PickJobGithub; + export type RequestHeaders = {}; + export type ResponseBody = AddJobData; + } + /** + * No description + * @tags Jobs + * @name DeleteJob + * @request DELETE:/jobs/{id} + * @secure + */ + export namespace DeleteJob { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DeleteJobData; + } + /** + * No description + * @tags Jobs + * @name GetJob + * @request GET:/jobs/{id} + * @secure + */ + export namespace GetJob { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetJobData; + } + /** + * No description + * @tags Jobs + * @name GetJobs + * @request GET:/jobs + * @secure + */ + export namespace GetJobs { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetJobsData; + } + /** + * No description + * @tags Jobs + * @name UpdateJob + * @request PATCH:/jobs/{id} + * @secure + */ + export namespace UpdateJob { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = JobUpdate; + export type RequestHeaders = {}; + export type ResponseBody = UpdateJobData; + } +} + +export namespace XRoute { + /** + * No description + * @tags Jobs + * @name AddJob + * @request POST:x-route + * @secure + */ + export namespace AddJob { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = PickJobGithub; + export type RequestHeaders = {}; + export type ResponseBody = AddJobResult; + } + /** + * No description + * @tags Jobs + * @name GetJobs + * @request GET:x-route + * @secure + */ + export namespace GetJobs { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetJobsResult; + } +} + +export namespace Projects { + /** + * No description + * @tags Projects + * @name AddProjects + * @request POST:/projects + * @secure + */ + export namespace AddProjects { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = ProjectUpdate; + export type RequestHeaders = {}; + export type ResponseBody = AddProjectsData; + } + /** + * No description + * @tags Projects + * @name GetProjects + * @request GET:/projects + */ + export namespace GetProjects { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetProjectsData; + } + /** + * No description + * @tags Projects + * @name UpdateProject + * @request PATCH:/projects/{id} + * @secure + */ + export namespace UpdateProject { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = ProjectUpdate; + export type RequestHeaders = {}; + export type ResponseBody = UpdateProjectData; + } +} + +export namespace Users { + /** + * No description + * @tags Users + * @name AddUser + * @request POST:/users + * @secure + */ + export namespace AddUser { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = AuthUser; + export type RequestHeaders = {}; + export type ResponseBody = AddUserData; + } + /** + * No description + * @tags Users + * @name DeleteUser + * @request DELETE:/users/{id} + * @secure + */ + export namespace DeleteUser { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = DeleteUserData; + } + /** + * No description + * @tags Users + * @name GetUsers + * @request GET:/users + * @secure + */ + export namespace GetUsers { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetUsersData; + } + /** + * No description + * @tags Users + * @name UpdateUser + * @request PATCH:/users/{id} + * @secure + */ + export namespace UpdateUser { + export type RequestParams = { + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = UserUpdate; + export type RequestHeaders = {}; + export type ResponseBody = UpdateUserData; + } +} + +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 = "http://localhost:8080/api/v1"; + 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.clone() 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 http://localhost:8080/api/v1 + */ +export class Api extends HttpClient { + auth = { + /** + * No description + * + * @tags Auth + * @name Login + * @request POST:/auth + */ + login: (data?: AuthUser, params: RequestParams = {}) => + this.request({ + path: \`/auth\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Auth + * @name Refresh + * @request POST:/auth/refresh + * @secure + */ + refresh: (params: RequestParams = {}) => + this.request({ + path: \`/auth/refresh\`, + method: "POST", + secure: true, + ...params, + }), + }; + jobs = { + /** + * No description + * + * @tags Jobs + * @name AddJob + * @request POST:/jobs + * @secure + */ + addJob: (data: PickJobGithub, params: RequestParams = {}) => + this.request({ + path: \`/jobs\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Jobs + * @name DeleteJob + * @request DELETE:/jobs/{id} + * @secure + */ + deleteJob: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Jobs + * @name GetJob + * @request GET:/jobs/{id} + * @secure + */ + getJob: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Jobs + * @name GetJobs + * @request GET:/jobs + * @secure + */ + getJobs: (params: RequestParams = {}) => + this.request({ + path: \`/jobs\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Jobs + * @name UpdateJob + * @request PATCH:/jobs/{id} + * @secure + */ + updateJob: (id: string, data: JobUpdate, params: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, + method: "PATCH", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + }; + xRoute = { + /** + * No description + * + * @tags Jobs + * @name AddJob + * @request POST:x-route + * @secure + */ + addJob: (data: PickJobGithub, params: RequestParams = {}) => + this.request({ + path: \`x-route\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Jobs + * @name GetJobs + * @request GET:x-route + * @secure + */ + getJobs: (params: RequestParams = {}) => + this.request({ + path: \`x-route\`, + method: "GET", + secure: true, + ...params, + }), + }; + projects = { + /** + * No description + * + * @tags Projects + * @name AddProjects + * @request POST:/projects + * @secure + */ + addProjects: (data: ProjectUpdate, params: RequestParams = {}) => + this.request({ + path: \`/projects\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Projects + * @name GetProjects + * @request GET:/projects + */ + getProjects: (params: RequestParams = {}) => + this.request({ + path: \`/projects\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags Projects + * @name UpdateProject + * @request PATCH:/projects/{id} + * @secure + */ + updateProject: (id: string, data: ProjectUpdate, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${id}\`, + method: "PATCH", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + }; + users = { + /** + * No description + * + * @tags Users + * @name AddUser + * @request POST:/users + * @secure + */ + addUser: (data: AuthUser, params: RequestParams = {}) => + this.request({ + path: \`/users\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags Users + * @name DeleteUser + * @request DELETE:/users/{id} + * @secure + */ + deleteUser: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${id}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Users + * @name GetUsers + * @request GET:/users + * @secure + */ + getUsers: (params: RequestParams = {}) => + this.request({ + path: \`/users\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * No description + * + * @tags Users + * @name UpdateUser + * @request PATCH:/users/{id} + * @secure + */ + updateUser: (id: string, data: UserUpdate, params: RequestParams = {}) => + this.request({ + path: \`/users/\${id}\`, + method: "PATCH", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'uber' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Activities { + /** + * Total number of items available. + * @format int32 + */ + count?: number; + history?: Activity[]; + /** + * Number of items to retrieve (100 max). + * @format int32 + */ + limit?: number; + /** + * Position in pagination. + * @format int32 + */ + offset?: number; +} + +export interface Activity { + /** Unique identifier for the activity */ + uuid?: string; +} + +export interface Error { + /** @format int32 */ + code?: number; + fields?: string; + message?: string; +} + +export type GetMeData = Profile; + +export type GetMeError = Error; + +export type HistoryListData = Activities; + +export type HistoryListError = Error; + +export interface HistoryListParams { + /** + * Number of items to retrieve. Default is 5, maximum is 100. + * @format int32 + */ + limit?: number; + /** + * Offset the list of returned results by this amount. Default is zero. + * @format int32 + */ + offset?: number; +} + +export interface PriceEstimate { + /** [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code. */ + currency_code?: string; + /** Display name of product. */ + display_name?: string; + /** Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI. */ + estimate?: string; + /** Upper bound of the estimated price. */ + high_estimate?: number; + /** Lower bound of the estimated price. */ + low_estimate?: number; + /** Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles */ + product_id?: string; + /** Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier. */ + surge_multiplier?: number; +} + +export type PriceListData = PriceEstimate[]; + +export type PriceListError = Error; + +export interface PriceListParams { + /** + * Latitude component of end location. + * @format double + */ + end_latitude?: number; + /** + * Longitude component of end location. + * @format double + */ + end_longitude: number; + /** + * Latitude component of start location. + * @format double + */ + start_latitude: number; + /** + * Longitude component of start location. + * @format double + */ + start_longitude: number; +} + +export interface Product { + /** Capacity of product. For example, 4 people. */ + capacity?: number; + /** Description of product. */ + description?: string; + /** Display name of product. */ + display_name?: string; + /** Image URL representing the product. */ + image?: string; + /** Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. */ + product_id?: string; +} + +export interface ProductList { + /** Contains the list of products */ + products?: Product[]; +} + +export type ProductsListData = Product[]; + +export type ProductsListError = Error; + +export interface ProductsListParams { + /** + * Latitude component of location. + * @format double + */ + latitude: number; + /** + * Longitude component of location. + * @format double + */ + longitude: number; +} + +export interface Profile { + /** Email address of the Uber user */ + email?: string; + /** First name of the Uber user. */ + first_name?: string; + /** Last name of the Uber user. */ + last_name?: string; + /** Image URL of the Uber user. */ + picture?: string; + /** Promo code of the Uber user. */ + promo_code?: string; +} + +export type TimeListData = Product[]; + +export type TimeListError = Error; + +export interface TimeListParams { + /** + * Unique customer identifier to be used for experience customization. + * @format uuid + */ + customer_uuid?: string; + /** Unique identifier representing a specific product for a given latitude & longitude. */ + product_id?: string; + /** + * Latitude component of start location. + * @format double + */ + start_latitude: number; + /** + * Longitude component of start location. + * @format double + */ + start_longitude: number; +} + +export namespace Products { + /** + * @description The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order. + * @tags Products + * @name ProductsList + * @summary Product Types + * @request GET:/products + * @secure + */ + export namespace ProductsList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Latitude component of location. + * @format double + */ + latitude: number; + /** + * Longitude component of location. + * @format double + */ + longitude: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ProductsListData; + } +} + +export namespace Estimates { + /** + * @description The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.

The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier. + * @tags Estimates + * @name PriceList + * @summary Price Estimates + * @request GET:/estimates/price + */ + export namespace PriceList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Latitude component of end location. + * @format double + */ + end_latitude?: number; + /** + * Longitude component of end location. + * @format double + */ + end_longitude: number; + /** + * Latitude component of start location. + * @format double + */ + start_latitude: number; + /** + * Longitude component of start location. + * @format double + */ + start_longitude: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PriceListData; + } + /** + * @description The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. + * @tags Estimates + * @name TimeList + * @summary Time Estimates + * @request GET:/estimates/time + */ + export namespace TimeList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Unique customer identifier to be used for experience customization. + * @format uuid + */ + customer_uuid?: string; + /** Unique identifier representing a specific product for a given latitude & longitude. */ + product_id?: string; + /** + * Latitude component of start location. + * @format double + */ + start_latitude: number; + /** + * Longitude component of start location. + * @format double + */ + start_longitude: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TimeListData; + } +} + +export namespace Me { + /** + * @description The User Profile endpoint returns information about the Uber user that has authorized with the application. + * @tags User + * @name GetMe + * @summary User Profile + * @request GET:/me + */ + export namespace GetMe { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetMeData; + } +} + +export namespace History { + /** + * @description The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. + * @tags User + * @name HistoryList + * @summary User Activity + * @request GET:/history + */ + export namespace HistoryList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * Number of items to retrieve. Default is 5, maximum is 100. + * @format int32 + */ + limit?: number; + /** + * Offset the list of returned results by this amount. Default is zero. + * @format int32 + */ + offset?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = HistoryListData; + } +} + +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://api.uber.com/v1"; + 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.clone() 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 Uber API + * @version 1.0.0 + * @baseUrl https://api.uber.com/v1 + * + * Move your app forward with the Uber API + */ +export class Api extends HttpClient { + products = { + /** + * @description The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order. + * + * @tags Products + * @name ProductsList + * @summary Product Types + * @request GET:/products + * @secure + */ + productsList: (query: ProductsListParams, params: RequestParams = {}) => + this.request({ + path: \`/products\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + }; + estimates = { + /** + * @description The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.

The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier. + * + * @tags Estimates + * @name PriceList + * @summary Price Estimates + * @request GET:/estimates/price + */ + priceList: (query: PriceListParams, params: RequestParams = {}) => + this.request({ + path: \`/estimates/price\`, + method: "GET", + query: query, + ...params, + }), + + /** + * @description The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. + * + * @tags Estimates + * @name TimeList + * @summary Time Estimates + * @request GET:/estimates/time + */ + timeList: (query: TimeListParams, params: RequestParams = {}) => + this.request({ + path: \`/estimates/time\`, + method: "GET", + query: query, + ...params, + }), + }; + me = { + /** + * @description The User Profile endpoint returns information about the Uber user that has authorized with the application. + * + * @tags User + * @name GetMe + * @summary User Profile + * @request GET:/me + */ + getMe: (params: RequestParams = {}) => + this.request({ + path: \`/me\`, + method: "GET", + ...params, + }), + }; + history = { + /** + * @description The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. + * + * @tags User + * @name HistoryList + * @summary User Activity + * @request GET:/history + */ + historyList: (query: HistoryListParams, params: RequestParams = {}) => + this.request({ + path: \`/history\`, + method: "GET", + query: query, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'up-banking' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** Provides information about an Up bank account. */ +export interface AccountResource { + attributes: { + /** The bank account type of this account. */ + accountType: AccountTypeEnum; + /** + * The available balance of the account, taking into account any amounts + * that are currently on hold. + */ + balance: MoneyObject; + /** + * The date-time at which this account was first opened. + * @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; + links?: { + /** The canonical link to this resource within the API. */ + self: string; + }; + relationships: { + transactions: { + links?: { + /** The link to retrieve the related resource(s) in this relationship. */ + related: string; + }; + }; + }; + /** The type of this resource: \`accounts\` */ + type: string; +} + +/** + * Specifies the type of bank account. Currently returned values are \`SAVER\` + * and \`TRANSACTIONAL\`. + */ +export enum AccountTypeEnum { + SAVER = "SAVER", + TRANSACTIONAL = "TRANSACTIONAL", +} + +export type AccountsDetailData = GetAccountResponse; + +export type AccountsListData = ListAccountsResponse; + +export interface AccountsListParams { + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; +} + +/** + * Provides information about an instant reimbursement in the form of + * cashback. + */ +export interface CashbackObject { + /** The total amount of cashback paid, represented as a positive value. */ + amount: MoneyObject; + /** A brief description of why this cashback was paid. */ + description: string; +} + +export type CategoriesDetailData = GetCategoryResponse; + +export type CategoriesListData = ListCategoriesResponse; + +export interface CategoriesListParams { + /** + * The unique identifier of a parent category for which to + * return only its children. Providing an invalid category + * identifier results in a \`404\` response. + * @example "good-life" + */ + "filter[parent]"?: string; +} + +/** Provides information about a category and its ancestry. */ +export interface CategoryResource { + attributes: { + /** The name of this category as seen in the Up application. */ + name: string; + }; + /** + * The unique identifier for this category. This is a human-readable but + * URL-safe value. + */ + id: string; + links?: { + /** The canonical link to this resource within the API. */ + self: string; + }; + relationships: { + children: { + data: { + /** The unique identifier of the resource within its type. */ + id: string; + /** The type of this resource: \`categories\` */ + type: string; + }[]; + links?: { + /** The link to retrieve the related resource(s) in this relationship. */ + related: string; + }; + }; + parent: { + data: { + /** 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; + }; + }; + }; + /** The type of this resource: \`categories\` */ + type: string; +} + +/** + * Request to create a new webhook. This currently only requires a \`url\` + * attribute. + */ +export interface CreateWebhookRequest { + /** The webhook resource to create. */ + data: WebhookInputResource; +} + +/** Successful response after creating a webhook. */ +export interface CreateWebhookResponse { + /** The webhook that was created. */ + data: WebhookResource; +} + +/** Provides information about an error processing a request. */ +export interface ErrorObject { + /** + * A detailed description of this error. This should be considered unique + * to individual occurrences of an error and subject to change. It is + * useful for debugging purposes. + */ + detail: string; + /** + * If applicable, location in the request that this error relates to. This + * may be a parameter in the query string, or a an attribute in the + * request body. + */ + source?: { + /** + * If this error relates to a query parameter, the name of the + * parameter. + */ + parameter?: string; + /** + * If this error relates to an attribute in the request body, a + * rfc-6901 JSON pointer to the attribute. + */ + pointer?: string; + }; + /** + * The HTTP status code associated with this error. This can also be + * obtained from the response headers. The status indicates the broad type + * of error according to HTTP semantics. + */ + status: string; + /** + * A short description of this error. This should be stable across + * multiple occurrences of this type of error and typically expands on the + * reason for the status code. + */ + title: string; +} + +/** Generic error response that returns one or more errors. */ +export interface ErrorResponse { + /** The list of errors returned in this response. */ + errors: ErrorObject[]; +} + +/** Successful response to get a single account. */ +export interface GetAccountResponse { + /** The account returned in this response. */ + data: AccountResource; +} + +/** Successful response to get a single category and its ancestry. */ +export interface GetCategoryResponse { + /** The category returned in this response. */ + data: CategoryResource; +} + +/** Successful response to get a single transaction. */ +export interface GetTransactionResponse { + /** The transaction returned in this response. */ + data: TransactionResource; +} + +/** Successful response to get a single webhook. */ +export interface GetWebhookResponse { + /** The webhook returned in this response. */ + data: WebhookResource; +} + +/** + * Provides information about the amount at which a transaction was in the + * \`HELD\` status. + */ +export interface HoldInfoObject { + /** + * The amount of this transaction while in the \`HELD\` status, in + * Australian dollars. + */ + amount: MoneyObject; + /** + * The foreign currency amount of this transaction while in the \`HELD\` + * status. This field will be \`null\` for domestic transactions. The amount + * was converted to the AUD amount reflected in the \`amount\` field. + */ + foreignAmount: MoneyObject | null; +} + +/** + * Successful response to get all accounts. This returns a paginated list of + * accounts, which can be scrolled by following the \`prev\` and \`next\` links + * if present. + */ +export interface ListAccountsResponse { + /** The list of accounts returned in this response. */ + data: AccountResource[]; + links: { + /** + * 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; + }; +} + +/** + * Successful response to get all categories and their ancestry. The + * returned list is not paginated. + */ +export interface ListCategoriesResponse { + /** The list of categories returned in this response. */ + data: CategoryResource[]; +} + +/** + * Successful response to get all tags. This returns a paginated list of + * tags, which can be scrolled by following the \`prev\` and \`next\` links if + * present. + */ +export interface ListTagsResponse { + /** The list of tags returned in this response. */ + data: TagResource[]; + links: { + /** + * 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; + }; +} + +/** + * Successful response to get all transactions. This returns a paginated + * list of transactions, which can be scrolled by following the \`prev\` and + * \`next\` links if present. + */ +export interface ListTransactionsResponse { + /** The list of transactions returned in this response. */ + data: TransactionResource[]; + links: { + /** + * 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; + }; +} + +/** + * Successful response to get all delivery logs for a webhook. This returns + * a paginated list of delivery logs, which can be scrolled by following the + * \`next\` and \`prev\` links if present. + */ +export interface ListWebhookDeliveryLogsResponse { + /** The list of delivery logs returned in this response. */ + data: WebhookDeliveryLogResource[]; + links: { + /** + * 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; + }; +} + +/** + * Successful response to get all webhooks. This returns a paginated list of + * webhooks, which can be scrolled by following the \`prev\` and \`next\` links + * if present. + */ +export interface ListWebhooksResponse { + /** The list of webhooks returned in this response. */ + data: WebhookResource[]; + links: { + /** + * 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; + }; +} + +export type LogsDetailData = ListWebhookDeliveryLogsResponse; + +export interface LogsDetailParams { + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; + /** + * The unique identifier for the webhook. + * @example "49733526-b90d-436a-8a75-9715a1d7cc5b" + */ + webhookId: string; +} + +/** Provides information about a value of money. */ +export interface MoneyObject { + /** The ISO 4217 currency code. */ + currencyCode: string; + /** + * The amount of money, formatted as a string in the relevant currency. + * For example, for an Australian dollar value of $10.56, this field will + * be \`"10.56"\`. The currency symbol is not included in the string. + */ + value: string; + /** + * The amount of money in the smallest denomination for the currency, as a + * 64-bit integer. For example, for an Australian dollar value of $10.56, + * this field will be \`1056\`. + */ + valueInBaseUnits: number; +} + +export type PingCreateData = WebhookEventCallback; + +export type PingListData = PingResponse; + +export type PingListError = ErrorResponse; + +/** Basic ping response to verify authentication. */ +export interface PingResponse { + meta: { + /** The unique identifier of the authenticated customer. */ + id: string; + /** A cute emoji that represents the response status. */ + statusEmoji: string; + }; +} + +export type RelationshipsTagsCreateData = any; + +export type RelationshipsTagsDeleteData = any; + +/** + * Provides information about how a Round Up was applied, such as whether or + * not a boost was included in the Round Up. + */ +export interface RoundUpObject { + /** + * The total amount of this Round Up, including any boosts, represented as + * a negative value. + */ + amount: MoneyObject; + /** + * The portion of the Round Up \`amount\` owing to boosted Round Ups, + * represented as a negative value. If no boost was added to the Round Up + * this field will be \`null\`. + */ + boostPortion: MoneyObject | null; +} + +/** Bla bla bla foo bar baz */ +export enum SomeEnumName { + Foo = "Foo", + Bar = "Bar", + Baz = "Baz", + Bad = "Bad", +} + +/** Uniquely identifies a single tag in the API. */ +export interface TagInputResourceIdentifier { + /** The label of the tag, which also acts as the tag’s unique identifier. */ + id: string; + /** The type of this resource: \`tags\` */ + type: string; +} + +/** Provides information about a tag. */ +export interface TagResource { + /** The label of the tag, which also acts as the tag’s unique identifier. */ + id: string; + relationships: { + transactions: { + links?: { + /** The link to retrieve the related resource(s) in this relationship. */ + related: string; + }; + }; + }; + /** The type of this resource: \`tags\` */ + type: string; +} + +export type TagsListData = ListTagsResponse; + +export interface TagsListParams { + /** + * The number of records to return in each page. + * @example 50 + */ + "page[size]"?: number; +} + +export interface TransactionResource { + attributes: { + /** + * 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. + */ + amount: MoneyObject; + /** + * If all or part of this transaction was instantly reimbursed in the + * form of cashback, details of the reimbursement. + */ + 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; + /** + * 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. + */ + 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 + * transaction while \`HELD\`. + */ + holdInfo: HoldInfoObject | null; + /** + * Attached message for this transaction, such as a payment message, or a + * transfer note. + */ + message: string | null; + /** + * 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. + */ + rawText: string | null; + /** + * Details of how this transaction was rounded-up. If no Round Up was + * applied this field will be \`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. + * @format date-time + */ + settledAt: string | null; + /** + * The current processing status of this transaction, according to + * whether or not this transaction has settled or is still held. + */ + status: TransactionStatusEnum; + }; + /** The unique identifier for this transaction. */ + id: string; + links?: { + /** The canonical link to this resource within the API. */ + self: string; + }; + relationships: { + account: { + data: { + /** 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. */ + related: string; + }; + }; + category: { + data: { + /** 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; + }; + }; + parentCategory: { + data: { + /** 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; + }; + }; + tags: { + data: { + /** 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?: { + /** + * The link to retrieve or modify linkage between this resources and the + * related resource(s) in this relationship. + */ + self: string; + }; + }; + }; + /** The type of this resource: \`transactions\` */ + type: string; +} + +/** + * Specifies which stage of processing a transaction is currently at. + * Currently returned values are \`HELD\` and \`SETTLED\`. When a transaction is + * held, its account’s \`availableBalance\` is affected. When a transaction is + * settled, its account’s \`currentBalance\` is affected. + */ +export enum TransactionStatusEnum { + HELD = "HELD", + SETTLED = "SETTLED", +} + +export type TransactionsDetailData = GetTransactionResponse; + +export interface TransactionsDetailParams1 { + /** + * The category identifier for which to filter transactions. + * Both parent and child categories can be filtered through + * this parameter. Providing an invalid category identifier + * results in a \`404\` response. + * @example "good-life" + */ + "filter[category]"?: string; + /** + * The start date-time from which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-01-01T01:02:03+10:00" + */ + "filter[since]"?: string; + /** + * The transaction status for which to return records. This + * can be used to filter \`HELD\` transactions from those + * that are \`SETTLED\`. + * @example "HELD" + */ + "filter[status]"?: TransactionStatusEnum; + /** + * A transaction tag to filter for which to return records. + * If the tag does not exist, zero records are returned and + * a success response is given. + * @example "Holiday" + */ + "filter[tag]"?: string; + /** + * The end date-time up to which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-02-01T01:02:03+10:00" + */ + "filter[until]"?: string; + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; + /** + * The unique identifier for the account. + * @example "86150b64-feaa-4186-a7e4-e84eae764602" + */ + accountId: string; +} + +export type TransactionsDetailResult = ListTransactionsResponse; + +export type TransactionsListData = ListTransactionsResponse; + +export interface TransactionsListParams { + /** + * The category identifier for which to filter transactions. + * Both parent and child categories can be filtered through + * this parameter. Providing an invalid category identifier + * results in a \`404\` response. + * @example "good-life" + */ + "filter[category]"?: string; + /** + * The start date-time from which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-01-01T01:02:03+10:00" + */ + "filter[since]"?: string; + /** + * The transaction status for which to return records. This + * can be used to filter \`HELD\` transactions from those + * that are \`SETTLED\`. + * @example "HELD" + */ + "filter[status]"?: TransactionStatusEnum; + /** + * A transaction tag to filter for which to return records. + * If the tag does not exist, zero records are returned and + * a success response is given. + * @example "Holiday" + */ + "filter[tag]"?: string; + /** + * The end date-time up to which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-02-01T01:02:03+10:00" + */ + "filter[until]"?: string; + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; + /** Blablabla bla */ + someEnumName?: SomeEnumName; +} + +/** Request to add or remove tags associated with a transaction. */ +export interface UpdateTransactionTagsRequest { + /** The tags to add to or remove from the transaction. */ + data: TagInputResourceIdentifier[]; +} + +/** + * Provides historical webhook event delivery information for analysis and + * debugging purposes. + */ +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. */ + body: string; + }; + /** Information about the response that was received from the webhook URL. */ + response: { + /** The payload that was received in the response body. */ + body: string; + /** The HTTP status code received in the response. */ + statusCode: number; + } | null; + }; + /** The unique identifier for this log entry. */ + id: string; + relationships: { + webhookEvent: { + data: { + /** The unique identifier of the resource within its type. */ + id: string; + /** The type of this resource: \`webhook-events\` */ + type: string; + }; + }; + }; + /** The type of this resource: \`webhook-delivery-logs\` */ + type: string; +} + +/** + * Specifies the nature of the success or failure of a webhook delivery + * attempt to the subscribed webhook URL. The currently returned values are + * described below: + * + * - **\`DELIVERED\`**: The event was delivered to the webhook URL + * successfully and a \`200\` response was received. + * - **\`UNDELIVERABLE\`**: The webhook URL was not reachable, or timed out. + * - **\`BAD_RESPONSE_CODE\`**: The event was delivered to the webhook URL + * but a non-\`200\` response was received. + */ +export enum WebhookDeliveryStatusEnum { + DELIVERED = "DELIVERED", + UNDELIVERABLE = "UNDELIVERABLE", + BAD_RESPONSE_CODE = "BAD_RESPONSE_CODE", +} + +/** Asynchronous callback request used for webhook event delivery. */ +export interface WebhookEventCallback { + /** The webhook event data sent to the subscribed webhook. */ + data: WebhookEventResource; +} + +/** + * Provides the event data used in asynchronous webhook event callbacks to + * subscribed endpoints. Webhooks events have defined \`eventType\`s and may + * optionally relate to other resources within the Up API. + */ +export interface WebhookEventResource { + attributes: { + /** + * 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 + * delivery retries. + */ + id: string; + relationships: { + transaction?: { + data: { + /** 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; + }; + }; + webhook: { + data: { + /** 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. */ + related: string; + }; + }; + }; + /** The type of this resource: \`webhook-events\` */ + type: string; +} + +/** + * Specifies the type of a webhook event. This can be used to determine what + * action to take in response to the event, such as which relationships to + * expect. + */ +export enum WebhookEventTypeEnum { + TRANSACTION_CREATED = "TRANSACTION_CREATED", + TRANSACTION_SETTLED = "TRANSACTION_SETTLED", + TRANSACTION_DELETED = "TRANSACTION_DELETED", + PING = "PING", +} + +/** 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; + }; +} + +/** Provides information about a webhook. */ +export interface WebhookResource { + attributes: { + /** + * 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. + */ + description: string | null; + /** + * A shared secret key used to sign all webhook events sent to the + * configured webhook URL. This field is returned only once, upon the + * initial creation of the webhook. If lost, create a new webhook and + * delete this webhook. + * + * The webhook URL receives a request with a + * \`X-Up-Authenticity-Signature\` header, which is the SHA-256 HMAC of + * the entire raw request body signed using this \`secretKey\`. It is + * advised to compute and check this signature to verify the + * authenticity of requests sent to the webhook URL. See + * [Handling webhook events](#callback_post_webhookURL) for full + * details. + */ + secretKey?: string; + /** The URL that this webhook is configured to \`POST\` events to. */ + url: string; + }; + /** The unique identifier for this webhook. */ + id: string; + links?: { + /** The canonical link to this resource within the API. */ + self: string; + }; + relationships: { + logs: { + links?: { + /** The link to retrieve the related resource(s) in this relationship. */ + related: string; + }; + }; + }; + /** The type of this resource: \`webhooks\` */ + type: string; +} + +export type WebhooksCreateData = CreateWebhookResponse; + +export type WebhooksDeleteData = any; + +export type WebhooksDetailData = GetWebhookResponse; + +export type WebhooksListData = ListWebhooksResponse; + +export interface WebhooksListParams { + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; +} + +export namespace Accounts { + /** + * @description Retrieve a specific account by providing its unique identifier. + * @tags Accounts + * @name AccountsDetail + * @summary Retrieve account + * @request GET:/accounts/{id} + * @secure + */ + export namespace AccountsDetail { + export type RequestParams = { + /** + * The unique identifier for the account. + * @example "9842e43e-a1f9-4460-a252-364c86df2d3e" + */ + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AccountsDetailData; + } + /** + * @description Retrieve a paginated list of all accounts for the currently authenticated user. The returned list is paginated and can be scrolled by following the \`prev\` and \`next\` links where present. + * @tags Accounts + * @name AccountsList + * @summary List accounts + * @request GET:/accounts + * @secure + */ + export namespace AccountsList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = AccountsListData; + } + /** + * @description Retrieve a list of all transactions for a specific account. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. To narrow the results to a specific date range pass one or both of \`filter[since]\` and \`filter[until]\` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last. + * @tags Transactions + * @name TransactionsDetail + * @summary List transactions by account + * @request GET:/accounts/{accountId}/transactions + * @secure + */ + export namespace TransactionsDetail { + export type RequestParams = { + /** + * The unique identifier for the account. + * @example "86150b64-feaa-4186-a7e4-e84eae764602" + */ + accountId: string; + }; + export type RequestQuery = { + /** + * The category identifier for which to filter transactions. + * Both parent and child categories can be filtered through + * this parameter. Providing an invalid category identifier + * results in a \`404\` response. + * @example "good-life" + */ + "filter[category]"?: string; + /** + * The start date-time from which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-01-01T01:02:03+10:00" + */ + "filter[since]"?: string; + /** + * The transaction status for which to return records. This + * can be used to filter \`HELD\` transactions from those + * that are \`SETTLED\`. + * @example "HELD" + */ + "filter[status]"?: TransactionStatusEnum; + /** + * A transaction tag to filter for which to return records. + * If the tag does not exist, zero records are returned and + * a success response is given. + * @example "Holiday" + */ + "filter[tag]"?: string; + /** + * The end date-time up to which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-02-01T01:02:03+10:00" + */ + "filter[until]"?: string; + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TransactionsDetailResult; + } +} + +export namespace Categories { + /** + * @description Retrieve a specific category by providing its unique identifier. + * @tags Categories + * @name CategoriesDetail + * @summary Retrieve category + * @request GET:/categories/{id} + * @secure + */ + export namespace CategoriesDetail { + export type RequestParams = { + /** + * The unique identifier for the category. + * @example "restaurants-and-cafes" + */ + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CategoriesDetailData; + } + /** + * @description Retrieve a list of all categories and their ancestry. The returned list is not paginated. + * @tags Categories + * @name CategoriesList + * @summary List categories + * @request GET:/categories + * @secure + */ + export namespace CategoriesList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * The unique identifier of a parent category for which to + * return only its children. Providing an invalid category + * identifier results in a \`404\` response. + * @example "good-life" + */ + "filter[parent]"?: string; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = CategoriesListData; + } +} + +export namespace Util { + /** + * @description Make a basic ping request to the API. This is useful to verify that authentication is functioning correctly. On authentication success an HTTP \`200\` status is returned. On failure an HTTP \`401\` error response is returned. + * @tags Utility endpoints + * @name PingList + * @summary Ping + * @request GET:/util/ping + * @secure + */ + export namespace PingList { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PingListData; + } +} + +export namespace Tags { + /** + * @description Retrieve a list of all tags currently in use. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered lexicographically. The \`transactions\` relationship for each tag exposes a link to get the transactions with the given tag. + * @tags Tags + * @name TagsList + * @summary List tags + * @request GET:/tags + * @secure + */ + export namespace TagsList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * The number of records to return in each page. + * @example 50 + */ + "page[size]"?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TagsListData; + } +} + +export namespace Transactions { + /** + * @description Associates one or more tags with a specific transaction. No more than 6 tags may be present on any single transaction. Duplicate tags are silently ignored. An HTTP \`204\` is returned on success. The associated tags, along with this request URL, are also exposed via the \`tags\` relationship on the transaction resource returned from \`/transactions/{id}\`. + * @tags Tags + * @name RelationshipsTagsCreate + * @summary Add tags to transaction + * @request POST:/transactions/{transactionId}/relationships/tags + * @secure + */ + export namespace RelationshipsTagsCreate { + export type RequestParams = { + /** + * The unique identifier for the transaction. + * @example "d024c1b8-bc6a-4785-afc6-cd332d2a2efb" + */ + transactionId: string; + }; + export type RequestQuery = {}; + export type RequestBody = UpdateTransactionTagsRequest; + export type RequestHeaders = {}; + export type ResponseBody = RelationshipsTagsCreateData; + } + /** + * @description Disassociates one or more tags from a specific transaction. Tags that are not associated are silently ignored. An HTTP \`204\` is returned on success. The associated tags, along with this request URL, are also exposed via the \`tags\` relationship on the transaction resource returned from \`/transactions/{id}\`. + * @tags Tags + * @name RelationshipsTagsDelete + * @summary Remove tags from transaction + * @request DELETE:/transactions/{transactionId}/relationships/tags + * @secure + */ + export namespace RelationshipsTagsDelete { + export type RequestParams = { + /** + * The unique identifier for the transaction. + * @example "d8c190d6-be35-4d64-b2c4-e1aa0c09a0e0" + */ + transactionId: string; + }; + export type RequestQuery = {}; + export type RequestBody = UpdateTransactionTagsRequest; + export type RequestHeaders = {}; + export type ResponseBody = RelationshipsTagsDeleteData; + } + /** + * @description Retrieve a specific transaction by providing its unique identifier. + * @tags Transactions + * @name TransactionsDetail + * @summary Retrieve transaction + * @request GET:/transactions/{id} + * @secure + */ + export namespace TransactionsDetail { + export type RequestParams = { + /** + * The unique identifier for the transaction. + * @example "8e1da97e-6490-42eb-9c18-d8fdd94cfddc" + */ + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TransactionsDetailData; + } + /** + * @description Retrieve a list of all transactions across all accounts for the currently authenticated user. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. To narrow the results to a specific date range pass one or both of \`filter[since]\` and \`filter[until]\` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last. + * @tags Transactions + * @name TransactionsList + * @summary List transactions + * @request GET:/transactions + * @secure + */ + export namespace TransactionsList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * The category identifier for which to filter transactions. + * Both parent and child categories can be filtered through + * this parameter. Providing an invalid category identifier + * results in a \`404\` response. + * @example "good-life" + */ + "filter[category]"?: string; + /** + * The start date-time from which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-01-01T01:02:03+10:00" + */ + "filter[since]"?: string; + /** + * The transaction status for which to return records. This + * can be used to filter \`HELD\` transactions from those + * that are \`SETTLED\`. + * @example "HELD" + */ + "filter[status]"?: TransactionStatusEnum; + /** + * A transaction tag to filter for which to return records. + * If the tag does not exist, zero records are returned and + * a success response is given. + * @example "Holiday" + */ + "filter[tag]"?: string; + /** + * The end date-time up to which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-02-01T01:02:03+10:00" + */ + "filter[until]"?: string; + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; + /** Blablabla bla */ + someEnumName?: SomeEnumName; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = TransactionsListData; + } +} + +export namespace Webhooks { + /** + * @description Retrieve a list of delivery logs for a webhook by providing its unique identifier. This is useful for analysis and debugging purposes. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered newest first to oldest last. Logs may be automatically purged after a period of time. + * @tags Webhooks + * @name LogsDetail + * @summary List webhook logs + * @request GET:/webhooks/{webhookId}/logs + * @secure + */ + export namespace LogsDetail { + export type RequestParams = { + /** + * The unique identifier for the webhook. + * @example "49733526-b90d-436a-8a75-9715a1d7cc5b" + */ + webhookId: string; + }; + export type RequestQuery = { + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = LogsDetailData; + } + /** + * @description Send a \`PING\` event to a webhook by providing its unique identifier. This is useful for testing and debugging purposes. The event is delivered asynchronously and its data is returned in the response to this request. + * @tags Webhooks + * @name PingCreate + * @summary Ping webhook + * @request POST:/webhooks/{webhookId}/ping + * @secure + */ + export namespace PingCreate { + export type RequestParams = { + /** + * The unique identifier for the webhook. + * @example "6ef4bb23-53f1-4a3d-aa5c-a6e9121c5da3" + */ + webhookId: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = PingCreateData; + } + /** + * @description Create a new webhook with a given URL. The URL will receive webhook events as JSON-encoded \`POST\` requests. The URL must respond with a HTTP \`200\` status on success. There is currently a limit of 10 webhooks at any given time. Once this limit is reached, existing webhooks will need to be deleted before new webhooks can be created. Event delivery is retried with exponential backoff if the URL is unreachable or it does not respond with a \`200\` status. The response includes a \`secretKey\` attribute, which is used to sign requests sent to the webhook URL. It will not be returned from any other endpoints within the Up API. If the \`secretKey\` is lost, simply create a new webhook with the same URL, capture its \`secretKey\` and then delete the original webhook. See [Handling webhook events](#callback_post_webhookURL) for details on how to process webhook events. It is probably a good idea to test the webhook by [sending it a \`PING\` event](#post_webhooks_webhookId_ping) after creating it. + * @tags Webhooks + * @name WebhooksCreate + * @summary Create webhook + * @request POST:/webhooks + * @secure + */ + export namespace WebhooksCreate { + export type RequestParams = {}; + export type RequestQuery = {}; + export type RequestBody = CreateWebhookRequest; + export type RequestHeaders = {}; + export type ResponseBody = WebhooksCreateData; + } + /** + * @description Delete a specific webhook by providing its unique identifier. Once deleted, webhook events will no longer be sent to the configured URL. + * @tags Webhooks + * @name WebhooksDelete + * @summary Delete webhook + * @request DELETE:/webhooks/{id} + * @secure + */ + export namespace WebhooksDelete { + export type RequestParams = { + /** + * The unique identifier for the webhook. + * @example "81f485ae-0e10-493d-95f3-a9c1dd4b6b6a" + */ + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = WebhooksDeleteData; + } + /** + * @description Retrieve a specific webhook by providing its unique identifier. + * @tags Webhooks + * @name WebhooksDetail + * @summary Retrieve webhook + * @request GET:/webhooks/{id} + * @secure + */ + export namespace WebhooksDetail { + export type RequestParams = { + /** + * The unique identifier for the webhook. + * @example "bc11e3ed-362e-43ab-b141-ef4f6251faa5" + */ + id: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = WebhooksDetailData; + } + /** + * @description Retrieve a list of configured webhooks. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered oldest first to newest last. + * @tags Webhooks + * @name WebhooksList + * @summary List webhooks + * @request GET:/webhooks + * @secure + */ + export namespace WebhooksList { + export type RequestParams = {}; + export type RequestQuery = { + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = WebhooksListData; + } +} + +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://api.up.com.au/api/v1"; + 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.clone() 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 Up API + * @version v1 + * @baseUrl https://api.up.com.au/api/v1 + * @contact API Specification and Support (https://github.com/up-banking/api) + * + * The Up API gives you programmatic access to your balances and + * transaction data. You can request past transactions or set up + * webhooks to receive real-time events when new transactions hit your + * account. It’s new, it’s exciting and it’s just the beginning. + */ +export class Api extends HttpClient { + accounts = { + /** + * @description Retrieve a specific account by providing its unique identifier. + * + * @tags Accounts + * @name AccountsDetail + * @summary Retrieve account + * @request GET:/accounts/{id} + * @secure + */ + accountsDetail: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/accounts/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description Retrieve a paginated list of all accounts for the currently authenticated user. The returned list is paginated and can be scrolled by following the \`prev\` and \`next\` links where present. + * + * @tags Accounts + * @name AccountsList + * @summary List accounts + * @request GET:/accounts + * @secure + */ + accountsList: (query: AccountsListParams, params: RequestParams = {}) => + this.request({ + path: \`/accounts\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Retrieve a list of all transactions for a specific account. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. To narrow the results to a specific date range pass one or both of \`filter[since]\` and \`filter[until]\` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last. + * + * @tags Transactions + * @name TransactionsDetail + * @summary List transactions by account + * @request GET:/accounts/{accountId}/transactions + * @secure + */ + transactionsDetail: ({ accountId, ...query }: TransactionsDetailParams1, params: RequestParams = {}) => + this.request({ + path: \`/accounts/\${accountId}/transactions\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + }; + categories = { + /** + * @description Retrieve a specific category by providing its unique identifier. + * + * @tags Categories + * @name CategoriesDetail + * @summary Retrieve category + * @request GET:/categories/{id} + * @secure + */ + categoriesDetail: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/categories/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description Retrieve a list of all categories and their ancestry. The returned list is not paginated. + * + * @tags Categories + * @name CategoriesList + * @summary List categories + * @request GET:/categories + * @secure + */ + categoriesList: (query: CategoriesListParams, params: RequestParams = {}) => + this.request({ + path: \`/categories\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + }; + util = { + /** + * @description Make a basic ping request to the API. This is useful to verify that authentication is functioning correctly. On authentication success an HTTP \`200\` status is returned. On failure an HTTP \`401\` error response is returned. + * + * @tags Utility endpoints + * @name PingList + * @summary Ping + * @request GET:/util/ping + * @secure + */ + pingList: (params: RequestParams = {}) => + this.request({ + path: \`/util/ping\`, + method: "GET", + secure: true, + ...params, + }), + }; + tags = { + /** + * @description Retrieve a list of all tags currently in use. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered lexicographically. The \`transactions\` relationship for each tag exposes a link to get the transactions with the given tag. + * + * @tags Tags + * @name TagsList + * @summary List tags + * @request GET:/tags + * @secure + */ + tagsList: (query: TagsListParams, params: RequestParams = {}) => + this.request({ + path: \`/tags\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + }; + transactions = { + /** + * @description Associates one or more tags with a specific transaction. No more than 6 tags may be present on any single transaction. Duplicate tags are silently ignored. An HTTP \`204\` is returned on success. The associated tags, along with this request URL, are also exposed via the \`tags\` relationship on the transaction resource returned from \`/transactions/{id}\`. + * + * @tags Tags + * @name RelationshipsTagsCreate + * @summary Add tags to transaction + * @request POST:/transactions/{transactionId}/relationships/tags + * @secure + */ + relationshipsTagsCreate: (transactionId: string, data: UpdateTransactionTagsRequest, params: RequestParams = {}) => + this.request({ + path: \`/transactions/\${transactionId}/relationships/tags\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * @description Disassociates one or more tags from a specific transaction. Tags that are not associated are silently ignored. An HTTP \`204\` is returned on success. The associated tags, along with this request URL, are also exposed via the \`tags\` relationship on the transaction resource returned from \`/transactions/{id}\`. + * + * @tags Tags + * @name RelationshipsTagsDelete + * @summary Remove tags from transaction + * @request DELETE:/transactions/{transactionId}/relationships/tags + * @secure + */ + relationshipsTagsDelete: (transactionId: string, data: UpdateTransactionTagsRequest, params: RequestParams = {}) => + this.request({ + path: \`/transactions/\${transactionId}/relationships/tags\`, + method: "DELETE", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * @description Retrieve a specific transaction by providing its unique identifier. + * + * @tags Transactions + * @name TransactionsDetail + * @summary Retrieve transaction + * @request GET:/transactions/{id} + * @secure + */ + transactionsDetail: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/transactions/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description Retrieve a list of all transactions across all accounts for the currently authenticated user. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. To narrow the results to a specific date range pass one or both of \`filter[since]\` and \`filter[until]\` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last. + * + * @tags Transactions + * @name TransactionsList + * @summary List transactions + * @request GET:/transactions + * @secure + */ + transactionsList: (query: TransactionsListParams, params: RequestParams = {}) => + this.request({ + path: \`/transactions\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + }; + webhooks = { + /** + * @description Retrieve a list of delivery logs for a webhook by providing its unique identifier. This is useful for analysis and debugging purposes. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered newest first to oldest last. Logs may be automatically purged after a period of time. + * + * @tags Webhooks + * @name LogsDetail + * @summary List webhook logs + * @request GET:/webhooks/{webhookId}/logs + * @secure + */ + logsDetail: ({ webhookId, ...query }: LogsDetailParams, params: RequestParams = {}) => + this.request({ + path: \`/webhooks/\${webhookId}/logs\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + + /** + * @description Send a \`PING\` event to a webhook by providing its unique identifier. This is useful for testing and debugging purposes. The event is delivered asynchronously and its data is returned in the response to this request. + * + * @tags Webhooks + * @name PingCreate + * @summary Ping webhook + * @request POST:/webhooks/{webhookId}/ping + * @secure + */ + pingCreate: (webhookId: string, params: RequestParams = {}) => + this.request({ + path: \`/webhooks/\${webhookId}/ping\`, + method: "POST", + secure: true, + ...params, + }), + + /** + * @description Create a new webhook with a given URL. The URL will receive webhook events as JSON-encoded \`POST\` requests. The URL must respond with a HTTP \`200\` status on success. There is currently a limit of 10 webhooks at any given time. Once this limit is reached, existing webhooks will need to be deleted before new webhooks can be created. Event delivery is retried with exponential backoff if the URL is unreachable or it does not respond with a \`200\` status. The response includes a \`secretKey\` attribute, which is used to sign requests sent to the webhook URL. It will not be returned from any other endpoints within the Up API. If the \`secretKey\` is lost, simply create a new webhook with the same URL, capture its \`secretKey\` and then delete the original webhook. See [Handling webhook events](#callback_post_webhookURL) for details on how to process webhook events. It is probably a good idea to test the webhook by [sending it a \`PING\` event](#post_webhooks_webhookId_ping) after creating it. + * + * @tags Webhooks + * @name WebhooksCreate + * @summary Create webhook + * @request POST:/webhooks + * @secure + */ + webhooksCreate: (data: CreateWebhookRequest, params: RequestParams = {}) => + this.request({ + path: \`/webhooks\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + ...params, + }), + + /** + * @description Delete a specific webhook by providing its unique identifier. Once deleted, webhook events will no longer be sent to the configured URL. + * + * @tags Webhooks + * @name WebhooksDelete + * @summary Delete webhook + * @request DELETE:/webhooks/{id} + * @secure + */ + webhooksDelete: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/webhooks/\${id}\`, + method: "DELETE", + secure: true, + ...params, + }), + + /** + * @description Retrieve a specific webhook by providing its unique identifier. + * + * @tags Webhooks + * @name WebhooksDetail + * @summary Retrieve webhook + * @request GET:/webhooks/{id} + * @secure + */ + webhooksDetail: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/webhooks/\${id}\`, + method: "GET", + secure: true, + ...params, + }), + + /** + * @description Retrieve a list of configured webhooks. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered oldest first to newest last. + * + * @tags Webhooks + * @name WebhooksList + * @summary List webhooks + * @request GET:/webhooks + * @secure + */ + webhooksList: (query: WebhooksListParams, params: RequestParams = {}) => + this.request({ + path: \`/webhooks\`, + method: "GET", + query: query, + secure: true, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'uspto' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +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; + /** + * The URL describing the dataset's fields + * @format uriref + */ + apiUrl?: string; + /** To be used as a version parameter value */ + apiVersionNumber?: string; + }[]; + total?: number; +} + +export type ListDataSetsData = DataSetList; + +export type ListSearchableFieldsData = string; + +export type ListSearchableFieldsError = string; + +export type PerformSearchData = Record[]; + +export interface PerformSearchPayload { + /** + * Uses Lucene Query Syntax in the format of propertyName:value, propertyName:[num1 TO num2] and date range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the response please see the 'docs' element which has the list of record objects. Each record structure would consist of all the fields and their corresponding values. + * @default "*:*" + */ + criteria: string; + /** + * Specify number of rows to be returned. If you run the search with default values, in the response you will see 'numFound' attribute which will tell the number of records available in the dataset. + * @default 100 + */ + rows?: number; + /** + * Starting record number. Default value is 0. + * @default 0 + */ + start?: number; +} + +export enum SomeEnum { + Foo = "Foo", + Bar = "Bar", + FooBar = "Foo Bar", +} + +export enum Status { + Resolved = "resolved", + New = "new", + InProgress = "in progress", +} + +export namespace Dataset { + /** + * @description This GET API returns the list of all the searchable field names that are in the oa_citations. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the syntax options shown below. + * @tags metadata + * @name ListSearchableFields + * @summary Provides the general information about the API and the list of fields that can be used to query the dataset. + * @request GET:/{dataset}/{version}/fields + */ + export namespace ListSearchableFields { + export type RequestParams = { + /** + * Name of the dataset. + * @example "oa_citations" + */ + dataset: string; + /** + * Version of the dataset. + * @example "v1" + */ + version: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = ListSearchableFieldsData; + } + /** + * @description This API is based on Solr/Lucense Search. The data is indexed using SOLR. This GET API returns the list of all the searchable field names that are in the Solr Index. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the Solr/Lucene Syntax. Please refer https://lucene.apache.org/core/3_6_2/queryparsersyntax.html#Overview for the query syntax. List of field names that are searchable can be determined using above GET api. + * @tags search + * @name PerformSearch + * @summary Provides search capability for the data set with the given search criteria. + * @request POST:/{dataset}/{version}/records + */ + export namespace PerformSearch { + export type RequestParams = { + /** + * Name of the dataset. In this case, the default value is oa_citations + * @default "oa_citations" + */ + dataset: string; + /** + * Version of the dataset. + * @default "v1" + */ + version: string; + }; + export type RequestQuery = {}; + export type RequestBody = PerformSearchPayload; + export type RequestHeaders = {}; + export type ResponseBody = PerformSearchData; + } +} + +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 = "{scheme}://developer.uspto.gov/ds-api"; + 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.clone() 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 USPTO Data Set API + * @version 1.0.0 + * @baseUrl {scheme}://developer.uspto.gov/ds-api + * @contact Open Data Portal (https://developer.uspto.gov) + * + * The Data Set API (DSAPI) allows the public users to discover and search USPTO exported data sets. This is a generic API that allows USPTO users to make any CSV based data files searchable through API. With the help of GET call, it returns the list of data fields that are searchable. With the help of POST call, data can be fetched based on the filters on the field names. Please note that POST call is used to search the actual data. The reason for the POST call is that it allows users to specify any complex search criteria without worry about the GET size limitations as well as encoding of the input parameters. + */ +export class Api extends HttpClient { + /** + * No description + * + * @tags metadata + * @name ListDataSets + * @summary List available data sets + * @request GET:/ + */ + listDataSets = (params: RequestParams = {}) => + this.request({ + path: \`/\`, + method: "GET", + ...params, + }); + + dataset = { + /** + * @description This GET API returns the list of all the searchable field names that are in the oa_citations. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the syntax options shown below. + * + * @tags metadata + * @name ListSearchableFields + * @summary Provides the general information about the API and the list of fields that can be used to query the dataset. + * @request GET:/{dataset}/{version}/fields + */ + listSearchableFields: (dataset: string, version: string, params: RequestParams = {}) => + this.request({ + path: \`/\${dataset}/\${version}/fields\`, + method: "GET", + ...params, + }), + + /** + * @description This API is based on Solr/Lucense Search. The data is indexed using SOLR. This GET API returns the list of all the searchable field names that are in the Solr Index. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the Solr/Lucene Syntax. Please refer https://lucene.apache.org/core/3_6_2/queryparsersyntax.html#Overview for the query syntax. List of field names that are searchable can be determined using above GET api. + * + * @tags search + * @name PerformSearch + * @summary Provides search capability for the data set with the given search criteria. + * @request POST:/{dataset}/{version}/records + */ + performSearch: (version: string, dataset: string, data: PerformSearchPayload, params: RequestParams = {}) => + this.request({ + path: \`/\${dataset}/\${version}/records\`, + method: "POST", + body: data, + type: ContentType.UrlEncoded, + ...params, + }), + }; +} +" +`; + +exports[`extended > 'wrong-enum-subtypes' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type Test = { + x?: TestXEnum[]; +} & { + y?: string; +}; + +export enum TestXEnum { + AB = "A-B", +} + +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.clone() 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 Test + * @version test + */ +export class Api extends HttpClient {} +" +`; + +exports[`extended > 'wrong-schema-names' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** + * Not found response + * @example "Not found" + */ +export type DF = string; + +export type GetPullRequestsByIdData = Type404; + +export type GetPullRequestsByRepositoryData = any[]; + +export interface GetPullRequestsByRepositoryParams { + slug: string; + state?: StateEnum; + username: string; +} + +export enum GetPullRequestsByRepositoryParams1StateEnum { + Open = "open", + Merged = "merged", + Declined = "declined", +} + +export type GetRepositoriesByOwnerData = any[]; + +export type GetRepositoryData = any; + +export type GetUserByNameData = any; + +export type MergePullRequestData = any; + +export enum StateEnum { + Open = "open", + Merged = "merged", + Declined = "declined", +} + +/** + * Not found response + * @example "Not found" + */ +export type Type404 = string; + +/** + * Not found response + * @example "Not found" + */ +export type Type405 = string; + +/** + * Not found response + * @example "Not found" + */ +export type TypeFF = string; + +export namespace V20 { + /** + * No description + * @name GetPullRequestsById + * @request GET:/2.0/repositories/{username}/{slug}/pullrequests/{pid} + */ + export namespace GetPullRequestsById { + export type RequestParams = { + pid: string; + slug: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetPullRequestsByIdData; + } + /** + * No description + * @name GetPullRequestsByRepository + * @request GET:/2.0/repositories/{username}/{slug}/pullrequests + */ + export namespace GetPullRequestsByRepository { + export type RequestParams = { + slug: string; + username: string; + }; + export type RequestQuery = { + state?: GetPullRequestsByRepositoryParams1StateEnum; + }; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetPullRequestsByRepositoryData; + } + /** + * No description + * @name GetRepositoriesByOwner + * @request GET:/2.0/repositories/{username} + */ + export namespace GetRepositoriesByOwner { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetRepositoriesByOwnerData; + } + /** + * No description + * @name GetRepository + * @request GET:/2.0/repositories/{username}/{slug} + */ + export namespace GetRepository { + export type RequestParams = { + slug: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetRepositoryData; + } + /** + * No description + * @name GetUserByName + * @request GET:/2.0/users/{username} + */ + export namespace GetUserByName { + export type RequestParams = { + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = GetUserByNameData; + } + /** + * No description + * @name MergePullRequest + * @request POST:/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge + */ + export namespace MergePullRequest { + export type RequestParams = { + pid: string; + slug: string; + username: string; + }; + export type RequestQuery = {}; + export type RequestBody = never; + export type RequestHeaders = {}; + export type ResponseBody = MergePullRequestData; + } +} + +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.clone() 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 Link Example + * @version 1.0.0 + */ +export class Api extends HttpClient { + v20 = { + /** + * No description + * + * @name GetPullRequestsById + * @request GET:/2.0/repositories/{username}/{slug}/pullrequests/{pid} + */ + getPullRequestsById: (username: string, slug: string, pid: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests/\${pid}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name GetPullRequestsByRepository + * @request GET:/2.0/repositories/{username}/{slug}/pullrequests + */ + getPullRequestsByRepository: ( + { username, slug, ...query }: GetPullRequestsByRepositoryParams, + params: RequestParams = {}, + ) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests\`, + method: "GET", + query: query, + ...params, + }), + + /** + * No description + * + * @name GetRepositoriesByOwner + * @request GET:/2.0/repositories/{username} + */ + getRepositoriesByOwner: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name GetRepository + * @request GET:/2.0/repositories/{username}/{slug} + */ + getRepository: (username: string, slug: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name GetUserByName + * @request GET:/2.0/users/{username} + */ + getUserByName: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/users/\${username}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @name MergePullRequest + * @request POST:/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge + */ + mergePullRequest: (username: string, slug: string, pid: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests/\${pid}/merge\`, + method: "POST", + ...params, + }), + }; +} +" +`; diff --git a/tests/generated/v3.0/full-swagger-scheme.ts b/tests/__snapshots__/simple.test.ts.snap similarity index 52% rename from tests/generated/v3.0/full-swagger-scheme.ts rename to tests/__snapshots__/simple.test.ts.snap index 4b6cb5ab..3069a13c 100644 --- a/tests/generated/v3.0/full-swagger-scheme.ts +++ b/tests/__snapshots__/simple.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`simple > 'adafruit' 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -9,8994 +12,22951 @@ * --------------------------------------------------------------- */ -export interface ActionsBillingUsage { - /** The amount of free GitHub Actions minutes available. */ - included_minutes: number; - minutes_used_breakdown: { - /** 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; - }; - /** The sum of the free and paid GitHub Actions minutes used. */ - total_minutes_used: number; - /** The total paid GitHub Actions minutes used. */ - total_paid_minutes_used: number; +export interface Activity { + action?: string; + /** @format dateTime */ + created_at?: string; + data?: object; + id?: number; + model?: string; + /** @format dateTime */ + updated_at?: string; + user_id?: number; } -/** Whether GitHub Actions is enabled on the repository. */ -export type ActionsEnabled = boolean; +export interface Block { + block_feeds?: BlockFeed[]; + column?: number; + description?: string; + key?: string; + name?: string; + row?: number; + size_x?: number; + size_y?: number; + visual_type?: string; +} -export interface ActionsEnterprisePermissions { - /** The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. */ - allowed_actions: AllowedActions; - /** The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`. */ - enabled_organizations: EnabledOrganizations; - /** The API URL to use to get or set the actions that are allowed to run, when `allowed_actions` is set to `selected`. */ - selected_actions_url?: SelectedActionsUrl; - /** The API URL to use to get or set the selected organizations that are allowed to run GitHub Actions, when `enabled_organizations` is set to `selected`. */ - selected_organizations_url?: string; +export interface BlockFeed { + feed?: Feed; + group?: Group; + id?: string; } -export interface ActionsOrganizationPermissions { - /** The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. */ - allowed_actions: AllowedActions; - /** The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`. */ - enabled_repositories: EnabledRepositories; - /** The API URL to use to get or set the actions that are allowed to run, when `allowed_actions` is set to `selected`. */ - selected_actions_url?: SelectedActionsUrl; - /** The API URL to use to get or set the selected repositories that are allowed to run GitHub Actions, when `enabled_repositories` is set to `selected`. */ - selected_repositories_url?: string; +export interface Dashboard { + blocks?: Block[]; + description?: string; + key?: string; + name?: string; } -/** - * ActionsPublicKey - * The public key used for setting Actions Secrets. - */ -export interface ActionsPublicKey { - /** @example "2011-01-26T19:01:12Z" */ +export interface Data { + completed_at?: string; created_at?: string; - /** @example 2 */ - id?: number; - /** - * The Base64 encoded public key. - * @example "hBT5WZEj8ZoOv6TYJsfWq7MxTEQopZO5/IT3ZCVQPzs=" - */ - key: string; - /** - * The identifier for the key. - * @example "1234567" - */ - key_id: string; - /** @example "ssh-rsa AAAAB3NzaC1yc2EAAA" */ - title?: string; - /** @example "https://api.github.com/user/keys/2" */ - url?: string; + created_epoch?: number; + ele?: number; + expiration?: string; + feed_id?: number; + group_id?: number; + id?: string; + lat?: number; + lon?: number; + updated_at?: string; + value?: string; } -export interface ActionsRepositoryPermissions { - /** The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. */ - allowed_actions: AllowedActions; - /** Whether GitHub Actions is enabled on the repository. */ - enabled: ActionsEnabled; - /** The API URL to use to get or set the actions that are allowed to run, when `allowed_actions` is set to `selected`. */ - selected_actions_url?: SelectedActionsUrl; +export interface DataResponse { + completed_at?: string; + created_at?: string; + created_epoch?: number; + ele?: number; + expiration?: string; + feed_id?: number; + group_id?: number; + id?: string; + lat?: number; + lon?: number; + updated_at?: string; + value?: string; } -/** - * Actions Secret - * Set secrets for GitHub Actions. - */ -export interface ActionsSecret { - /** @format date-time */ - created_at: string; - /** - * The name of the secret. - * @example "SECRET_TOKEN" - */ - name: string; - /** @format date-time */ - updated_at: string; +export interface Error { + code?: string; + message?: string; } -/** - * Actor - * Actor - */ -export interface Actor { - /** @format uri */ - avatar_url: string; - display_login?: string; - gravatar_id: string | null; - id: number; - login: string; - /** @format uri */ - url: string; +export interface Feed { + created_at?: string; + description?: string; + /** Additional details about this feed. */ + details?: { + data?: { + /** Number of data points stored by this feed. */ + count?: number; + first?: Record; + last?: Record; + }; + /** Access control list for this feed */ + shared_with?: object[]; + }; + enabled?: boolean; + group?: Record; + groups?: ShallowGroup[]; + history?: boolean; + id?: number; + key?: string; + last_value?: string; + license?: string; + name?: string; + status?: string; + /** Is status notification active? */ + status_notify?: boolean; + /** Status notification timeout in minutes. */ + status_timeout?: number; + unit_symbol?: string; + unit_type?: string; + updated_at?: string; + /** @default "private" */ + visibility?: "private" | "public" | "in progress" | "out of access"; } -/** - * The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - * @format date-time - */ -export type AlertCreatedAt = string; - -/** - * The GitHub URL of the alert resource. - * @format uri - */ -export type AlertHtmlUrl = string; - -/** The security alert number. */ -export type AlertNumber = number; - -/** - * The REST API URL of the alert resource. - * @format uri - */ -export type AlertUrl = string; - -/** The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. */ -export enum AllowedActions { - All = "all", - LocalOnly = "local_only", - Selected = "selected", +export interface Group { + created_at?: string; + description?: string; + feeds?: Feed[]; + id?: number; + name?: string; + updated_at?: string; } -/** - * Api Overview - * Api Overview - */ -export interface ApiOverview { - /** @example ["13.64.0.0/16","13.65.0.0/16"] */ - actions?: string[]; - /** @example ["127.0.0.1/32"] */ - api?: string[]; - /** @example ["127.0.0.1/32"] */ - git?: string[]; - /** @example ["127.0.0.1/32"] */ - hooks?: string[]; - /** @example ["54.158.161.132","54.226.70.38"] */ - importer?: string[]; - /** @example ["192.30.252.153/32","192.30.252.154/32"] */ - pages?: string[]; - ssh_key_fingerprints?: { - SHA256_DSA?: string; - SHA256_RSA?: string; - }; - /** @example true */ - verifiable_password_authentication: boolean; - /** @example ["127.0.0.1/32"] */ - web?: string[]; +export interface Permission { + created_at?: string; + id?: number; + /** @default "feed" */ + model?: "feed" | "group" | "dashboard"; + object_id?: number; + /** @default "public" */ + scope?: "secret" | "public" | "user" | "organization"; + scope_value?: string; + updated_at?: string; + user_id?: number; } -/** - * App Permissions - * The permissions granted to the user-to-server access token. - * @example {"contents":"read","issues":"read","deployments":"write","single_file":"read"} - */ -export interface AppPermissions { - /** The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be one of: `read` or `write`. */ - actions?: "read" | "write"; - /** The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. Can be one of: `read` or `write`. */ - administration?: "read" | "write"; - /** The level of permission to grant the access token for checks on code. Can be one of: `read` or `write`. */ - checks?: "read" | "write"; - /** The level of permission to grant the access token for notification of content references and creation content attachments. Can be one of: `read` or `write`. */ - content_references?: "read" | "write"; - /** The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges. Can be one of: `read` or `write`. */ - contents?: "read" | "write"; - /** The level of permission to grant the access token for deployments and deployment statuses. Can be one of: `read` or `write`. */ - deployments?: "read" | "write"; - /** The level of permission to grant the access token for managing repository environments. Can be one of: `read` or `write`. */ - environments?: "read" | "write"; - /** The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. Can be one of: `read` or `write`. */ - issues?: "read" | "write"; - /** The level of permission to grant the access token for organization teams and members. Can be one of: `read` or `write`. */ - members?: "read" | "write"; - /** The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. Can be one of: `read` or `write`. */ - metadata?: "read" | "write"; - /** The level of permission to grant the access token to manage access to an organization. Can be one of: `read` or `write`. */ - organization_administration?: "read" | "write"; - /** The level of permission to grant the access token to manage the post-receive hooks for an organization. Can be one of: `read` or `write`. */ - organization_hooks?: "read" | "write"; - /** The level of permission to grant the access token for viewing an organization's plan. Can be one of: `read`. */ - organization_plan?: "read"; - /** The level of permission to grant the access token to manage organization projects, columns, and cards. Can be one of: `read`, `write`, or `admin`. */ - organization_projects?: "read" | "write" | "admin"; - /** The level of permission to grant the access token to manage organization secrets. Can be one of: `read` or `write`. */ - organization_secrets?: "read" | "write"; - /** The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization. Can be one of: `read` or `write`. */ - organization_self_hosted_runners?: "read" | "write"; - /** The level of permission to grant the access token to view and manage users blocked by the organization. Can be one of: `read` or `write`. */ - organization_user_blocking?: "read" | "write"; - /** The level of permission to grant the access token for packages published to GitHub Packages. Can be one of: `read` or `write`. */ - packages?: "read" | "write"; - /** The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds. Can be one of: `read` or `write`. */ - pages?: "read" | "write"; - /** The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges. Can be one of: `read` or `write`. */ - pull_requests?: "read" | "write"; - /** The level of permission to grant the access token to manage the post-receive hooks for a repository. Can be one of: `read` or `write`. */ - repository_hooks?: "read" | "write"; - /** The level of permission to grant the access token to manage repository projects, columns, and cards. Can be one of: `read`, `write`, or `admin`. */ - repository_projects?: "read" | "write" | "admin"; - /** The level of permission to grant the access token to view and manage secret scanning alerts. Can be one of: `read` or `write`. */ - secret_scanning_alerts?: "read" | "write"; - /** The level of permission to grant the access token to manage repository secrets. Can be one of: `read` or `write`. */ - secrets?: "read" | "write"; - /** The level of permission to grant the access token to view and manage security events like code scanning alerts. Can be one of: `read` or `write`. */ - security_events?: "read" | "write"; - /** The level of permission to grant the access token to manage just a single file. Can be one of: `read` or `write`. */ - single_file?: "read" | "write"; - /** The level of permission to grant the access token for commit statuses. Can be one of: `read` or `write`. */ - statuses?: "read" | "write"; - /** The level of permission to grant the access token to manage team discussions and related comments. Can be one of: `read` or `write`. */ - team_discussions?: "read" | "write"; - /** The level of permission to grant the access token to retrieve Dependabot alerts. Can be one of: `read`. */ - vulnerability_alerts?: "read"; - /** The level of permission to grant the access token to update GitHub Actions workflow files. Can be one of: `write`. */ - workflows?: "write"; +export interface ShallowGroup { + created_at?: string; + description?: string; + id?: number; + name?: string; + updated_at?: string; } -/** - * Application Grant - * The authorization associated with an OAuth Access. - */ -export interface ApplicationGrant { - app: { - client_id: string; - name: string; - /** @format uri */ - url: string; - }; - /** - * @format date-time - * @example "2011-09-06T17:26:27Z" - */ - created_at: string; - /** @example 1 */ - id: number; - /** @example ["public_repo"] */ - scopes: string[]; - /** - * @format date-time - * @example "2011-09-06T20:39:23Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/applications/grants/1" - */ - url: string; - user?: SimpleUser | null; +export interface Token { + token?: string; } -/** - * Artifact - * An artifact - */ -export interface Artifact { - /** @example "https://api.github.com/repos/github/hello-world/actions/artifacts/5/zip" */ - archive_download_url: string; - /** @format date-time */ - created_at: string | null; - /** Whether or not the artifact has expired. */ - expired: boolean; - /** @format date-time */ - expires_at: string; - /** @example 5 */ - id: number; - /** - * The name of the artifact. - * @example "AdventureWorks.Framework" - */ - name: string; - /** @example "MDEwOkNoZWNrU3VpdGU1" */ - node_id: string; - /** - * The size in bytes of the artifact. - * @example 12345 - */ - size_in_bytes: number; - /** @format date-time */ - updated_at: string | null; - /** @example "https://api.github.com/repos/github/hello-world/actions/artifacts/5" */ - url: string; +export interface Trigger { + name?: string; } -export interface AuditLogEvent { - /** The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). */ - "@timestamp"?: number; - /** The name of the action that was performed, for example `user.login` or `repo.create`. */ - action?: string; - active?: boolean; - active_was?: boolean; - /** The actor who performed the action. */ - actor?: string; - /** The username of the account being blocked. */ - blocked_user?: string; - business?: string; - config?: any[]; - config_was?: any[]; - content_type?: string; - /** The time the audit log event was recorded, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). */ - created_at?: number; - deploy_key_fingerprint?: string; - emoji?: string; - events?: any[]; - events_were?: any[]; - explanation?: string; - fingerprint?: string; - hook_id?: number; - limited_availability?: boolean; - message?: string; +export interface User { + color?: string; + /** @format dateTime */ + created_at?: string; + id?: number; name?: string; - old_user?: string; - openssh_public_key?: string; - org?: string; - previous_visibility?: string; - read_only?: boolean; - /** The name of the repository. */ - repo?: string; - /** The name of the repository. */ - repository?: string; - repository_public?: boolean; - target_login?: string; - team?: string; - /** The type of protocol (for example, HTTP or SSH) used to transfer Git data. */ - transport_protocol?: number; - /** A human readable name for the protocol (for example, HTTP or SSH) used to transfer Git data. */ - transport_protocol_name?: string; - /** The user that was affected by the action performed (if available). */ - user?: string; - /** The repository visibility, for example `public` or `private`. */ - visibility?: string; + time_zone?: string; + /** @format dateTime */ + updated_at?: string; + username?: string; } -/** - * Authentication Token - * Authentication Token - */ -export interface AuthenticationToken { - /** - * The time this token expires - * @format date-time - * @example "2016-07-11T22:14:10Z" - */ - expires_at: string; - /** @example {"issues":"read","deployments":"write"} */ - permissions?: object; - /** The repositories this token has access to */ - repositories?: Repository[]; - /** Describe whether all repositories have been selected or there's a selection involved */ - repository_selection?: "all" | "selected"; - /** @example "config.yaml" */ - single_file?: string | null; - /** - * The token used for authentication - * @example "v1.1f699f1069f60xxx" - */ - token: string; +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; } -/** - * author_association - * How the author is associated with the repository. - * @example "OWNER" - */ -export enum AuthorAssociation { - COLLABORATOR = "COLLABORATOR", - CONTRIBUTOR = "CONTRIBUTOR", - FIRST_TIMER = "FIRST_TIMER", - FIRST_TIME_CONTRIBUTOR = "FIRST_TIME_CONTRIBUTOR", - MANNEQUIN = "MANNEQUIN", - MEMBER = "MEMBER", - NONE = "NONE", - OWNER = "OWNER", +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** - * Authorization - * The authorization for an OAuth app, GitHub App, or a Personal Access Token. - */ -export interface Authorization { - app: { - client_id: string; - name: string; - /** @format uri */ - url: string; - }; - /** @format date-time */ - created_at: string; - fingerprint: string | null; - hashed_token: string | null; - id: number; - installation?: ScopedInstallation | null; - note: string | null; - /** @format uri */ - note_url: string | null; - /** A list of scopes that this authorization is in. */ - scopes: string[] | null; - token: string; - token_last_eight: string | null; - /** @format date-time */ - updated_at: string; - /** @format uri */ - url: string; - user?: SimpleUser | null; +export interface HttpResponse extends Response { + data: D; + error: E; } -/** - * Auto merge - * The status of auto merging a pull request. - */ -export type AutoMerge = { - /** Commit message for the merge commit. */ - commit_message: string; - /** Title for the merge commit message. */ - commit_title: string; - /** Simple User */ - enabled_by: SimpleUser; - /** The merge method to use. */ - merge_method: "merge" | "squash" | "rebase"; -} | null; +type CancelToken = Symbol | string | number; -/** - * Base Gist - * Base Gist - */ -export interface BaseGist { - comments: number; - /** @format uri */ - comments_url: string; - /** @format uri */ - commits_url: string; - /** @format date-time */ - created_at: string; - description: string | null; - files: Record< - string, - { - filename?: string; - language?: string; - raw_url?: string; - size?: number; - type?: string; - } - >; - forks?: any[]; - /** @format uri */ - forks_url: string; - /** @format uri */ - git_pull_url: string; - /** @format uri */ - git_push_url: string; - history?: any[]; - /** @format uri */ - html_url: string; - id: string; - node_id: string; - owner?: SimpleUser | null; - public: boolean; - truncated?: boolean; - /** @format date-time */ - updated_at: string; - /** @format uri */ - url: string; - user: SimpleUser | null; +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", } -/** - * Basic Error - * Basic Error - */ -export interface BasicError { - documentation_url?: string; - message?: string; -} +export class HttpClient { + public baseUrl: string = "https://io.adafruit.com/api/v2"; + private securityData: SecurityDataType | null = null; + private securityWorker?: ApiConfig["securityWorker"]; + private abortControllers = new Map(); + private customFetch = (...fetchParams: Parameters) => fetch(...fetchParams); -/** - * Blob - * Blob - */ -export interface Blob { - content: string; - encoding: string; - highlighted_content?: string; - node_id: string; - sha: string; - size: number | null; - /** @format uri */ - url: string; -} + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; -/** - * Branch Protection - * Branch Protection - */ -export interface BranchProtection { - allow_deletions?: { - enabled?: boolean; - }; - allow_force_pushes?: { - enabled?: boolean; - }; - enabled: boolean; - /** Protected Branch Admin Enforced */ - enforce_admins?: ProtectedBranchAdminEnforced; - /** @example ""branch/with/protection"" */ - name?: string; - /** @example ""https://api.github.com/repos/owner-79e94e2d36b3fd06a32bb213/AAA_Public_Repo/branches/branch/with/protection/protection"" */ - protection_url?: string; - required_linear_history?: { - enabled?: boolean; + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; }; - /** Protected Branch Pull Request Review */ - required_pull_request_reviews?: ProtectedBranchPullRequestReview; - required_status_checks: { - contexts: string[]; - contexts_url?: string; - enforcement_level: string; - url?: string; + + 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), }; - /** Branch Restriction Policy */ - restrictions?: BranchRestrictionPolicy; - url?: string; -} -/** - * Branch Restriction Policy - * Branch Restriction Policy - */ -export interface BranchRestrictionPolicy { - apps: { - created_at?: string; - description?: string; - events?: string[]; - external_url?: string; - html_url?: string; - id?: number; - name?: string; - node_id?: string; - owner?: { - avatar_url?: string; - description?: 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 """" */ - 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; - }; - permissions?: { - contents?: string; - issues?: string; - metadata?: string; - single_file?: string; + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, }; - slug?: string; - updated_at?: string; - }[]; - /** @format uri */ - apps_url: string; - teams: { - description?: string | null; - html_url?: string; - id?: number; - members_url?: string; - name?: string; - node_id?: string; - parent?: string | null; - permission?: string; - privacy?: string; - repositories_url?: string; - slug?: string; - url?: string; - }[]; - /** @format uri */ - teams_url: string; - /** @format uri */ - url: string; - users: { - 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; - }[]; - /** @format uri */ - users_url: string; -} + } -/** - * Branch Short - * Branch Short - */ -export interface BranchShort { - commit: { - sha: string; - url: string; - }; - name: string; - protected: boolean; -} + 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; + } -/** - * Branch With Protection - * Branch With Protection - */ -export interface BranchWithProtection { - _links: { - html: string; - /** @format uri */ - self: string; + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; }; - /** Commit */ - commit: Commit; - name: string; - /** @example ""mas*"" */ - pattern?: string; - protected: boolean; - /** Branch Protection */ - protection: BranchProtection; - /** @format uri */ - protection_url: string; - /** @example 1 */ - required_approving_review_count?: number; -} -/** - * Check Annotation - * Check Annotation - */ -export interface CheckAnnotation { - /** @example "warning" */ - annotation_level: string | null; - blob_href: string; - /** @example 10 */ - end_column: number | null; - /** @example 2 */ - end_line: number; - /** @example "Check your spelling for 'banaas'." */ - message: string | null; - /** @example "README.md" */ - path: string; - /** @example "Do you mean 'bananas' or 'banana'?" */ - raw_details: string | null; - /** @example 5 */ - start_column: number | null; - /** @example 2 */ - start_line: number; - /** @example "Spell Checker" */ - title: string | null; -} + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); -/** - * CheckRun - * A check performed on the code of a given code change - */ -export interface CheckRun { - app: Integration | null; - check_suite: { - id: number; - } | null; - /** - * @format date-time - * @example "2018-05-04T01:14:52Z" - */ - completed_at: string | null; - /** @example "neutral" */ - conclusion: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required" | null; - /** @example "https://example.com" */ - details_url: string | null; - /** @example "42" */ - external_id: string | null; - /** - * The SHA of the commit that is being checked. - * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" - */ - head_sha: string; - /** @example "https://github.com/github/hello-world/runs/4" */ - html_url: string | null; - /** - * The id of the check. - * @example 21 - */ - id: number; - /** - * The name of the check. - * @example "test-coverage" - */ - name: string; - /** @example "MDg6Q2hlY2tSdW40" */ - node_id: string; - output: { - annotations_count: number; - /** @format uri */ - annotations_url: string; - summary: string | null; - text: string | null; - title: string | null; + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } }; - pull_requests: PullRequestMinimal[]; - /** - * @format date-time - * @example "2018-05-04T01:14:52Z" - */ - started_at: string | null; - /** - * The phase of the lifecycle that the check is currently in. - * @example "queued" - */ - status: "queued" | "in_progress" | "completed"; - /** @example "https://api.github.com/repos/github/hello-world/check-runs/4" */ - url: string; -} -/** - * CheckSuite - * A suite of checks performed on the code of a given code change - */ -export interface CheckSuite { - /** @example "d6fde92930d4715a2b49857d24b940956b26d2d3" */ - after: string | null; - app: Integration | null; - /** @example "146e867f55c26428e5f9fade55a9bbf5e95a7912" */ - before: string | null; - check_runs_url: string; - /** @example "neutral" */ - conclusion: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required" | null; - /** @format date-time */ - created_at: string | null; - /** @example "master" */ - head_branch: string | null; - /** Simple Commit */ - head_commit: SimpleCommit; - /** - * The SHA of the head commit that is being checked. - * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" - */ - head_sha: string; - /** @example 5 */ - id: number; - latest_check_runs_count: number; - /** @example "MDEwOkNoZWNrU3VpdGU1" */ - node_id: string; - pull_requests: PullRequestMinimal[] | null; - /** Minimal Repository */ - repository: MinimalRepository; - /** @example "completed" */ - status: "queued" | "in_progress" | "completed" | null; - /** @format date-time */ - updated_at: string | null; - /** @example "https://api.github.com/repos/github/hello-world/check-suites/5" */ - url: string | null; -} + 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; -/** - * Check Suite Preference - * Check suite configuration preferences for a repository. - */ -export interface CheckSuitePreference { - preferences: { - auto_trigger_checks?: { - app_id: number; - setting: boolean; - }[]; - }; - /** A git repository */ - repository: Repository; -} + 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.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; -/** - * Clone Traffic - * Clone Traffic - */ -export interface CloneTraffic { - clones: Traffic[]; - /** @example 173 */ - count: number; - /** @example 128 */ - uniques: number; -} + 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; + }); -/** - * Code Frequency Stat - * Code Frequency Stat - */ -export type CodeFrequencyStat = number[]; + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } -/** - * Code Of Conduct - * Code Of Conduct - */ -export interface CodeOfConduct { - /** - * @example "# Contributor Covenant Code of Conduct - * - * ## Our Pledge - * - * In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. - * - * ## Our Standards - * - * Examples of behavior that contributes to creating a positive environment include: - * - * * Using welcoming and inclusive language - * * Being respectful of differing viewpoints and experiences - * * Gracefully accepting constructive criticism - * * Focusing on what is best for the community - * * Showing empathy towards other community members - * - * Examples of unacceptable behavior by participants include: - * - * * The use of sexualized language or imagery and unwelcome sexual attention or advances - * * Trolling, insulting/derogatory comments, and personal or political attacks - * * Public or private harassment - * * Publishing others' private information, such as a physical or electronic address, without explicit permission - * * Other conduct which could reasonably be considered inappropriate in a professional setting - * - * ## Our Responsibilities - * - * Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response - * to any instances of unacceptable behavior. - * - * Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. - * - * ## Scope - * - * This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, - * posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. - * - * ## Enforcement - * - * Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [EMAIL]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. - * - * Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. - * - * ## Attribution - * - * This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] - * - * [homepage]: http://contributor-covenant.org - * [version]: http://contributor-covenant.org/version/1/4/ - * " - */ - body?: string; - /** @format uri */ - html_url: string | null; - /** @example "contributor_covenant" */ - key: string; - /** @example "Contributor Covenant" */ - name: string; - /** - * @format uri - * @example "https://api.github.com/codes_of_conduct/contributor_covenant" - */ - url: string; + if (!response.ok) throw data; + return data; + }); + }; } /** - * Code Of Conduct Simple - * Code of Conduct Simple + * @title Adafruit IO + * @version 2.0.0 + * @baseUrl https://io.adafruit.com/api/v2 + * + * ### The Internet of Things for Everyone + * + * The Adafruit IO HTTP API provides access to your Adafruit IO data from any programming language or hardware environment that can speak HTTP. The easiest way to get started is with [an Adafruit IO learn guide](https://learn.adafruit.com/series/adafruit-io-basics) and [a simple Internet of Things capable device like the Feather Huzzah](https://www.adafruit.com/product/2821). + * + * This API documentation is hosted on GitHub Pages and is available at [https://github.com/adafruit/io-api](https://github.com/adafruit/io-api). For questions or comments visit the [Adafruit IO Forums](https://forums.adafruit.com/viewforum.php?f=56) or the [adafruit-io channel on the Adafruit Discord server](https://discord.gg/adafruit). + * + * #### Authentication + * + * Authentication for every API request happens through the \`X-AIO-Key\` header or query parameter and your IO API key. A simple cURL request to get all available feeds for a user with the username "io_username" and the key "io_key_12345" could look like this: + * + * $ curl -H "X-AIO-Key: io_key_12345" https://io.adafruit.com/api/v2/io_username/feeds + * + * Or like this: + * + * $ curl "https://io.adafruit.com/api/v2/io_username/feeds?X-AIO-Key=io_key_12345 + * + * Using the node.js [request](https://github.com/request/request) library, IO HTTP requests are as easy as: + * + * \`\`\`js + * var request = require('request'); + * + * var options = { + * url: 'https://io.adafruit.com/api/v2/io_username/feeds', + * headers: { + * 'X-AIO-Key': 'io_key_12345', + * 'Content-Type': 'application/json' + * } + * }; + * + * function callback(error, response, body) { + * if (!error && response.statusCode == 200) { + * var feeds = JSON.parse(body); + * console.log(feeds.length + " FEEDS AVAILABLE"); + * + * feeds.forEach(function (feed) { + * console.log(feed.name, feed.key); + * }) + * } + * } + * + * request(options, callback); + * \`\`\` + * + * Using the ESP8266 Arduino HTTPClient library, an HTTPS GET request would look like this (replacing \`---\` with your own values in the appropriate locations): + * + * \`\`\`arduino + * /// based on + * /// https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/examples/Authorization/Authorization.ino + * + * #include + * #include + * #include + * #include + * + * ESP8266WiFiMulti WiFiMulti; + * + * const char* ssid = "---"; + * const char* password = "---"; + * + * const char* host = "io.adafruit.com"; + * + * const char* io_key = "---"; + * const char* path_with_username = "/api/v2/---/dashboards"; + * + * // Use web browser to view and copy + * // SHA1 fingerprint of the certificate + * const char* fingerprint = "77 00 54 2D DA E7 D8 03 27 31 23 99 EB 27 DB CB A5 4C 57 18"; + * + * void setup() { + * Serial.begin(115200); + * + * for(uint8_t t = 4; t > 0; t--) { + * Serial.printf("[SETUP] WAIT %d...\\n", t); + * Serial.flush(); + * delay(1000); + * } + * + * WiFi.mode(WIFI_STA); + * WiFiMulti.addAP(ssid, password); + * + * // wait for WiFi connection + * while(WiFiMulti.run() != WL_CONNECTED) { + * Serial.print('.'); + * delay(1000); + * } + * + * Serial.println("[WIFI] connected!"); + * + * HTTPClient http; + * + * // start request with URL and TLS cert fingerprint for verification + * http.begin("https://" + String(host) + String(path_with_username), fingerprint); + * + * // IO API authentication + * http.addHeader("X-AIO-Key", io_key); + * + * // start connection and send HTTP header + * int httpCode = http.GET(); + * + * // httpCode will be negative on error + * if(httpCode > 0) { + * // HTTP header has been send and Server response header has been handled + * Serial.printf("[HTTP] GET response: %d\\n", httpCode); + * + * // HTTP 200 OK + * if(httpCode == HTTP_CODE_OK) { + * String payload = http.getString(); + * Serial.println(payload); + * } + * + * http.end(); + * } + * } + * + * void loop() {} + * \`\`\` + * + * #### Client Libraries + * + * We have client libraries to help you get started with your project: [Python](https://github.com/adafruit/io-client-python), [Ruby](https://github.com/adafruit/io-client-ruby), [Arduino C++](https://github.com/adafruit/Adafruit_IO_Arduino), [Javascript](https://github.com/adafruit/adafruit-io-node), and [Go](https://github.com/adafruit/io-client-go) are available. They're all open source, so if they don't already do what you want, you can fork and add any feature you'd like. + * */ -export interface CodeOfConductSimple { - /** @format uri */ - html_url: string | null; - /** @example "citizen_code_of_conduct" */ - key: string; - /** @example "Citizen Code of Conduct" */ - name: string; - /** - * @format uri - * @example "https://api.github.com/codes_of_conduct/citizen_code_of_conduct" - */ - url: string; -} +export class Api extends HttpClient { + user = { + /** + * No description + * + * @tags Users + * @name CurrentUser + * @summary Get information about the current user + * @request GET:/user + * @secure + */ + currentUser: (params: RequestParams = {}) => + this.request({ + path: \`/user\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + }; + webhooks = { + /** + * No description + * + * @tags Webhooks, Data + * @name CreateWebhookFeedData + * @summary Send data to a feed via webhook URL. + * @request POST:/webhooks/feed/:token + * @secure + */ + createWebhookFeedData: ( + token: string, + payload: { + value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/webhooks/feed/\${token}\`, + method: "POST", + body: payload, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -export interface CodeScanningAlertCodeScanningAlert { - /** The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. */ - created_at: AlertCreatedAt; - /** The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. */ - dismissed_at: CodeScanningAlertDismissedAt; - /** Simple User */ - dismissed_by: SimpleUser; - /** **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`. */ - dismissed_reason: CodeScanningAlertDismissedReason; - /** The GitHub URL of the alert resource. */ - html_url: AlertHtmlUrl; - instances: CodeScanningAlertInstances; - /** The security alert number. */ - number: AlertNumber; - rule: CodeScanningAlertRule; - /** State of a code scanning alert. */ - state: CodeScanningAlertState; - tool: CodeScanningAnalysisTool; - /** The REST API URL of the alert resource. */ - url: AlertUrl; -} + /** + * @description The raw data webhook receiver accepts POST requests and stores the raw request body on your feed. This is useful when you don't have control of the webhook sender. If feed history is turned on, payloads will be truncated at 1024 bytes. If feed history is turned off, payloads will be truncated at 100KB. + * + * @tags Webhooks, Data + * @name CreateRawWebhookFeedData + * @summary Send arbitrary data to a feed via webhook URL. + * @request POST:/webhooks/feed/:token/raw + * @secure + */ + createRawWebhookFeedData: (token: string, params: RequestParams = {}) => + this.request({ + path: \`/webhooks/feed/\${token}/raw\`, + method: "POST", + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + username = { + /** + * @description Delete all your activities. + * + * @tags Activities + * @name DestroyActivities + * @summary All activities for current user + * @request DELETE:/{username}/activities + * @secure + */ + destroyActivities: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/activities\`, + method: "DELETE", + secure: true, + ...params, + }), -export interface CodeScanningAlertCodeScanningAlertItems { - /** The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. */ - created_at: AlertCreatedAt; - /** The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. */ - dismissed_at: CodeScanningAlertDismissedAt; - /** Simple User */ - dismissed_by: SimpleUser; - /** **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`. */ - dismissed_reason: CodeScanningAlertDismissedReason; - /** The GitHub URL of the alert resource. */ - html_url: AlertHtmlUrl; - /** The security alert number. */ - number: AlertNumber; - rule: CodeScanningAlertRule; - /** State of a code scanning alert. */ - state: CodeScanningAlertState; - tool: CodeScanningAnalysisTool; - /** The REST API URL of the alert resource. */ - url: AlertUrl; -} + /** + * @description The Activities endpoint returns information about the user's activities. + * + * @tags Activities + * @name AllActivities + * @summary All activities for current user + * @request GET:/{username}/activities + * @secure + */ + allActivities: ( + username: string, + query?: { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/activities\`, + method: "GET", + query: query, + secure: true, + format: "json", + ...params, + }), -/** - * The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - * @format date-time - */ -export type CodeScanningAlertDismissedAt = string | null; + /** + * @description The Activities endpoint returns information about the user's activities. + * + * @tags Activities + * @name GetActivity + * @summary Get activities by type for current user + * @request GET:/{username}/activities/{type} + * @secure + */ + getActivity: ( + username: string, + type: string, + query?: { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/activities/\${type}\`, + method: "GET", + query: query, + secure: true, + format: "json", + ...params, + }), -/** **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 CodeScanningAlertDismissedReason = "false positive" | "won't fix" | "used in tests" | null; + /** + * @description The Dashboards endpoint returns information about the user's dashboards. + * + * @tags Dashboards + * @name AllDashboards + * @summary All dashboards for current user + * @request GET:/{username}/dashboards + * @secure + */ + allDashboards: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** 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. */ -export type CodeScanningAlertEnvironment = string; + /** + * No description + * + * @tags Dashboards + * @name CreateDashboard + * @summary Create a new Dashboard + * @request POST:/{username}/dashboards + * @secure + */ + createDashboard: (username: string, dashboard: Dashboard, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards\`, + method: "POST", + body: dashboard, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -export type CodeScanningAlertInstances = { - /** 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; -}[]; + /** + * @description The Blocks endpoint returns information about the user's blocks. + * + * @tags Blocks + * @name AllBlocks + * @summary All blocks for current user + * @request GET:/{username}/dashboards/{dashboard_id}/blocks + * @secure + */ + allBlocks: (username: string, dashboardId: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** The full Git reference, formatted as `refs/heads/`. */ -export type CodeScanningAlertRef = string; + /** + * No description + * + * @tags Blocks + * @name CreateBlock + * @summary Create a new Block + * @request POST:/{username}/dashboards/{dashboard_id}/blocks + * @secure + */ + createBlock: (username: string, dashboardId: string, block: Block, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks\`, + method: "POST", + body: block, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -export interface CodeScanningAlertRule { - /** A short description of the rule used to detect the alert. */ - description?: string; - /** A unique identifier for the rule used to detect the alert. */ - id?: string | null; - /** The severity of the alert. */ - severity?: "none" | "note" | "warning" | "error" | null; -} + /** + * No description + * + * @tags Blocks + * @name DestroyBlock + * @summary Delete an existing Block + * @request DELETE:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + destroyBlock: (username: string, dashboardId: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks/\${id}\`, + method: "DELETE", + secure: true, + format: "json", + ...params, + }), -/** Sets the state of the code scanning alert. Can be one of `open` or `dismissed`. You must provide `dismissed_reason` when you set the state to `dismissed`. */ -export enum CodeScanningAlertSetState { - Open = "open", - Dismissed = "dismissed", -} + /** + * No description + * + * @tags Blocks + * @name GetBlock + * @summary Returns Block based on ID + * @request GET:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + getBlock: (username: string, dashboardId: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks/\${id}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** State of a code scanning alert. */ -export enum CodeScanningAlertState { - Open = "open", - Dismissed = "dismissed", - Fixed = "fixed", -} + /** + * No description + * + * @tags Blocks + * @name UpdateBlock + * @summary Update properties of an existing Block + * @request PATCH:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + updateBlock: ( + username: string, + dashboardId: string, + id: string, + block: { + block_feeds?: { + feed_id?: string; + group_id?: string; + }[]; + column?: number; + dashboard_id?: number; + description?: string; + key?: string; + name?: string; + properties?: object; + row?: number; + size_x?: number; + size_y?: number; + visual_type?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks/\${id}\`, + method: "PATCH", + body: block, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name. */ -export type CodeScanningAnalysisAnalysisKey = string; + /** + * No description + * + * @tags Blocks + * @name ReplaceBlock + * @summary Replace an existing Block + * @request PUT:/{username}/dashboards/{dashboard_id}/blocks/{id} + * @secure + */ + replaceBlock: ( + username: string, + dashboardId: string, + id: string, + block: { + block_feeds?: { + feed_id?: string; + group_id?: string; + }[]; + column?: number; + dashboard_id?: number; + description?: string; + key?: string; + name?: string; + properties?: object; + row?: number; + size_x?: number; + size_y?: number; + visual_type?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/dashboards/\${dashboardId}/blocks/\${id}\`, + method: "PUT", + body: block, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -export interface CodeScanningAnalysisCodeScanningAnalysis { - /** 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; - /** The commit SHA of the code scanning analysis file. */ - commit_sha: CodeScanningAnalysisCommitSha; - /** The time that the analysis was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. */ - created_at: CodeScanningAnalysisCreatedAt; - /** Identifies the variable values associated with the environment in which this analysis was performed. */ - environment: CodeScanningAnalysisEnvironment; - /** @example "error reading field xyz" */ - error: string; - /** The full Git reference of the code scanning analysis file, formatted as `refs/heads/`. */ - ref: CodeScanningAnalysisRef; - /** The name of the tool used to generate the code scanning analysis alert. */ - tool_name: CodeScanningAnalysisToolName; -} + /** + * No description + * + * @tags Dashboards + * @name DestroyDashboard + * @summary Delete an existing Dashboard + * @request DELETE:/{username}/dashboards/{id} + * @secure + */ + destroyDashboard: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${id}\`, + method: "DELETE", + secure: true, + format: "json", + ...params, + }), -/** - * The commit SHA of the code scanning analysis file. - * @minLength 40 - * @maxLength 40 - * @pattern ^[0-9a-fA-F]+$ - */ -export type CodeScanningAnalysisCommitSha = string; + /** + * No description + * + * @tags Dashboards + * @name GetDashboard + * @summary Returns Dashboard based on ID + * @request GET:/{username}/dashboards/{id} + * @secure + */ + getDashboard: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/dashboards/\${id}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** - * The time that the analysis was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - * @format date-time - */ -export type CodeScanningAnalysisCreatedAt = string; + /** + * No description + * + * @tags Dashboards + * @name UpdateDashboard + * @summary Update properties of an existing Dashboard + * @request PATCH:/{username}/dashboards/{id} + * @secure + */ + updateDashboard: ( + username: string, + id: string, + dashboard: { + description?: string; + key?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/dashboards/\${id}\`, + method: "PATCH", + body: dashboard, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** Identifies the variable values associated with the environment in which this analysis was performed. */ -export type CodeScanningAnalysisEnvironment = string; + /** + * No description + * + * @tags Dashboards + * @name ReplaceDashboard + * @summary Replace an existing Dashboard + * @request PUT:/{username}/dashboards/{id} + * @secure + */ + replaceDashboard: ( + username: string, + id: string, + dashboard: { + description?: string; + key?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/dashboards/\${id}\`, + method: "PUT", + body: dashboard, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** The full Git reference of the code scanning analysis file, formatted as `refs/heads/`. */ -export type CodeScanningAnalysisRef = string; + /** + * @description The Feeds endpoint returns information about the user's feeds. The response includes the latest value of each feed, and other metadata about each feed. + * + * @tags Feeds + * @name AllFeeds + * @summary All feeds for current user + * @request GET:/{username}/feeds + * @secure + */ + allFeeds: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** 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. */ -export type CodeScanningAnalysisSarifFile = string; + /** + * No description + * + * @tags Feeds + * @name CreateFeed + * @summary Create a new Feed + * @request POST:/{username}/feeds + * @secure + */ + createFeed: ( + username: string, + feed: Feed, + query?: { + group_key?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds\`, + method: "POST", + query: query, + body: feed, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -export interface CodeScanningAnalysisTool { - /** The name of the tool used to generate the code scanning analysis alert. */ - name?: CodeScanningAnalysisToolName; - /** The version of the tool used to detect the alert. */ - version?: string | null; -} + /** + * No description + * + * @tags Feeds + * @name DestroyFeed + * @summary Delete an existing Feed + * @request DELETE:/{username}/feeds/{feed_key} + * @secure + */ + destroyFeed: (username: string, feedKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}\`, + method: "DELETE", + secure: true, + ...params, + }), -/** The name of the tool used to generate the code scanning analysis alert. */ -export type CodeScanningAnalysisToolName = string; + /** + * @description Returns feed based on the feed key + * + * @tags Feeds + * @name GetFeed + * @summary Get feed by feed key + * @request GET:/{username}/feeds/{feed_key} + * @secure + */ + getFeed: (username: string, feedKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** - * Code Search Result Item - * Code Search Result Item - */ -export interface CodeSearchResultItem { - file_size?: number; - /** @format uri */ - git_url: string; - /** @format uri */ - html_url: string; - language?: string | null; - /** @format date-time */ - last_modified_at?: string; - /** @example ["73..77","77..78"] */ - line_numbers?: string[]; - name: string; - path: string; - /** Minimal Repository */ - repository: MinimalRepository; - score: number; - sha: string; - text_matches?: SearchResultTextMatches; - /** @format uri */ - url: string; -} + /** + * No description + * + * @tags Feeds + * @name UpdateFeed + * @summary Update properties of an existing Feed + * @request PATCH:/{username}/feeds/{feed_key} + * @secure + */ + updateFeed: ( + username: string, + feedKey: string, + feed: { + description?: string; + key?: string; + license?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}\`, + method: "PATCH", + body: feed, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Collaborator - * Collaborator - */ -export interface Collaborator { - /** - * @format uri - * @example "https://github.com/images/error/octocat_happy.gif" - */ - avatar_url: string; - /** @example "https://api.github.com/users/octocat/events{/privacy}" */ - events_url: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/followers" - */ - followers_url: string; - /** @example "https://api.github.com/users/octocat/following{/other_user}" */ - following_url: string; - /** @example "https://api.github.com/users/octocat/gists{/gist_id}" */ - gists_url: string; - /** @example "41d064eb2195891e12d0413f63227ea7" */ - gravatar_id: string | null; - /** - * @format uri - * @example "https://github.com/octocat" - */ - html_url: string; - /** @example 1 */ - id: number; - /** @example "octocat" */ - login: string; - /** @example "MDQ6VXNlcjE=" */ - node_id: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/orgs" - */ - organizations_url: string; - permissions?: { - admin: boolean; - pull: boolean; - push: boolean; - }; - /** - * @format uri - * @example "https://api.github.com/users/octocat/received_events" - */ - received_events_url: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/repos" - */ - repos_url: string; - site_admin: boolean; - /** @example "https://api.github.com/users/octocat/starred{/owner}{/repo}" */ - starred_url: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/subscriptions" - */ - subscriptions_url: string; - /** @example "User" */ - type: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat" - */ - url: string; -} + /** + * No description + * + * @tags Feeds + * @name ReplaceFeed + * @summary Replace an existing Feed + * @request PUT:/{username}/feeds/{feed_key} + * @secure + */ + replaceFeed: ( + username: string, + feedKey: string, + feed: { + description?: string; + key?: string; + license?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}\`, + method: "PUT", + body: feed, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -export interface CombinedBillingUsage { - /** Numbers of days left in billing cycle. */ - days_left_in_billing_cycle: number; - /** Estimated storage space (GB) used in billing cycle. */ - estimated_paid_storage_for_month: number; - /** Estimated sum of free and paid storage space (GB) used in billing cycle. */ - estimated_storage_for_month: number; -} + /** + * No description + * + * @tags Data + * @name AllData + * @summary Get all data for the given feed + * @request GET:/{username}/feeds/{feed_key}/data + * @secure + */ + allData: ( + username: string, + feedKey: string, + query?: { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data\`, + method: "GET", + query: query, + secure: true, + format: "json", + ...params, + }), -/** - * Combined Commit Status - * Combined Commit Status - */ -export interface CombinedCommitStatus { - /** @format uri */ - commit_url: string; - /** Minimal Repository */ - repository: MinimalRepository; - sha: string; - state: string; - statuses: SimpleCommitStatus[]; - total_count: number; - /** @format uri */ - url: string; -} + /** + * @description Create new data records on the given feed. **NOTE:** when feed history is on, data \`value\` size is limited to 1KB, when feed history is turned off data value size is limited to 100KB. + * + * @tags Data + * @name CreateData + * @summary Create new Data + * @request POST:/{username}/feeds/{feed_key}/data + * @secure + */ + createData: ( + username: string, + feedKey: string, + datum: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data\`, + method: "POST", + body: datum, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Commit - * Commit - */ -export interface Commit { - author: SimpleUser | null; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments" - */ - comments_url: string; - commit: { - author: GitUser | null; - /** @example 0 */ - comment_count: number; - committer: GitUser | null; - /** @example "Fix all the bugs" */ - message: string; - tree: { - /** @example "827efc6d56897b048c772eb4087f854f46256132" */ - sha: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/tree/827efc6d56897b048c772eb4087f854f46256132" - */ - url: string; - }; /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" + * No description + * + * @tags Data + * @name BatchCreateData + * @summary Create multiple new Data records + * @request POST:/{username}/feeds/{feed_key}/data/batch + * @secure */ - url: string; - verification?: Verification; - }; - committer: SimpleUser | null; - files?: { - additions?: number; - blob_url?: 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 - * @example "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e" - */ - html_url: string; - /** @example "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==" */ - node_id: string; - parents: { + batchCreateData: (username: string, feedKey: string, data: Data, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/batch\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + /** - * @format uri - * @example "https://github.com/octocat/Hello-World/commit/7638417db6d59f3c431d3e1f261cc637155684cd" + * @description The Chart API is what we use on io.adafruit.com to populate charts over varying timespans with a consistent number of data points. The maximum number of points returned is 480. This API works by aggregating slices of time into a single value by averaging. All time-based parameters are optional, if none are given it will default to 1 hour at the finest-grained resolution possible. + * + * @tags Data + * @name ChartData + * @summary Chart data for current feed + * @request GET:/{username}/feeds/{feed_key}/data/chart + * @secure */ - html_url?: string; - /** @example "7638417db6d59f3c431d3e1f261cc637155684cd" */ - sha: string; + chartData: ( + username: string, + feedKey: string, + query?: { + /** + * End time for filtering, returns records created before give time. + * @format date-time + */ + end_time?: string; + /** + * The number of hours the chart should cover. + * @format int32 + */ + hours?: number; + /** + * A resolution size in minutes. By giving a resolution value you will get back grouped data points aggregated over resolution-sized intervals. NOTE: time span is preferred over resolution, so if you request a span of time that includes more than max limit points you may get a larger resolution than you requested. Valid resolutions are 1, 5, 10, 30, 60, and 120. + * @format int32 + */ + resolution?: number; + /** + * Start time for filtering, returns records created after given time. + * @format date-time + */ + start_time?: string; + }, + params: RequestParams = {}, + ) => + this.request< + { + /** The names of the columns returned as data. */ + columns?: string[]; + /** The actual chart data. */ + data?: string[][]; + feed?: { + id?: number; + key?: string; + name?: string; + }; + parameters?: object; + }, + void + >({ + path: \`/\${username}/feeds/\${feedKey}/data/chart\`, + method: "GET", + query: query, + secure: true, + format: "json", + ...params, + }), + /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/commits/7638417db6d59f3c431d3e1f261cc637155684cd" + * @description Get the oldest data point in the feed. This request sets the queue pointer to the beginning of the feed. + * + * @tags Data + * @name FirstData + * @summary First Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/first + * @secure */ - url: string; - }[]; - /** @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" */ - sha: string; - stats?: { - additions?: number; - deletions?: number; - total?: number; - }; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" - */ - url: string; -} + firstData: ( + username: string, + feedKey: string, + query?: { + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/first\`, + method: "GET", + query: query, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Commit Activity - * Commit Activity - */ -export interface CommitActivity { - /** @example [0,3,26,20,39,1,0] */ - days: number[]; - /** @example 89 */ - total: number; - /** @example 1336280400 */ - week: number; -} + /** + * @description Get the most recent data point in the feed. This request sets the queue pointer to the end of the feed. + * + * @tags Data + * @name LastData + * @summary Last Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/last + * @secure + */ + lastData: ( + username: string, + feedKey: string, + query?: { + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/last\`, + method: "GET", + query: query, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Commit Comment - * Commit Comment - */ -export interface CommitComment { - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - body: string; - commit_id: string; - /** @format date-time */ - created_at: string; - /** @format uri */ - html_url: string; - id: number; - line: number | null; - node_id: string; - path: string | null; - position: number | null; - reactions?: ReactionRollup; - /** @format date-time */ - updated_at: string; - /** @format uri */ - url: string; - user: SimpleUser | null; -} + /** + * @description Get the next newest data point in the feed. If queue processing hasn't been started, the first data point in the feed will be returned. + * + * @tags Data + * @name NextData + * @summary Next Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/next + * @secure + */ + nextData: ( + username: string, + feedKey: string, + query?: { + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/next\`, + method: "GET", + query: query, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Commit Comparison - * Commit Comparison - */ -export interface CommitComparison { - /** @example 4 */ - ahead_by: number; - /** Commit */ - base_commit: Commit; - /** @example 5 */ - behind_by: number; - commits: Commit[]; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/compare/master...topic.diff" - */ - diff_url: string; - files: DiffEntry[]; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/compare/master...topic" - */ - html_url: string; - /** Commit */ - merge_base_commit: Commit; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/compare/master...topic.patch" - */ - patch_url: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/compare/octocat:bbcd538c8e72b8c175046e27cc8f907076331401...octocat:0328041d1152db8ae77652d1618a02e57f745f17" - */ - permalink_url: string; - /** @example "ahead" */ - status: "diverged" | "ahead" | "behind" | "identical"; - /** @example 6 */ - total_commits: number; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/compare/master...topic" - */ - url: string; -} + /** + * @description Get the previously processed data point in the feed. NOTE: this method doesn't move the processing queue pointer. + * + * @tags Data + * @name PreviousData + * @summary Previous Data in Queue + * @request GET:/{username}/feeds/{feed_key}/data/previous + * @secure + */ + previousData: ( + username: string, + feedKey: string, + query?: { + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/previous\`, + method: "GET", + query: query, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Commit Search Result Item - * Commit Search Result Item - */ -export interface CommitSearchResultItem { - author: SimpleUser | null; - /** @format uri */ - comments_url: string; - commit: { - author: { - /** @format date-time */ - date: string; - email: string; - name: string; - }; - comment_count: number; - committer: GitUser | null; - message: string; - tree: { - sha: string; - /** @format uri */ - url: string; - }; - /** @format uri */ - url: string; - verification?: Verification; - }; - committer: GitUser | null; - /** @format uri */ - html_url: string; - node_id: string; - parents: { - html_url?: string; - sha?: string; - url?: string; - }[]; - /** Minimal Repository */ - repository: MinimalRepository; - score: number; - sha: string; - text_matches?: SearchResultTextMatches; - /** @format uri */ - url: string; -} + /** + * @description Get the most recent data point in the feed in an MQTT compatible CSV format: \`value,lat,lon,ele\` + * + * @tags Data + * @name RetainData + * @summary Last Data in MQTT CSV format + * @request GET:/{username}/feeds/{feed_key}/data/retain + * @secure + */ + retainData: (username: string, feedKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/retain\`, + method: "GET", + secure: true, + type: ContentType.Json, + ...params, + }), -/** Community Health File */ -export interface CommunityHealthFile { - /** @format uri */ - html_url: string; - /** @format uri */ - url: string; -} + /** + * No description + * + * @tags Data + * @name DestroyData + * @summary Delete existing Data + * @request DELETE:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + destroyData: (username: string, feedKey: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/\${id}\`, + method: "DELETE", + secure: true, + format: "json", + ...params, + }), -/** - * Community Profile - * Community Profile - */ -export interface CommunityProfile { - /** @example true */ - content_reports_enabled?: boolean; - /** @example "My first repository on GitHub!" */ - description: string | null; - /** @example "example.com" */ - documentation: string | null; - files: { - code_of_conduct: CodeOfConductSimple | null; - contributing: CommunityHealthFile | null; - issue_template: CommunityHealthFile | null; - license: LicenseSimple | null; - pull_request_template: CommunityHealthFile | null; - readme: CommunityHealthFile | null; - }; - /** @example 100 */ - health_percentage: number; - /** - * @format date-time - * @example "2017-02-28T19:09:29Z" - */ - updated_at: string | null; -} + /** + * No description + * + * @tags Data + * @name GetData + * @summary Returns data based on feed key + * @request GET:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + getData: ( + username: string, + feedKey: string, + id: string, + query?: { + /** List of Data record fields to include in response as comma separated list. Acceptable values are: \`value\`, \`lat\`, \`lon\`, \`ele\`, \`id\`, and \`created_at\`. */ + include?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/\${id}\`, + method: "GET", + query: query, + secure: true, + format: "json", + ...params, + }), -/** - * Content Directory - * A list of directory items - */ -export type ContentDirectory = { - _links: { - /** @format uri */ - git: string | null; - /** @format uri */ - html: string | null; - /** @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; -}[]; + /** + * No description + * + * @tags Data + * @name UpdateData + * @summary Update properties of existing Data + * @request PATCH:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + updateData: ( + username: string, + feedKey: string, + id: string, + datum: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/\${id}\`, + method: "PATCH", + body: datum, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Content File - * Content File - */ -export interface ContentFile { - _links: { - /** @format uri */ - git: string | null; - /** @format uri */ - html: string | null; - /** @format uri */ - self: string; - }; - content: string; - /** @format uri */ - download_url: string | null; - encoding: string; - /** @format uri */ - git_url: string | null; - /** @format uri */ - html_url: string | null; - name: string; - path: string; - sha: string; - size: number; - /** @example ""git://example.com/defunkt/dotjs.git"" */ - submodule_git_url?: string; - /** @example ""actual/actual.md"" */ - target?: string; - type: string; - /** @format uri */ - url: string; -} + /** + * No description + * + * @tags Data + * @name ReplaceData + * @summary Replace existing Data + * @request PUT:/{username}/feeds/{feed_key}/data/{id} + * @secure + */ + replaceData: ( + username: string, + feedKey: string, + id: string, + datum: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/data/\${id}\`, + method: "PUT", + body: datum, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * ContentReferenceAttachment - * Content Reference attachments allow you to provide context around URLs posted in comments - */ -export interface ContentReferenceAttachment { - /** - * The body of the attachment - * @maxLength 262144 - * @example "Body of the attachment" - */ - body: string; - /** - * The ID of the attachment - * @example 21 - */ - id: number; - /** - * The node_id of the content attachment - * @example "MDE3OkNvbnRlbnRBdHRhY2htZW50MjE=" - */ - node_id?: string; - /** - * The title of the attachment - * @maxLength 1024 - * @example "Title of the attachment" - */ - title: string; -} + /** + * @description Returns more detailed feed record based on the feed key + * + * @tags Feeds + * @name GetFeedDetails + * @summary Get detailed feed by feed key + * @request GET:/{username}/feeds/{feed_key}/details + * @secure + */ + getFeedDetails: (username: string, feedKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/feeds/\${feedKey}/details\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** - * Symlink Content - * An object describing a symlink - */ -export interface ContentSubmodule { - _links: { - /** @format uri */ - git: string | null; - /** @format uri */ - html: string | null; - /** @format uri */ - self: 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; - /** @format uri */ - submodule_git_url: string; - type: string; - /** @format uri */ - url: string; -} + /** + * @description The Groups endpoint returns information about the user's groups. The response includes the latest value of each feed in the group, and other metadata about the group. + * + * @tags Groups + * @name AllGroups + * @summary All groups for current user + * @request GET:/{username}/groups + * @secure + */ + allGroups: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** - * Symlink Content - * An object describing a symlink - */ -export interface ContentSymlink { - _links: { - /** @format uri */ - git: string | null; - /** @format uri */ - html: string | null; - /** @format uri */ - self: 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; - target: string; - type: string; - /** @format uri */ - url: string; -} + /** + * No description + * + * @tags Groups + * @name CreateGroup + * @summary Create a new Group + * @request POST:/{username}/groups + * @secure + */ + createGroup: (username: string, group: Group, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups\`, + method: "POST", + body: group, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Content Traffic - * Content Traffic - */ -export interface ContentTraffic { - /** @example 3542 */ - count: number; - /** @example "/github/hubot" */ - path: string; - /** @example "github/hubot: A customizable life embetterment robot." */ - title: string; - /** @example 2225 */ - uniques: number; -} + /** + * No description + * + * @tags Groups + * @name DestroyGroup + * @summary Delete an existing Group + * @request DELETE:/{username}/groups/{group_key} + * @secure + */ + destroyGroup: (username: string, groupKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups/\${groupKey}\`, + method: "DELETE", + secure: true, + format: "json", + ...params, + }), -/** - * Content Tree - * Content Tree - */ -export interface ContentTree { - _links: { - /** @format uri */ - git: string | null; - /** @format uri */ - html: string | null; - /** @format uri */ - self: string; - }; - /** @format uri */ - download_url: string | null; - entries?: { - _links: { - /** @format uri */ - git: string | null; - /** @format uri */ - html: string | null; - /** @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; - /** @format uri */ - html_url: string | null; - name: string; - path: string; - sha: string; - size: number; - type: string; - /** @format uri */ - url: string; -} + /** + * No description + * + * @tags Groups + * @name GetGroup + * @summary Returns Group based on ID + * @request GET:/{username}/groups/{group_key} + * @secure + */ + getGroup: (username: string, groupKey: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups/\${groupKey}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** - * Contributor - * Contributor - */ -export interface Contributor { - /** @format uri */ - avatar_url?: string; - contributions: number; - email?: string; - events_url?: string; - /** @format uri */ - followers_url?: string; - following_url?: string; - gists_url?: string; - gravatar_id?: string | null; - /** @format uri */ - html_url?: string; - id?: number; - login?: string; - name?: string; - node_id?: string; - /** @format uri */ - organizations_url?: string; - /** @format uri */ - received_events_url?: string; - /** @format uri */ - repos_url?: string; - site_admin?: boolean; - starred_url?: string; - /** @format uri */ - subscriptions_url?: string; - type: string; - /** @format uri */ - url?: string; -} + /** + * No description + * + * @tags Groups + * @name UpdateGroup + * @summary Update properties of an existing Group + * @request PATCH:/{username}/groups/{group_key} + * @secure + */ + updateGroup: ( + username: string, + groupKey: string, + group: { + description?: string; + key?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}\`, + method: "PATCH", + body: group, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Contributor Activity - * Contributor Activity - */ -export interface ContributorActivity { - author: SimpleUser | null; - /** @example 135 */ - total: number; - /** @example [{"w":"1367712000","a":6898,"d":77,"c":10}] */ - weeks: { - a?: number; - c?: number; - d?: number; - w?: string; - }[]; -} + /** + * No description + * + * @tags Groups + * @name ReplaceGroup + * @summary Replace an existing Group + * @request PUT:/{username}/groups/{group_key} + * @secure + */ + replaceGroup: ( + username: string, + groupKey: string, + group: { + description?: string; + key?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}\`, + method: "PUT", + body: group, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Credential Authorization - * Credential Authorization - */ -export interface CredentialAuthorization { - /** @example 12345678 */ - authorized_credential_id?: number | null; - /** - * The note given to the token. This will only be present when the credential is a token. - * @example "my token" - */ - authorized_credential_note?: string | null; - /** - * The title given to the ssh key. This will only be present when the credential is an ssh key. - * @example "my ssh key" - */ - authorized_credential_title?: string | null; - /** - * Date when the credential was last accessed. May be null if it was never accessed - * @format date-time - * @example "2011-01-26T19:06:43Z" - */ - credential_accessed_at?: string | null; - /** - * Date when the credential was authorized for use. - * @format date-time - * @example "2011-01-26T19:06:43Z" - */ - credential_authorized_at: string; - /** - * Unique identifier for the credential. - * @example 1 - */ - credential_id: number; - /** - * Human-readable description of the credential type. - * @example "SSH Key" - */ - credential_type: string; - /** - * Unique string to distinguish the credential. Only included in responses with credential_type of SSH Key. - * @example "jklmnop12345678" - */ - fingerprint?: string; - /** - * User login that owns the underlying credential. - * @example "monalisa" - */ - login: string; - /** - * List of oauth scopes the token has been granted. - * @example ["user","repo"] - */ - scopes?: string[]; - /** - * Last eight characters of the credential. Only included in responses with credential_type of personal access token. - * @example "12345678" - */ - token_last_eight?: string; -} + /** + * No description + * + * @tags Groups, Feeds + * @name AddFeedToGroup + * @summary Add an existing Feed to a Group + * @request POST:/{username}/groups/{group_key}/add + * @secure + */ + addFeedToGroup: ( + groupKey: string, + username: string, + query?: { + feed_key?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/add\`, + method: "POST", + query: query, + secure: true, + format: "json", + ...params, + }), -/** - * Deploy Key - * An SSH key granting access to a single repository. - */ -export interface DeployKey { - created_at: string; - id: number; - key: string; - read_only: boolean; - title: string; - url: string; - verified: boolean; -} + /** + * No description + * + * @tags Data + * @name CreateGroupData + * @summary Create new data for multiple feeds in a group + * @request POST:/{username}/groups/{group_key}/data + * @secure + */ + createGroupData: ( + username: string, + groupKey: string, + group_feed_data: { + /** Optional created_at timestamp which will be applied to all feed values created. */ + created_at?: string; + /** An array of feed data records with \`key\` and \`value\` properties. */ + feeds: { + key: string; + value: string; + }[]; + /** A location record with \`lat\`, \`lon\`, and [optional] \`ele\` properties. */ + location?: { + ele?: number; + lat: number; + lon: number; + }; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/data\`, + method: "POST", + body: group_feed_data, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Deployment - * A request for a specific ref(branch,sha,tag) to be deployed - */ -export interface Deployment { - /** - * @format date-time - * @example "2012-07-20T01:19:13Z" - */ - created_at: string; - creator: SimpleUser | null; - /** @example "Deploy request from hubot" */ - description: string | null; - /** - * Name for the target deployment environment. - * @example "production" - */ - environment: string; - /** - * Unique identifier of the deployment - * @example 42 - */ - id: number; - /** @example "MDEwOkRlcGxveW1lbnQx" */ - node_id: string; - /** @example "staging" */ - original_environment?: string; - payload: object; - performed_via_github_app?: Integration | null; - /** - * Specifies if the given environment is one that end-users directly interact with. Default: false. - * @example true - */ - production_environment?: boolean; - /** - * The ref to deploy. This can be a branch, tag, or sha. - * @example "topic-branch" - */ - ref: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/example" - */ - repository_url: string; - /** @example "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d" */ - sha: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/example/deployments/1/statuses" - */ - statuses_url: string; - /** - * Parameter to specify a task to execute - * @example "deploy" - */ - task: string; - /** - * Specifies if the given environment is will no longer exist at some point in the future. Default: false. - * @example true - */ - transient_environment?: boolean; - /** - * @format date-time - * @example "2012-07-20T01:19:13Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/example/deployments/1" - */ - url: string; -} + /** + * @description The Group Feeds endpoint returns information about the user's feeds. The response includes the latest value of each feed, and other metadata about each feed, but only for feeds within the given group. + * + * @tags Groups, Feeds + * @name AllGroupFeeds + * @summary All feeds for current user in a given group + * @request GET:/{username}/groups/{group_key}/feeds + * @secure + */ + allGroupFeeds: (groupKey: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/feeds\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** - * Deployment Status - * The status of a deployment. - */ -export interface DeploymentStatus { - /** - * @format date-time - * @example "2012-07-20T01:19:13Z" - */ - created_at: string; - creator: SimpleUser | null; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/example/deployments/42" - */ - deployment_url: string; - /** - * A short description of the status. - * @maxLength 140 - * @default "" - * @example "Deployment finished successfully." - */ - description: string; - /** - * The environment of the deployment that the status is for. - * @default "" - * @example "production" - */ - environment?: string; - /** - * The URL for accessing your environment. - * @format uri - * @default "" - * @example "https://staging.example.com/" - */ - environment_url?: string; - /** @example 1 */ - id: number; - /** - * The URL to associate with this status. - * @format uri - * @default "" - * @example "https://example.com/deployment/42/output" - */ - log_url?: string; - /** @example "MDE2OkRlcGxveW1lbnRTdGF0dXMx" */ - node_id: string; - performed_via_github_app?: Integration | null; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/example" - */ - repository_url: string; - /** - * The state of the status. - * @example "success" - */ - state: "error" | "failure" | "inactive" | "pending" | "success" | "queued" | "in_progress"; - /** - * Deprecated: the URL to associate with this status. - * @format uri - * @default "" - * @example "https://example.com/deployment/42/output" - */ - target_url: string; - /** - * @format date-time - * @example "2012-07-20T01:19:13Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/example/deployments/42/statuses/1" - */ - url: string; -} + /** + * No description + * + * @tags Feeds + * @name CreateGroupFeed + * @summary Create a new Feed in a Group + * @request POST:/{username}/groups/{group_key}/feeds + * @secure + */ + createGroupFeed: ( + username: string, + groupKey: string, + feed: { + description?: string; + key?: string; + license?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/feeds\`, + method: "POST", + body: feed, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Diff Entry - * Diff Entry - */ -export interface DiffEntry { - /** @example 103 */ - additions: number; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt" - */ - blob_url: string; - /** @example 124 */ - changes: number; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e" - */ - contents_url: string; - /** @example 21 */ - deletions: number; - /** @example "file1.txt" */ - filename: string; - /** @example "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test" */ - patch?: string; - /** @example "file.txt" */ - previous_filename?: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt" - */ - raw_url: string; - /** @example "bbcd538c8e72b8c175046e27cc8f907076331401" */ - sha: string; - /** @example "added" */ - status: string; + /** + * No description + * + * @tags Data + * @name AllGroupFeedData + * @summary All data for current feed in a specific group + * @request GET:/{username}/groups/{group_key}/feeds/{feed_key}/data + * @secure + */ + allGroupFeedData: ( + username: string, + groupKey: string, + feedKey: string, + query?: { + /** + * End time for filtering data. Returns data created before give time. + * @format date-time + */ + end_time?: string; + /** Limit the number of records returned. */ + limit?: number; + /** + * Start time for filtering data. Returns data created after given time. + * @format date-time + */ + start_time?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/feeds/\${feedKey}/data\`, + method: "GET", + query: query, + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Data + * @name CreateGroupFeedData + * @summary Create new Data in a feed belonging to a particular group + * @request POST:/{username}/groups/{group_key}/feeds/{feed_key}/data + * @secure + */ + createGroupFeedData: ( + username: string, + groupKey: string, + feedKey: string, + datum: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/feeds/\${feedKey}/data\`, + method: "POST", + body: datum, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Data + * @name BatchCreateGroupFeedData + * @summary Create multiple new Data records in a feed belonging to a particular group + * @request POST:/{username}/groups/{group_key}/feeds/{feed_key}/data/batch + * @secure + */ + batchCreateGroupFeedData: ( + username: string, + groupKey: string, + feedKey: string, + data: { + /** @format dateTime */ + created_at?: string; + ele?: string; + epoch?: number; + lat?: string; + lon?: string; + value?: string; + }[], + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/feeds/\${feedKey}/data/batch\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Groups, Feeds + * @name RemoveFeedFromGroup + * @summary Remove a Feed from a Group + * @request POST:/{username}/groups/{group_key}/remove + * @secure + */ + removeFeedFromGroup: ( + groupKey: string, + username: string, + query?: { + feed_key?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/groups/\${groupKey}/remove\`, + method: "POST", + query: query, + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Users + * @name GetCurrentUserThrottle + * @summary Get the user's data rate limit and current activity level. + * @request GET:/{username}/throttle + * @secure + */ + getCurrentUserThrottle: (username: string, params: RequestParams = {}) => + this.request< + { + /** Actions taken inside the time window. */ + active_data_rate?: number; + /** Max possible actions inside the time window (usually 1 minute). */ + data_rate_limit?: number; + }, + void + >({ + path: \`/\${username}/throttle\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + + /** + * @description The Tokens endpoint returns information about the user's tokens. + * + * @tags Tokens + * @name AllTokens + * @summary All tokens for current user + * @request GET:/{username}/tokens + * @secure + */ + allTokens: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/tokens\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Tokens + * @name CreateToken + * @summary Create a new Token + * @request POST:/{username}/tokens + * @secure + */ + createToken: (username: string, token: Token, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/tokens\`, + method: "POST", + body: token, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Tokens + * @name DestroyToken + * @summary Delete an existing Token + * @request DELETE:/{username}/tokens/{id} + * @secure + */ + destroyToken: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/tokens/\${id}\`, + method: "DELETE", + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Tokens + * @name GetToken + * @summary Returns Token based on ID + * @request GET:/{username}/tokens/{id} + * @secure + */ + getToken: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/tokens/\${id}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Tokens + * @name UpdateToken + * @summary Update properties of an existing Token + * @request PATCH:/{username}/tokens/{id} + * @secure + */ + updateToken: ( + username: string, + id: string, + token: { + token?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/tokens/\${id}\`, + method: "PATCH", + body: token, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Tokens + * @name ReplaceToken + * @summary Replace an existing Token + * @request PUT:/{username}/tokens/{id} + * @secure + */ + replaceToken: ( + username: string, + id: string, + token: { + token?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/tokens/\${id}\`, + method: "PUT", + body: token, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description The Triggers endpoint returns information about the user's triggers. + * + * @tags Triggers + * @name AllTriggers + * @summary All triggers for current user + * @request GET:/{username}/triggers + * @secure + */ + allTriggers: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/triggers\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Triggers + * @name CreateTrigger + * @summary Create a new Trigger + * @request POST:/{username}/triggers + * @secure + */ + createTrigger: (username: string, trigger: Trigger, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/triggers\`, + method: "POST", + body: trigger, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Triggers + * @name DestroyTrigger + * @summary Delete an existing Trigger + * @request DELETE:/{username}/triggers/{id} + * @secure + */ + destroyTrigger: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/triggers/\${id}\`, + method: "DELETE", + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Triggers + * @name GetTrigger + * @summary Returns Trigger based on ID + * @request GET:/{username}/triggers/{id} + * @secure + */ + getTrigger: (username: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/triggers/\${id}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Triggers + * @name UpdateTrigger + * @summary Update properties of an existing Trigger + * @request PATCH:/{username}/triggers/{id} + * @secure + */ + updateTrigger: ( + username: string, + id: string, + trigger: { + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/triggers/\${id}\`, + method: "PATCH", + body: trigger, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Triggers + * @name ReplaceTrigger + * @summary Replace an existing Trigger + * @request PUT:/{username}/triggers/{id} + * @secure + */ + replaceTrigger: ( + username: string, + id: string, + trigger: { + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/triggers/\${id}\`, + method: "PUT", + body: trigger, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description The Permissions endpoint returns information about the user's permissions. + * + * @tags Permissions + * @name AllPermissions + * @summary All permissions for current user and type + * @request GET:/{username}/{type}/{type_id}/acl + * @secure + */ + allPermissions: (username: string, type: string, typeId: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Permissions + * @name CreatePermission + * @summary Create a new Permission + * @request POST:/{username}/{type}/{type_id}/acl + * @secure + */ + createPermission: ( + username: string, + type: string, + typeId: string, + permission: Permission, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl\`, + method: "POST", + body: permission, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Permissions + * @name DestroyPermission + * @summary Delete an existing Permission + * @request DELETE:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + destroyPermission: (username: string, type: string, typeId: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl/\${id}\`, + method: "DELETE", + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Permissions + * @name GetPermission + * @summary Returns Permission based on ID + * @request GET:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + getPermission: (username: string, type: string, typeId: string, id: string, params: RequestParams = {}) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl/\${id}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Permissions + * @name UpdatePermission + * @summary Update properties of an existing Permission + * @request PATCH:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + updatePermission: ( + username: string, + type: string, + typeId: string, + id: string, + permission: { + /** @default "r" */ + mode?: "r" | "w" | "rw"; + /** @default "public" */ + scope?: "secret" | "public" | "user" | "organization"; + scope_value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl/\${id}\`, + method: "PATCH", + body: permission, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Permissions + * @name ReplacePermission + * @summary Replace an existing Permission + * @request PUT:/{username}/{type}/{type_id}/acl/{id} + * @secure + */ + replacePermission: ( + username: string, + type: string, + typeId: string, + id: string, + permission: { + /** @default "r" */ + mode?: "r" | "w" | "rw"; + /** @default "public" */ + scope?: "secret" | "public" | "user" | "organization"; + scope_value?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${username}/\${type}/\${typeId}/acl/\${id}\`, + method: "PUT", + body: permission, + secure: true, + type: ContentType.Json, + format: "json", + ...params, + }), + }; } +" +`; -/** - * Email - * Email +exports[`simple > 'additional-properties' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export interface Email { - /** - * @format email - * @example "octocat@github.com" - */ - email: string; - /** @example true */ - primary: boolean; - /** @example true */ - verified: boolean; - /** @example "public" */ - visibility: string | null; + +export interface Message { + code?: number; + text?: string; } -/** The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`. */ -export enum EnabledOrganizations { - All = "all", - None = "none", - Selected = "selected", +export type Messages = Record; + +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; } -/** The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`. */ -export enum EnabledRepositories { - All = "all", - None = "none", - Selected = "selected", +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** - * Enterprise - * An enterprise account - */ -export interface Enterprise { - /** @format uri */ - avatar_url: string; - /** - * @format date-time - * @example "2019-01-26T19:01:12Z" - */ - created_at: string | null; - /** A short description of the enterprise. */ - description?: string | null; - /** - * @format uri - * @example "https://github.com/enterprises/octo-business" - */ - html_url: string; - /** - * Unique identifier of the enterprise - * @example 42 - */ - id: number; - /** - * The name of the enterprise. - * @example "Octo Business" - */ - name: string; - /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ - node_id: string; - /** - * The slug url identifier for the enterprise. - * @example "octo-business" - */ - slug: string; - /** - * @format date-time - * @example "2019-01-26T19:14:43Z" - */ - updated_at: string | null; - /** - * The enterprise's website URL. - * @format uri - */ - website_url?: string | null; +export interface HttpResponse extends Response { + data: D; + error: E; } -/** - * Event - * Event - */ -export interface Event { - /** Actor */ - actor: Actor; - /** @format date-time */ - created_at: string | null; - id: string; - /** Actor */ - org?: Actor; - payload: { - action: string; - /** Comments provide a way for people to collaborate on an issue. */ - comment?: IssueComment; - /** Issue Simple */ - issue?: IssueSimple; - pages?: { - action?: string; - html_url?: string; - page_name?: string; - sha?: string; - summary?: string | null; - title?: string; - }[]; - }; - public: boolean; - repo: { - id: number; - name: string; - /** @format uri */ - url: string; - }; - type: string | null; +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", } -/** - * Feed - * Feed - */ -export interface Feed { - _links: { - /** Hypermedia Link with Type */ - current_user?: 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; +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.clone() 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; + }); }; - /** @example "https://github.com/octocat.private.actor?token=abc123" */ - current_user_actor_url?: string; - /** @example "https://github.com/octocat-org" */ - current_user_organization_url?: string; - /** @example ["https://github.com/organizations/github/octocat.private.atom?token=abc123"] */ - current_user_organization_urls?: string[]; - /** @example "https://github.com/octocat" */ - current_user_public_url?: string; - /** @example "https://github.com/octocat.private?token=abc123" */ - current_user_url?: string; - /** @example "https://github.com/security-advisories" */ - security_advisories_url?: string; - /** @example "https://github.com/timeline" */ - timeline_url: string; - /** @example "https://github.com/{user}" */ - user_url: string; } /** - * File Commit - * File Commit + * @title Additional properties Example + * @version 1.0.0 */ -export interface FileCommit { - commit: { - author?: { - date?: string; - email?: string; - name?: string; - }; - committer?: { - date?: string; - email?: string; - name?: string; - }; - html_url?: string; - message?: string; - node_id?: string; - parents?: { - html_url?: string; - sha?: string; - url?: string; - }[]; - sha?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - verification?: { - payload?: string | null; - reason?: string; - signature?: string | null; - verified?: boolean; - }; +export class Api extends HttpClient {} +" +`; + +exports[`simple > 'additional-properties2' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type Primitive = string | number | boolean | null; + +export type PrimitiveMap = Record; + +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", }; - content: { - _links?: { - git?: string; - html?: string; - self?: string; + + 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) || {}), + }, }; - download_url?: string; - git_url?: string; - html_url?: string; - name?: string; - path?: string; - sha?: string; - size?: number; - type?: string; - url?: string; - } | null; + } + + 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.clone() 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; + }); + }; } /** - * Full Repository - * Full Repository + * @title No title */ -export interface FullRepository { - /** @example true */ - allow_merge_commit?: boolean; - /** @example true */ - allow_rebase_merge?: boolean; - /** @example true */ - allow_squash_merge?: boolean; - /** - * Whether anonymous git access is allowed. - * @default true - */ - anonymous_access_enabled?: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ - archive_url: string; - archived: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ - assignees_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ - blobs_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ - branches_url: string; - /** @example "https://github.com/octocat/Hello-World.git" */ - clone_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ - collaborators_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ - comments_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ - commits_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ - compare_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ - contents_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/contributors" - */ - contributors_url: string; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - created_at: string; - /** @example "master" */ - default_branch: string; - /** @example false */ - delete_branch_on_merge?: boolean; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/deployments" - */ - deployments_url: string; - /** @example "This your first repo!" */ - description: string | null; - /** Returns whether or not this repository disabled. */ - disabled: boolean; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/downloads" - */ - downloads_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/events" - */ - events_url: string; - fork: boolean; - forks: number; - /** @example 9 */ - forks_count: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/forks" - */ - forks_url: string; - /** @example "octocat/Hello-World" */ - full_name: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ - git_commits_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ - git_refs_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ - git_tags_url: string; - /** @example "git:github.com/octocat/Hello-World.git" */ - git_url: string; - /** @example true */ - has_downloads: boolean; - /** @example true */ - has_issues: boolean; - has_pages: boolean; - /** @example true */ - has_projects: boolean; - /** @example true */ - has_wiki: boolean; - /** - * @format uri - * @example "https://github.com" - */ - homepage: string | null; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/hooks" - */ - hooks_url: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World" - */ - html_url: string; - /** @example 1296269 */ - id: number; - /** @example true */ - is_template?: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ - issue_comment_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ - issue_events_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ - issues_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ - keys_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ - labels_url: string; - language: string | null; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/languages" - */ - languages_url: string; - license: LicenseSimple | null; - master_branch?: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/merges" - */ - merges_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ - milestones_url: string; - /** - * @format uri - * @example "git:git.example.com/octocat/Hello-World" - */ - mirror_url: string | null; - /** @example "Hello-World" */ - name: string; - /** @example 0 */ - network_count: number; - /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ - node_id: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ - notifications_url: string; - open_issues: number; - /** @example 0 */ - open_issues_count: number; - organization?: SimpleUser | null; - owner: SimpleUser | null; - /** A git repository */ - parent?: Repository; - permissions?: { - admin: boolean; - pull: boolean; - push: boolean; +export class Api extends HttpClient {} +" +`; + +exports[`simple > 'allof-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type Cat = Pet & { + age?: number; + hunts?: boolean; +}; + +export type Dog = Pet & { + bark?: boolean; + breed: "Dingo" | "Husky" | "Retriever" | "Shepherd"; +}; + +export interface Pet { + pet_type: string; +} + +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.clone() 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; + }); }; - private: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ - pulls_url: string; - /** - * @format date-time - * @example "2011-01-26T19:06:43Z" - */ - pushed_at: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ - releases_url: string; - /** @example 108 */ - size: number; - /** A git repository */ - source?: Repository; - /** @example "git@github.com:octocat/Hello-World.git" */ - ssh_url: string; - /** @example 80 */ - stargazers_count: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" - */ - stargazers_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ - statuses_url: string; - /** @example 42 */ - subscribers_count: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" - */ - subscribers_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/subscription" - */ - subscription_url: string; - /** - * @format uri - * @example "https://svn.github.com/octocat/Hello-World" - */ - svn_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/tags" - */ - tags_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/teams" - */ - teams_url: string; - temp_clone_token?: string | null; - template_repository?: Repository | null; - /** @example ["octocat","atom","electron","API"] */ - topics?: string[]; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ - trees_url: string; - /** - * @format date-time - * @example "2011-01-26T19:14:43Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World" - */ - url: string; - /** - * The repository visibility: public, private, or internal. - * @example "public" - */ - visibility?: string; - watchers: number; - /** @example 80 */ - watchers_count: number; } /** - * Gist Comment - * A comment made to a gist. + * @title Allof Example + * @version 1.0.0 */ -export interface GistComment { - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - /** - * The comment text. - * @maxLength 65535 - * @example "Body of the attachment" - */ - body: string; - /** - * @format date-time - * @example "2011-04-18T23:23:56Z" - */ - created_at: string; - /** @example 1 */ - id: number; - /** @example "MDExOkdpc3RDb21tZW50MQ==" */ - node_id: string; - /** - * @format date-time - * @example "2011-04-18T23:23:56Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/gists/a6db0bec360bb87e9418/comments/1" - */ - url: string; - user: SimpleUser | null; +export class Api extends HttpClient { + pets = { + /** + * No description + * + * @name PetsPartialUpdate + * @request PATCH:/pets + */ + petsPartialUpdate: (data: Cat | Dog, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), + }; } +" +`; -/** - * Gist Commit - * Gist Commit +exports[`simple > 'another-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export interface GistCommit { - change_status: { - additions?: number; - deletions?: number; - total?: number; - }; - /** - * @format date-time - * @example "2010-04-14T02:15:15Z" - */ - committed_at: string; + +/** some description */ +export interface Amount { + /** some description */ + currency: Currency; /** - * @format uri - * @example "https://api.github.com/gists/aa5a315d61ae9438b18d/57a7f021a713b1c5a6a199b54cc514735d2d462f" + * some description + * @format double + * @min 0.01 + * @max 1000000000000000 */ - url: string; - user: SimpleUser | null; - /** @example "57a7f021a713b1c5a6a199b54cc514735d2d462f" */ - version: string; + value: number; } /** - * Gist Simple - * Gist Simple + * An uploaded response + * Describes the result of uploading an image resource + * @example {"code":0,"type":"type","message":"message"} */ -export interface GistSimple { - comments?: number; - comments_url?: string; - commits_url?: string; - created_at?: string; - description?: string | null; - files?: Record< - string, - { - content?: string; - filename?: string; - language?: string; - raw_url?: string; - size?: number; - truncated?: boolean; - type?: string; - } | null - >; - forks_url?: string; - git_pull_url?: string; - git_push_url?: string; - html_url?: string; - id?: string; - node_id?: string; - /** Simple User */ - owner?: SimpleUser; - public?: boolean; - truncated?: boolean; - updated_at?: string; - url?: string; - user?: string | null; +export interface ApiResponse { + /** @format int32 */ + code?: number; + message?: string; + type?: string; } /** - * Git Commit - * Low-level Git commit operations within a repository + * Pet category + * A category for a pet + * @example {"name":"name","id":6} */ -export interface GitCommit { - /** Identifying information for the git-user */ - author: { - /** - * Timestamp of the commit - * @format date-time - * @example "2014-08-09T08:02:04+12:00" - */ - date: string; - /** - * Git email address of the user - * @example "monalisa.octocat@example.com" - */ - email: string; - /** - * Name of the git user - * @example "Monalisa Octocat" - */ - name: string; - }; - /** Identifying information for the git-user */ - committer: { - /** - * Timestamp of the commit - * @format date-time - * @example "2014-08-09T08:02:04+12:00" - */ - date: string; - /** - * Git email address of the user - * @example "monalisa.octocat@example.com" - */ - email: string; - /** - * Name of the git user - * @example "Monalisa Octocat" - */ - name: string; - }; - /** @format uri */ - html_url: string; - /** - * Message describing the purpose of the commit - * @example "Fix #42" - */ - message: string; - node_id: string; - parents: { - /** @format uri */ - html_url: string; - /** - * SHA for the commit - * @example "7638417db6d59f3c431d3e1f261cc637155684cd" - */ - sha: string; - /** @format uri */ - url: string; - }[]; - /** - * SHA for the commit - * @example "7638417db6d59f3c431d3e1f261cc637155684cd" - */ - sha: string; - tree: { - /** - * SHA for the commit - * @example "7638417db6d59f3c431d3e1f261cc637155684cd" - */ - sha: string; - /** @format uri */ - url: string; - }; - /** @format uri */ - url: string; - verification: { - payload: string | null; - reason: string; - signature: string | null; - verified: boolean; - }; +export interface Category { + /** @format int64 */ + id?: number; + name?: string; } /** - * Git Reference - * Git references within a repository + * some description + * @pattern ^[A-Z]{3,3}$ */ -export interface GitRef { - node_id: string; - object: { - /** - * SHA for the reference - * @minLength 40 - * @maxLength 40 - * @example "7638417db6d59f3c431d3e1f261cc637155684cd" - */ - sha: string; - type: string; - /** @format uri */ - url: string; - }; - ref: string; - /** @format uri */ - url: string; -} +export type Currency = string; /** - * Git Tag - * Metadata for a Git tag + * Pet Order + * An order for a pets from the pet store + * @example {"petId":6,"quantity":1,"id":0,"shipDate":"2000-01-23T04:56:07.000+00:00","complete":false,"status":"placed"} */ -export interface GitTag { - /** - * Message describing the purpose of the tag - * @example "Initial public release" - */ - message: string; - /** @example "MDM6VGFnOTQwYmQzMzYyNDhlZmFlMGY5ZWU1YmM3YjJkNWM5ODU4ODdiMTZhYw==" */ - node_id: string; - object: { - sha: string; - type: string; - /** @format uri */ - url: string; - }; - /** @example "940bd336248efae0f9ee5bc7b2d5c985887b16ac" */ - sha: string; - /** - * Name of the tag - * @example "v0.0.1" - */ - tag: string; - tagger: { - date: string; - email: string; - name: string; - }; - /** - * URL for the tag - * @format uri - * @example "https://api.github.com/repositories/42/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac" - */ - url: string; - verification?: Verification; +export interface Order { + /** @default false */ + complete?: boolean; + /** @format int64 */ + id?: number; + /** @format int64 */ + petId?: number; + /** @format int32 */ + quantity?: number; + /** @format date-time */ + shipDate?: string; + /** Order Status */ + status?: "placed" | "approved" | "delivered" | null; } /** - * Git Tree - * The hierarchy between files in a Git repository. + * a Pet + * A pet for sale in the pet store + * @example {"photoUrls":["photoUrls","photoUrls"],"name":"doggie","id":0,"category":{"name":"name","id":6},"tags":[{"name":"name","id":1},{"name":"name","id":1}],"status":"available"} */ -export interface GitTree { - sha: string; - /** - * Objects specifying a tree structure - * @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 "040000" */ - mode?: 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; - }[]; - truncated: boolean; - /** @format uri */ - url: string; +export interface Pet { + /** A category for a pet */ + category?: Category; + /** @format int64 */ + id?: number; + /** @example "doggie" */ + name: string; + photoUrls: string[]; + /** pet status in the store */ + status?: "available" | "pending" | "sold"; + tags?: Tag[]; } -/** - * Git User - * Metaproperties for Git author/committer information. - */ -export interface GitUser { - /** @example ""2007-10-29T02:42:39.000-07:00"" */ - date?: string; - /** @example ""chris@ozmm.org"" */ - email?: string; - /** @example ""Chris Wanstrath"" */ - name?: string; +export enum PetIds { + Value10 = 10, + Value20 = 20, + Value30 = 30, + Value40 = 40, } -/** - * Gitignore Template - * Gitignore Template - */ -export interface GitignoreTemplate { - /** @example "C" */ - name: string; - /** - * @example "# Object files - * *.o - * - * # Libraries - * *.lib - * *.a - * - * # Shared objects (inc. Windows DLLs) - * *.dll - * *.so - * *.so.* - * *.dylib - * - * # Executables - * *.exe - * *.out - * *.app - * " - */ - source: string; +export enum PetIdsWithWrongEnum { + Value10 = 10, + Value20 = 20, + Value30 = 30, + Value40 = 40, } -/** - * GPG Key - * A unique encryption key - */ -export interface GpgKey { - /** @example true */ - can_certify: boolean; - can_encrypt_comms: boolean; - can_encrypt_storage: boolean; - /** @example true */ - can_sign: boolean; - /** - * @format date-time - * @example "2016-03-24T11:31:04-06:00" - */ - created_at: string; - /** @example [{"email":"mastahyeti@users.noreply.github.com","verified":true}] */ - emails: { - email?: string; - verified?: boolean; - }[]; - /** @format date-time */ - expires_at: string | null; - /** @example 3 */ - id: number; - /** @example "3262EFF25BA0D270" */ - key_id: string; - primary_key_id: number | null; - /** @example "xsBNBFayYZ..." */ - public_key: string; - 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: { - can_certify?: boolean; - can_encrypt_comms?: boolean; - can_encrypt_storage?: 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[]; - }[]; +export enum PetNames { + FluffyHero = "Fluffy Hero", + PiggyPo = "Piggy Po", + SwaggerTypescriptApi = "Swagger Typescript Api", + UPPER_CASE = "UPPER_CASE", } /** - * GroupMapping - * External Groups to be mapped to a team for membership + * Pet Tag + * A tag for a pet + * @example {"name":"name","id":1} */ -export interface GroupMapping { - /** - * 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" - */ - group_id?: string; - /** - * The name of the group - * @example "saml-azuread-test" - */ - group_name?: string; - /** - * Array of groups to be mapped to this team - * @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" - */ - group_id: string; - /** - * The name of the group - * @example "saml-azuread-test" - */ - group_name: string; - }[]; - /** - * synchronization status for this group mapping - * @example "unsynced" - */ - status?: string; - /** - * the time of the last sync for this group-mapping - * @example "2019-06-03 22:27:15:000 -700" - */ - synced_at?: string; +export interface Tag { + /** @format int64 */ + id?: number; + name?: string; } /** - * Webhook - * Webhooks for repositories. + * a User + * A User who is purchasing from the pet store + * @example {"firstName":"firstName","lastName":"lastName","password":"password","userStatus":6,"phone":"phone","id":0,"email":"email","username":"username"} */ -export interface Hook { - /** - * Determines whether the hook is actually triggered on pushes. - * @example true - */ - 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; - /** 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 - * @example "2011-09-06T17:26:27Z" - */ - created_at: string; - /** - * Determines what events the hook is triggered for. Default: ['push']. - * @example ["push","pull_request"] - */ - events: string[]; - /** - * Unique identifier of the webhook. - * @example 42 - */ - id: number; - last_response: HookResponse; - /** - * The name of a valid service, use 'web' for a webhook. - * @example "web" - */ - name: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings" - */ - ping_url: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/hooks/1/test" - */ - test_url: string; - type: string; - /** - * @format date-time - * @example "2011-09-06T20:39:23Z" - */ - updated_at: string; +export interface User { + email?: string; + firstName?: string; + /** @format int64 */ + id?: number; + lastName?: string; + password?: string; + phone?: string; /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/hooks/1" + * User Status + * @format int32 */ - url: string; + userStatus?: number; + username?: string; } -/** Hook Response */ -export interface HookResponse { - code: number | null; - message: string | null; - status: string | null; +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; } -/** - * Hovercard - * Hovercard - */ -export interface Hovercard { - contexts: { - message: string; - octicon: string; - }[]; +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** - * Import - * A repository import from an external source. - */ -export interface Import { - authors_count?: number | null; - /** @format uri */ - authors_url: string; - commit_count?: number | null; - error_message?: string | null; - failed_step?: string | null; - has_large_files?: boolean; - /** @format uri */ - html_url: string; - import_percent?: number | null; - large_files_count?: number; - large_files_size?: number; - message?: string; - project_choices?: { - human_name?: string; - tfvc_project?: string; - vcs?: string; - }[]; - push_percent?: number | null; - /** @format uri */ - repository_url: string; - status: - | "auth" - | "error" - | "none" - | "detecting" - | "choose" - | "auth_failed" - | "importing" - | "mapping" - | "waiting_to_push" - | "pushing" - | "complete" - | "setup" - | "unknown" - | "detection_found_multiple" - | "detection_found_nothing" - | "detection_needs_auth"; - status_text?: string | null; - svc_root?: string; - svn_root?: string; - tfvc_project?: string; - /** @format uri */ - url: string; - use_lfs?: string; - vcs: string | null; - /** The URL of the originating repository. */ - vcs_url: string; +export interface HttpResponse extends Response { + data: D; + error: E; } -/** - * Installation - * Installation - */ -export interface Installation { - /** - * @format uri - * @example "https://api.github.com/installations/1/access_tokens" - */ - access_tokens_url: string; - account: SimpleUser | Enterprise | null; - /** @example 1 */ - app_id: number; - /** @example "github-actions" */ - app_slug: string; - /** @example ""test_13f1e99741e3e004@d7e1eb0bc0a1ba12.com"" */ - contact_email?: string | null; - /** @format date-time */ - created_at: string; - events: string[]; - /** @example true */ - has_multiple_single_files?: boolean; - /** - * @format uri - * @example "https://github.com/organizations/github/settings/installations/1" - */ - html_url: string; - /** - * The ID of the installation. - * @example 1 - */ - id: number; - /** @example {"issues":"read","deployments":"write"} */ - permissions: { - checks?: string; - contents?: string; - deployments?: string; - /** @example ""read"" */ - issues?: string; - metadata?: string; - /** @example ""read"" */ - organization_administration?: string; - pull_requests?: string; - statuses?: string; - }; - /** - * @format uri - * @example "https://api.github.com/installation/repositories" - */ - repositories_url: string; - /** Describe whether all repositories have been selected or there's a selection involved */ - repository_selection: "all" | "selected"; - /** @example "config.yaml" */ - single_file_name: string | null; - /** @example ["config.yml",".github/issue_TEMPLATE.md"] */ - single_file_paths?: string[]; - /** @format date-time */ - suspended_at?: string | null; - suspended_by?: SimpleUser | null; - /** The ID of the user or organization this token is being scoped to. */ - target_id: number; - /** @example "Organization" */ - target_type: string; - /** @format date-time */ - updated_at: string; +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", } -/** - * Installation Token - * Authentication token for a GitHub App installed on a user or org. - */ -export interface InstallationToken { - expires_at: string; - /** @example true */ - has_multiple_single_files?: boolean; - permissions?: { - contents?: string; - issues?: string; - /** @example "read" */ - metadata?: string; - /** @example "read" */ - single_file?: string; +export class HttpClient { + public baseUrl: string = "http://petstore.swagger.io/v2"; + 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", }; - repositories?: Repository[]; - repository_selection?: "all" | "selected"; - /** @example "README.md" */ - single_file?: string; - /** @example ["config.yml",".github/issue_TEMPLATE.md"] */ - single_file_paths?: string[]; - token: string; -} -/** - * GitHub app - * GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. - */ -export interface Integration { - /** @example ""Iv1.25b5d1e65ffc4022"" */ - client_id?: string; - /** @example ""1d4b2097ac622ba702d19de498f005747a8b21d3"" */ - client_secret?: string; - /** - * @format date-time - * @example "2017-07-08T16:18:44-04:00" - */ - created_at: string; - /** @example "The description of the app." */ - description: string | null; - /** - * The list of events for the GitHub app - * @example ["label","deployment"] - */ - events: string[]; - /** - * @format uri - * @example "https://example.com" - */ - external_url: string; - /** - * @format uri - * @example "https://github.com/apps/super-ci" - */ - html_url: string; - /** - * Unique identifier of the GitHub app - * @example 37 - */ - id: number; - /** - * The number of installations associated with the GitHub app - * @example 5 - */ - installations_count?: number; - /** - * The name of the GitHub app - * @example "Probot Owners" - */ - name: string; - /** @example "MDExOkludGVncmF0aW9uMQ==" */ - node_id: string; - owner: SimpleUser | null; - /** @example ""-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEArYxrNYD/iT5CZVpRJu4rBKmmze3PVmT/gCo2ATUvDvZTPTey\nxcGJ3vvrJXazKk06pN05TN29o98jrYz4cengG3YGsXPNEpKsIrEl8NhbnxapEnM9\nJCMRe0P5JcPsfZlX6hmiT7136GRWiGOUba2X9+HKh8QJVLG5rM007TBER9/z9mWm\nrJuNh+m5l320oBQY/Qq3A7wzdEfZw8qm/mIN0FCeoXH1L6B8xXWaAYBwhTEh6SSn\nZHlO1Xu1JWDmAvBCi0RO5aRSKM8q9QEkvvHP4yweAtK3N8+aAbZ7ovaDhyGz8r6r\nzhU1b8Uo0Z2ysf503WqzQgIajr7Fry7/kUwpgQIDAQABAoIBADwJp80Ko1xHPZDy\nfcCKBDfIuPvkmSW6KumbsLMaQv1aGdHDwwTGv3t0ixSay8CGlxMRtRDyZPib6SvQ\n6OH/lpfpbMdW2ErkksgtoIKBVrDilfrcAvrNZu7NxRNbhCSvN8q0s4ICecjbbVQh\nnueSdlA6vGXbW58BHMq68uRbHkP+k+mM9U0mDJ1HMch67wlg5GbayVRt63H7R2+r\nVxcna7B80J/lCEjIYZznawgiTvp3MSanTglqAYi+m1EcSsP14bJIB9vgaxS79kTu\noiSo93leJbBvuGo8QEiUqTwMw4tDksmkLsoqNKQ1q9P7LZ9DGcujtPy4EZsamSJT\ny8OJt0ECgYEA2lxOxJsQk2kI325JgKFjo92mQeUObIvPfSNWUIZQDTjniOI6Gv63\nGLWVFrZcvQBWjMEQraJA9xjPbblV8PtfO87MiJGLWCHFxmPz2dzoedN+2Coxom8m\nV95CLz8QUShuao6u/RYcvUaZEoYs5bHcTmy5sBK80JyEmafJPtCQVxMCgYEAy3ar\nZr3yv4xRPEPMat4rseswmuMooSaK3SKub19WFI5IAtB/e7qR1Rj9JhOGcZz+OQrl\nT78O2OFYlgOIkJPvRMrPpK5V9lslc7tz1FSh3BZMRGq5jSyD7ETSOQ0c8T2O/s7v\nbeEPbVbDe4mwvM24XByH0GnWveVxaDl51ABD65sCgYB3ZAspUkOA5egVCh8kNpnd\nSd6SnuQBE3ySRlT2WEnCwP9Ph6oPgn+oAfiPX4xbRqkL8q/k0BdHQ4h+zNwhk7+h\nWtPYRAP1Xxnc/F+jGjb+DVaIaKGU18MWPg7f+FI6nampl3Q0KvfxwX0GdNhtio8T\nTj1E+SnFwh56SRQuxSh2gwKBgHKjlIO5NtNSflsUYFM+hyQiPiqnHzddfhSG+/3o\nm5nNaSmczJesUYreH5San7/YEy2UxAugvP7aSY2MxB+iGsiJ9WD2kZzTUlDZJ7RV\nUzWsoqBR+eZfVJ2FUWWvy8TpSG6trh4dFxImNtKejCR1TREpSiTV3Zb1dmahK9GV\nrK9NAoGAbBxRLoC01xfxCTgt5BDiBcFVh4fp5yYKwavJPLzHSpuDOrrI9jDn1oKN\nonq5sDU1i391zfQvdrbX4Ova48BN+B7p63FocP/MK5tyyBoT8zQEk2+vWDOw7H/Z\nu5dTCPxTIsoIwUw1I+7yIxqJzLPFgR2gVBwY1ra/8iAqCj+zeBw=\n-----END RSA PRIVATE KEY-----\n"" */ - pem?: string; - /** - * The set of permissions for the GitHub app - * @example {"issues":"read","deployments":"write"} - */ - permissions: { - checks?: string; - contents?: string; - deployments?: string; - issues?: string; - metadata?: string; - [key: string]: any; + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; }; - /** - * The slug name of the GitHub app - * @example "probot-owners" - */ - slug?: string; - /** - * @format date-time - * @example "2017-07-08T16:18:44-04:00" - */ - updated_at: string; - /** @example ""6fba8f2fc8a7e8f2cca5577eddd82ca7586b3b6b"" */ - webhook_secret?: string; - [key: string]: any; -} -/** - * The duration of the interaction restriction. Can be one of: `one_day`, `three_days`, `one_week`, `one_month`, `six_months`. Default: `one_day`. - * @example "one_month" - */ -export enum InteractionExpiry { - OneDay = "one_day", - ThreeDays = "three_days", - OneWeek = "one_week", - OneMonth = "one_month", - SixMonths = "six_months", -} + protected encodeQueryParam(key: string, value: any) { + const encodedKey = encodeURIComponent(key); + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; + } -/** - * The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: `existing_users`, `contributors_only`, `collaborators_only`. - * @example "collaborators_only" - */ -export enum InteractionGroup { - ExistingUsers = "existing_users", - ContributorsOnly = "contributors_only", - CollaboratorsOnly = "collaborators_only", -} + protected addQueryParam(query: QueryParamsType, key: string) { + return this.encodeQueryParam(key, query[key]); + } -/** - * Interaction Restrictions - * Limit interactions to a specific type of user for a specified duration - */ -export interface InteractionLimit { - /** The duration of the interaction restriction. Can be one of: `one_day`, `three_days`, `one_week`, `one_month`, `six_months`. Default: `one_day`. */ - expiry?: InteractionExpiry; - /** The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: `existing_users`, `contributors_only`, `collaborators_only`. */ - limit: InteractionGroup; -} + protected addArrayQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); + } -/** - * Interaction Limits - * Interaction limit settings. - */ -export interface InteractionLimitResponse { - /** - * @format date-time - * @example "2018-08-17T04:18:39Z" - */ - expires_at: string; - /** The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: `existing_users`, `contributors_only`, `collaborators_only`. */ - limit: InteractionGroup; - /** @example "repository" */ - origin: string; -} + 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("&"); + } -/** - * Issue - * Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. - */ -export interface Issue { - active_lock_reason?: string | null; - assignee: SimpleUser | null; - assignees?: SimpleUser[] | null; - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - /** - * Contents of the issue - * @example "It looks like the new widget form is broken on Safari. When I try and create the widget, Safari crashes. This is reproducible on 10.8, but not 10.9. Maybe a browser bug?" - */ - body?: string; - body_html?: string; - body_text?: string; - /** @format date-time */ - closed_at: string | null; - closed_by?: SimpleUser | null; - comments: number; - /** @format uri */ - comments_url: string; - /** @format date-time */ - created_at: string; - /** @format uri */ - events_url: string; - /** @format uri */ - html_url: string; - id: number; - /** - * Labels to associate with this issue; pass one or more label names to replace the set of labels on this issue; send an empty array to clear all labels from the issue; note that the labels are silently dropped for users without push access to the repository - * @example ["bug","registration"] - */ - labels: ( - | string - | { - color?: string | null; - default?: boolean; - description?: string | null; - id?: number; - name?: string; - node_id?: string; - /** @format uri */ - url?: string; + 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; } - )[]; - labels_url: string; - locked: boolean; - milestone: Milestone | null; - node_id: string; - /** - * Number uniquely identifying the issue within its repository - * @example 42 - */ - number: number; - performed_via_github_app?: Integration | null; - pull_request?: { - /** @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 */ - url: string | null; + return void 0; + } + + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; }; - reactions?: ReactionRollup; - /** A git repository */ - repository?: Repository; - /** @format uri */ - repository_url: string; - /** - * State of the issue; either 'open' or 'closed' - * @example "open" - */ - state: string; - /** @format uri */ - timeline_url?: string; - /** - * Title of the issue - * @example "Widget creation fails in Safari on OS X 10.8" - */ - title: string; - /** @format date-time */ - updated_at: string; - /** - * URL for the issue - * @format uri - * @example "https://api.github.com/repositories/42/issues/1" - */ - url: string; - user: SimpleUser | null; -} -/** - * Issue Comment - * Comments provide a way for people to collaborate on an issue. - */ -export interface IssueComment { - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - /** - * Contents of the issue comment - * @example "What version of Safari were you using when you observed this bug?" - */ - body?: string; - body_html?: string; - body_text?: string; - /** - * @format date-time - * @example "2011-04-14T16:00:49Z" - */ - created_at: string; - /** @format uri */ - html_url: string; - /** - * Unique identifier of the issue comment - * @example 42 - */ - id: number; - /** @format uri */ - issue_url: string; - node_id: string; - performed_via_github_app?: Integration | null; - reactions?: ReactionRollup; - /** - * @format date-time - * @example "2011-04-14T16:00:49Z" - */ - updated_at: string; - /** - * URL for the issue comment - * @format uri - * @example "https://api.github.com/repositories/42/issues/comments/1" - */ - url: string; - user: SimpleUser | null; -} + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); -/** - * Issue Event - * Issue Event - */ -export interface IssueEvent { - actor: SimpleUser | null; - assignee?: SimpleUser | null; - assigner?: SimpleUser | null; - /** How the author is associated with the repository. */ - author_association?: AuthorAssociation; - /** @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" */ - commit_id: string | null; - /** @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" */ - commit_url: string | null; - /** - * @format date-time - * @example "2011-04-14T16:00:49Z" - */ - created_at: string; - dismissed_review?: IssueEventDismissedReview; - /** @example "closed" */ - event: string; - /** @example 1 */ - id: number; - /** Issue Simple */ - issue?: IssueSimple; - /** Issue Event Label */ - label?: IssueEventLabel; - lock_reason?: string | null; - /** Issue Event Milestone */ - milestone?: IssueEventMilestone; - /** @example "MDEwOklzc3VlRXZlbnQx" */ - node_id: string; - /** Issue Event Project Card */ - project_card?: IssueEventProjectCard; - /** Issue Event Rename */ - rename?: IssueEventRename; - requested_reviewer?: SimpleUser | null; - /** Groups of organization members that gives permissions on specified repositories. */ - requested_team?: Team; - review_requester?: SimpleUser | null; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/issues/events/1" - */ - url: string; -} + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; -/** Issue Event Dismissed Review */ -export interface IssueEventDismissedReview { - dismissal_commit_id?: string | null; - dismissal_message: string | null; - review_id: number; - state: string; + 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.clone() 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; + }); + }; } /** - * Issue Event for Issue - * Issue Event for Issue + * @title Swagger Petstore + * @version 1.0.0 + * @license Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/v2 + * @externalDocs http://swagger.io + * @contact + * + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key \`special-key\` to test the authorization filters. */ -export interface IssueEventForIssue { - /** Simple User */ - actor?: SimpleUser; - /** How the author is associated with the repository. */ - author_association?: AuthorAssociation; - /** @example "":+1:"" */ - body?: string; - /** @example ""

Accusantium fugiat cumque. Autem qui nostrum. Atque quae ullam.

"" */ - body_html?: string; - /** @example ""Accusantium fugiat cumque. Autem qui nostrum. Atque quae ullam."" */ - body_text?: string; - commit_id?: string | null; - commit_url?: string | null; - created_at?: string; - event?: string; - /** @example ""https://github.com/owner-3906e11a33a3d55ba449d63f/BBB_Private_Repo/commit/480d4f47447129f015cb327536c522ca683939a1"" */ - html_url?: string; - id?: number; - /** @example ""https://api.github.com/repos/owner-3906e11a33a3d55ba449d63f/AAA_Public_Repo/issues/1"" */ - issue_url?: string; - /** @example ""off-topic"" */ - lock_reason?: string; - /** @example ""add a bunch of files"" */ - message?: string; - node_id?: string; - /** @example ""https://api.github.com/repos/owner-3906e11a33a3d55ba449d63f/AAA_Public_Repo/pulls/2"" */ - pull_request_url?: string; - /** @example ""480d4f47447129f015cb327536c522ca683939a1"" */ - sha?: string; - /** @example ""commented"" */ - state?: string; - /** @example ""2020-07-09T00:17:51Z"" */ - submitted_at?: string; - /** @example ""2020-07-09T00:17:36Z"" */ - updated_at?: string; - url?: string; -} +export class Api extends HttpClient { + pet = { + /** + * No description + * + * @tags pet + * @name AddPet + * @summary Add a new pet to the store + * @request POST:/pet + * @secure + */ + addPet: (body: Pet, params: RequestParams = {}) => + this.request({ + path: \`/pet\`, + method: "POST", + body: body, + secure: true, + type: ContentType.Json, + ...params, + }), -/** - * Issue Event Label - * Issue Event Label - */ -export interface IssueEventLabel { - color: string | null; - name: string | null; -} + /** + * No description + * + * @tags pet + * @name UpdatePet + * @summary Update an existing pet + * @request PUT:/pet + * @secure + */ + updatePet: (body: Pet, params: RequestParams = {}) => + this.request({ + path: \`/pet\`, + method: "PUT", + body: body, + secure: true, + type: ContentType.Json, + ...params, + }), -/** - * Issue Event Milestone - * Issue Event Milestone - */ -export interface IssueEventMilestone { - title: string; -} + /** + * @description Multiple status values can be provided with comma separated strings + * + * @tags pet + * @name FindPetsByStatus + * @summary Finds Pets by status + * @request GET:/pet/findByStatus + * @secure + */ + findPetsByStatus: ( + query: { + /** Status values that need to be considered for filter */ + status: ("available" | "pending" | "sold")[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/pet/findByStatus\`, + method: "GET", + query: query, + secure: true, + format: "json", + ...params, + }), -/** - * Issue Event Project Card - * Issue Event Project Card - */ -export interface IssueEventProjectCard { - column_name: string; - id: number; - previous_column_name?: string; - project_id: number; - /** @format uri */ - project_url: string; - /** @format uri */ - url: string; -} + /** + * No description + * + * @tags pet + * @name SingleFormUrlEncodedRequest + * @summary summary + * @request POST:/pet/single-form-url-encoded + */ + singleFormUrlEncodedRequest: ( + data: { + /** @format string */ + param1: string; + param2: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/pet/single-form-url-encoded\`, + method: "POST", + body: data, + type: ContentType.UrlEncoded, + ...params, + }), -/** - * Issue Event Rename - * Issue Event Rename - */ -export interface IssueEventRename { - from: string; - to: string; -} + /** + * No description + * + * @tags pet + * @name FormUrlEncodedRequest + * @summary summary + * @request POST:/pet/form-url-encoded + */ + formUrlEncodedRequest: ( + data: { + /** @format string */ + param1: string; + param2: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/pet/form-url-encoded\`, + method: "POST", + body: data, + type: ContentType.UrlEncoded, + ...params, + }), -/** - * Issue Search Result Item - * Issue Search Result Item - */ -export interface IssueSearchResultItem { - active_lock_reason?: string | null; - assignee: SimpleUser | null; - assignees?: SimpleUser[] | null; - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - body?: string; - body_html?: string; - body_text?: string; - /** @format date-time */ - closed_at: string | null; - comments: number; - /** @format uri */ - comments_url: string; - /** @format date-time */ - created_at: string; - draft?: boolean; - /** @format uri */ - events_url: string; - /** @format uri */ - html_url: string; - id: number; - labels: { - color?: string; - default?: boolean; - description?: string | null; - id?: number; - name?: string; - node_id?: string; - url?: string; - }[]; - labels_url: string; - locked: boolean; - milestone: Milestone | null; - node_id: string; - number: number; - performed_via_github_app?: Integration | null; - pull_request?: { - /** @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 */ - url: string | null; - }; - /** A git repository */ - repository?: Repository; - /** @format uri */ - repository_url: string; - score: number; - state: string; - text_matches?: SearchResultTextMatches; - /** @format uri */ - timeline_url?: string; - title: string; - /** @format date-time */ - updated_at: string; - /** @format uri */ - url: string; - user: SimpleUser | null; -} + /** + * No description + * + * @tags pet + * @name FormUrlEncodedRequest2 + * @summary summary + * @request POST:/pet/end-form-url-encoded + * @originalName formUrlEncodedRequest + * @duplicate + */ + formUrlEncodedRequest2: ( + data: { + /** @format string */ + param1: string; + param2: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/pet/end-form-url-encoded\`, + method: "POST", + body: data, + type: ContentType.UrlEncoded, + ...params, + }), -/** - * Issue Simple - * Issue Simple - */ -export interface IssueSimple { - /** @example "too heated" */ - active_lock_reason?: string | null; - assignee: SimpleUser | null; - assignees?: SimpleUser[] | null; - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - /** @example "I'm having a problem with this." */ - body?: string; - body_html?: string; - body_text?: string; - /** @format date-time */ - closed_at: string | null; - /** @example 0 */ - comments: number; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments" - */ - comments_url: string; - /** - * @format date-time - * @example "2011-04-22T13:33:48Z" - */ - created_at: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/events" - */ - events_url: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/issues/1347" - */ - html_url: string; - /** @example 1 */ - id: number; - labels: Label[]; - /** @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/labels{/name}" */ - labels_url: string; - /** @example true */ - locked: boolean; - milestone: Milestone | null; - /** @example "MDU6SXNzdWUx" */ - node_id: string; - /** @example 1347 */ - number: number; - performed_via_github_app?: Integration | null; - pull_request?: { - /** @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 */ - url: string | null; - }; - /** A git repository */ - repository?: Repository; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World" - */ - repository_url: string; - /** @example "open" */ - state: string; - /** @format uri */ - timeline_url?: string; - /** @example "Found a bug" */ - title: string; - /** - * @format date-time - * @example "2011-04-22T13:33:48Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347" - */ - url: string; - user: SimpleUser | null; -} + /** + * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * @tags pet + * @name FindPetsByTags + * @summary Finds Pets by tags + * @request GET:/pet/findByTags + * @deprecated + * @secure + */ + findPetsByTags: ( + query: { + /** Tags to filter by */ + tags: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/pet/findByTags\`, + method: "GET", + query: query, + secure: true, + format: "json", + ...params, + }), -/** - * Job - * Information of a job execution in a workflow run - */ -export interface Job { - /** @example "https://api.github.com/repos/github/hello-world/check-runs/4" */ - check_run_url: string; - /** - * The time that the job finished, in ISO 8601 format. - * @format date-time - * @example "2019-08-08T08:00:00-07:00" - */ - completed_at: string | null; - /** - * The outcome of the job. - * @example "success" - */ - conclusion: string | null; - /** - * The SHA of the commit that is being run. - * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" - */ - head_sha: string; - /** @example "https://github.com/github/hello-world/runs/4" */ - html_url: string | null; - /** - * The id of the job. - * @example 21 - */ - id: number; - /** - * The name of the job. - * @example "test-coverage" - */ - name: string; - /** @example "MDg6Q2hlY2tSdW40" */ - node_id: string; - /** - * The id of the associated workflow run. - * @example 5 - */ - run_id: number; - /** @example "https://api.github.com/repos/github/hello-world/actions/runs/5" */ - run_url: string; - /** - * The time that the job started, in ISO 8601 format. - * @format date-time - * @example "2019-08-08T08:00:00-07:00" - */ - started_at: string; - /** - * The phase of the lifecycle that the job is currently in. - * @example "queued" - */ - status: "queued" | "in_progress" | "completed"; - /** Steps in this job. */ - steps?: { /** - * The time that the job finished, in ISO 8601 format. - * @format date-time - * @example "2019-08-08T08:00:00-07:00" + * @description Returns a single pet + * + * @tags pet + * @name GetPetById + * @summary Find pet by ID + * @request GET:/pet/{petId} + * @secure */ - completed_at?: string | null; + getPetById: (petId: number, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + /** - * The outcome of the job. - * @example "success" + * No description + * + * @tags pet + * @name UpdatePetWithForm + * @summary Updates a pet in the store with form data + * @request POST:/pet/{petId} + * @secure */ - conclusion: string | null; + updatePetWithForm: ( + petId: number, + data: { + /** Updated name of the pet */ + name?: string; + /** Updated status of the pet */ + status?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/pet/\${petId}\`, + method: "POST", + body: data, + secure: true, + type: ContentType.FormData, + ...params, + }), + /** - * The name of the job. - * @example "test-coverage" + * No description + * + * @tags pet + * @name DeletePet + * @summary Deletes a pet + * @request DELETE:/pet/{petId} + * @secure */ - name: string; - /** @example 1 */ - number: number; + deletePet: (petId: number, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}\`, + method: "DELETE", + secure: true, + ...params, + }), + /** - * The time that the step started, in ISO 8601 format. - * @format date-time - * @example "2019-08-08T08:00:00-07:00" + * No description + * + * @tags pet + * @name UploadFile + * @summary uploads an image + * @request POST:/pet/{petId}/uploadImage + * @secure */ - started_at?: string | null; + uploadFile: ( + petId: number, + data: { + /** Additional data to pass to server */ + additionalMetadata?: string; + /** file to upload */ + file?: File; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/pet/\${petId}/uploadImage\`, + method: "POST", + body: data, + secure: true, + type: ContentType.FormData, + format: "json", + ...params, + }), + }; + store = { /** - * The phase of the lifecycle that the job is currently in. - * @example "queued" + * @description Returns a map of status codes to quantities + * + * @tags store + * @name GetInventory + * @summary Returns pet inventories by status + * @request GET:/store/inventory + * @secure */ - status: "queued" | "in_progress" | "completed"; - }[]; - /** @example "https://api.github.com/repos/github/hello-world/actions/jobs/21" */ - url: string; -} - -/** - * Key - * Key - */ -export interface Key { - /** @format date-time */ - created_at: string; - id: number; - key: string; - key_id: string; - read_only: boolean; - title: string; - url: string; - verified: boolean; -} + getInventory: (params: RequestParams = {}) => + this.request, any>({ + path: \`/store/inventory\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), -/** - * Key Simple - * Key Simple - */ -export interface KeySimple { - id: number; - key: string; -} + /** + * No description + * + * @tags store + * @name PlaceOrder + * @summary Place an order for a pet + * @request POST:/store/order + */ + placeOrder: (body: Order, params: RequestParams = {}) => + this.request({ + path: \`/store/order\`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Label - * Color-coded labels help you categorize and filter your issues (just like labels in Gmail). - */ -export interface Label { - /** - * 6-character hex code, without the leading #, identifying the color - * @example "FFFFFF" - */ - color: string; - /** @example true */ - default: boolean; - /** @example "Something isn't working" */ - description: string | null; - /** @example 208045946 */ - id: number; - /** - * The name of the label. - * @example "bug" - */ - name: string; - /** @example "MDU6TGFiZWwyMDgwNDU5NDY=" */ - node_id: string; - /** - * URL for the label - * @format uri - * @example "https://api.github.com/repositories/42/labels/bug" - */ - url: string; -} + /** + * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * + * @tags store + * @name GetOrderById + * @summary Find purchase order by ID + * @request GET:/store/order/{orderId} + */ + getOrderById: (orderId: number, params: RequestParams = {}) => + this.request({ + path: \`/store/order/\${orderId}\`, + method: "GET", + format: "json", + ...params, + }), -/** - * Label Search Result Item - * Label Search Result Item - */ -export interface LabelSearchResultItem { - color: string; - default: boolean; - description: string | null; - id: number; - name: string; - node_id: string; - score: number; - text_matches?: SearchResultTextMatches; - /** @format uri */ - url: string; + /** + * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * + * @tags store + * @name DeleteOrder + * @summary Delete purchase order by ID + * @request DELETE:/store/order/{orderId} + */ + deleteOrder: (orderId: string, params: RequestParams = {}) => + this.request({ + path: \`/store/order/\${orderId}\`, + method: "DELETE", + ...params, + }), + }; + user = { + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name CreateUser + * @summary Create user + * @request POST:/user + */ + createUser: (body: User, params: RequestParams = {}) => + this.request({ + path: \`/user\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags user + * @name CreateUsersWithArrayInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithArray + */ + createUsersWithArrayInput: (body: User[], params: RequestParams = {}) => + this.request({ + path: \`/user/createWithArray\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags user + * @name CreateUsersWithListInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithList + */ + createUsersWithListInput: (body: User[], params: RequestParams = {}) => + this.request({ + path: \`/user/createWithList\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags user + * @name LoginUser + * @summary Logs user into the system + * @request GET:/user/login + */ + loginUser: ( + query: { + /** The password for login in clear text */ + password: string; + /** The user name for login */ + username: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/login\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags user + * @name LogoutUser + * @summary Logs out current logged in user session + * @request GET:/user/logout + */ + logoutUser: (params: RequestParams = {}) => + this.request({ + path: \`/user/logout\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags user + * @name GetUserByName + * @summary Get user by user name + * @request GET:/user/{username} + */ + getUserByName: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name UpdateUser + * @summary Updated user + * @request PUT:/user/{username} + */ + updateUser: (username: string, body: User, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "PUT", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name DeleteUser + * @summary Delete user + * @request DELETE:/user/{username} + */ + deleteUser: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "DELETE", + ...params, + }), + }; } +" +`; -/** - * Language - * Language +exports[`simple > 'another-schema' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export type Language = Record; -/** - * License - * License - */ -export interface License { - /** - * @example " - * - * The MIT License (MIT) - * - * Copyright (c) [year] [fullname] - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * " - */ - body: string; - /** @example ["include-copyright"] */ - conditions: string[]; - /** @example "A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty." */ - description: string; - /** @example true */ - featured: boolean; - /** - * @format uri - * @example "http://choosealicense.com/licenses/mit/" - */ - html_url: string; - /** @example "Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders." */ - implementation: string; - /** @example "mit" */ - key: string; - /** @example ["no-liability"] */ - limitations: string[]; - /** @example "MIT License" */ - name: string; - /** @example "MDc6TGljZW5zZW1pdA==" */ - node_id: string; - /** @example ["commercial-use","modifications","distribution","sublicense","private-use"] */ - permissions: string[]; - /** @example "MIT" */ - spdx_id: string | null; - /** - * @format uri - * @example "https://api.github.com/licenses/mit" - */ - url: string | null; +export interface Bar { + A?: string; + /** @format int32 */ + B: number; + Baz?: Baz; + /** @format date-time */ + C: string; } -/** - * License Content - * License Content - */ -export interface LicenseContent { - _links: { - /** @format uri */ - git: string | null; - /** @format uri */ - html: string | null; - /** @format uri */ - self: string; - }; - content: string; - /** @format uri */ - download_url: string | null; - encoding: string; - /** @format uri */ - git_url: string | null; - /** @format uri */ - html_url: string | null; - license: LicenseSimple | null; - name: string; - path: string; - sha: string; - size: number; - type: string; - /** @format uri */ - url: string; +export interface Baz { + Color: Color; + /** @format decimal */ + D: number; } -/** - * License Simple - * License Simple - */ -export interface LicenseSimple { - /** @format uri */ - html_url?: string; - /** @example "mit" */ - key: string; - /** @example "MIT License" */ - name: string; - /** @example "MDc6TGljZW5zZW1pdA==" */ - node_id: string; - /** @example "MIT" */ - spdx_id: string | null; - /** - * @format uri - * @example "https://api.github.com/licenses/mit" - */ - url: string | null; +export enum Color { + RED = 0, + GREEN = 1, + BLUE = 2, } -/** - * Link - * Hypermedia Link - */ -export interface Link { - href: string; +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; } -/** - * Link With Type - * Hypermedia Link with Type - */ -export interface LinkWithType { - href: string; - type: string; +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** Marketplace Account */ -export interface MarketplaceAccount { - /** @format email */ - email?: string | null; - id: number; - login: string; - node_id?: string; - /** @format email */ - organization_billing_email?: string | null; - type: string; - /** @format uri */ - url: string; +export interface HttpResponse extends Response { + data: D; + error: E; } -/** - * Marketplace Listing Plan - * Marketplace Listing Plan - */ -export interface MarketplaceListingPlan { - /** - * @format uri - * @example "https://api.github.com/marketplace_listing/plans/1313/accounts" - */ - accounts_url: string; - /** @example ["Up to 25 private repositories","11 concurrent builds"] */ - bullets: string[]; - /** @example "A professional-grade CI solution" */ - description: string; - /** @example true */ - has_free_trial: boolean; - /** @example 1313 */ - id: number; - /** @example 1099 */ - monthly_price_in_cents: number; - /** @example "Pro" */ - name: string; - /** @example 3 */ - number: number; - /** @example "flat-rate" */ - price_model: string; - /** @example "published" */ - state: string; - unit_name: string | null; - /** - * @format uri - * @example "https://api.github.com/marketplace_listing/plans/1313" - */ - url: string; - /** @example 11870 */ - yearly_price_in_cents: number; +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", } -/** - * Marketplace Purchase - * Marketplace Purchase - */ -export interface MarketplacePurchase { - id: number; - login: string; - marketplace_pending_change?: { - effective_date?: string; - id?: number; - is_installed?: boolean; - /** Marketplace Listing Plan */ - plan?: MarketplaceListingPlan; - unit_count?: number | null; +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", }; - marketplace_purchase: { - billing_cycle?: string; - free_trial_ends_on?: string | null; - is_installed?: boolean; - next_billing_date?: string | null; - on_free_trial?: boolean; - /** Marketplace Listing Plan */ - plan?: MarketplaceListingPlan; - unit_count?: number | null; - updated_at?: string; + + 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.clone() 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; + }); }; - organization_billing_email?: string; - type: string; - url: string; } /** - * Migration - * A migration. + * @title No title */ -export interface Migration { - /** @format uri */ - archive_url?: string; - /** - * @format date-time - * @example "2015-07-06T15:33:38-07:00" - */ - created_at: string; - exclude?: any[]; - exclude_attachments: boolean; - /** @example "0b989ba4-242f-11e5-81e1-c7b6966d2516" */ - guid: string; - /** @example 79 */ - id: number; - /** @example true */ - lock_repositories: boolean; - node_id: string; - owner: SimpleUser | null; - repositories: Repository[]; - /** @example "pending" */ - state: string; - /** - * @format date-time - * @example "2015-07-06T15:33:38-07:00" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/orgs/octo-org/migrations/79" - */ - url: string; +export class Api extends HttpClient { + api = { + /** + * No description + * + * @tags Foo + * @name FooGetBarDescriptions + * @request GET:/api/Foo/GetBarDescriptions + */ + fooGetBarDescriptions: (params: RequestParams = {}) => + this.request({ + path: \`/api/Foo/GetBarDescriptions\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Foo + * @name FooGetBar + * @request GET:/api/Foo/GetBar + */ + fooGetBar: ( + query: { + /** @format int32 */ + id: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/api/Foo/GetBar\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags Foo + * @name FooSetBar + * @request POST:/api/Foo/SetBar + */ + fooSetBar: (value: Bar | null, params: RequestParams = {}) => + this.request({ + path: \`/api/Foo/SetBar\`, + method: "POST", + body: value, + type: ContentType.Json, + ...params, + }), + }; } +" +`; -/** - * Milestone - * A collection of related issues and pull requests. +exports[`simple > 'anyof-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export interface Milestone { - /** - * @format date-time - * @example "2013-02-12T13:22:01Z" - */ - closed_at: string | null; - /** @example 8 */ - closed_issues: number; - /** - * @format date-time - * @example "2011-04-10T20:09:31Z" - */ - created_at: string; - creator: SimpleUser | null; - /** @example "Tracking milestone for version 1.0" */ - description: string | null; - /** - * @format date-time - * @example "2012-10-09T23:39:01Z" - */ - due_on: string | null; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/milestones/v1.0" - */ - html_url: string; - /** @example 1002604 */ - id: number; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels" - */ - labels_url: string; - /** @example "MDk6TWlsZXN0b25lMTAwMjYwNA==" */ - node_id: string; - /** - * The number of the milestone. - * @example 42 - */ - number: number; - /** @example 4 */ - open_issues: number; - /** - * The state of the milestone. - * @default "open" - * @example "open" - */ - state: "open" | "closed"; - /** - * The title of the milestone. - * @example "v1.0" - */ - title: string; - /** - * @format date-time - * @example "2014-03-03T18:58:10Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/milestones/1" - */ - url: string; + +export interface PetByAge { + age: number; + nickname?: string; } -/** - * Minimal Repository - * Minimal Repository - */ -export interface MinimalRepository { - /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ - archive_url: string; - archived?: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ - assignees_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ - blobs_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ - branches_url: string; - clone_url?: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ - collaborators_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ - comments_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ - commits_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ - compare_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ - contents_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/contributors" - */ - contributors_url: string; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - created_at?: string | null; - default_branch?: string; - delete_branch_on_merge?: boolean; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/deployments" - */ - deployments_url: string; - /** @example "This your first repo!" */ - description: string | null; - disabled?: boolean; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/downloads" - */ - downloads_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/events" - */ - events_url: string; - fork: boolean; - /** @example 0 */ - forks?: number; - forks_count?: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/forks" - */ - forks_url: string; - /** @example "octocat/Hello-World" */ - full_name: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ - git_commits_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ - git_refs_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ - git_tags_url: string; - git_url?: string; - has_downloads?: boolean; - has_issues?: boolean; - has_pages?: boolean; - has_projects?: boolean; - has_wiki?: boolean; - homepage?: string | null; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/hooks" - */ - hooks_url: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World" - */ - html_url: string; - /** @example 1296269 */ - id: number; - is_template?: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ - issue_comment_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ - issue_events_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ - issues_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ - keys_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ - labels_url: string; - language?: string | null; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/languages" - */ - languages_url: string; - license?: { - key?: string; - name?: string; - node_id?: string; - spdx_id?: string; - url?: string; - } | null; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/merges" - */ - merges_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ - milestones_url: string; - mirror_url?: string | null; - /** @example "Hello-World" */ - name: string; - network_count?: number; - /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ - node_id: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ - notifications_url: string; - /** @example 0 */ - open_issues?: number; - open_issues_count?: number; - owner: SimpleUser | null; - permissions?: { - admin?: boolean; - pull?: boolean; - push?: boolean; - }; - private: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ - pulls_url: string; - /** - * @format date-time - * @example "2011-01-26T19:06:43Z" - */ - pushed_at?: string | null; - /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ - releases_url: string; - size?: number; - ssh_url?: string; - stargazers_count?: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" - */ - stargazers_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ - statuses_url: string; - subscribers_count?: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" - */ - subscribers_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/subscription" - */ - subscription_url: string; - svn_url?: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/tags" - */ - tags_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/teams" - */ - teams_url: string; - temp_clone_token?: string; - template_repository?: Repository | null; - topics?: string[]; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ - trees_url: string; - /** - * @format date-time - * @example "2011-01-26T19:14:43Z" - */ - updated_at?: string | null; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World" - */ - url: string; - visibility?: string; - /** @example 0 */ - watchers?: number; - watchers_count?: number; +export interface PetByType { + hunts?: boolean; + pet_type: "Cat" | "Dog"; } -/** - * Org Hook - * Org Hook - */ -export interface OrgHook { - /** @example true */ - active: boolean; - config: { - /** @example ""form"" */ - content_type?: string; - /** @example ""0"" */ - insecure_ssl?: string; - /** @example ""********"" */ - secret?: string; - /** @example ""http://example.com/2"" */ - url?: string; - }; - /** - * @format date-time - * @example "2011-09-06T17:26:27Z" - */ - created_at: string; - /** @example ["push","pull_request"] */ - events: string[]; - /** @example 1 */ - id: number; - /** @example "web" */ - name: string; - /** - * @format uri - * @example "https://api.github.com/orgs/octocat/hooks/1/pings" - */ - ping_url: string; - type: string; - /** - * @format date-time - * @example "2011-09-06T20:39:23Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/orgs/octocat/hooks/1" - */ - url: string; +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; } -/** - * Org Membership - * Org Membership - */ -export interface OrgMembership { - /** Organization Simple */ - organization: OrganizationSimple; - /** - * @format uri - * @example "https://api.github.com/orgs/octocat" - */ - organization_url: string; - permissions?: { - can_create_repository: boolean; - }; - /** @example "admin" */ - role: string; - /** @example "active" */ - state: string; - /** - * @format uri - * @example "https://api.github.com/orgs/octocat/memberships/defunkt" - */ - url: string; - user: SimpleUser | null; +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** - * Actions Secret for an Organization - * Secrets for GitHub Actions for an organization. - */ -export interface OrganizationActionsSecret { - /** @format date-time */ - created_at: string; - /** - * The name of the secret. - * @example "SECRET_TOKEN" - */ - name: string; - /** - * @format uri - * @example "https://api.github.com/organizations/org/secrets/my_secret/repositories" - */ - selected_repositories_url?: string; - /** @format date-time */ - updated_at: string; - /** Visibility of a secret */ - visibility: "all" | "private" | "selected"; +export interface HttpResponse extends Response { + data: D; + error: E; } -/** - * Organization Full - * Organization Full - */ -export interface OrganizationFull { - /** @example "https://github.com/images/error/octocat_happy.gif" */ - avatar_url: string; - /** - * @format email - * @example "org@example.com" - */ - billing_email?: string | null; - /** - * @format uri - * @example "https://github.com/blog" - */ - blog?: string; - /** @example 8 */ - collaborators?: number | null; - /** @example "GitHub" */ - company?: string; - /** - * @format date-time - * @example "2008-01-14T04:33:35Z" - */ - created_at: string; - default_repository_permission?: string | null; - /** @example "A great organization" */ - description: string | null; - /** @example 10000 */ - disk_usage?: number | null; - /** - * @format email - * @example "octocat@github.com" - */ - email?: string; - /** - * @format uri - * @example "https://api.github.com/orgs/github/events" - */ - events_url: string; - /** @example 20 */ - followers: number; - /** @example 0 */ - following: number; - /** @example true */ - has_organization_projects: boolean; - /** @example true */ - has_repository_projects: boolean; - /** @example "https://api.github.com/orgs/github/hooks" */ - hooks_url: string; - /** - * @format uri - * @example "https://github.com/octocat" - */ - html_url: string; - /** @example 1 */ - id: number; - /** @example true */ - is_verified?: boolean; - /** @example "https://api.github.com/orgs/github/issues" */ - issues_url: string; - /** @example "San Francisco" */ - location?: string; - /** @example "github" */ - login: string; - /** @example "all" */ - members_allowed_repository_creation_type?: string; - /** @example true */ - members_can_create_internal_repositories?: boolean; - /** @example true */ - members_can_create_pages?: boolean; - /** @example true */ - members_can_create_private_repositories?: boolean; - /** @example true */ - members_can_create_public_repositories?: boolean; - /** @example true */ - members_can_create_repositories?: boolean | null; - /** @example "https://api.github.com/orgs/github/members{/member}" */ - members_url: string; - /** @example "github" */ - name?: string; - /** @example "MDEyOk9yZ2FuaXphdGlvbjE=" */ - node_id: string; - /** @example 100 */ - owned_private_repos?: number; - plan?: { - filled_seats?: number; - name: string; - private_repos: number; - seats?: number; - space: number; - }; - /** @example 81 */ - private_gists?: number | null; - /** @example 1 */ - public_gists: number; - /** @example "https://api.github.com/orgs/github/public_members{/member}" */ - public_members_url: string; - /** @example 2 */ - public_repos: number; - /** - * @format uri - * @example "https://api.github.com/orgs/github/repos" - */ - repos_url: string; - /** @example 100 */ - total_private_repos?: number; - /** @example "github" */ - twitter_username?: string | null; - /** @example true */ - two_factor_requirement_enabled?: boolean | null; - /** @example "Organization" */ - type: string; - /** @format date-time */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/orgs/github" - */ - url: string; -} +type CancelToken = Symbol | string | number; -/** - * Organization Invitation - * Organization Invitation - */ -export interface OrganizationInvitation { - created_at: string; - email: string | null; - failed_at?: string; - failed_reason?: string; - id: number; - invitation_team_url: string; - /** @example ""https://api.github.com/organizations/16/invitations/1/teams"" */ - invitation_teams_url?: string; - /** Simple User */ - inviter: SimpleUser; - login: string | null; - /** @example ""MDIyOk9yZ2FuaXphdGlvbkludml0YXRpb24x"" */ - node_id: string; - role: string; - team_count: number; +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", } -/** - * Organization Simple - * Organization Simple - */ -export interface OrganizationSimple { - /** @example "https://github.com/images/error/octocat_happy.gif" */ - avatar_url: string; - /** @example "A great organization" */ - description: string | null; - /** - * @format uri - * @example "https://api.github.com/orgs/github/events" - */ - events_url: string; - /** @example "https://api.github.com/orgs/github/hooks" */ - hooks_url: string; - /** @example 1 */ - id: number; - /** @example "https://api.github.com/orgs/github/issues" */ - issues_url: string; - /** @example "github" */ - login: string; - /** @example "https://api.github.com/orgs/github/members{/member}" */ - members_url: string; - /** @example "MDEyOk9yZ2FuaXphdGlvbjE=" */ - node_id: string; - /** @example "https://api.github.com/orgs/github/public_members{/member}" */ - public_members_url: string; - /** - * @format uri - * @example "https://api.github.com/orgs/github/repos" - */ - repos_url: string; - /** - * @format uri - * @example "https://api.github.com/orgs/github" - */ - url: string; -} +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); -export interface PackagesBillingUsage { - /** Free storage space (GB) for GitHub Packages. */ - included_gigabytes_bandwidth: number; - /** Sum of the free and paid storage space (GB) for GitHuub Packages. */ - total_gigabytes_bandwidth_used: number; - /** Total paid storage space (GB) for GitHuub Packages. */ - total_paid_gigabytes_bandwidth_used: number; -} + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; -/** - * GitHub Pages - * The configuration for GitHub Pages for a repository. - */ -export interface Page { - /** - * Whether the Page has a custom 404 page. - * @default false - * @example false - */ - custom_404: boolean; - /** - * The Pages site's custom domain - * @example "example.com" - */ - cname: string | null; - /** - * The web address the Page can be accessed from. - * @format uri - * @example "https://example.com" - */ - html_url?: string; - /** - * Whether the GitHub Pages site is publicly visible. If set to `true`, the site is accessible to anyone on the internet. If set to `false`, the site will only be accessible to users who have at least `read` access to the repository that published the site. - * @example true - */ - public: boolean; - source?: PagesSourceHash; - /** - * The status of the most recent build of the Page. - * @example "built" - */ - status: "built" | "building" | "errored" | null; - /** - * The API address for accessing this Page resource. - * @format uri - * @example "https://api.github.com/repos/github/hello-world/pages" - */ - url: string; + 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.clone() 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; + }); + }; } /** - * Page Build - * Page Build + * @title Anyof Example + * @version 1.0.0 */ -export interface PageBuild { - commit: string; - /** @format date-time */ - created_at: string; - duration: number; - error: { - message: string | null; +export class Api extends HttpClient { + pets = { + /** + * No description + * + * @name PetsPartialUpdate + * @request PATCH:/pets + */ + petsPartialUpdate: (data: PetByAge | PetByType, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "PATCH", + body: data, + type: ContentType.Json, + ...params, + }), }; - pusher: SimpleUser | null; - status: string; - /** @format date-time */ - updated_at: string; - /** @format uri */ - url: string; } +" +`; -/** - * Page Build Status - * Page Build Status +exports[`simple > 'api-with-examples' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export interface PageBuildStatus { - /** @example "queued" */ - status: string; - /** - * @format uri - * @example "https://api.github.com/repos/github/hello-world/pages/builds/latest" - */ - url: string; -} -/** Pages Source Hash */ -export interface PagesSourceHash { - branch: string; +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; } -/** Participation Stats */ -export interface ParticipationStats { - all: number[]; - owner: number[]; +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** - * Porter Author - * Porter Author - */ -export interface PorterAuthor { - email: string; - id: number; - /** @format uri */ - import_url: string; - name: string; - remote_id: string; - remote_name: string; - /** @format uri */ - url: string; +export interface HttpResponse extends Response { + data: D; + error: E; } -/** - * Porter Large File - * Porter Large File - */ -export interface PorterLargeFile { - oid: string; - path: string; - ref_name: string; - size: number; +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", } -/** - * Private User - * Private User - */ -export interface PrivateUser { - /** - * @format uri - * @example "https://github.com/images/error/octocat_happy.gif" - */ - avatar_url: string; - /** @example "There once was..." */ - bio: string | null; - /** @example "https://github.com/blog" */ - blog: string | null; - business_plus?: boolean; - /** @example 8 */ - collaborators: number; - /** @example "GitHub" */ - company: string | null; - /** - * @format date-time - * @example "2008-01-14T04:33:35Z" - */ - created_at: string; - /** @example 10000 */ - disk_usage: number; - /** - * @format email - * @example "octocat@github.com" - */ - email: string | null; - /** @example "https://api.github.com/users/octocat/events{/privacy}" */ - events_url: string; - /** @example 20 */ - followers: number; - /** - * @format uri - * @example "https://api.github.com/users/octocat/followers" - */ - followers_url: string; - /** @example 0 */ - following: number; - /** @example "https://api.github.com/users/octocat/following{/other_user}" */ - following_url: string; - /** @example "https://api.github.com/users/octocat/gists{/gist_id}" */ - gists_url: string; - /** @example "41d064eb2195891e12d0413f63227ea7" */ - gravatar_id: string | null; - hireable: boolean | null; - /** - * @format uri - * @example "https://github.com/octocat" - */ - html_url: string; - /** @example 1 */ - id: number; - ldap_dn?: string; - /** @example "San Francisco" */ - location: string | null; - /** @example "octocat" */ - login: string; - /** @example "monalisa octocat" */ - name: string | null; - /** @example "MDQ6VXNlcjE=" */ - node_id: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/orgs" - */ - organizations_url: string; - /** @example 100 */ - owned_private_repos: number; - plan?: { - collaborators: number; - name: string; - private_repos: number; - space: number; - }; - /** @example 81 */ - private_gists: number; - /** @example 1 */ - public_gists: number; - /** @example 2 */ - public_repos: number; - /** - * @format uri - * @example "https://api.github.com/users/octocat/received_events" - */ - received_events_url: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/repos" - */ - repos_url: string; - site_admin: boolean; - /** @example "https://api.github.com/users/octocat/starred{/owner}{/repo}" */ - starred_url: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/subscriptions" - */ - subscriptions_url: string; - /** @format date-time */ - suspended_at?: string | null; - /** @example 100 */ - total_private_repos: number; - /** @example "monalisa" */ - twitter_username?: string | null; - /** @example true */ - two_factor_authentication: boolean; - /** @example "User" */ - type: string; - /** - * @format date-time - * @example "2008-01-14T04:33:35Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat" - */ - url: string; -} - -/** - * Project - * Projects are a way to organize columns and cards of work. - */ -export interface Project { - /** - * Body of the project - * @example "This project represents the sprint of the first week in January" - */ - body: string | null; - /** - * @format uri - * @example "https://api.github.com/projects/1002604/columns" - */ - columns_url: string; - /** - * @format date-time - * @example "2011-04-10T20:09:31Z" - */ - created_at: string; - creator: SimpleUser | null; - /** - * @format uri - * @example "https://github.com/api-playground/projects-test/projects/12" - */ - html_url: string; - /** @example 1002604 */ - id: number; - /** - * Name of the project - * @example "Week One Sprint" - */ - name: string; - /** @example "MDc6UHJvamVjdDEwMDI2MDQ=" */ - node_id: string; - /** @example 1 */ - number: number; - /** The baseline permission that all organization members have on this project. Only present if owner is an organization. */ - organization_permission?: "read" | "write" | "admin" | "none"; - /** - * @format uri - * @example "https://api.github.com/repos/api-playground/projects-test" - */ - owner_url: string; - /** Whether or not this project can be seen by everyone. Only present if owner is an organization. */ - private?: boolean; - /** - * State of the project; either 'open' or 'closed' - * @example "open" - */ - state: string; - /** - * @format date-time - * @example "2014-03-03T18:58:10Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/projects/1002604" - */ - url: string; -} +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); -/** - * Project Card - * Project cards represent a scope of work. - */ -export interface ProjectCard { - /** - * Whether or not the card is archived - * @example false - */ - archived?: boolean; - /** - * @format uri - * @example "https://api.github.com/projects/columns/367" - */ - column_url: string; - /** - * @format uri - * @example "https://api.github.com/repos/api-playground/projects-test/issues/3" - */ - content_url?: string; - /** - * @format date-time - * @example "2016-09-05T14:21:06Z" - */ - created_at: string; - creator: SimpleUser | null; - /** - * The project card's ID - * @example 42 - */ - id: number; - /** @example "MDExOlByb2plY3RDYXJkMTQ3OA==" */ - node_id: string; - /** @example "Add payload for delete Project column" */ - note: string | null; - /** - * @format uri - * @example "https://api.github.com/projects/120" - */ - project_url: string; - /** - * @format date-time - * @example "2016-09-05T14:20:22Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/projects/columns/cards/1478" - */ - url: string; -} + private baseApiParams: RequestParams = { + credentials: "same-origin", + headers: {}, + redirect: "follow", + referrerPolicy: "no-referrer", + }; -/** - * Project Column - * Project columns contain cards of work. - */ -export interface ProjectColumn { - /** - * @format uri - * @example "https://api.github.com/projects/columns/367/cards" - */ - cards_url: string; - /** - * @format date-time - * @example "2016-09-05T14:18:44Z" - */ - created_at: string; - /** - * The unique identifier of the project column - * @example 42 - */ - id: number; - /** - * Name of the project column - * @example "Remaining tasks" - */ - name: string; - /** @example "MDEzOlByb2plY3RDb2x1bW4zNjc=" */ - node_id: string; - /** - * @format uri - * @example "https://api.github.com/projects/120" - */ - project_url: string; - /** - * @format date-time - * @example "2016-09-05T14:22:28Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/projects/columns/367" - */ - url: string; -} + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } -/** - * Protected Branch - * Branch protections protect branches - */ -export interface ProtectedBranch { - allow_deletions?: { - enabled: boolean; - }; - allow_force_pushes?: { - enabled: boolean; - }; - enforce_admins?: { - enabled: boolean; - /** @format uri */ - url: string; + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; }; - required_linear_history?: { - enabled: boolean; + + 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), }; - required_pull_request_reviews?: { - dismiss_stale_reviews?: boolean; - dismissal_restrictions?: { - teams: Team[]; - /** @format uri */ - teams_url: string; - /** @format uri */ - url: string; - users: SimpleUser[]; - /** @format uri */ - users_url: string; + + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, }; - require_code_owner_reviews?: boolean; - required_approving_review_count?: number; - /** @format uri */ - url: string; + } + + 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; }; - required_signatures?: { - /** @example true */ - enabled: boolean; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_signatures" - */ - url: string; + + 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.clone() 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; + }); }; - /** Status Check Policy */ - required_status_checks?: StatusCheckPolicy; - /** Branch Restriction Policy */ - restrictions?: BranchRestrictionPolicy; - /** @format uri */ - url: string; } /** - * Protected Branch Admin Enforced - * Protected Branch Admin Enforced + * @title Simple API overview + * @version 2.0.0 */ -export interface ProtectedBranchAdminEnforced { - /** @example true */ - enabled: boolean; +export class Api extends HttpClient { /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/enforce_admins" + * No description + * + * @name ListVersionsv2 + * @summary List API versions + * @request GET:/ */ - url: string; -} + listVersionsv2 = (params: RequestParams = {}) => + this.request({ + path: \`/\`, + method: "GET", + format: "json", + ...params, + }); -/** - * Protected Branch Pull Request Review - * Protected Branch Pull Request Review - */ -export interface ProtectedBranchPullRequestReview { - /** @example true */ - dismiss_stale_reviews: boolean; - dismissal_restrictions?: { - /** 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; + v2 = { + /** + * No description + * + * @name GetVersionDetailsv2 + * @summary Show API version details + * @request GET:/v2 + */ + getVersionDetailsv2: (params: RequestParams = {}) => + this.request({ + path: \`/v2\`, + method: "GET", + format: "json", + ...params, + }), }; - /** @example true */ - require_code_owner_reviews: boolean; - /** - * @min 1 - * @max 6 - * @example 2 - */ - required_approving_review_count?: number; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/dismissal_restrictions" - */ - url?: string; } +" +`; -/** - * Public User - * Public User +exports[`simple > 'api-with-examples' 2`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export interface PublicUser { - /** @format uri */ - avatar_url: string; - bio: string | null; - blog: string | null; - /** @example 3 */ - collaborators?: number; - company: string | null; - /** @format date-time */ - created_at: string; - /** @example 1 */ - disk_usage?: number; - /** @format email */ - email: string | null; - events_url: string; - followers: number; - /** @format uri */ - followers_url: string; - following: number; - following_url: string; - gists_url: string; - gravatar_id: string | null; - hireable: boolean | null; - /** @format uri */ - html_url: string; - id: number; - location: string | null; - login: string; - name: string | null; - node_id: string; - /** @format uri */ - organizations_url: string; - /** @example 2 */ - owned_private_repos?: number; - plan?: { - collaborators: number; - name: string; - private_repos: number; - space: number; - }; - /** @example 1 */ - private_gists?: number; - public_gists: number; - public_repos: number; - /** @format uri */ - received_events_url: string; - /** @format uri */ - repos_url: string; - site_admin: boolean; - starred_url: string; - /** @format uri */ - subscriptions_url: string; - /** @format date-time */ - suspended_at?: string | null; - /** @example 2 */ - total_private_repos?: number; - twitter_username?: string | null; - type: string; - /** @format date-time */ - updated_at: string; - /** @format uri */ - url: string; + +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; } -/** - * Pull Request - * Pull requests let you tell others about changes you've pushed to a repository on GitHub. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary. - */ -export interface PullRequest { - _links: { - /** Hypermedia Link */ - comments: Link; - /** Hypermedia Link */ - commits: Link; - /** Hypermedia Link */ - html: Link; - /** Hypermedia Link */ - issue: Link; - /** Hypermedia Link */ - review_comment: Link; - /** Hypermedia Link */ - review_comments: Link; - /** Hypermedia Link */ - self: Link; - /** Hypermedia Link */ - statuses: Link; +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", }; - /** @example "too heated" */ - active_lock_reason?: string | null; - /** @example 100 */ - additions: number; - assignee: SimpleUser | null; - assignees?: SimpleUser[] | null; - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - /** The status of auto merging a pull request. */ - auto_merge: AutoMerge; - base: { - 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; - compare_url: string; - 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; - 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; - events_url: string; - /** @format uri */ - followers_url: string; - following_url: string; - gists_url: string; - gravatar_id: string | null; - /** @format uri */ - html_url: string; - id: number; - login: string; - node_id: string; - /** @format uri */ - organizations_url: string; - /** @format uri */ - received_events_url: string; - /** @format uri */ - repos_url: string; - site_admin: boolean; - starred_url: string; - /** @format uri */ - subscriptions_url: string; - type: string; - /** @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; - /** @format uri */ - subscribers_url: string; - /** @format uri */ - subscription_url: string; - /** @format uri */ - svn_url: string; - /** @format uri */ - tags_url: string; - /** @format uri */ - teams_url: string; - temp_clone_token?: string; - topics?: string[]; - trees_url: string; - /** @format date-time */ - updated_at: string; - /** @format uri */ - url: string; - watchers: number; - watchers_count: number; - }; - sha: string; - user: { - /** @format uri */ - avatar_url: string; - events_url: string; - /** @format uri */ - followers_url: string; - following_url: string; - gists_url: string; - gravatar_id: string | null; - /** @format uri */ - html_url: string; - id: number; - login: string; - node_id: string; - /** @format uri */ - organizations_url: string; - /** @format uri */ - received_events_url: string; - /** @format uri */ - repos_url: string; - site_admin: boolean; - starred_url: string; - /** @format uri */ - subscriptions_url: string; - type: string; - /** @format uri */ - url: string; + + 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; }; - /** @example "Please pull these awesome changes" */ - body: string | null; - /** @example 5 */ - changed_files: number; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - closed_at: string | null; - /** @example 10 */ - comments: number; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments" - */ - comments_url: string; - /** @example 3 */ - commits: number; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits" - */ - commits_url: string; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - created_at: string; - /** @example 3 */ - deletions: number; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/pull/1347.diff" - */ - diff_url: string; + + 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.clone() 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 Simple API overview + * @version v2 + */ +export class Api extends HttpClient { /** - * Indicates whether or not the pull request is a draft. - * @example false + * @description multiple line 1 multiple line 2 multiple line 3 + * + * @name ListVersionsv2 + * @summary List API versions + * @request GET:/ */ - draft?: boolean; - head: { - 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; - compare_url: string; - 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; - 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; - events_url: string; - /** @format uri */ - followers_url: string; - following_url: string; - gists_url: string; - gravatar_id: string | null; - /** @format uri */ - html_url: string; - id: number; - login: string; - node_id: string; - /** @format uri */ - organizations_url: string; - /** @format uri */ - received_events_url: string; - /** @format uri */ - repos_url: string; - site_admin: boolean; - starred_url: string; - /** @format uri */ - subscriptions_url: string; - type: string; - /** @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; - /** @format uri */ - subscribers_url: string; - /** @format uri */ - subscription_url: string; - /** @format uri */ - svn_url: string; - /** @format uri */ - tags_url: string; - /** @format uri */ - teams_url: string; - temp_clone_token?: string; - topics?: string[]; - trees_url: string; - /** @format date-time */ - updated_at: string; - /** @format uri */ - url: string; - watchers: number; - watchers_count: number; - }; - sha: string; - user: { - /** @format uri */ - avatar_url: string; - events_url: string; - /** @format uri */ - followers_url: string; - following_url: string; - gists_url: string; - gravatar_id: string | null; - /** @format uri */ - html_url: string; - id: number; - login: string; - node_id: string; - /** @format uri */ - organizations_url: string; - /** @format uri */ - received_events_url: string; - /** @format uri */ - repos_url: string; - site_admin: boolean; - starred_url: string; - /** @format uri */ - subscriptions_url: string; - type: string; - /** @format uri */ - url: string; - }; + listVersionsv2 = (params: RequestParams = {}) => + this.request({ + path: \`/\`, + method: "GET", + format: "json", + ...params, + }); + + v2 = { + /** + * No description + * + * @name GetVersionDetailsv2 + * @summary Show API version details + * @request GET:/v2 + */ + getVersionDetailsv2: (params: RequestParams = {}) => + this.request({ + path: \`/v2\`, + method: "GET", + format: "json", + ...params, + }), + }; + withCharset = { + /** + * @description consumes contains charset + * + * @name WithCharset + * @summary consumes contains charset + * @request POST:/with-charset/ + */ + withCharset: (someParm: string, params: RequestParams = {}) => + this.request({ + path: \`/with-charset/\`, + method: "POST", + body: someParm, + type: ContentType.Json, + ...params, + }), + }; + consumesPlainText = { + /** + * @description consumes plain text + * + * @name ConsumesPlainText + * @summary consumes plain text + * @request POST:/consumes-plain-text/ + */ + consumesPlainText: (someParm: string, params: RequestParams = {}) => + this.request({ + path: \`/consumes-plain-text/\`, + method: "POST", + body: someParm, + type: ContentType.Text, + ...params, + }), }; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/pull/1347" - */ - html_url: string; - /** @example 1 */ - id: number; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347" - */ - issue_url: string; - labels: { - color?: string; - default?: boolean; - description?: string | null; - id?: number; - name?: string; - node_id?: string; - url?: string; - }[]; - /** @example true */ - locked: boolean; - /** - * Indicates whether maintainers can modify the pull request. - * @example true - */ - maintainer_can_modify: boolean; - /** @example "e5bd3914e2e596debea16f433f57875b5b90bcd6" */ - merge_commit_sha: string | null; - /** @example true */ - mergeable: boolean | null; - /** @example "clean" */ - mergeable_state: string; - merged: boolean; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - merged_at: string | null; - merged_by: SimpleUser | null; - milestone: Milestone | null; - /** @example "MDExOlB1bGxSZXF1ZXN0MQ==" */ - node_id: string; - /** - * Number uniquely identifying the pull request within its repository. - * @example 42 - */ - number: number; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/pull/1347.patch" - */ - patch_url: string; - /** @example true */ - rebaseable?: boolean | null; - requested_reviewers?: SimpleUser[] | null; - requested_teams?: TeamSimple[] | null; - /** @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}" */ - review_comment_url: string; - /** @example 0 */ - review_comments: number; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments" - */ - review_comments_url: string; - /** - * State of this Pull Request. Either `open` or `closed`. - * @example "open" - */ - state: "open" | "closed"; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e" - */ - statuses_url: string; - /** - * The title of the pull request. - * @example "Amazing new feature" - */ - title: string; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347" - */ - url: string; - user: SimpleUser | null; } +" +`; -/** - * Pull Request Merge Result - * Pull Request Merge Result +exports[`simple > 'authentiq' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export interface PullRequestMergeResult { - merged: boolean; - message: string; - sha: string; + +/** Authentiq ID in JWT format, self-signed. */ +export interface AuthentiqID { + /** device token for push messages */ + devtoken?: string; + /** UUID and public signing key */ + sub: string; } -/** Pull Request Minimal */ -export interface PullRequestMinimal { - base: { - ref: string; - repo: { - id: number; - name: string; - url: string; - }; - sha: string; - }; - head: { - ref: string; - repo: { - id: number; - name: string; - url: string; - }; - sha: string; - }; - id: number; - number: number; - url: string; +/** Claim in JWT format, self- or issuer-signed. */ +export interface Claims { + email?: string; + phone?: string; + /** claim scope */ + scope: string; + /** UUID */ + sub: string; + type?: string; } -/** - * Pull Request Review - * Pull Request Reviews are reviews on pull requests. - */ -export interface PullRequestReview { - _links: { - html: { - href: string; - }; - pull_request: { - href: string; - }; - }; - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - /** - * The text of the review. - * @example "This looks great." - */ - body: string; - body_html?: string; - body_text?: string; - /** - * A commit SHA for the review. - * @example "54bb654c9e6025347f57900a4a5c2313a96b8035" - */ - commit_id: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" - */ - html_url: string; - /** - * Unique identifier of the review - * @example 42 - */ - id: number; - /** @example "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=" */ - node_id: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/12" - */ - pull_request_url: string; - /** @example "CHANGES_REQUESTED" */ - state: string; - /** @format date-time */ - submitted_at?: string; - user: SimpleUser | null; +export interface Error { + detail?: string; + error: number; + title?: string; + /** unique uri for this error */ + type?: string; } -/** - * Pull Request Review Comment - * Pull Request Review Comments are comments on a portion of the Pull Request's diff. - */ -export interface PullRequestReviewComment { - _links: { - html: { - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" - */ - href: string; - }; - pull_request: { - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" - */ - href: string; - }; - self: { - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" - */ - href: string; - }; - }; - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - /** - * The text of the comment. - * @example "We should probably include a check for null values here." - */ - body: string; - /** @example ""

comment body

"" */ - body_html?: string; - /** @example ""comment body"" */ - body_text?: string; - /** - * The SHA of the commit to which the comment applies. - * @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" - */ - commit_id: string; - /** - * @format date-time - * @example "2011-04-14T16:00:49Z" - */ - created_at: string; - /** - * The diff of the line that the comment refers to. - * @example "@@ -16,33 +16,40 @@ public class Connection : IConnection..." - */ - diff_hunk: string; - /** - * HTML URL for the pull request review comment. - * @format uri - * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" - */ - html_url: string; - /** - * The ID of the pull request review comment. - * @example 1 - */ - id: number; - /** - * The comment ID to reply to. - * @example 8 - */ - in_reply_to_id?: number; - /** - * The line of the blob to which the comment applies. The last line of the range for a multi-line comment - * @example 2 - */ - line?: number; - /** - * The node ID of the pull request review comment. - * @example "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw" - */ - node_id: string; - /** - * The SHA of the original commit to which the comment applies. - * @example "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840" - */ - original_commit_id: string; - /** - * The line of the blob to which the comment applies. The last line of the range for a multi-line comment - * @example 2 - */ - original_line?: number; - /** - * The index of the original line in the diff to which the comment applies. - * @example 4 - */ - original_position: number; - /** - * The first line of the range for a multi-line comment. - * @example 2 - */ - original_start_line?: number | null; - /** - * The relative path of the file to which the comment applies. - * @example "config/database.yaml" - */ +/** PushToken in JWT format, self-signed. */ +export interface PushToken { + /** audience (URI) */ + aud: string; + exp?: number; + iat?: number; + /** issuer (URI) */ + iss: string; + nbf: number; + /** UUID and public signing key */ + sub: string; +} + +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; - /** - * The line index in the diff to which the comment applies. - * @example 1 - */ - position: number; - /** - * The ID of the pull request review to which the comment belongs. - * @example 42 - */ - pull_request_review_id: number | null; - /** - * URL for the pull request that the review comment belongs to. - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" - */ - pull_request_url: string; - reactions?: ReactionRollup; - /** - * The side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment - * @default "RIGHT" - */ - side?: "LEFT" | "RIGHT"; - /** - * The first line of the range for a multi-line comment. - * @example 2 - */ - start_line?: number | null; - /** - * The side of the first line of the range for a multi-line comment. - * @default "RIGHT" - */ - start_side?: "LEFT" | "RIGHT" | null; - /** - * @format date-time - * @example "2011-04-14T16:00:49Z" - */ - updated_at: string; - /** - * URL for the pull request review comment - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" - */ - url: string; - /** Simple User */ - user: SimpleUser; + /** 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; } -/** - * Pull Request Review Request - * Pull Request Review Request - */ -export interface PullRequestReviewRequest { - teams: TeamSimple[]; - users: SimpleUser[]; +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** - * Pull Request Simple - * Pull Request Simple - */ -export interface PullRequestSimple { - _links: { - /** Hypermedia Link */ - comments: Link; - /** Hypermedia Link */ - commits: Link; - /** Hypermedia Link */ - html: Link; - /** Hypermedia Link */ - issue: Link; - /** Hypermedia Link */ - review_comment: Link; - /** Hypermedia Link */ - review_comments: Link; - /** Hypermedia Link */ - self: Link; - /** Hypermedia Link */ - statuses: Link; +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://6-dot-authentiqio.appspot.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", }; - /** @example "too heated" */ - active_lock_reason?: string | null; - assignee: SimpleUser | null; - assignees?: SimpleUser[] | null; - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - /** The status of auto merging a pull request. */ - auto_merge: AutoMerge; - base: { - label: string; - ref: string; - /** A git repository */ - repo: Repository; - sha: string; - user: SimpleUser | null; + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; }; - /** @example "Please pull these awesome changes" */ - body: string | null; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - closed_at: string | null; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments" - */ - comments_url: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits" - */ - commits_url: string; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - created_at: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/pull/1347.diff" - */ - diff_url: string; - /** - * Indicates whether or not the pull request is a draft. - * @example false - */ - draft?: boolean; - head: { - label: string; - ref: string; - /** A git repository */ - repo: Repository; - sha: string; - user: SimpleUser | null; + + 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), }; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/pull/1347" - */ - html_url: string; - /** @example 1 */ - id: number; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347" - */ - issue_url: string; - labels: { - color?: string; - default?: boolean; - description?: string; - id?: number; - name?: string; - node_id?: string; - url?: string; - }[]; - /** @example true */ - locked: boolean; - /** @example "e5bd3914e2e596debea16f433f57875b5b90bcd6" */ - merge_commit_sha: string | null; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - merged_at: string | null; - milestone: Milestone | null; - /** @example "MDExOlB1bGxSZXF1ZXN0MQ==" */ - node_id: string; - /** @example 1347 */ - number: number; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/pull/1347.patch" - */ - patch_url: string; - requested_reviewers?: SimpleUser[] | null; - requested_teams?: TeamSimple[] | null; - /** @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}" */ - review_comment_url: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments" - */ - review_comments_url: string; - /** @example "open" */ - state: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e" - */ - statuses_url: string; - /** @example "new-feature" */ - title: string; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347" - */ - url: string; - user: SimpleUser | null; -} -/** Rate Limit */ -export interface RateLimit { - limit: number; - remaining: number; - reset: number; -} + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), + }, + }; + } -/** - * Rate Limit Overview - * Rate Limit Overview - */ -export interface RateLimitOverview { - rate: RateLimit; - resources: { - code_scanning_upload?: RateLimit; - core: RateLimit; - graphql?: RateLimit; - integration_manifest?: RateLimit; - search: RateLimit; - source_import?: RateLimit; + 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; }; -} -/** - * Reaction - * Reactions to conversations provide a way to help people express their feelings more simply and effectively. - */ -export interface Reaction { - /** - * The reaction to use - * @example "heart" - */ - content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; - /** - * @format date-time - * @example "2016-05-20T20:09:31Z" - */ - created_at: string; - /** @example 1 */ - id: number; - /** @example "MDg6UmVhY3Rpb24x" */ - node_id: string; - user: SimpleUser | null; -} + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); -/** Reaction Rollup */ -export interface ReactionRollup { - "+1": number; - "-1": number; - confused: number; - eyes: number; - heart: number; - hooray: number; - laugh: number; - rocket: number; - total_count: number; - /** @format uri */ - url: string; -} + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; -/** - * Referrer Traffic - * Referrer Traffic - */ -export interface ReferrerTraffic { - /** @example 4 */ - count: number; - /** @example "Google" */ - referrer: string; - /** @example 3 */ - uniques: number; -} + 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; -/** - * Release - * A release. - */ -export interface Release { - assets: ReleaseAsset[]; - /** @format uri */ - assets_url: string; - /** Simple User */ - author: SimpleUser; - body?: string | null; - body_html?: string; - body_text?: string; - /** @format date-time */ - created_at: string; - /** - * true to create a draft (unpublished) release, false to create a published one. - * @example false - */ - draft: boolean; - /** @format uri */ - html_url: string; - id: number; - name: string | null; - node_id: string; - /** - * Whether to identify the release as a prerelease or a full release. - * @example false - */ - prerelease: boolean; - /** @format date-time */ - published_at: string | null; - /** - * The name of the tag. - * @example "v1.0.0" - */ - tag_name: string; - /** @format uri */ - tarball_url: string | null; - /** - * Specifies the commitish value that determines where the Git tag is created from. - * @example "master" - */ - target_commitish: string; - upload_url: string; - /** @format uri */ - url: string; - /** @format uri */ - zipball_url: string | null; -} + 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.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; -/** - * Release Asset - * Data related to a release. - */ -export interface ReleaseAsset { - /** @format uri */ - browser_download_url: string; - content_type: string; - /** @format date-time */ - created_at: string; - download_count: number; - id: number; - label: string | null; - /** - * The file name of the asset. - * @example "Team Environment" - */ - name: string; - node_id: string; - size: number; - /** State of the release asset. */ - state: "uploaded" | "open"; - /** @format date-time */ - updated_at: string; - uploader: SimpleUser | null; - /** @format uri */ - url: string; + 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; + }); + }; } /** - * Repo Search Result Item - * Repo Search Result Item + * @title Authentiq + * @version 6 + * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://authentiq.com/terms/ + * @baseUrl https://6-dot-authentiqio.appspot.com + * @contact Authentiq team (http://authentiq.io/support) + * + * Strong authentication, without the passwords. */ -export interface RepoSearchResultItem { - 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; - /** @format uri */ - contributors_url: string; - /** @format date-time */ - created_at: string; - default_branch: string; - delete_branch_on_merge?: boolean; - /** @format uri */ - deployments_url: string; - description: string | null; - /** Returns whether or not this repository disabled. */ - 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; - 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: SimpleUser | null; - permissions?: { - admin: boolean; - pull: boolean; - push: boolean; +export class Api extends HttpClient { + wrongPathParams1 = { + /** + * @description DDD + * + * @tags key, delete + * @name WrongPathParams1 + * @request DELETE:/wrong-path-params1/{pathParam1}/{path_param2}/{path_param3}/:pathParam4 + */ + wrongPathParams1: ( + pathParam1: string, + pathParam2: string, + pathParam3: string, + pathParam4: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/wrong-path-params1/\${pathParam1}/\${pathParam2}/\${pathParam3}/\${pathParam4}\`, + method: "DELETE", + ...params, + }), + }; + wrongPathParams2 = { + /** + * @description DDD + * + * @tags key, delete + * @name WrongPathParams2 + * @request DELETE:/wrong-path-params2 + */ + wrongPathParams2: (pathParam1: string, params: RequestParams = {}) => + this.request({ + path: \`/wrong-path-params2\`, + method: "DELETE", + ...params, + }), + }; + key = { + /** + * @description Revoke an Authentiq ID using email & phone. If called with \`email\` and \`phone\` only, a verification code will be sent by email. Do a second call adding \`code\` to complete the revocation. + * + * @tags key, delete + * @name KeyRevokeNosecret + * @request DELETE:/key + */ + keyRevokeNosecret: ( + query: { + /** verification code sent by email */ + code?: string; + /** primary email associated to Key (ID) */ + email: string; + /** primary phone number, international representation */ + phone: string; + }, + params: RequestParams = {}, + ) => + this.request< + { + /** pending or done */ + status?: string; + }, + Error + >({ + path: \`/key\`, + method: "DELETE", + query: query, + format: "json", + ...params, + }), + + /** + * @description Register a new ID \`JWT(sub, devtoken)\` v5: \`JWT(sub, pk, devtoken, ...)\` See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags key, post + * @name KeyRegister + * @request POST:/key + */ + keyRegister: (body: AuthentiqID, params: RequestParams = {}) => + this.request< + { + /** revoke key */ + secret?: string; + /** registered */ + status?: string; + }, + Error + >({ + path: \`/key\`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * @description Revoke an Identity (Key) with a revocation secret + * + * @tags key, delete + * @name KeyRevoke + * @request DELETE:/key/{PK} + */ + keyRevoke: ( + pk: string, + query: { + /** revokation secret */ + secret: string; + }, + params: RequestParams = {}, + ) => + this.request< + { + /** done */ + status?: string; + }, + Error + >({ + path: \`/key/\${pk}\`, + method: "DELETE", + query: query, + format: "json", + ...params, + }), + + /** + * @description Get public details of an Authentiq ID. + * + * @tags key, get + * @name GetKey + * @request GET:/key/{PK} + */ + getKey: (pk: string, params: RequestParams = {}) => + this.request< + { + /** @format date-time */ + since?: string; + status?: string; + /** base64safe encoded public signing key */ + sub?: string; + }, + Error + >({ + path: \`/key/\${pk}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description HEAD info on Authentiq ID + * + * @tags key, head + * @name HeadKey + * @request HEAD:/key/{PK} + */ + headKey: (pk: string, params: RequestParams = {}) => + this.request({ + path: \`/key/\${pk}\`, + method: "HEAD", + ...params, + }), + + /** + * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags key, post + * @name KeyUpdate + * @request POST:/key/{PK} + */ + keyUpdate: (pk: string, body: AuthentiqID, params: RequestParams = {}) => + this.request< + { + /** confirmed */ + status?: string; + }, + Error + >({ + path: \`/key/\${pk}\`, + method: "POST", + body: body, + format: "json", + ...params, + }), + + /** + * @description Update Authentiq ID by replacing the object. v4: \`JWT(sub,email,phone)\` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration \`JWT(sub, pk, devtoken, ...)\` See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags key, put + * @name KeyBind + * @request PUT:/key/{PK} + */ + keyBind: (pk: string, body: AuthentiqID, params: RequestParams = {}) => + this.request< + { + /** confirmed */ + status?: string; + }, + Error + >({ + path: \`/key/\${pk}\`, + method: "PUT", + body: body, + format: "json", + ...params, + }), + }; + login = { + /** + * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags login, post + * @name PushLoginRequest + * @request POST:/login + */ + pushLoginRequest: ( + query: { + /** URI App will connect to */ + callback: string; + }, + body: PushToken, + params: RequestParams = {}, + ) => + this.request< + { + /** sent */ + status?: string; + }, + Error + >({ + path: \`/login\`, + method: "POST", + query: query, + body: body, + format: "json", + ...params, + }), + }; + scope = { + /** + * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags scope, post + * @name SignRequest + * @request POST:/scope + */ + signRequest: ( + body: Claims, + query?: { + /** test only mode, using test issuer */ + test?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + /** 20-character ID */ + job?: string; + /** waiting */ + status?: string; + }, + Error + >({ + path: \`/scope\`, + method: "POST", + query: query, + body: body, + format: "json", + ...params, + }), + + /** + * @description delete a verification job + * + * @tags scope, delete + * @name SignDelete + * @request DELETE:/scope/{job} + */ + signDelete: (job: string, params: RequestParams = {}) => + this.request< + { + /** done */ + status?: string; + }, + Error + >({ + path: \`/scope/\${job}\`, + method: "DELETE", + format: "json", + ...params, + }), + + /** + * @description get the status / current content of a verification job + * + * @tags scope, get + * @name SignRetrieve + * @request GET:/scope/{job} + */ + signRetrieve: (job: string, params: RequestParams = {}) => + this.request< + { + exp?: number; + field?: string; + /** base64safe encoded public signing key */ + sub?: string; + }, + Error + >({ + path: \`/scope/\${job}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description HEAD to get the status of a verification job + * + * @tags scope, head + * @name SignRetrieveHead + * @request HEAD:/scope/{job} + */ + signRetrieveHead: (job: string, params: RequestParams = {}) => + this.request({ + path: \`/scope/\${job}\`, + method: "HEAD", + ...params, + }), + + /** + * @description this is a scope confirmation + * + * @tags scope, post + * @name SignConfirm + * @request POST:/scope/{job} + */ + signConfirm: (job: string, params: RequestParams = {}) => + this.request< + { + /** confirmed */ + status?: string; + }, + Error + >({ + path: \`/scope/\${job}\`, + method: "POST", + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples + * + * @tags scope, put + * @name SignUpdate + * @request PUT:/scope/{job} + */ + signUpdate: (job: string, params: RequestParams = {}) => + this.request< + { + /** result is JWT or JSON?? */ + jwt?: string; + /** ready */ + status?: string; + }, + Error + >({ + path: \`/scope/\${job}\`, + method: "PUT", + ...params, + }), + }; +} +" +`; + +exports[`simple > 'callback-example' 1`] = ` +"/* 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 = ""; + 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.clone() 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; + }); }; - private: boolean; - pulls_url: string; - /** @format date-time */ - pushed_at: string; - releases_url: string; - score: number; - size: number; - ssh_url: string; - stargazers_count: number; - /** @format uri */ - stargazers_url: string; - statuses_url: string; - /** @format uri */ - subscribers_url: string; - /** @format uri */ - subscription_url: string; - /** @format uri */ - svn_url: string; - /** @format uri */ - tags_url: string; - /** @format uri */ - teams_url: string; - temp_clone_token?: string; - text_matches?: SearchResultTextMatches; - topics?: string[]; - trees_url: string; - /** @format date-time */ - updated_at: string; - /** @format uri */ - url: string; - watchers: number; - watchers_count: number; } /** - * Repository - * A git repository + * @title Callback Example + * @version 1.0.0 */ -export interface Repository { - /** - * Whether to allow merge commits for pull requests. - * @default true - * @example true - */ - allow_merge_commit?: boolean; - /** - * Whether to allow rebase merges for pull requests. - * @default true - * @example true - */ - allow_rebase_merge?: boolean; - /** - * Whether to allow squash merges for pull requests. - * @default true - * @example true - */ - allow_squash_merge?: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ - archive_url: string; - /** - * Whether the repository is archived. - * @default false - */ - archived: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ - assignees_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ - blobs_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ - branches_url: string; - /** @example "https://github.com/octocat/Hello-World.git" */ - clone_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ - collaborators_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ - comments_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ - commits_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ - compare_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ - contents_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/contributors" - */ - contributors_url: string; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - created_at: string | null; - /** - * The default branch of the repository. - * @example "master" - */ - default_branch: string; - /** - * Whether to delete head branches when pull requests are merged - * @default false - * @example false - */ - delete_branch_on_merge?: boolean; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/deployments" - */ - deployments_url: string; - /** @example "This your first repo!" */ - description: string | null; - /** Returns whether or not this repository disabled. */ - disabled: boolean; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/downloads" - */ - downloads_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/events" - */ - events_url: string; - fork: boolean; - forks: number; - /** @example 9 */ - forks_count: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/forks" - */ - forks_url: string; - /** @example "octocat/Hello-World" */ - full_name: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ - git_commits_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ - git_refs_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ - git_tags_url: string; - /** @example "git:github.com/octocat/Hello-World.git" */ - git_url: string; - /** - * Whether downloads are enabled. - * @default true - * @example true - */ - has_downloads: boolean; - /** - * Whether issues are enabled. - * @default true - * @example true - */ - has_issues: boolean; - has_pages: boolean; - /** - * Whether projects are enabled. - * @default true - * @example true - */ - has_projects: boolean; - /** - * Whether the wiki is enabled. - * @default true - * @example true - */ - has_wiki: boolean; - /** - * @format uri - * @example "https://github.com" - */ - homepage: string | null; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/hooks" - */ - hooks_url: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World" - */ - html_url: string; - /** - * Unique identifier of the repository - * @example 42 - */ - id: number; - /** - * Whether this repository acts as a template that can be used to generate new repositories. - * @default false - * @example true - */ - is_template?: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ - issue_comment_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ - issue_events_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ - issues_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ - keys_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ - labels_url: string; - language: string | null; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/languages" - */ - languages_url: string; - license: LicenseSimple | null; - master_branch?: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/merges" - */ - merges_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ - milestones_url: string; - /** - * @format uri - * @example "git:git.example.com/octocat/Hello-World" - */ - mirror_url: string | null; - /** - * The name of the repository. - * @example "Team Environment" - */ - name: string; - network_count?: number; - /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ - node_id: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ - notifications_url: string; - open_issues: number; - /** @example 0 */ - open_issues_count: number; - owner: SimpleUser | null; - permissions?: { - admin: boolean; - maintain?: boolean; - pull: boolean; - push: boolean; - triage?: boolean; +export class Api extends HttpClient { + streams = { + /** + * @description subscribes a client to receive out-of-band data + * + * @name StreamsCreate + * @request POST:/streams + */ + streamsCreate: ( + query: { + /** + * the location where data will be sent. Must be network accessible + * by the source server + * @format uri + * @example "https://tonys-server.com" + */ + callbackUrl: string; + }, + params: RequestParams = {}, + ) => + this.request< + { + /** + * this unique identifier allows management of the subscription + * @example "2531329f-fb09-4ef7-887e-84e648214436" + */ + subscriptionId: string; + }, + any + >({ + path: \`/streams\`, + method: "POST", + query: query, + format: "json", + ...params, + }), }; - /** - * Whether the repository is private or public. - * @default false - */ - private: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ - pulls_url: string; - /** - * @format date-time - * @example "2011-01-26T19:06:43Z" - */ - pushed_at: string | null; - /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ - releases_url: string; - /** @example 108 */ - size: number; - /** @example "git@github.com:octocat/Hello-World.git" */ - ssh_url: string; - /** @example 80 */ - stargazers_count: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" - */ - stargazers_url: string; - /** @example ""2020-07-09T00:17:42Z"" */ - starred_at?: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ - statuses_url: string; - subscribers_count?: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" - */ - subscribers_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/subscription" - */ - subscription_url: string; - /** - * @format uri - * @example "https://svn.github.com/octocat/Hello-World" - */ - svn_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/tags" - */ - tags_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/teams" - */ - teams_url: string; - temp_clone_token?: string; - template_repository?: { - 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; - temp_clone_token?: string; - topics?: string[]; - trees_url?: string; - updated_at?: string; - url?: string; - visibility?: string; - watchers_count?: number; - } | null; - topics?: string[]; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ - trees_url: string; - /** - * @format date-time - * @example "2011-01-26T19:14:43Z" - */ - updated_at: string | null; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World" - */ - url: string; - /** - * The repository visibility: public, private, or internal. - * @default "public" - */ - visibility?: string; - watchers: number; - /** @example 80 */ - watchers_count: number; } +" +`; -/** - * Repository Collaborator Permission - * Repository Collaborator Permission +exports[`simple > 'components-responses' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export interface RepositoryCollaboratorPermission { - permission: string; - user: SimpleUser | null; + +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; } -/** - * Repository Invitation - * Repository invitations let you manage who you collaborate with. - */ -export interface RepositoryInvitation { - /** - * @format date-time - * @example "2016-06-13T14:52:50-05:00" - */ - created_at: string; - /** Whether or not the invitation has expired */ - expired?: boolean; - /** @example "https://github.com/octocat/Hello-World/invitations" */ - html_url: string; - /** - * Unique identifier of the repository invitation. - * @example 42 - */ - id: number; - invitee: SimpleUser | null; - inviter: SimpleUser | null; - node_id: string; - /** - * The permission associated with the invitation. - * @example "read" - */ - permissions: "read" | "write" | "admin"; - /** Minimal Repository */ - repository: MinimalRepository; - /** - * URL for the repository invitation - * @example "https://api.github.com/user/repository-invitations/1" - */ - url: string; +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** - * Repository Invitation - * Repository invitations let you manage who you collaborate with. - */ -export interface RepositorySubscription { - /** - * @format date-time - * @example "2012-10-06T21:34:12Z" - */ - created_at: string; - /** Determines if all notifications should be blocked from this repository. */ - ignored: boolean; - reason: string | null; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/example" - */ - repository_url: string; - /** - * Determines if notifications should be received from this repository. - * @example true - */ - subscribed: boolean; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/example/subscription" - */ - url: string; +export interface HttpResponse extends Response { + data: D; + error: E; } -/** - * Legacy Review Comment - * Legacy Review Comment - */ -export interface ReviewComment { - _links: { - /** Hypermedia Link */ - html: Link; - /** Hypermedia Link */ - pull_request: Link; - /** Hypermedia Link */ - self: Link; +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", }; - /** How the author is associated with the repository. */ - author_association: AuthorAssociation; - /** @example "Great stuff" */ - body: string; - body_html?: string; - body_text?: string; - /** @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" */ - commit_id: string; - /** - * @format date-time - * @example "2011-04-14T16:00:49Z" - */ - created_at: string; - /** @example "@@ -16,33 +16,40 @@ public class Connection : IConnection..." */ - diff_hunk: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" - */ - html_url: string; - /** @example 10 */ - id: number; - /** @example 8 */ - in_reply_to_id?: number; - /** - * The line of the blob to which the comment applies. The last line of the range for a multi-line comment - * @example 2 - */ - line?: number; - /** @example "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw" */ - node_id: string; - /** @example "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840" */ - original_commit_id: string; - /** - * The original line of the blob to which the comment applies. The last line of the range for a multi-line comment - * @example 2 - */ - original_line?: number; - /** @example 4 */ - original_position: number; - /** - * The original first line of the range for a multi-line comment. - * @example 2 - */ - original_start_line?: number | null; - /** @example "file1.txt" */ - path: string; - /** @example 1 */ - position: number | null; - /** @example 42 */ - pull_request_review_id: number | null; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" - */ - pull_request_url: string; - /** - * The side of the first line of the range for a multi-line comment. - * @default "RIGHT" - */ - side?: "LEFT" | "RIGHT"; - /** - * The first line of the range for a multi-line comment. - * @example 2 - */ - start_line?: number | null; - /** - * The side of the first line of the range for a multi-line comment. - * @default "RIGHT" - */ - start_side?: "LEFT" | "RIGHT" | null; - /** - * @format date-time - * @example "2011-04-14T16:00:49Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" - */ - url: string; - user: SimpleUser | null; -} -/** - * Self hosted runners - * A self hosted runner - */ -export interface Runner { - busy: boolean; - /** - * The id of the runner. - * @example 5 - */ - id: number; - labels: { - /** Unique identifier of the label. */ - id?: number; - /** Name of the label. */ - name?: string; - /** The type of label. Read-only labels are applied automatically when the runner is configured. */ - type?: "read-only" | "custom"; - }[]; - /** - * The name of the runner. - * @example "iMac" - */ - name: string; - /** - * The Operating System of the runner. - * @example "macos" - */ - os: string; - /** - * The status of the runner. - * @example "online" - */ - status: string; -} + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } -/** - * Runner Application - * Runner Application - */ -export interface RunnerApplication { - architecture: string; - download_url: string; - filename: string; - os: string; -} + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; + }; -export interface RunnerGroupsEnterprise { - allows_public_repositories: boolean; - default: boolean; - id: number; - name: string; - runners_url: string; - selected_organizations_url?: string; - visibility: string; -} + protected encodeQueryParam(key: string, value: any) { + const encodedKey = encodeURIComponent(key); + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; + } -export interface RunnerGroupsOrg { - allows_public_repositories: boolean; - default: boolean; - id: number; - inherited: boolean; - inherited_allows_public_repositories?: boolean; - name: string; - runners_url: string; - /** Link to the selected repositories resource for this runner group. Not present unless visibility was set to `selected` */ - selected_repositories_url?: string; - visibility: string; -} + protected addQueryParam(query: QueryParamsType, key: string) { + return this.encodeQueryParam(key, query[key]); + } -export interface ScimEnterpriseGroup { - displayName?: string; - externalId?: string | null; - id: string; - members?: { - $ref?: string; - display?: string; - value?: string; - }[]; - meta?: { - created?: string; - lastModified?: string; - location?: string; - resourceType?: string; + 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), }; - schemas: string[]; -} -export interface ScimEnterpriseUser { - active?: boolean; - emails?: { - primary?: boolean; - type?: string; - value?: string; - }[]; - externalId?: string; - groups?: { - value?: string; - }[]; - id: string; - meta?: { - created?: string; - lastModified?: string; - location?: string; - resourceType?: string; + 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; }; - name?: { - familyName?: string; - givenName?: string; + + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); + + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } }; - schemas: string[]; - userName?: string; -} -/** - * Scim Error - * Scim Error - */ -export interface ScimError { - detail?: string | null; - documentation_url?: string | null; - message?: string | null; - schemas?: string[]; - scimType?: string | null; - status?: number; -} + 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; -export interface ScimGroupListEnterprise { - Resources: { - displayName?: string; - externalId?: string | null; - id: string; - members?: { - $ref?: string; - display?: string; - value?: string; - }[]; - meta?: { - created?: string; - lastModified?: string; - location?: string; - resourceType?: string; - }; - schemas: string[]; - }[]; - itemsPerPage: number; - schemas: string[]; - startIndex: number; - totalResults: number; + 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.clone() 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; + }); + }; } /** - * SCIM /Users - * SCIM /Users provisioning endpoints + * @title Title + * @version latest + * + * Description */ -export interface ScimUser { - /** - * The active status of the User. - * @example true - */ - active: boolean; - /** - * The name of the user, suitable for display to end-users - * @example "Jon Doe" - */ - displayName?: string | null; - /** - * user emails - * @minItems 1 - * @example [{"value":"someone@example.com","primary":true},{"value":"another@example.com","primary":false}] - */ - emails: { - primary?: boolean; - value: string; - }[]; - /** - * The ID of the User. - * @example "a7b0f98395" - */ - externalId: string | null; - /** associated groups */ - groups?: { - display?: string; - value?: string; - }[]; - /** - * Unique identifier of an external identity - * @example "1b78eada-9baa-11e6-9eb6-a431576d590e" - */ - id: string; - meta: { - /** - * @format date-time - * @example "2019-01-24T22:45:36.000Z" - */ - created?: string; - /** - * @format date-time - * @example "2019-01-24T22:45:36.000Z" - */ - lastModified?: string; +export class Api extends HttpClient { + api = { /** - * @format uri - * @example "https://api.github.com/scim/v2/organizations/myorg-123abc55141bfd8f/Users/c42772b5-2029-11e9-8543-9264a97dec8d" + * No description + * + * @name GetData + * @request GET:/api */ - location?: string; - /** @example "User" */ - resourceType?: string; - }; - /** @example {"givenName":"Jane","familyName":"User"} */ - name: { - familyName: string | null; - formatted?: string | null; - givenName: string | null; + getData: (params: RequestParams = {}) => + this.request< + { + data?: string; + }, + any + >({ + path: \`/api\`, + method: "GET", + ...params, + }), }; - /** - * Set of operations to be performed - * @minItems 1 - * @example [{"op":"replace","value":{"active":false}}] - */ - operations?: { - op: "add" | "remove" | "replace"; - path?: string; - value?: string | object | any[]; - }[]; - /** The ID of the organization. */ - organization_id?: number; - /** - * SCIM schema used. - * @minItems 1 - */ - schemas: string[]; - /** - * Configured by the admin. Could be an email, login, or username - * @example "someone@example.com" - */ - userName: string | null; } +" +`; -/** - * SCIM User List - * SCIM User List +exports[`simple > 'enums' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export interface ScimUserList { - Resources: ScimUser[]; - /** @example 10 */ - itemsPerPage: number; - /** - * SCIM schema used. - * @minItems 1 - */ - schemas: string[]; - /** @example 1 */ - startIndex: number; - /** @example 3 */ - totalResults: number; + +/** @format int32 */ +export enum EmptyEnum { + Bla = "Bla", + Blabla = "Blabla", + Boiler = "Boiler", } -export interface ScimUserListEnterprise { - Resources: { - active?: boolean; - emails?: { - primary?: boolean; - type?: string; - value?: string; - }[]; - externalId?: string; - groups?: { - value?: string; - }[]; - id: string; - meta?: { - created?: string; - lastModified?: string; - location?: string; - resourceType?: string; - }; - name?: { - familyName?: string; - givenName?: string; - }; - schemas: string[]; - userName?: string; - }[]; - itemsPerPage: number; - schemas: string[]; - startIndex: number; - totalResults: number; +/** @format int32 */ +export enum EnumWithMoreNames { + Bla = 1, + Blabla = "Blabla", + Boiler = "Boiler", } -/** Scoped Installation */ -export interface ScopedInstallation { - /** Simple User */ - account: SimpleUser; - /** @example true */ - has_multiple_single_files?: boolean; - /** The permissions granted to the user-to-server access token. */ - permissions: AppPermissions; - /** - * @format uri - * @example "https://api.github.com/users/octocat/repos" - */ - repositories_url: string; - /** Describe whether all repositories have been selected or there's a selection involved */ - repository_selection: "all" | "selected"; - /** @example "config.yaml" */ - single_file_name: string | null; - /** @example ["config.yml",".github/issue_TEMPLATE.md"] */ - single_file_paths?: string[]; +export enum OnlyEnumNames { + Bla = "Bla", + Blabla = "Blabla", + Boiler = "Boiler", } -/** Search Result Text Matches */ -export type SearchResultTextMatches = { - fragment?: string; - matches?: { - indices?: number[]; - text?: string; - }[]; - object_type?: string | null; - object_url?: string; - property?: string; -}[]; +/** @format int32 */ +export enum SomeInterestEnum { + Bla = 6, + Blabla = 2, + Boiler = 1, + Bbabab = 67, + Nowadays = 88, + FAIL = 122, + Vvvvv = 88, + ASdasAS = 0, + ASDsacZX = 213, + Zook = 12378, + EnumMm = 123125, + VCsa = 32452, + Yuuu = 1111, + ASddd = 66666, + ASdsdsa = "ASdsdsa", + ASDds = "ASDds", + HSDFDS = "HSDFDS", +} -export interface SecretScanningAlert { - /** The time that the alert was created in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. */ - created_at?: AlertCreatedAt; - /** The GitHub URL of the alert resource. */ - html_url?: AlertHtmlUrl; - /** The security alert number. */ - number?: AlertNumber; - /** **Required when the `state` is `resolved`.** The reason for resolving the alert. Can be one of `false_positive`, `wont_fix`, `revoked`, or `used_in_tests`. */ - resolution?: SecretScanningAlertResolution; - /** - * The time that the alert was resolved in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`. - * @format date-time - */ - resolved_at?: string | null; - /** Simple User */ - resolved_by?: SimpleUser; - /** The secret that was detected. */ - secret?: string; - /** The type of secret that secret scanning detected. */ - secret_type?: string; - /** Sets the state of the secret scanning alert. Can be either `open` or `resolved`. You must provide `resolution` when you set the state to `resolved`. */ - state?: SecretScanningAlertState; - /** The REST API URL of the alert resource. */ - url?: AlertUrl; +export enum StringCompleteEnums { + Bla = "foo", + Blabla = "bar", + Boiler = "baz", } -/** **Required when the `state` is `resolved`.** The reason for resolving the alert. Can be one of `false_positive`, `wont_fix`, `revoked`, or `used_in_tests`. */ -export type SecretScanningAlertResolution = "false_positive" | "wont_fix" | "revoked" | "used_in_tests" | null; +export enum StringEnums { + Bla = "foo", + Blabla = "bar", + Boiler = "Boiler", +} -/** Sets the state of the secret scanning alert. Can be either `open` or `resolved`. You must provide `resolution` when you set the state to `resolved`. */ -export enum SecretScanningAlertState { - Open = "open", - Resolved = "resolved", +export enum StringOnlyEnumNames { + Bla = "Bla", + Blabla = "Blabla", + Boiler = "Boiler", } -export interface SelectedActions { - /** Whether GitHub-owned actions are allowed. For example, this includes the actions in the `actions` organization. */ - github_owned_allowed: boolean; - /** Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, `monalisa/octocat@*`, `monalisa/octocat@v2`, `monalisa/*`." */ - patterns_allowed: string[]; - /** Whether actions in GitHub Marketplace from verified creators are allowed. Set to `true` to allow all GitHub Marketplace actions by verified creators. */ - verified_allowed: boolean; +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; } -/** The API URL to use to get or set the actions that are allowed to run, when `allowed_actions` is set to `selected`. */ -export type SelectedActionsUrl = string; +export type RequestParams = Omit; -/** - * Short Blob - * Short Blob - */ -export interface ShortBlob { - sha: string; - url: string; +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** - * Short Branch - * Short Branch - */ -export interface ShortBranch { - commit: { - sha: string; - /** @format uri */ - url: string; - }; - name: string; - protected: boolean; - /** Branch Protection */ - protection?: BranchProtection; - /** @format uri */ - protection_url?: string; +export interface HttpResponse extends Response { + data: D; + error: E; } -/** - * Simple Commit - * Simple Commit - */ -export interface SimpleCommit { - author: { - email: string; - name: string; - } | null; - committer: { - email: string; - name: string; - } | null; - id: string; - message: string; - /** @format date-time */ - timestamp: string; - tree_id: string; +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", } -/** Simple Commit Status */ -export interface SimpleCommitStatus { - /** @format uri */ - avatar_url: string | null; - context: string; - /** @format date-time */ - created_at: string; - description: string | null; - id: number; - node_id: string; - required?: boolean | null; - state: string; - /** @format uri */ - target_url: string; - /** @format date-time */ - updated_at: string; - /** @format uri */ - url: string; +export class HttpClient { + public baseUrl: string = "https://ffff.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) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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; + }); + }; } /** - * Simple User - * Simple User + * @title No title + * @baseUrl https://ffff.com */ -export type SimpleUser = { - /** - * @format uri - * @example "https://github.com/images/error/octocat_happy.gif" - */ - avatar_url: string; - /** @example "https://api.github.com/users/octocat/events{/privacy}" */ - events_url: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/followers" - */ - followers_url: string; - /** @example "https://api.github.com/users/octocat/following{/other_user}" */ - following_url: string; - /** @example "https://api.github.com/users/octocat/gists{/gist_id}" */ - gists_url: string; - /** @example "41d064eb2195891e12d0413f63227ea7" */ - gravatar_id: string | null; - /** - * @format uri - * @example "https://github.com/octocat" - */ - html_url: string; - /** @example 1 */ - id: number; - /** @example "octocat" */ - login: string; - /** @example "MDQ6VXNlcjE=" */ - node_id: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/orgs" - */ - organizations_url: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/received_events" - */ - received_events_url: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/repos" - */ - repos_url: string; - site_admin: boolean; - /** @example ""2020-07-09T00:17:55Z"" */ - starred_at?: string; - /** @example "https://api.github.com/users/octocat/starred{/owner}{/repo}" */ - starred_url: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat/subscriptions" - */ - subscriptions_url: string; - /** @example "User" */ - type: string; - /** - * @format uri - * @example "https://api.github.com/users/octocat" - */ - url: string; -}; +export class Api extends HttpClient {} +" +`; -/** - * Stargazer - * Stargazer +exports[`simple > 'example1' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export interface Stargazer { - /** @format date-time */ - starred_at: string; - user: SimpleUser | null; -} /** - * Starred Repository - * Starred Repository + * some description + * @pattern ^[A-Z]{3,3}$ */ -export interface StarredRepository { - /** A git repository */ - repo: Repository; - /** @format date-time */ - starred_at: string; +export type Currency = string; + +/** A TDE certificate that can be uploaded into a server. */ +export type TdeCertificate = { + /** Resource ID. */ + id?: string; + /** Resource name. */ + name?: string; + /** Resource type. */ + type?: string; +} & { + /** Resource properties. */ + properties?: TdeCertificateProperties; +}; + +/** A TDE certificate that can be uploaded into a server. */ +export type TdeCertificate2 = { + /** Resource ID. */ + id?: string; + /** Resource name. */ + name?: string; + /** Resource type. */ + type?: string; +}; + +/** Properties of a TDE certificate. */ +export interface TdeCertificateProperties { + /** The certificate password. */ + certPassword?: string; + /** The base64 encoded certificate private blob. */ + privateBlob: string; } -/** - * Status - * The status of a commit. - */ -export interface Status { - avatar_url: string | null; - context: string; - created_at: string; - /** Simple User */ - creator: SimpleUser; - description: string; - id: number; - node_id: string; - state: string; - target_url: string; - updated_at: string; - url: string; +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; } -/** - * Status Check Policy - * Status Check Policy - */ -export interface StatusCheckPolicy { - /** @example ["continuous-integration/travis-ci"] */ - contexts: string[]; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks/contexts" - */ - contexts_url: string; - /** @example true */ - strict: boolean; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks" - */ - url: string; +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** - * Tag - * Tag - */ -export interface Tag { - commit: { - sha: string; - /** @format uri */ - url: string; - }; - /** @example "v0.1" */ - name: string; - node_id: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/tarball/v0.1" - */ - tarball_url: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World/zipball/v0.1" - */ - zipball_url: string; +export interface HttpResponse extends Response { + data: D; + error: E; } -/** - * Team - * Groups of organization members that gives permissions on specified repositories. - */ -export interface Team { - description: string | null; - /** - * @format uri - * @example "https://github.com/orgs/rails/teams/core" - */ - html_url: string; - id: number; - members_url: string; - name: string; - node_id: string; - parent?: TeamSimple | null; - permission: string; - privacy?: string; - /** @format uri */ - repositories_url: string; - slug: string; - /** @format uri */ - url: string; +type CancelToken = Symbol | string | number; + +export enum ContentType { + Json = "application/json", + FormData = "multipart/form-data", + UrlEncoded = "application/x-www-form-urlencoded", + Text = "text/plain", } -/** - * Team Discussion - * A team discussion is a persistent record of a free-form conversation within a team. - */ -export interface TeamDiscussion { - author: SimpleUser | null; - /** - * The main text of the discussion. - * @example "Please suggest improvements to our workflow in comments." - */ - body: string; - /** @example "

Hi! This is an area for us to collaborate as a team

" */ - body_html: string; - /** - * The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. - * @example "0307116bbf7ced493b8d8a346c650b71" - */ - body_version: string; - /** @example 0 */ - comments_count: number; - /** - * @format uri - * @example "https://api.github.com/organizations/1/team/2343027/discussions/1/comments" - */ - comments_url: string; - /** - * @format date-time - * @example "2018-01-25T18:56:31Z" - */ - created_at: string; - /** - * @format uri - * @example "https://github.com/orgs/github/teams/justice-league/discussions/1" - */ - html_url: string; - /** @format date-time */ - last_edited_at: string | null; - /** @example "MDE0OlRlYW1EaXNjdXNzaW9uMQ==" */ - node_id: string; - /** - * The unique sequence number of a team discussion. - * @example 42 - */ - number: number; - /** - * Whether or not this discussion should be pinned for easy retrieval. - * @example true - */ - pinned: boolean; - /** - * Whether or not this discussion should be restricted to team members and organization administrators. - * @example true - */ - private: boolean; - reactions?: ReactionRollup; - /** - * @format uri - * @example "https://api.github.com/organizations/1/team/2343027" - */ - team_url: string; - /** - * The title of the discussion. - * @example "How can we improve our workflow?" - */ - title: string; - /** - * @format date-time - * @example "2018-01-25T18:56:31Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/organizations/1/team/2343027/discussions/1" - */ - url: string; +export class HttpClient { + public baseUrl: string = "https://management.azure.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) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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; + }); + }; } /** - * Team Discussion Comment - * A reply to a discussion within a team. + * @title SqlManagementClient + * @version 2017-10-01-preview + * @baseUrl https://management.azure.com + * + * The Azure SQL Database management API provides a RESTful set of web APIs that interact with Azure SQL Database services to manage your databases. The API enables users to create, retrieve, update, and delete databases, servers, and other entities. */ -export interface TeamDiscussionComment { - author: SimpleUser | null; - /** - * The main text of the comment. - * @example "I agree with this suggestion." - */ - body: string; - /** @example "

Do you like apples?

" */ - body_html: string; - /** - * The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. - * @example "0307116bbf7ced493b8d8a346c650b71" - */ - body_version: string; - /** - * @format date-time - * @example "2018-01-15T23:53:58Z" - */ - created_at: string; - /** - * @format uri - * @example "https://api.github.com/organizations/1/team/2403582/discussions/1" - */ - discussion_url: string; - /** - * @format uri - * @example "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1" - */ - html_url: string; - /** @format date-time */ - last_edited_at: string | null; - /** @example "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=" */ - node_id: string; - /** - * The unique sequence number of a team discussion comment. - * @example 42 - */ - number: number; - reactions?: ReactionRollup; - /** - * @format date-time - * @example "2018-01-15T23:53:58Z" - */ - updated_at: string; - /** - * @format uri - * @example "https://api.github.com/organizations/1/team/2403582/discussions/1/comments/1" - */ - url: string; +export class Api extends HttpClient { + subscriptions = { + /** + * @description Creates a TDE certificate for a given server. + * + * @tags ManagedInstanceTdeCertificates + * @name ManagedInstanceTdeCertificatesCreate + * @request POST:/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates + */ + managedInstanceTdeCertificatesCreate: ( + resourceGroupName: string, + managedInstanceName: string, + subscriptionId: string, + query: { + /** The API version to use for the request. */ + "api-version": string; + }, + parameters: TdeCertificate, + params: RequestParams = {}, + ) => + this.request({ + path: \`/subscriptions/\${subscriptionId}/resourceGroups/\${resourceGroupName}/providers/Microsoft.Sql/managedInstances/\${managedInstanceName}/tdeCertificates\`, + method: "POST", + query: query, + body: parameters, + type: ContentType.Json, + ...params, + }), + }; } +" +`; -/** - * Full Team - * Groups of organization members that gives permissions on specified repositories. +exports[`simple > 'explode-param-3' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- */ -export interface TeamFull { - /** - * @format date-time - * @example "2017-07-14T16:53:42Z" - */ - created_at: string; - /** @example "A great team." */ - description: string | null; - /** - * @format uri - * @example "https://github.com/orgs/rails/teams/core" - */ - html_url: string; - /** - * Unique identifier of the team - * @example 42 - */ - id: number; - /** - * Distinguished Name (DN) that team maps to within LDAP environment - * @example "uid=example,ou=users,dc=github,dc=com" - */ - ldap_dn?: string; - /** @example 3 */ - members_count: number; - /** @example "https://api.github.com/organizations/1/team/1/members{/member}" */ - members_url: string; - /** - * Name of the team - * @example "Developers" - */ - name: string; - /** @example "MDQ6VGVhbTE=" */ - node_id: string; - /** Organization Full */ - organization: OrganizationFull; - parent?: TeamSimple | null; - /** - * Permission that the team will have for its repositories - * @example "push" - */ - permission: string; - /** - * The level of privacy this team should have - * @example "closed" - */ - privacy?: "closed" | "secret"; - /** @example 10 */ - repos_count: number; - /** - * @format uri - * @example "https://api.github.com/organizations/1/team/1/repos" - */ - repositories_url: string; - /** @example "justice-league" */ - slug: string; + +export interface Floop { + info?: string; +} + +export interface QueryParams { /** - * @format date-time - * @example "2017-08-17T12:37:15Z" + * Page size + * @format int32 + * @min 0 */ - updated_at: string; + "page-size"?: number | null; /** - * URL for the team - * @format uri - * @example "https://api.github.com/organizations/1/team/1" + * Page number + * @format int32 + * @min 0 */ - url: string; + page?: number | null; } -/** - * Team Membership - * Team Membership - */ -export interface TeamMembership { - /** - * The role of the user in the team. - * @default "member" - * @example "member" - */ - role: "member" | "maintainer"; - state: string; - /** @format uri */ - url: string; +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; } -/** - * Team Project - * A team's access to a project. - */ -export interface TeamProject { - body: string | null; - columns_url: string; - created_at: string; - /** Simple User */ - creator: SimpleUser; - html_url: string; - id: number; - name: string; - node_id: string; - number: number; - /** The organization permission for this project. Only present when owner is an organization. */ - organization_permission?: string; - owner_url: string; - permissions: { - admin: boolean; - read: boolean; - write: boolean; - }; - /** Whether the project is private or not. Only present when owner is an organization. */ - private?: boolean; - state: string; - updated_at: string; - url: string; +export type RequestParams = Omit; + +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; } -/** - * Team Repository - * A team's access to a repository. - */ -export interface TeamRepository { - /** - * Whether to allow merge commits for pull requests. - * @default true - * @example true - */ - allow_merge_commit?: boolean; - /** - * Whether to allow rebase merges for pull requests. - * @default true - * @example true - */ - allow_rebase_merge?: boolean; - /** - * Whether to allow squash merges for pull requests. - * @default true - * @example true - */ - allow_squash_merge?: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ - archive_url: string; - /** - * Whether the repository is archived. - * @default false - */ - archived: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ - assignees_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ - blobs_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ - branches_url: string; - /** @example "https://github.com/octocat/Hello-World.git" */ - clone_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ - collaborators_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ - comments_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ - commits_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ - compare_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ - contents_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/contributors" - */ - contributors_url: string; - /** - * @format date-time - * @example "2011-01-26T19:01:12Z" - */ - created_at: string | null; - /** - * The default branch of the repository. - * @example "master" - */ - default_branch: string; - /** - * Whether to delete head branches when pull requests are merged - * @default false - * @example false - */ - delete_branch_on_merge?: boolean; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/deployments" - */ - deployments_url: string; - /** @example "This your first repo!" */ - description: string | null; - /** Returns whether or not this repository disabled. */ - disabled: boolean; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/downloads" - */ - downloads_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/events" - */ - events_url: string; - fork: boolean; - forks: number; - /** @example 9 */ - forks_count: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/forks" - */ - forks_url: string; - /** @example "octocat/Hello-World" */ - full_name: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ - git_commits_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ - git_refs_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ - git_tags_url: string; - /** @example "git:github.com/octocat/Hello-World.git" */ - git_url: string; - /** - * Whether downloads are enabled. - * @default true - * @example true - */ - has_downloads: boolean; - /** - * Whether issues are enabled. - * @default true - * @example true - */ - has_issues: boolean; - has_pages: boolean; - /** - * Whether projects are enabled. - * @default true - * @example true - */ - has_projects: boolean; - /** - * Whether the wiki is enabled. - * @default true - * @example true - */ - has_wiki: boolean; - /** - * @format uri - * @example "https://github.com" - */ - homepage: string | null; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/hooks" - */ - hooks_url: string; - /** - * @format uri - * @example "https://github.com/octocat/Hello-World" - */ - html_url: string; - /** - * Unique identifier of the repository - * @example 42 - */ - id: number; - /** - * Whether this repository acts as a template that can be used to generate new repositories. - * @default false - * @example true - */ - is_template?: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ - issue_comment_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ - issue_events_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ - issues_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ - keys_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ - labels_url: string; - language: string | null; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/languages" - */ - languages_url: string; - license: LicenseSimple | null; - master_branch?: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/merges" - */ - merges_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ - milestones_url: string; - /** - * @format uri - * @example "git:git.example.com/octocat/Hello-World" - */ - mirror_url: string | null; - /** - * The name of the repository. - * @example "Team Environment" - */ - name: string; - network_count?: number; - /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ - node_id: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ - notifications_url: string; - open_issues: number; - /** @example 0 */ - open_issues_count: number; - owner: SimpleUser | null; - permissions?: { - admin: boolean; - maintain?: boolean; - pull: boolean; - push: boolean; - triage?: boolean; - }; - /** - * Whether the repository is private or public. - * @default false - */ - private: boolean; - /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ - pulls_url: string; - /** - * @format date-time - * @example "2011-01-26T19:06:43Z" - */ - pushed_at: string | null; - /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ - releases_url: string; - /** @example 108 */ - size: number; - /** @example "git@github.com:octocat/Hello-World.git" */ - ssh_url: string; - /** @example 80 */ - stargazers_count: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" - */ - stargazers_url: string; - /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ - statuses_url: string; - subscribers_count?: number; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" - */ - subscribers_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/subscription" - */ - subscription_url: string; - /** - * @format uri - * @example "https://svn.github.com/octocat/Hello-World" - */ - svn_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/tags" - */ - tags_url: string; - /** - * @format uri - * @example "http://api.github.com/repos/octocat/Hello-World/teams" - */ - teams_url: string; - temp_clone_token?: string; - template_repository?: Repository | null; - topics?: string[]; - /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ - trees_url: string; - /** - * @format date-time - * @example "2011-01-26T19:14:43Z" - */ - updated_at: string | null; - /** - * @format uri - * @example "https://api.github.com/repos/octocat/Hello-World" - */ - url: string; - /** - * The repository visibility: public, private, or internal. - * @default "public" - */ - visibility?: string; - watchers: number; - /** @example 80 */ - watchers_count: number; +export interface HttpResponse extends Response { + data: D; + error: E; } -/** - * Team Simple - * Groups of organization members that gives permissions on specified repositories. - */ -export type TeamSimple = { - /** - * Description of the team - * @example "A great team." - */ - description: string | null; - /** - * @format uri - * @example "https://github.com/orgs/rails/teams/core" - */ - html_url: string; - /** - * Unique identifier of the team - * @example 1 - */ - id: number; - /** - * Distinguished Name (DN) that team maps to within LDAP environment - * @example "uid=example,ou=users,dc=github,dc=com" - */ - ldap_dn?: string; - /** @example "https://api.github.com/organizations/1/team/1/members{/member}" */ - members_url: string; - /** - * Name of the team - * @example "Justice League" - */ - name: string; - /** @example "MDQ6VGVhbTE=" */ - node_id: string; - /** - * Permission that the team will have for its repositories - * @example "admin" - */ - permission: string; - /** - * The level of privacy this team should have - * @example "closed" - */ - privacy?: string; - /** - * @format uri - * @example "https://api.github.com/organizations/1/team/1/repos" - */ - repositories_url: string; - /** @example "justice-league" */ - slug: string; - /** - * URL for the team - * @format uri - * @example "https://api.github.com/organizations/1/team/1" - */ - url: string; -}; +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.clone() 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; + }); + }; +} /** - * Thread - * Thread + * @title API + * @version 0.1 + * + * Documentation */ -export interface Thread { - id: string; - last_read_at: string | null; - reason: string; - /** Minimal Repository */ - repository: MinimalRepository; - subject: { - latest_comment_url: string; - title: string; - type: string; - url: string; +export class Api extends HttpClient { + user = { + /** + * No description + * + * @name CreateFile + * @summary Some summary + * @request POST:/{user}/foos + */ + createFile: ( + user: string, + data: { + /** @default "" */ + meme: string; + memeType?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/\${user}/foos\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + something = { + /** + * No description + * + * @name Gets + * @request GET:/something/ + */ + gets: ( + query?: { + params?: QueryParams; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/something/\`, + method: "GET", + query: query, + ...params, + }), }; - /** @example "https://api.github.com/notifications/threads/2/subscription" */ - subscription_url: string; - unread: boolean; - updated_at: string; - url: string; } +" +`; + +exports[`simple > 'file-formdata-example' 1`] = ` +"/* 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 = ""; + 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.clone() 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 Title + * @version v0.1 + */ +export class Api extends HttpClient { + uploadFile = { + /** + * No description + * + * @tags tag + * @name UploadFile + * @summary Upload file + * @request POST:/upload-file + */ + uploadFile: ( + data: { + /** + * File description + * @format binary + */ + file?: File; + /** Boolean flag */ + someFlag?: boolean; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/upload-file\`, + method: "POST", + body: data, + type: ContentType.FormData, + ...params, + }), + }; +} +" +`; + +exports[`simple > 'full-swagger-scheme' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface ActionsBillingUsage { + /** The amount of free GitHub Actions minutes available. */ + included_minutes: number; + minutes_used_breakdown: { + /** 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; + }; + /** The sum of the free and paid GitHub Actions minutes used. */ + total_minutes_used: number; + /** The total paid GitHub Actions minutes used. */ + total_paid_minutes_used: number; +} + +/** Whether GitHub Actions is enabled on the repository. */ +export type ActionsEnabled = boolean; + +export interface ActionsEnterprisePermissions { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions: AllowedActions; + /** The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ + enabled_organizations: EnabledOrganizations; + /** The API URL to use to get or set the actions that are allowed to run, when \`allowed_actions\` is set to \`selected\`. */ + selected_actions_url?: SelectedActionsUrl; + /** The API URL to use to get or set the selected organizations that are allowed to run GitHub Actions, when \`enabled_organizations\` is set to \`selected\`. */ + selected_organizations_url?: string; +} + +export interface ActionsOrganizationPermissions { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions: AllowedActions; + /** The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ + enabled_repositories: EnabledRepositories; + /** The API URL to use to get or set the actions that are allowed to run, when \`allowed_actions\` is set to \`selected\`. */ + selected_actions_url?: SelectedActionsUrl; + /** The API URL to use to get or set the selected repositories that are allowed to run GitHub Actions, when \`enabled_repositories\` is set to \`selected\`. */ + selected_repositories_url?: string; +} + +/** + * ActionsPublicKey + * The public key used for setting Actions Secrets. + */ +export interface ActionsPublicKey { + /** @example "2011-01-26T19:01:12Z" */ + created_at?: string; + /** @example 2 */ + id?: number; + /** + * The Base64 encoded public key. + * @example "hBT5WZEj8ZoOv6TYJsfWq7MxTEQopZO5/IT3ZCVQPzs=" + */ + key: string; + /** + * The identifier for the key. + * @example "1234567" + */ + key_id: string; + /** @example "ssh-rsa AAAAB3NzaC1yc2EAAA" */ + title?: string; + /** @example "https://api.github.com/user/keys/2" */ + url?: string; +} + +export interface ActionsRepositoryPermissions { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions: AllowedActions; + /** Whether GitHub Actions is enabled on the repository. */ + enabled: ActionsEnabled; + /** The API URL to use to get or set the actions that are allowed to run, when \`allowed_actions\` is set to \`selected\`. */ + selected_actions_url?: SelectedActionsUrl; +} + +/** + * Actions Secret + * Set secrets for GitHub Actions. + */ +export interface ActionsSecret { + /** @format date-time */ + created_at: string; + /** + * The name of the secret. + * @example "SECRET_TOKEN" + */ + name: string; + /** @format date-time */ + updated_at: string; +} + +/** + * Actor + * Actor + */ +export interface Actor { + /** @format uri */ + avatar_url: string; + display_login?: string; + gravatar_id: string | null; + id: number; + login: string; + /** @format uri */ + url: string; +} + +/** + * The time that the alert was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. + * @format date-time + */ +export type AlertCreatedAt = string; + +/** + * The GitHub URL of the alert resource. + * @format uri + */ +export type AlertHtmlUrl = string; + +/** The security alert number. */ +export type AlertNumber = number; + +/** + * The REST API URL of the alert resource. + * @format uri + */ +export type AlertUrl = string; + +/** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ +export enum AllowedActions { + All = "all", + LocalOnly = "local_only", + Selected = "selected", +} + +/** + * Api Overview + * Api Overview + */ +export interface ApiOverview { + /** @example ["13.64.0.0/16","13.65.0.0/16"] */ + actions?: string[]; + /** @example ["127.0.0.1/32"] */ + api?: string[]; + /** @example ["127.0.0.1/32"] */ + git?: string[]; + /** @example ["127.0.0.1/32"] */ + hooks?: string[]; + /** @example ["54.158.161.132","54.226.70.38"] */ + importer?: string[]; + /** @example ["192.30.252.153/32","192.30.252.154/32"] */ + pages?: string[]; + ssh_key_fingerprints?: { + SHA256_DSA?: string; + SHA256_RSA?: string; + }; + /** @example true */ + verifiable_password_authentication: boolean; + /** @example ["127.0.0.1/32"] */ + web?: string[]; +} + +/** + * App Permissions + * The permissions granted to the user-to-server access token. + * @example {"contents":"read","issues":"read","deployments":"write","single_file":"read"} + */ +export interface AppPermissions { + /** The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be one of: \`read\` or \`write\`. */ + actions?: "read" | "write"; + /** The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. Can be one of: \`read\` or \`write\`. */ + administration?: "read" | "write"; + /** The level of permission to grant the access token for checks on code. Can be one of: \`read\` or \`write\`. */ + checks?: "read" | "write"; + /** The level of permission to grant the access token for notification of content references and creation content attachments. Can be one of: \`read\` or \`write\`. */ + content_references?: "read" | "write"; + /** The level of permission to grant the access token for repository contents, commits, branches, downloads, releases, and merges. Can be one of: \`read\` or \`write\`. */ + contents?: "read" | "write"; + /** The level of permission to grant the access token for deployments and deployment statuses. Can be one of: \`read\` or \`write\`. */ + deployments?: "read" | "write"; + /** The level of permission to grant the access token for managing repository environments. Can be one of: \`read\` or \`write\`. */ + environments?: "read" | "write"; + /** The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. Can be one of: \`read\` or \`write\`. */ + issues?: "read" | "write"; + /** The level of permission to grant the access token for organization teams and members. Can be one of: \`read\` or \`write\`. */ + members?: "read" | "write"; + /** The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. Can be one of: \`read\` or \`write\`. */ + metadata?: "read" | "write"; + /** The level of permission to grant the access token to manage access to an organization. Can be one of: \`read\` or \`write\`. */ + organization_administration?: "read" | "write"; + /** The level of permission to grant the access token to manage the post-receive hooks for an organization. Can be one of: \`read\` or \`write\`. */ + organization_hooks?: "read" | "write"; + /** The level of permission to grant the access token for viewing an organization's plan. Can be one of: \`read\`. */ + organization_plan?: "read"; + /** The level of permission to grant the access token to manage organization projects, columns, and cards. Can be one of: \`read\`, \`write\`, or \`admin\`. */ + organization_projects?: "read" | "write" | "admin"; + /** The level of permission to grant the access token to manage organization secrets. Can be one of: \`read\` or \`write\`. */ + organization_secrets?: "read" | "write"; + /** The level of permission to grant the access token to view and manage GitHub Actions self-hosted runners available to an organization. Can be one of: \`read\` or \`write\`. */ + organization_self_hosted_runners?: "read" | "write"; + /** The level of permission to grant the access token to view and manage users blocked by the organization. Can be one of: \`read\` or \`write\`. */ + organization_user_blocking?: "read" | "write"; + /** The level of permission to grant the access token for packages published to GitHub Packages. Can be one of: \`read\` or \`write\`. */ + packages?: "read" | "write"; + /** The level of permission to grant the access token to retrieve Pages statuses, configuration, and builds, as well as create new builds. Can be one of: \`read\` or \`write\`. */ + pages?: "read" | "write"; + /** The level of permission to grant the access token for pull requests and related comments, assignees, labels, milestones, and merges. Can be one of: \`read\` or \`write\`. */ + pull_requests?: "read" | "write"; + /** The level of permission to grant the access token to manage the post-receive hooks for a repository. Can be one of: \`read\` or \`write\`. */ + repository_hooks?: "read" | "write"; + /** The level of permission to grant the access token to manage repository projects, columns, and cards. Can be one of: \`read\`, \`write\`, or \`admin\`. */ + repository_projects?: "read" | "write" | "admin"; + /** The level of permission to grant the access token to view and manage secret scanning alerts. Can be one of: \`read\` or \`write\`. */ + secret_scanning_alerts?: "read" | "write"; + /** The level of permission to grant the access token to manage repository secrets. Can be one of: \`read\` or \`write\`. */ + secrets?: "read" | "write"; + /** The level of permission to grant the access token to view and manage security events like code scanning alerts. Can be one of: \`read\` or \`write\`. */ + security_events?: "read" | "write"; + /** The level of permission to grant the access token to manage just a single file. Can be one of: \`read\` or \`write\`. */ + single_file?: "read" | "write"; + /** The level of permission to grant the access token for commit statuses. Can be one of: \`read\` or \`write\`. */ + statuses?: "read" | "write"; + /** The level of permission to grant the access token to manage team discussions and related comments. Can be one of: \`read\` or \`write\`. */ + team_discussions?: "read" | "write"; + /** The level of permission to grant the access token to retrieve Dependabot alerts. Can be one of: \`read\`. */ + vulnerability_alerts?: "read"; + /** The level of permission to grant the access token to update GitHub Actions workflow files. Can be one of: \`write\`. */ + workflows?: "write"; +} + +/** + * Application Grant + * The authorization associated with an OAuth Access. + */ +export interface ApplicationGrant { + app: { + client_id: string; + name: string; + /** @format uri */ + url: string; + }; + /** + * @format date-time + * @example "2011-09-06T17:26:27Z" + */ + created_at: string; + /** @example 1 */ + id: number; + /** @example ["public_repo"] */ + scopes: string[]; + /** + * @format date-time + * @example "2011-09-06T20:39:23Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/applications/grants/1" + */ + url: string; + user?: SimpleUser | null; +} + +/** + * Artifact + * An artifact + */ +export interface Artifact { + /** @example "https://api.github.com/repos/github/hello-world/actions/artifacts/5/zip" */ + archive_download_url: string; + /** @format date-time */ + created_at: string | null; + /** Whether or not the artifact has expired. */ + expired: boolean; + /** @format date-time */ + expires_at: string; + /** @example 5 */ + id: number; + /** + * The name of the artifact. + * @example "AdventureWorks.Framework" + */ + name: string; + /** @example "MDEwOkNoZWNrU3VpdGU1" */ + node_id: string; + /** + * The size in bytes of the artifact. + * @example 12345 + */ + size_in_bytes: number; + /** @format date-time */ + updated_at: string | null; + /** @example "https://api.github.com/repos/github/hello-world/actions/artifacts/5" */ + url: string; +} + +export interface AuditLogEvent { + /** The time the audit log event occurred, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). */ + "@timestamp"?: number; + /** The name of the action that was performed, for example \`user.login\` or \`repo.create\`. */ + action?: string; + active?: boolean; + active_was?: boolean; + /** The actor who performed the action. */ + actor?: string; + /** The username of the account being blocked. */ + blocked_user?: string; + business?: string; + config?: any[]; + config_was?: any[]; + content_type?: string; + /** The time the audit log event was recorded, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). */ + created_at?: number; + deploy_key_fingerprint?: string; + emoji?: string; + events?: any[]; + events_were?: any[]; + explanation?: string; + fingerprint?: string; + hook_id?: number; + limited_availability?: boolean; + message?: string; + name?: string; + old_user?: string; + openssh_public_key?: string; + org?: string; + previous_visibility?: string; + read_only?: boolean; + /** The name of the repository. */ + repo?: string; + /** The name of the repository. */ + repository?: string; + repository_public?: boolean; + target_login?: string; + team?: string; + /** The type of protocol (for example, HTTP or SSH) used to transfer Git data. */ + transport_protocol?: number; + /** A human readable name for the protocol (for example, HTTP or SSH) used to transfer Git data. */ + transport_protocol_name?: string; + /** The user that was affected by the action performed (if available). */ + user?: string; + /** The repository visibility, for example \`public\` or \`private\`. */ + visibility?: string; +} + +/** + * Authentication Token + * Authentication Token + */ +export interface AuthenticationToken { + /** + * The time this token expires + * @format date-time + * @example "2016-07-11T22:14:10Z" + */ + expires_at: string; + /** @example {"issues":"read","deployments":"write"} */ + permissions?: object; + /** The repositories this token has access to */ + repositories?: Repository[]; + /** Describe whether all repositories have been selected or there's a selection involved */ + repository_selection?: "all" | "selected"; + /** @example "config.yaml" */ + single_file?: string | null; + /** + * The token used for authentication + * @example "v1.1f699f1069f60xxx" + */ + token: string; +} + +/** + * author_association + * How the author is associated with the repository. + * @example "OWNER" + */ +export enum AuthorAssociation { + COLLABORATOR = "COLLABORATOR", + CONTRIBUTOR = "CONTRIBUTOR", + FIRST_TIMER = "FIRST_TIMER", + FIRST_TIME_CONTRIBUTOR = "FIRST_TIME_CONTRIBUTOR", + MANNEQUIN = "MANNEQUIN", + MEMBER = "MEMBER", + NONE = "NONE", + OWNER = "OWNER", +} + +/** + * Authorization + * The authorization for an OAuth app, GitHub App, or a Personal Access Token. + */ +export interface Authorization { + app: { + client_id: string; + name: string; + /** @format uri */ + url: string; + }; + /** @format date-time */ + created_at: string; + fingerprint: string | null; + hashed_token: string | null; + id: number; + installation?: ScopedInstallation | null; + note: string | null; + /** @format uri */ + note_url: string | null; + /** A list of scopes that this authorization is in. */ + scopes: string[] | null; + token: string; + token_last_eight: string | null; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + user?: SimpleUser | null; +} + +/** + * Auto merge + * The status of auto merging a pull request. + */ +export type AutoMerge = { + /** Commit message for the merge commit. */ + commit_message: string; + /** Title for the merge commit message. */ + commit_title: string; + /** Simple User */ + enabled_by: SimpleUser; + /** The merge method to use. */ + merge_method: "merge" | "squash" | "rebase"; +} | null; + +/** + * Base Gist + * Base Gist + */ +export interface BaseGist { + comments: number; + /** @format uri */ + comments_url: string; + /** @format uri */ + commits_url: string; + /** @format date-time */ + created_at: string; + description: string | null; + files: Record< + string, + { + filename?: string; + language?: string; + raw_url?: string; + size?: number; + type?: string; + } + >; + forks?: any[]; + /** @format uri */ + forks_url: string; + /** @format uri */ + git_pull_url: string; + /** @format uri */ + git_push_url: string; + history?: any[]; + /** @format uri */ + html_url: string; + id: string; + node_id: string; + owner?: SimpleUser | null; + public: boolean; + truncated?: boolean; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + user: SimpleUser | null; +} + +/** + * Basic Error + * Basic Error + */ +export interface BasicError { + documentation_url?: string; + message?: string; +} + +/** + * Blob + * Blob + */ +export interface Blob { + content: string; + encoding: string; + highlighted_content?: string; + node_id: string; + sha: string; + size: number | null; + /** @format uri */ + url: string; +} + +/** + * Branch Protection + * Branch Protection + */ +export interface BranchProtection { + allow_deletions?: { + enabled?: boolean; + }; + allow_force_pushes?: { + enabled?: boolean; + }; + enabled: boolean; + /** Protected Branch Admin Enforced */ + enforce_admins?: ProtectedBranchAdminEnforced; + /** @example ""branch/with/protection"" */ + name?: string; + /** @example ""https://api.github.com/repos/owner-79e94e2d36b3fd06a32bb213/AAA_Public_Repo/branches/branch/with/protection/protection"" */ + protection_url?: string; + required_linear_history?: { + enabled?: boolean; + }; + /** Protected Branch Pull Request Review */ + required_pull_request_reviews?: ProtectedBranchPullRequestReview; + required_status_checks: { + contexts: string[]; + contexts_url?: string; + enforcement_level: string; + url?: string; + }; + /** Branch Restriction Policy */ + restrictions?: BranchRestrictionPolicy; + url?: string; +} + +/** + * Branch Restriction Policy + * Branch Restriction Policy + */ +export interface BranchRestrictionPolicy { + apps: { + created_at?: string; + description?: string; + events?: string[]; + external_url?: string; + html_url?: string; + id?: number; + name?: string; + node_id?: string; + owner?: { + avatar_url?: string; + description?: 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 """" */ + 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; + }; + permissions?: { + contents?: string; + issues?: string; + metadata?: string; + single_file?: string; + }; + slug?: string; + updated_at?: string; + }[]; + /** @format uri */ + apps_url: string; + teams: { + description?: string | null; + html_url?: string; + id?: number; + members_url?: string; + name?: string; + node_id?: string; + parent?: string | null; + permission?: string; + privacy?: string; + repositories_url?: string; + slug?: string; + url?: string; + }[]; + /** @format uri */ + teams_url: string; + /** @format uri */ + url: string; + users: { + 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; + }[]; + /** @format uri */ + users_url: string; +} + +/** + * Branch Short + * Branch Short + */ +export interface BranchShort { + commit: { + sha: string; + url: string; + }; + name: string; + protected: boolean; +} + +/** + * Branch With Protection + * Branch With Protection + */ +export interface BranchWithProtection { + _links: { + html: string; + /** @format uri */ + self: string; + }; + /** Commit */ + commit: Commit; + name: string; + /** @example ""mas*"" */ + pattern?: string; + protected: boolean; + /** Branch Protection */ + protection: BranchProtection; + /** @format uri */ + protection_url: string; + /** @example 1 */ + required_approving_review_count?: number; +} + +/** + * Check Annotation + * Check Annotation + */ +export interface CheckAnnotation { + /** @example "warning" */ + annotation_level: string | null; + blob_href: string; + /** @example 10 */ + end_column: number | null; + /** @example 2 */ + end_line: number; + /** @example "Check your spelling for 'banaas'." */ + message: string | null; + /** @example "README.md" */ + path: string; + /** @example "Do you mean 'bananas' or 'banana'?" */ + raw_details: string | null; + /** @example 5 */ + start_column: number | null; + /** @example 2 */ + start_line: number; + /** @example "Spell Checker" */ + title: string | null; +} + +/** + * CheckRun + * A check performed on the code of a given code change + */ +export interface CheckRun { + app: Integration | null; + check_suite: { + id: number; + } | null; + /** + * @format date-time + * @example "2018-05-04T01:14:52Z" + */ + completed_at: string | null; + /** @example "neutral" */ + conclusion: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required" | null; + /** @example "https://example.com" */ + details_url: string | null; + /** @example "42" */ + external_id: string | null; + /** + * The SHA of the commit that is being checked. + * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" + */ + head_sha: string; + /** @example "https://github.com/github/hello-world/runs/4" */ + html_url: string | null; + /** + * The id of the check. + * @example 21 + */ + id: number; + /** + * The name of the check. + * @example "test-coverage" + */ + name: string; + /** @example "MDg6Q2hlY2tSdW40" */ + node_id: string; + output: { + annotations_count: number; + /** @format uri */ + annotations_url: string; + summary: string | null; + text: string | null; + title: string | null; + }; + pull_requests: PullRequestMinimal[]; + /** + * @format date-time + * @example "2018-05-04T01:14:52Z" + */ + started_at: string | null; + /** + * The phase of the lifecycle that the check is currently in. + * @example "queued" + */ + status: "queued" | "in_progress" | "completed"; + /** @example "https://api.github.com/repos/github/hello-world/check-runs/4" */ + url: string; +} + +/** + * CheckSuite + * A suite of checks performed on the code of a given code change + */ +export interface CheckSuite { + /** @example "d6fde92930d4715a2b49857d24b940956b26d2d3" */ + after: string | null; + app: Integration | null; + /** @example "146e867f55c26428e5f9fade55a9bbf5e95a7912" */ + before: string | null; + check_runs_url: string; + /** @example "neutral" */ + conclusion: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required" | null; + /** @format date-time */ + created_at: string | null; + /** @example "master" */ + head_branch: string | null; + /** Simple Commit */ + head_commit: SimpleCommit; + /** + * The SHA of the head commit that is being checked. + * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" + */ + head_sha: string; + /** @example 5 */ + id: number; + latest_check_runs_count: number; + /** @example "MDEwOkNoZWNrU3VpdGU1" */ + node_id: string; + pull_requests: PullRequestMinimal[] | null; + /** Minimal Repository */ + repository: MinimalRepository; + /** @example "completed" */ + status: "queued" | "in_progress" | "completed" | null; + /** @format date-time */ + updated_at: string | null; + /** @example "https://api.github.com/repos/github/hello-world/check-suites/5" */ + url: string | null; +} + +/** + * Check Suite Preference + * Check suite configuration preferences for a repository. + */ +export interface CheckSuitePreference { + preferences: { + auto_trigger_checks?: { + app_id: number; + setting: boolean; + }[]; + }; + /** A git repository */ + repository: Repository; +} + +/** + * Clone Traffic + * Clone Traffic + */ +export interface CloneTraffic { + clones: Traffic[]; + /** @example 173 */ + count: number; + /** @example 128 */ + uniques: number; +} + +/** + * Code Frequency Stat + * Code Frequency Stat + */ +export type CodeFrequencyStat = number[]; + +/** + * Code Of Conduct + * Code Of Conduct + */ +export interface CodeOfConduct { + /** + * @example "# Contributor Covenant Code of Conduct + * + * ## Our Pledge + * + * In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + * + * ## Our Standards + * + * Examples of behavior that contributes to creating a positive environment include: + * + * * Using welcoming and inclusive language + * * Being respectful of differing viewpoints and experiences + * * Gracefully accepting constructive criticism + * * Focusing on what is best for the community + * * Showing empathy towards other community members + * + * Examples of unacceptable behavior by participants include: + * + * * The use of sexualized language or imagery and unwelcome sexual attention or advances + * * Trolling, insulting/derogatory comments, and personal or political attacks + * * Public or private harassment + * * Publishing others' private information, such as a physical or electronic address, without explicit permission + * * Other conduct which could reasonably be considered inappropriate in a professional setting + * + * ## Our Responsibilities + * + * Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response + * to any instances of unacceptable behavior. + * + * Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + * + * ## Scope + * + * This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, + * posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + * + * ## Enforcement + * + * Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [EMAIL]. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + * + * Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + * + * ## Attribution + * + * This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + * + * [homepage]: http://contributor-covenant.org + * [version]: http://contributor-covenant.org/version/1/4/ + * " + */ + body?: string; + /** @format uri */ + html_url: string | null; + /** @example "contributor_covenant" */ + key: string; + /** @example "Contributor Covenant" */ + name: string; + /** + * @format uri + * @example "https://api.github.com/codes_of_conduct/contributor_covenant" + */ + url: string; +} + +/** + * Code Of Conduct Simple + * Code of Conduct Simple + */ +export interface CodeOfConductSimple { + /** @format uri */ + html_url: string | null; + /** @example "citizen_code_of_conduct" */ + key: string; + /** @example "Citizen Code of Conduct" */ + name: string; + /** + * @format uri + * @example "https://api.github.com/codes_of_conduct/citizen_code_of_conduct" + */ + url: string; +} + +export interface CodeScanningAlertCodeScanningAlert { + /** The time that the alert was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + created_at: AlertCreatedAt; + /** The time that the alert was dismissed in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + dismissed_at: CodeScanningAlertDismissedAt; + /** Simple User */ + dismissed_by: SimpleUser; + /** **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\`. */ + dismissed_reason: CodeScanningAlertDismissedReason; + /** The GitHub URL of the alert resource. */ + html_url: AlertHtmlUrl; + instances: CodeScanningAlertInstances; + /** The security alert number. */ + number: AlertNumber; + rule: CodeScanningAlertRule; + /** State of a code scanning alert. */ + state: CodeScanningAlertState; + tool: CodeScanningAnalysisTool; + /** The REST API URL of the alert resource. */ + url: AlertUrl; +} + +export interface CodeScanningAlertCodeScanningAlertItems { + /** The time that the alert was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + created_at: AlertCreatedAt; + /** The time that the alert was dismissed in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + dismissed_at: CodeScanningAlertDismissedAt; + /** Simple User */ + dismissed_by: SimpleUser; + /** **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\`. */ + dismissed_reason: CodeScanningAlertDismissedReason; + /** The GitHub URL of the alert resource. */ + html_url: AlertHtmlUrl; + /** The security alert number. */ + number: AlertNumber; + rule: CodeScanningAlertRule; + /** State of a code scanning alert. */ + state: CodeScanningAlertState; + tool: CodeScanningAnalysisTool; + /** The REST API URL of the alert resource. */ + url: AlertUrl; +} + +/** + * The time that the alert was dismissed in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. + * @format date-time + */ +export type CodeScanningAlertDismissedAt = string | 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 CodeScanningAlertDismissedReason = "false positive" | "won't fix" | "used in tests" | null; + +/** 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. */ +export type CodeScanningAlertEnvironment = string; + +export type CodeScanningAlertInstances = { + /** 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; +}[]; + +/** The full Git reference, formatted as \`refs/heads/\`. */ +export type CodeScanningAlertRef = string; + +export interface CodeScanningAlertRule { + /** A short description of the rule used to detect the alert. */ + description?: string; + /** A unique identifier for the rule used to detect the alert. */ + id?: string | null; + /** The severity of the alert. */ + severity?: "none" | "note" | "warning" | "error" | null; +} + +/** Sets the state of the code scanning alert. Can be one of \`open\` or \`dismissed\`. You must provide \`dismissed_reason\` when you set the state to \`dismissed\`. */ +export enum CodeScanningAlertSetState { + Open = "open", + Dismissed = "dismissed", +} + +/** State of a code scanning alert. */ +export enum CodeScanningAlertState { + Open = "open", + Dismissed = "dismissed", + Fixed = "fixed", +} + +/** Identifies the configuration under which the analysis was executed. For example, in GitHub Actions this includes the workflow filename and job name. */ +export type CodeScanningAnalysisAnalysisKey = string; + +export interface CodeScanningAnalysisCodeScanningAnalysis { + /** 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; + /** The commit SHA of the code scanning analysis file. */ + commit_sha: CodeScanningAnalysisCommitSha; + /** The time that the analysis was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + created_at: CodeScanningAnalysisCreatedAt; + /** Identifies the variable values associated with the environment in which this analysis was performed. */ + environment: CodeScanningAnalysisEnvironment; + /** @example "error reading field xyz" */ + error: string; + /** The full Git reference of the code scanning analysis file, formatted as \`refs/heads/\`. */ + ref: CodeScanningAnalysisRef; + /** The name of the tool used to generate the code scanning analysis alert. */ + tool_name: CodeScanningAnalysisToolName; +} + +/** + * The commit SHA of the code scanning analysis file. + * @minLength 40 + * @maxLength 40 + * @pattern ^[0-9a-fA-F]+$ + */ +export type CodeScanningAnalysisCommitSha = string; + +/** + * The time that the analysis was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. + * @format date-time + */ +export type CodeScanningAnalysisCreatedAt = string; + +/** Identifies the variable values associated with the environment in which this analysis was performed. */ +export type CodeScanningAnalysisEnvironment = string; + +/** The full Git reference of the code scanning analysis file, formatted as \`refs/heads/\`. */ +export type CodeScanningAnalysisRef = string; + +/** 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. */ +export type CodeScanningAnalysisSarifFile = string; + +export interface CodeScanningAnalysisTool { + /** The name of the tool used to generate the code scanning analysis alert. */ + name?: CodeScanningAnalysisToolName; + /** The version of the tool used to detect the alert. */ + version?: string | null; +} + +/** The name of the tool used to generate the code scanning analysis alert. */ +export type CodeScanningAnalysisToolName = string; + +/** + * Code Search Result Item + * Code Search Result Item + */ +export interface CodeSearchResultItem { + file_size?: number; + /** @format uri */ + git_url: string; + /** @format uri */ + html_url: string; + language?: string | null; + /** @format date-time */ + last_modified_at?: string; + /** @example ["73..77","77..78"] */ + line_numbers?: string[]; + name: string; + path: string; + /** Minimal Repository */ + repository: MinimalRepository; + score: number; + sha: string; + text_matches?: SearchResultTextMatches; + /** @format uri */ + url: string; +} + +/** + * Collaborator + * Collaborator + */ +export interface Collaborator { + /** + * @format uri + * @example "https://github.com/images/error/octocat_happy.gif" + */ + avatar_url: string; + /** @example "https://api.github.com/users/octocat/events{/privacy}" */ + events_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/followers" + */ + followers_url: string; + /** @example "https://api.github.com/users/octocat/following{/other_user}" */ + following_url: string; + /** @example "https://api.github.com/users/octocat/gists{/gist_id}" */ + gists_url: string; + /** @example "41d064eb2195891e12d0413f63227ea7" */ + gravatar_id: string | null; + /** + * @format uri + * @example "https://github.com/octocat" + */ + html_url: string; + /** @example 1 */ + id: number; + /** @example "octocat" */ + login: string; + /** @example "MDQ6VXNlcjE=" */ + node_id: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/orgs" + */ + organizations_url: string; + permissions?: { + admin: boolean; + pull: boolean; + push: boolean; + }; + /** + * @format uri + * @example "https://api.github.com/users/octocat/received_events" + */ + received_events_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/repos" + */ + repos_url: string; + site_admin: boolean; + /** @example "https://api.github.com/users/octocat/starred{/owner}{/repo}" */ + starred_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/subscriptions" + */ + subscriptions_url: string; + /** @example "User" */ + type: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat" + */ + url: string; +} + +export interface CombinedBillingUsage { + /** Numbers of days left in billing cycle. */ + days_left_in_billing_cycle: number; + /** Estimated storage space (GB) used in billing cycle. */ + estimated_paid_storage_for_month: number; + /** Estimated sum of free and paid storage space (GB) used in billing cycle. */ + estimated_storage_for_month: number; +} + +/** + * Combined Commit Status + * Combined Commit Status + */ +export interface CombinedCommitStatus { + /** @format uri */ + commit_url: string; + /** Minimal Repository */ + repository: MinimalRepository; + sha: string; + state: string; + statuses: SimpleCommitStatus[]; + total_count: number; + /** @format uri */ + url: string; +} + +/** + * Commit + * Commit + */ +export interface Commit { + author: SimpleUser | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments" + */ + comments_url: string; + commit: { + author: GitUser | null; + /** @example 0 */ + comment_count: number; + committer: GitUser | null; + /** @example "Fix all the bugs" */ + message: string; + tree: { + /** @example "827efc6d56897b048c772eb4087f854f46256132" */ + sha: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/tree/827efc6d56897b048c772eb4087f854f46256132" + */ + url: string; + }; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + url: string; + verification?: Verification; + }; + committer: SimpleUser | null; + files?: { + additions?: number; + blob_url?: 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 + * @example "https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + html_url: string; + /** @example "MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==" */ + node_id: string; + parents: { + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/commit/7638417db6d59f3c431d3e1f261cc637155684cd" + */ + html_url?: string; + /** @example "7638417db6d59f3c431d3e1f261cc637155684cd" */ + sha: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/commits/7638417db6d59f3c431d3e1f261cc637155684cd" + */ + url: string; + }[]; + /** @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" */ + sha: string; + stats?: { + additions?: number; + deletions?: number; + total?: number; + }; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + url: string; +} + +/** + * Commit Activity + * Commit Activity + */ +export interface CommitActivity { + /** @example [0,3,26,20,39,1,0] */ + days: number[]; + /** @example 89 */ + total: number; + /** @example 1336280400 */ + week: number; +} + +/** + * Commit Comment + * Commit Comment + */ +export interface CommitComment { + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + body: string; + commit_id: string; + /** @format date-time */ + created_at: string; + /** @format uri */ + html_url: string; + id: number; + line: number | null; + node_id: string; + path: string | null; + position: number | null; + reactions?: ReactionRollup; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + user: SimpleUser | null; +} + +/** + * Commit Comparison + * Commit Comparison + */ +export interface CommitComparison { + /** @example 4 */ + ahead_by: number; + /** Commit */ + base_commit: Commit; + /** @example 5 */ + behind_by: number; + commits: Commit[]; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/compare/master...topic.diff" + */ + diff_url: string; + files: DiffEntry[]; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/compare/master...topic" + */ + html_url: string; + /** Commit */ + merge_base_commit: Commit; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/compare/master...topic.patch" + */ + patch_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/compare/octocat:bbcd538c8e72b8c175046e27cc8f907076331401...octocat:0328041d1152db8ae77652d1618a02e57f745f17" + */ + permalink_url: string; + /** @example "ahead" */ + status: "diverged" | "ahead" | "behind" | "identical"; + /** @example 6 */ + total_commits: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/compare/master...topic" + */ + url: string; +} + +/** + * Commit Search Result Item + * Commit Search Result Item + */ +export interface CommitSearchResultItem { + author: SimpleUser | null; + /** @format uri */ + comments_url: string; + commit: { + author: { + /** @format date-time */ + date: string; + email: string; + name: string; + }; + comment_count: number; + committer: GitUser | null; + message: string; + tree: { + sha: string; + /** @format uri */ + url: string; + }; + /** @format uri */ + url: string; + verification?: Verification; + }; + committer: GitUser | null; + /** @format uri */ + html_url: string; + node_id: string; + parents: { + html_url?: string; + sha?: string; + url?: string; + }[]; + /** Minimal Repository */ + repository: MinimalRepository; + score: number; + sha: string; + text_matches?: SearchResultTextMatches; + /** @format uri */ + url: string; +} + +/** Community Health File */ +export interface CommunityHealthFile { + /** @format uri */ + html_url: string; + /** @format uri */ + url: string; +} + +/** + * Community Profile + * Community Profile + */ +export interface CommunityProfile { + /** @example true */ + content_reports_enabled?: boolean; + /** @example "My first repository on GitHub!" */ + description: string | null; + /** @example "example.com" */ + documentation: string | null; + files: { + code_of_conduct: CodeOfConductSimple | null; + contributing: CommunityHealthFile | null; + issue_template: CommunityHealthFile | null; + license: LicenseSimple | null; + pull_request_template: CommunityHealthFile | null; + readme: CommunityHealthFile | null; + }; + /** @example 100 */ + health_percentage: number; + /** + * @format date-time + * @example "2017-02-28T19:09:29Z" + */ + updated_at: string | null; +} + +/** + * Content Directory + * A list of directory items + */ +export type ContentDirectory = { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @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; +}[]; + +/** + * Content File + * Content File + */ +export interface ContentFile { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @format uri */ + self: string; + }; + content: string; + /** @format uri */ + download_url: string | null; + encoding: string; + /** @format uri */ + git_url: string | null; + /** @format uri */ + html_url: string | null; + name: string; + path: string; + sha: string; + size: number; + /** @example ""git://example.com/defunkt/dotjs.git"" */ + submodule_git_url?: string; + /** @example ""actual/actual.md"" */ + target?: string; + type: string; + /** @format uri */ + url: string; +} + +/** + * ContentReferenceAttachment + * Content Reference attachments allow you to provide context around URLs posted in comments + */ +export interface ContentReferenceAttachment { + /** + * The body of the attachment + * @maxLength 262144 + * @example "Body of the attachment" + */ + body: string; + /** + * The ID of the attachment + * @example 21 + */ + id: number; + /** + * The node_id of the content attachment + * @example "MDE3OkNvbnRlbnRBdHRhY2htZW50MjE=" + */ + node_id?: string; + /** + * The title of the attachment + * @maxLength 1024 + * @example "Title of the attachment" + */ + title: string; +} + +/** + * Symlink Content + * An object describing a symlink + */ +export interface ContentSubmodule { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @format uri */ + self: 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; + /** @format uri */ + submodule_git_url: string; + type: string; + /** @format uri */ + url: string; +} + +/** + * Symlink Content + * An object describing a symlink + */ +export interface ContentSymlink { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @format uri */ + self: 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; + target: string; + type: string; + /** @format uri */ + url: string; +} + +/** + * Content Traffic + * Content Traffic + */ +export interface ContentTraffic { + /** @example 3542 */ + count: number; + /** @example "/github/hubot" */ + path: string; + /** @example "github/hubot: A customizable life embetterment robot." */ + title: string; + /** @example 2225 */ + uniques: number; +} + +/** + * Content Tree + * Content Tree + */ +export interface ContentTree { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @format uri */ + self: string; + }; + /** @format uri */ + download_url: string | null; + entries?: { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @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; + /** @format uri */ + html_url: string | null; + name: string; + path: string; + sha: string; + size: number; + type: string; + /** @format uri */ + url: string; +} + +/** + * Contributor + * Contributor + */ +export interface Contributor { + /** @format uri */ + avatar_url?: string; + contributions: number; + email?: string; + events_url?: string; + /** @format uri */ + followers_url?: string; + following_url?: string; + gists_url?: string; + gravatar_id?: string | null; + /** @format uri */ + html_url?: string; + id?: number; + login?: string; + name?: string; + node_id?: string; + /** @format uri */ + organizations_url?: string; + /** @format uri */ + received_events_url?: string; + /** @format uri */ + repos_url?: string; + site_admin?: boolean; + starred_url?: string; + /** @format uri */ + subscriptions_url?: string; + type: string; + /** @format uri */ + url?: string; +} + +/** + * Contributor Activity + * Contributor Activity + */ +export interface ContributorActivity { + author: SimpleUser | null; + /** @example 135 */ + total: number; + /** @example [{"w":"1367712000","a":6898,"d":77,"c":10}] */ + weeks: { + a?: number; + c?: number; + d?: number; + w?: string; + }[]; +} + +/** + * Credential Authorization + * Credential Authorization + */ +export interface CredentialAuthorization { + /** @example 12345678 */ + authorized_credential_id?: number | null; + /** + * The note given to the token. This will only be present when the credential is a token. + * @example "my token" + */ + authorized_credential_note?: string | null; + /** + * The title given to the ssh key. This will only be present when the credential is an ssh key. + * @example "my ssh key" + */ + authorized_credential_title?: string | null; + /** + * Date when the credential was last accessed. May be null if it was never accessed + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + credential_accessed_at?: string | null; + /** + * Date when the credential was authorized for use. + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + credential_authorized_at: string; + /** + * Unique identifier for the credential. + * @example 1 + */ + credential_id: number; + /** + * Human-readable description of the credential type. + * @example "SSH Key" + */ + credential_type: string; + /** + * Unique string to distinguish the credential. Only included in responses with credential_type of SSH Key. + * @example "jklmnop12345678" + */ + fingerprint?: string; + /** + * User login that owns the underlying credential. + * @example "monalisa" + */ + login: string; + /** + * List of oauth scopes the token has been granted. + * @example ["user","repo"] + */ + scopes?: string[]; + /** + * Last eight characters of the credential. Only included in responses with credential_type of personal access token. + * @example "12345678" + */ + token_last_eight?: string; +} + +/** + * Deploy Key + * An SSH key granting access to a single repository. + */ +export interface DeployKey { + created_at: string; + id: number; + key: string; + read_only: boolean; + title: string; + url: string; + verified: boolean; +} + +/** + * Deployment + * A request for a specific ref(branch,sha,tag) to be deployed + */ +export interface Deployment { + /** + * @format date-time + * @example "2012-07-20T01:19:13Z" + */ + created_at: string; + creator: SimpleUser | null; + /** @example "Deploy request from hubot" */ + description: string | null; + /** + * Name for the target deployment environment. + * @example "production" + */ + environment: string; + /** + * Unique identifier of the deployment + * @example 42 + */ + id: number; + /** @example "MDEwOkRlcGxveW1lbnQx" */ + node_id: string; + /** @example "staging" */ + original_environment?: string; + payload: object; + performed_via_github_app?: Integration | null; + /** + * Specifies if the given environment is one that end-users directly interact with. Default: false. + * @example true + */ + production_environment?: boolean; + /** + * The ref to deploy. This can be a branch, tag, or sha. + * @example "topic-branch" + */ + ref: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example" + */ + repository_url: string; + /** @example "a84d88e7554fc1fa21bcbc4efae3c782a70d2b9d" */ + sha: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example/deployments/1/statuses" + */ + statuses_url: string; + /** + * Parameter to specify a task to execute + * @example "deploy" + */ + task: string; + /** + * Specifies if the given environment is will no longer exist at some point in the future. Default: false. + * @example true + */ + transient_environment?: boolean; + /** + * @format date-time + * @example "2012-07-20T01:19:13Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example/deployments/1" + */ + url: string; +} + +/** + * Deployment Status + * The status of a deployment. + */ +export interface DeploymentStatus { + /** + * @format date-time + * @example "2012-07-20T01:19:13Z" + */ + created_at: string; + creator: SimpleUser | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example/deployments/42" + */ + deployment_url: string; + /** + * A short description of the status. + * @maxLength 140 + * @default "" + * @example "Deployment finished successfully." + */ + description: string; + /** + * The environment of the deployment that the status is for. + * @default "" + * @example "production" + */ + environment?: string; + /** + * The URL for accessing your environment. + * @format uri + * @default "" + * @example "https://staging.example.com/" + */ + environment_url?: string; + /** @example 1 */ + id: number; + /** + * The URL to associate with this status. + * @format uri + * @default "" + * @example "https://example.com/deployment/42/output" + */ + log_url?: string; + /** @example "MDE2OkRlcGxveW1lbnRTdGF0dXMx" */ + node_id: string; + performed_via_github_app?: Integration | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example" + */ + repository_url: string; + /** + * The state of the status. + * @example "success" + */ + state: "error" | "failure" | "inactive" | "pending" | "success" | "queued" | "in_progress"; + /** + * Deprecated: the URL to associate with this status. + * @format uri + * @default "" + * @example "https://example.com/deployment/42/output" + */ + target_url: string; + /** + * @format date-time + * @example "2012-07-20T01:19:13Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example/deployments/42/statuses/1" + */ + url: string; +} + +/** + * Diff Entry + * Diff Entry + */ +export interface DiffEntry { + /** @example 103 */ + additions: number; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt" + */ + blob_url: string; + /** @example 124 */ + changes: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + contents_url: string; + /** @example 21 */ + deletions: number; + /** @example "file1.txt" */ + filename: string; + /** @example "@@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test" */ + patch?: string; + /** @example "file.txt" */ + previous_filename?: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt" + */ + raw_url: string; + /** @example "bbcd538c8e72b8c175046e27cc8f907076331401" */ + sha: string; + /** @example "added" */ + status: string; +} + +/** + * Email + * Email + */ +export interface Email { + /** + * @format email + * @example "octocat@github.com" + */ + email: string; + /** @example true */ + primary: boolean; + /** @example true */ + verified: boolean; + /** @example "public" */ + visibility: string | null; +} + +/** The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ +export enum EnabledOrganizations { + All = "all", + None = "none", + Selected = "selected", +} + +/** The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ +export enum EnabledRepositories { + All = "all", + None = "none", + Selected = "selected", +} + +/** + * Enterprise + * An enterprise account + */ +export interface Enterprise { + /** @format uri */ + avatar_url: string; + /** + * @format date-time + * @example "2019-01-26T19:01:12Z" + */ + created_at: string | null; + /** A short description of the enterprise. */ + description?: string | null; + /** + * @format uri + * @example "https://github.com/enterprises/octo-business" + */ + html_url: string; + /** + * Unique identifier of the enterprise + * @example 42 + */ + id: number; + /** + * The name of the enterprise. + * @example "Octo Business" + */ + name: string; + /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ + node_id: string; + /** + * The slug url identifier for the enterprise. + * @example "octo-business" + */ + slug: string; + /** + * @format date-time + * @example "2019-01-26T19:14:43Z" + */ + updated_at: string | null; + /** + * The enterprise's website URL. + * @format uri + */ + website_url?: string | null; +} + +/** + * Event + * Event + */ +export interface Event { + /** Actor */ + actor: Actor; + /** @format date-time */ + created_at: string | null; + id: string; + /** Actor */ + org?: Actor; + payload: { + action: string; + /** Comments provide a way for people to collaborate on an issue. */ + comment?: IssueComment; + /** Issue Simple */ + issue?: IssueSimple; + pages?: { + action?: string; + html_url?: string; + page_name?: string; + sha?: string; + summary?: string | null; + title?: string; + }[]; + }; + public: boolean; + repo: { + id: number; + name: string; + /** @format uri */ + url: string; + }; + type: string | null; +} + +/** + * Feed + * Feed + */ +export interface Feed { + _links: { + /** Hypermedia Link with Type */ + current_user?: 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; + /** @example "https://github.com/octocat-org" */ + current_user_organization_url?: string; + /** @example ["https://github.com/organizations/github/octocat.private.atom?token=abc123"] */ + current_user_organization_urls?: string[]; + /** @example "https://github.com/octocat" */ + current_user_public_url?: string; + /** @example "https://github.com/octocat.private?token=abc123" */ + current_user_url?: string; + /** @example "https://github.com/security-advisories" */ + security_advisories_url?: string; + /** @example "https://github.com/timeline" */ + timeline_url: string; + /** @example "https://github.com/{user}" */ + user_url: string; +} + +/** + * File Commit + * File Commit + */ +export interface FileCommit { + commit: { + author?: { + date?: string; + email?: string; + name?: string; + }; + committer?: { + date?: string; + email?: string; + name?: string; + }; + html_url?: string; + message?: string; + node_id?: string; + parents?: { + html_url?: string; + sha?: string; + url?: string; + }[]; + sha?: string; + tree?: { + sha?: string; + url?: string; + }; + url?: string; + verification?: { + payload?: string | null; + reason?: string; + signature?: 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; + type?: string; + url?: string; + } | null; +} + +/** + * Full Repository + * Full Repository + */ +export interface FullRepository { + /** @example true */ + allow_merge_commit?: boolean; + /** @example true */ + allow_rebase_merge?: boolean; + /** @example true */ + allow_squash_merge?: boolean; + /** + * Whether anonymous git access is allowed. + * @default true + */ + anonymous_access_enabled?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ + archive_url: string; + archived: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ + assignees_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ + blobs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ + branches_url: string; + /** @example "https://github.com/octocat/Hello-World.git" */ + clone_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ + collaborators_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ + comments_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ + commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ + compare_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ + contents_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/contributors" + */ + contributors_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at: string; + /** @example "master" */ + default_branch: string; + /** @example false */ + delete_branch_on_merge?: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/deployments" + */ + deployments_url: string; + /** @example "This your first repo!" */ + description: string | null; + /** Returns whether or not this repository disabled. */ + disabled: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/downloads" + */ + downloads_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/events" + */ + events_url: string; + fork: boolean; + forks: number; + /** @example 9 */ + forks_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/forks" + */ + forks_url: string; + /** @example "octocat/Hello-World" */ + full_name: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ + git_commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ + git_refs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ + git_tags_url: string; + /** @example "git:github.com/octocat/Hello-World.git" */ + git_url: string; + /** @example true */ + has_downloads: boolean; + /** @example true */ + has_issues: boolean; + has_pages: boolean; + /** @example true */ + has_projects: boolean; + /** @example true */ + has_wiki: boolean; + /** + * @format uri + * @example "https://github.com" + */ + homepage: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/hooks" + */ + hooks_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World" + */ + html_url: string; + /** @example 1296269 */ + id: number; + /** @example true */ + is_template?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ + issue_comment_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ + issue_events_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ + issues_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ + keys_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ + labels_url: string; + language: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/languages" + */ + languages_url: string; + license: LicenseSimple | null; + master_branch?: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/merges" + */ + merges_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ + milestones_url: string; + /** + * @format uri + * @example "git:git.example.com/octocat/Hello-World" + */ + mirror_url: string | null; + /** @example "Hello-World" */ + name: string; + /** @example 0 */ + network_count: number; + /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ + node_id: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ + notifications_url: string; + open_issues: number; + /** @example 0 */ + open_issues_count: number; + organization?: SimpleUser | null; + owner: SimpleUser | null; + /** A git repository */ + parent?: Repository; + permissions?: { + admin: boolean; + pull: boolean; + push: boolean; + }; + private: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ + pulls_url: string; + /** + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + pushed_at: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ + releases_url: string; + /** @example 108 */ + size: number; + /** A git repository */ + source?: Repository; + /** @example "git@github.com:octocat/Hello-World.git" */ + ssh_url: string; + /** @example 80 */ + stargazers_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" + */ + stargazers_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ + statuses_url: string; + /** @example 42 */ + subscribers_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" + */ + subscribers_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscription" + */ + subscription_url: string; + /** + * @format uri + * @example "https://svn.github.com/octocat/Hello-World" + */ + svn_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/tags" + */ + tags_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/teams" + */ + teams_url: string; + temp_clone_token?: string | null; + template_repository?: Repository | null; + /** @example ["octocat","atom","electron","API"] */ + topics?: string[]; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ + trees_url: string; + /** + * @format date-time + * @example "2011-01-26T19:14:43Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World" + */ + url: string; + /** + * The repository visibility: public, private, or internal. + * @example "public" + */ + visibility?: string; + watchers: number; + /** @example 80 */ + watchers_count: number; +} + +/** + * Gist Comment + * A comment made to a gist. + */ +export interface GistComment { + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** + * The comment text. + * @maxLength 65535 + * @example "Body of the attachment" + */ + body: string; + /** + * @format date-time + * @example "2011-04-18T23:23:56Z" + */ + created_at: string; + /** @example 1 */ + id: number; + /** @example "MDExOkdpc3RDb21tZW50MQ==" */ + node_id: string; + /** + * @format date-time + * @example "2011-04-18T23:23:56Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/gists/a6db0bec360bb87e9418/comments/1" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Gist Commit + * Gist Commit + */ +export interface GistCommit { + change_status: { + additions?: number; + deletions?: number; + total?: number; + }; + /** + * @format date-time + * @example "2010-04-14T02:15:15Z" + */ + committed_at: string; + /** + * @format uri + * @example "https://api.github.com/gists/aa5a315d61ae9438b18d/57a7f021a713b1c5a6a199b54cc514735d2d462f" + */ + url: string; + user: SimpleUser | null; + /** @example "57a7f021a713b1c5a6a199b54cc514735d2d462f" */ + version: string; +} + +/** + * Gist Simple + * Gist Simple + */ +export interface GistSimple { + comments?: number; + comments_url?: string; + commits_url?: string; + created_at?: string; + description?: string | null; + files?: Record< + string, + { + content?: string; + filename?: string; + language?: string; + raw_url?: string; + size?: number; + truncated?: boolean; + type?: string; + } | null + >; + forks_url?: string; + git_pull_url?: string; + git_push_url?: string; + html_url?: string; + id?: string; + node_id?: string; + /** Simple User */ + owner?: SimpleUser; + public?: boolean; + truncated?: boolean; + updated_at?: string; + url?: string; + user?: string | null; +} + +/** + * Git Commit + * Low-level Git commit operations within a repository + */ +export interface GitCommit { + /** Identifying information for the git-user */ + author: { + /** + * Timestamp of the commit + * @format date-time + * @example "2014-08-09T08:02:04+12:00" + */ + date: string; + /** + * Git email address of the user + * @example "monalisa.octocat@example.com" + */ + email: string; + /** + * Name of the git user + * @example "Monalisa Octocat" + */ + name: string; + }; + /** Identifying information for the git-user */ + committer: { + /** + * Timestamp of the commit + * @format date-time + * @example "2014-08-09T08:02:04+12:00" + */ + date: string; + /** + * Git email address of the user + * @example "monalisa.octocat@example.com" + */ + email: string; + /** + * Name of the git user + * @example "Monalisa Octocat" + */ + name: string; + }; + /** @format uri */ + html_url: string; + /** + * Message describing the purpose of the commit + * @example "Fix #42" + */ + message: string; + node_id: string; + parents: { + /** @format uri */ + html_url: string; + /** + * SHA for the commit + * @example "7638417db6d59f3c431d3e1f261cc637155684cd" + */ + sha: string; + /** @format uri */ + url: string; + }[]; + /** + * SHA for the commit + * @example "7638417db6d59f3c431d3e1f261cc637155684cd" + */ + sha: string; + tree: { + /** + * SHA for the commit + * @example "7638417db6d59f3c431d3e1f261cc637155684cd" + */ + sha: string; + /** @format uri */ + url: string; + }; + /** @format uri */ + url: string; + verification: { + payload: string | null; + reason: string; + signature: string | null; + verified: boolean; + }; +} + +/** + * Git Reference + * Git references within a repository + */ +export interface GitRef { + node_id: string; + object: { + /** + * SHA for the reference + * @minLength 40 + * @maxLength 40 + * @example "7638417db6d59f3c431d3e1f261cc637155684cd" + */ + sha: string; + type: string; + /** @format uri */ + url: string; + }; + ref: string; + /** @format uri */ + url: string; +} + +/** + * Git Tag + * Metadata for a Git tag + */ +export interface GitTag { + /** + * Message describing the purpose of the tag + * @example "Initial public release" + */ + message: string; + /** @example "MDM6VGFnOTQwYmQzMzYyNDhlZmFlMGY5ZWU1YmM3YjJkNWM5ODU4ODdiMTZhYw==" */ + node_id: string; + object: { + sha: string; + type: string; + /** @format uri */ + url: string; + }; + /** @example "940bd336248efae0f9ee5bc7b2d5c985887b16ac" */ + sha: string; + /** + * Name of the tag + * @example "v0.0.1" + */ + tag: string; + tagger: { + date: string; + email: string; + name: string; + }; + /** + * URL for the tag + * @format uri + * @example "https://api.github.com/repositories/42/git/tags/940bd336248efae0f9ee5bc7b2d5c985887b16ac" + */ + url: string; + verification?: Verification; +} + +/** + * Git Tree + * The hierarchy between files in a Git repository. + */ +export interface GitTree { + sha: string; + /** + * Objects specifying a tree structure + * @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 "040000" */ + mode?: 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; + }[]; + truncated: boolean; + /** @format uri */ + url: string; +} + +/** + * Git User + * Metaproperties for Git author/committer information. + */ +export interface GitUser { + /** @example ""2007-10-29T02:42:39.000-07:00"" */ + date?: string; + /** @example ""chris@ozmm.org"" */ + email?: string; + /** @example ""Chris Wanstrath"" */ + name?: string; +} + +/** + * Gitignore Template + * Gitignore Template + */ +export interface GitignoreTemplate { + /** @example "C" */ + name: string; + /** + * @example "# Object files + * *.o + * + * # Libraries + * *.lib + * *.a + * + * # Shared objects (inc. Windows DLLs) + * *.dll + * *.so + * *.so.* + * *.dylib + * + * # Executables + * *.exe + * *.out + * *.app + * " + */ + source: string; +} + +/** + * GPG Key + * A unique encryption key + */ +export interface GpgKey { + /** @example true */ + can_certify: boolean; + can_encrypt_comms: boolean; + can_encrypt_storage: boolean; + /** @example true */ + can_sign: boolean; + /** + * @format date-time + * @example "2016-03-24T11:31:04-06:00" + */ + created_at: string; + /** @example [{"email":"mastahyeti@users.noreply.github.com","verified":true}] */ + emails: { + email?: string; + verified?: boolean; + }[]; + /** @format date-time */ + expires_at: string | null; + /** @example 3 */ + id: number; + /** @example "3262EFF25BA0D270" */ + key_id: string; + primary_key_id: number | null; + /** @example "xsBNBFayYZ..." */ + public_key: string; + 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: { + can_certify?: boolean; + can_encrypt_comms?: boolean; + can_encrypt_storage?: 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[]; + }[]; +} + +/** + * GroupMapping + * External Groups to be mapped to a team for membership + */ +export interface GroupMapping { + /** + * 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" + */ + group_id?: string; + /** + * The name of the group + * @example "saml-azuread-test" + */ + group_name?: string; + /** + * Array of groups to be mapped to this team + * @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" + */ + group_id: string; + /** + * The name of the group + * @example "saml-azuread-test" + */ + group_name: string; + }[]; + /** + * synchronization status for this group mapping + * @example "unsynced" + */ + status?: string; + /** + * the time of the last sync for this group-mapping + * @example "2019-06-03 22:27:15:000 -700" + */ + synced_at?: string; +} + +/** + * Webhook + * Webhooks for repositories. + */ +export interface Hook { + /** + * Determines whether the hook is actually triggered on pushes. + * @example true + */ + 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; + /** 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 + * @example "2011-09-06T17:26:27Z" + */ + created_at: string; + /** + * Determines what events the hook is triggered for. Default: ['push']. + * @example ["push","pull_request"] + */ + events: string[]; + /** + * Unique identifier of the webhook. + * @example 42 + */ + id: number; + last_response: HookResponse; + /** + * The name of a valid service, use 'web' for a webhook. + * @example "web" + */ + name: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/hooks/1/pings" + */ + ping_url: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/hooks/1/test" + */ + test_url: string; + type: string; + /** + * @format date-time + * @example "2011-09-06T20:39:23Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/hooks/1" + */ + url: string; +} + +/** Hook Response */ +export interface HookResponse { + code: number | null; + message: string | null; + status: string | null; +} + +/** + * Hovercard + * Hovercard + */ +export interface Hovercard { + contexts: { + message: string; + octicon: string; + }[]; +} + +/** + * Import + * A repository import from an external source. + */ +export interface Import { + authors_count?: number | null; + /** @format uri */ + authors_url: string; + commit_count?: number | null; + error_message?: string | null; + failed_step?: string | null; + has_large_files?: boolean; + /** @format uri */ + html_url: string; + import_percent?: number | null; + large_files_count?: number; + large_files_size?: number; + message?: string; + project_choices?: { + human_name?: string; + tfvc_project?: string; + vcs?: string; + }[]; + push_percent?: number | null; + /** @format uri */ + repository_url: string; + status: + | "auth" + | "error" + | "none" + | "detecting" + | "choose" + | "auth_failed" + | "importing" + | "mapping" + | "waiting_to_push" + | "pushing" + | "complete" + | "setup" + | "unknown" + | "detection_found_multiple" + | "detection_found_nothing" + | "detection_needs_auth"; + status_text?: string | null; + svc_root?: string; + svn_root?: string; + tfvc_project?: string; + /** @format uri */ + url: string; + use_lfs?: string; + vcs: string | null; + /** The URL of the originating repository. */ + vcs_url: string; +} + +/** + * Installation + * Installation + */ +export interface Installation { + /** + * @format uri + * @example "https://api.github.com/installations/1/access_tokens" + */ + access_tokens_url: string; + account: SimpleUser | Enterprise | null; + /** @example 1 */ + app_id: number; + /** @example "github-actions" */ + app_slug: string; + /** @example ""test_13f1e99741e3e004@d7e1eb0bc0a1ba12.com"" */ + contact_email?: string | null; + /** @format date-time */ + created_at: string; + events: string[]; + /** @example true */ + has_multiple_single_files?: boolean; + /** + * @format uri + * @example "https://github.com/organizations/github/settings/installations/1" + */ + html_url: string; + /** + * The ID of the installation. + * @example 1 + */ + id: number; + /** @example {"issues":"read","deployments":"write"} */ + permissions: { + checks?: string; + contents?: string; + deployments?: string; + /** @example ""read"" */ + issues?: string; + metadata?: string; + /** @example ""read"" */ + organization_administration?: string; + pull_requests?: string; + statuses?: string; + }; + /** + * @format uri + * @example "https://api.github.com/installation/repositories" + */ + repositories_url: string; + /** Describe whether all repositories have been selected or there's a selection involved */ + repository_selection: "all" | "selected"; + /** @example "config.yaml" */ + single_file_name: string | null; + /** @example ["config.yml",".github/issue_TEMPLATE.md"] */ + single_file_paths?: string[]; + /** @format date-time */ + suspended_at?: string | null; + suspended_by?: SimpleUser | null; + /** The ID of the user or organization this token is being scoped to. */ + target_id: number; + /** @example "Organization" */ + target_type: string; + /** @format date-time */ + updated_at: string; +} + +/** + * Installation Token + * Authentication token for a GitHub App installed on a user or org. + */ +export interface InstallationToken { + expires_at: string; + /** @example true */ + has_multiple_single_files?: boolean; + permissions?: { + contents?: string; + issues?: string; + /** @example "read" */ + metadata?: string; + /** @example "read" */ + single_file?: string; + }; + repositories?: Repository[]; + repository_selection?: "all" | "selected"; + /** @example "README.md" */ + single_file?: string; + /** @example ["config.yml",".github/issue_TEMPLATE.md"] */ + single_file_paths?: string[]; + token: string; +} + +/** + * GitHub app + * GitHub apps are a new way to extend GitHub. They can be installed directly on organizations and user accounts and granted access to specific repositories. They come with granular permissions and built-in webhooks. GitHub apps are first class actors within GitHub. + */ +export interface Integration { + /** @example ""Iv1.25b5d1e65ffc4022"" */ + client_id?: string; + /** @example ""1d4b2097ac622ba702d19de498f005747a8b21d3"" */ + client_secret?: string; + /** + * @format date-time + * @example "2017-07-08T16:18:44-04:00" + */ + created_at: string; + /** @example "The description of the app." */ + description: string | null; + /** + * The list of events for the GitHub app + * @example ["label","deployment"] + */ + events: string[]; + /** + * @format uri + * @example "https://example.com" + */ + external_url: string; + /** + * @format uri + * @example "https://github.com/apps/super-ci" + */ + html_url: string; + /** + * Unique identifier of the GitHub app + * @example 37 + */ + id: number; + /** + * The number of installations associated with the GitHub app + * @example 5 + */ + installations_count?: number; + /** + * The name of the GitHub app + * @example "Probot Owners" + */ + name: string; + /** @example "MDExOkludGVncmF0aW9uMQ==" */ + node_id: string; + owner: SimpleUser | null; + /** @example ""-----BEGIN RSA PRIVATE KEY-----\\nMIIEogIBAAKCAQEArYxrNYD/iT5CZVpRJu4rBKmmze3PVmT/gCo2ATUvDvZTPTey\\nxcGJ3vvrJXazKk06pN05TN29o98jrYz4cengG3YGsXPNEpKsIrEl8NhbnxapEnM9\\nJCMRe0P5JcPsfZlX6hmiT7136GRWiGOUba2X9+HKh8QJVLG5rM007TBER9/z9mWm\\nrJuNh+m5l320oBQY/Qq3A7wzdEfZw8qm/mIN0FCeoXH1L6B8xXWaAYBwhTEh6SSn\\nZHlO1Xu1JWDmAvBCi0RO5aRSKM8q9QEkvvHP4yweAtK3N8+aAbZ7ovaDhyGz8r6r\\nzhU1b8Uo0Z2ysf503WqzQgIajr7Fry7/kUwpgQIDAQABAoIBADwJp80Ko1xHPZDy\\nfcCKBDfIuPvkmSW6KumbsLMaQv1aGdHDwwTGv3t0ixSay8CGlxMRtRDyZPib6SvQ\\n6OH/lpfpbMdW2ErkksgtoIKBVrDilfrcAvrNZu7NxRNbhCSvN8q0s4ICecjbbVQh\\nnueSdlA6vGXbW58BHMq68uRbHkP+k+mM9U0mDJ1HMch67wlg5GbayVRt63H7R2+r\\nVxcna7B80J/lCEjIYZznawgiTvp3MSanTglqAYi+m1EcSsP14bJIB9vgaxS79kTu\\noiSo93leJbBvuGo8QEiUqTwMw4tDksmkLsoqNKQ1q9P7LZ9DGcujtPy4EZsamSJT\\ny8OJt0ECgYEA2lxOxJsQk2kI325JgKFjo92mQeUObIvPfSNWUIZQDTjniOI6Gv63\\nGLWVFrZcvQBWjMEQraJA9xjPbblV8PtfO87MiJGLWCHFxmPz2dzoedN+2Coxom8m\\nV95CLz8QUShuao6u/RYcvUaZEoYs5bHcTmy5sBK80JyEmafJPtCQVxMCgYEAy3ar\\nZr3yv4xRPEPMat4rseswmuMooSaK3SKub19WFI5IAtB/e7qR1Rj9JhOGcZz+OQrl\\nT78O2OFYlgOIkJPvRMrPpK5V9lslc7tz1FSh3BZMRGq5jSyD7ETSOQ0c8T2O/s7v\\nbeEPbVbDe4mwvM24XByH0GnWveVxaDl51ABD65sCgYB3ZAspUkOA5egVCh8kNpnd\\nSd6SnuQBE3ySRlT2WEnCwP9Ph6oPgn+oAfiPX4xbRqkL8q/k0BdHQ4h+zNwhk7+h\\nWtPYRAP1Xxnc/F+jGjb+DVaIaKGU18MWPg7f+FI6nampl3Q0KvfxwX0GdNhtio8T\\nTj1E+SnFwh56SRQuxSh2gwKBgHKjlIO5NtNSflsUYFM+hyQiPiqnHzddfhSG+/3o\\nm5nNaSmczJesUYreH5San7/YEy2UxAugvP7aSY2MxB+iGsiJ9WD2kZzTUlDZJ7RV\\nUzWsoqBR+eZfVJ2FUWWvy8TpSG6trh4dFxImNtKejCR1TREpSiTV3Zb1dmahK9GV\\nrK9NAoGAbBxRLoC01xfxCTgt5BDiBcFVh4fp5yYKwavJPLzHSpuDOrrI9jDn1oKN\\nonq5sDU1i391zfQvdrbX4Ova48BN+B7p63FocP/MK5tyyBoT8zQEk2+vWDOw7H/Z\\nu5dTCPxTIsoIwUw1I+7yIxqJzLPFgR2gVBwY1ra/8iAqCj+zeBw=\\n-----END RSA PRIVATE KEY-----\\n"" */ + pem?: string; + /** + * The set of permissions for the GitHub app + * @example {"issues":"read","deployments":"write"} + */ + permissions: { + checks?: string; + contents?: string; + deployments?: string; + issues?: string; + metadata?: string; + [key: string]: any; + }; + /** + * The slug name of the GitHub app + * @example "probot-owners" + */ + slug?: string; + /** + * @format date-time + * @example "2017-07-08T16:18:44-04:00" + */ + updated_at: string; + /** @example ""6fba8f2fc8a7e8f2cca5577eddd82ca7586b3b6b"" */ + webhook_secret?: string; + [key: string]: any; +} + +/** + * The duration of the interaction restriction. Can be one of: \`one_day\`, \`three_days\`, \`one_week\`, \`one_month\`, \`six_months\`. Default: \`one_day\`. + * @example "one_month" + */ +export enum InteractionExpiry { + OneDay = "one_day", + ThreeDays = "three_days", + OneWeek = "one_week", + OneMonth = "one_month", + SixMonths = "six_months", +} + +/** + * The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: \`existing_users\`, \`contributors_only\`, \`collaborators_only\`. + * @example "collaborators_only" + */ +export enum InteractionGroup { + ExistingUsers = "existing_users", + ContributorsOnly = "contributors_only", + CollaboratorsOnly = "collaborators_only", +} + +/** + * Interaction Restrictions + * Limit interactions to a specific type of user for a specified duration + */ +export interface InteractionLimit { + /** The duration of the interaction restriction. Can be one of: \`one_day\`, \`three_days\`, \`one_week\`, \`one_month\`, \`six_months\`. Default: \`one_day\`. */ + expiry?: InteractionExpiry; + /** The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: \`existing_users\`, \`contributors_only\`, \`collaborators_only\`. */ + limit: InteractionGroup; +} + +/** + * Interaction Limits + * Interaction limit settings. + */ +export interface InteractionLimitResponse { + /** + * @format date-time + * @example "2018-08-17T04:18:39Z" + */ + expires_at: string; + /** The type of GitHub user that can comment, open issues, or create pull requests while the interaction limit is in effect. Can be one of: \`existing_users\`, \`contributors_only\`, \`collaborators_only\`. */ + limit: InteractionGroup; + /** @example "repository" */ + origin: string; +} + +/** + * Issue + * Issues are a great way to keep track of tasks, enhancements, and bugs for your projects. + */ +export interface Issue { + active_lock_reason?: string | null; + assignee: SimpleUser | null; + assignees?: SimpleUser[] | null; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** + * Contents of the issue + * @example "It looks like the new widget form is broken on Safari. When I try and create the widget, Safari crashes. This is reproducible on 10.8, but not 10.9. Maybe a browser bug?" + */ + body?: string; + body_html?: string; + body_text?: string; + /** @format date-time */ + closed_at: string | null; + closed_by?: SimpleUser | null; + comments: number; + /** @format uri */ + comments_url: string; + /** @format date-time */ + created_at: string; + /** @format uri */ + events_url: string; + /** @format uri */ + html_url: string; + id: number; + /** + * Labels to associate with this issue; pass one or more label names to replace the set of labels on this issue; send an empty array to clear all labels from the issue; note that the labels are silently dropped for users without push access to the repository + * @example ["bug","registration"] + */ + labels: ( + | string + | { + color?: string | null; + default?: boolean; + description?: string | null; + id?: number; + name?: string; + node_id?: string; + /** @format uri */ + url?: string; + } + )[]; + labels_url: string; + locked: boolean; + milestone: Milestone | null; + node_id: string; + /** + * Number uniquely identifying the issue within its repository + * @example 42 + */ + number: number; + performed_via_github_app?: Integration | null; + pull_request?: { + /** @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 */ + url: string | null; + }; + reactions?: ReactionRollup; + /** A git repository */ + repository?: Repository; + /** @format uri */ + repository_url: string; + /** + * State of the issue; either 'open' or 'closed' + * @example "open" + */ + state: string; + /** @format uri */ + timeline_url?: string; + /** + * Title of the issue + * @example "Widget creation fails in Safari on OS X 10.8" + */ + title: string; + /** @format date-time */ + updated_at: string; + /** + * URL for the issue + * @format uri + * @example "https://api.github.com/repositories/42/issues/1" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Issue Comment + * Comments provide a way for people to collaborate on an issue. + */ +export interface IssueComment { + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** + * Contents of the issue comment + * @example "What version of Safari were you using when you observed this bug?" + */ + body?: string; + body_html?: string; + body_text?: string; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + created_at: string; + /** @format uri */ + html_url: string; + /** + * Unique identifier of the issue comment + * @example 42 + */ + id: number; + /** @format uri */ + issue_url: string; + node_id: string; + performed_via_github_app?: Integration | null; + reactions?: ReactionRollup; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + updated_at: string; + /** + * URL for the issue comment + * @format uri + * @example "https://api.github.com/repositories/42/issues/comments/1" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Issue Event + * Issue Event + */ +export interface IssueEvent { + actor: SimpleUser | null; + assignee?: SimpleUser | null; + assigner?: SimpleUser | null; + /** How the author is associated with the repository. */ + author_association?: AuthorAssociation; + /** @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" */ + commit_id: string | null; + /** @example "https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e" */ + commit_url: string | null; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + created_at: string; + dismissed_review?: IssueEventDismissedReview; + /** @example "closed" */ + event: string; + /** @example 1 */ + id: number; + /** Issue Simple */ + issue?: IssueSimple; + /** Issue Event Label */ + label?: IssueEventLabel; + lock_reason?: string | null; + /** Issue Event Milestone */ + milestone?: IssueEventMilestone; + /** @example "MDEwOklzc3VlRXZlbnQx" */ + node_id: string; + /** Issue Event Project Card */ + project_card?: IssueEventProjectCard; + /** Issue Event Rename */ + rename?: IssueEventRename; + requested_reviewer?: SimpleUser | null; + /** Groups of organization members that gives permissions on specified repositories. */ + requested_team?: Team; + review_requester?: SimpleUser | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/events/1" + */ + url: string; +} + +/** Issue Event Dismissed Review */ +export interface IssueEventDismissedReview { + dismissal_commit_id?: string | null; + dismissal_message: string | null; + review_id: number; + state: string; +} + +/** + * Issue Event for Issue + * Issue Event for Issue + */ +export interface IssueEventForIssue { + /** Simple User */ + actor?: SimpleUser; + /** How the author is associated with the repository. */ + author_association?: AuthorAssociation; + /** @example "":+1:"" */ + body?: string; + /** @example ""

Accusantium fugiat cumque. Autem qui nostrum. Atque quae ullam.

"" */ + body_html?: string; + /** @example ""Accusantium fugiat cumque. Autem qui nostrum. Atque quae ullam."" */ + body_text?: string; + commit_id?: string | null; + commit_url?: string | null; + created_at?: string; + event?: string; + /** @example ""https://github.com/owner-3906e11a33a3d55ba449d63f/BBB_Private_Repo/commit/480d4f47447129f015cb327536c522ca683939a1"" */ + html_url?: string; + id?: number; + /** @example ""https://api.github.com/repos/owner-3906e11a33a3d55ba449d63f/AAA_Public_Repo/issues/1"" */ + issue_url?: string; + /** @example ""off-topic"" */ + lock_reason?: string; + /** @example ""add a bunch of files"" */ + message?: string; + node_id?: string; + /** @example ""https://api.github.com/repos/owner-3906e11a33a3d55ba449d63f/AAA_Public_Repo/pulls/2"" */ + pull_request_url?: string; + /** @example ""480d4f47447129f015cb327536c522ca683939a1"" */ + sha?: string; + /** @example ""commented"" */ + state?: string; + /** @example ""2020-07-09T00:17:51Z"" */ + submitted_at?: string; + /** @example ""2020-07-09T00:17:36Z"" */ + updated_at?: string; + url?: string; +} + +/** + * Issue Event Label + * Issue Event Label + */ +export interface IssueEventLabel { + color: string | null; + name: string | null; +} + +/** + * Issue Event Milestone + * Issue Event Milestone + */ +export interface IssueEventMilestone { + title: string; +} + +/** + * Issue Event Project Card + * Issue Event Project Card + */ +export interface IssueEventProjectCard { + column_name: string; + id: number; + previous_column_name?: string; + project_id: number; + /** @format uri */ + project_url: string; + /** @format uri */ + url: string; +} + +/** + * Issue Event Rename + * Issue Event Rename + */ +export interface IssueEventRename { + from: string; + to: string; +} + +/** + * Issue Search Result Item + * Issue Search Result Item + */ +export interface IssueSearchResultItem { + active_lock_reason?: string | null; + assignee: SimpleUser | null; + assignees?: SimpleUser[] | null; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + body?: string; + body_html?: string; + body_text?: string; + /** @format date-time */ + closed_at: string | null; + comments: number; + /** @format uri */ + comments_url: string; + /** @format date-time */ + created_at: string; + draft?: boolean; + /** @format uri */ + events_url: string; + /** @format uri */ + html_url: string; + id: number; + labels: { + color?: string; + default?: boolean; + description?: string | null; + id?: number; + name?: string; + node_id?: string; + url?: string; + }[]; + labels_url: string; + locked: boolean; + milestone: Milestone | null; + node_id: string; + number: number; + performed_via_github_app?: Integration | null; + pull_request?: { + /** @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 */ + url: string | null; + }; + /** A git repository */ + repository?: Repository; + /** @format uri */ + repository_url: string; + score: number; + state: string; + text_matches?: SearchResultTextMatches; + /** @format uri */ + timeline_url?: string; + title: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + user: SimpleUser | null; +} + +/** + * Issue Simple + * Issue Simple + */ +export interface IssueSimple { + /** @example "too heated" */ + active_lock_reason?: string | null; + assignee: SimpleUser | null; + assignees?: SimpleUser[] | null; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** @example "I'm having a problem with this." */ + body?: string; + body_html?: string; + body_text?: string; + /** @format date-time */ + closed_at: string | null; + /** @example 0 */ + comments: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments" + */ + comments_url: string; + /** + * @format date-time + * @example "2011-04-22T13:33:48Z" + */ + created_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/events" + */ + events_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/issues/1347" + */ + html_url: string; + /** @example 1 */ + id: number; + labels: Label[]; + /** @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/labels{/name}" */ + labels_url: string; + /** @example true */ + locked: boolean; + milestone: Milestone | null; + /** @example "MDU6SXNzdWUx" */ + node_id: string; + /** @example 1347 */ + number: number; + performed_via_github_app?: Integration | null; + pull_request?: { + /** @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 */ + url: string | null; + }; + /** A git repository */ + repository?: Repository; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World" + */ + repository_url: string; + /** @example "open" */ + state: string; + /** @format uri */ + timeline_url?: string; + /** @example "Found a bug" */ + title: string; + /** + * @format date-time + * @example "2011-04-22T13:33:48Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Job + * Information of a job execution in a workflow run + */ +export interface Job { + /** @example "https://api.github.com/repos/github/hello-world/check-runs/4" */ + check_run_url: string; + /** + * The time that the job finished, in ISO 8601 format. + * @format date-time + * @example "2019-08-08T08:00:00-07:00" + */ + completed_at: string | null; + /** + * The outcome of the job. + * @example "success" + */ + conclusion: string | null; + /** + * The SHA of the commit that is being run. + * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" + */ + head_sha: string; + /** @example "https://github.com/github/hello-world/runs/4" */ + html_url: string | null; + /** + * The id of the job. + * @example 21 + */ + id: number; + /** + * The name of the job. + * @example "test-coverage" + */ + name: string; + /** @example "MDg6Q2hlY2tSdW40" */ + node_id: string; + /** + * The id of the associated workflow run. + * @example 5 + */ + run_id: number; + /** @example "https://api.github.com/repos/github/hello-world/actions/runs/5" */ + run_url: string; + /** + * The time that the job started, in ISO 8601 format. + * @format date-time + * @example "2019-08-08T08:00:00-07:00" + */ + started_at: string; + /** + * The phase of the lifecycle that the job is currently in. + * @example "queued" + */ + status: "queued" | "in_progress" | "completed"; + /** Steps in this job. */ + steps?: { + /** + * The time that the job finished, in ISO 8601 format. + * @format date-time + * @example "2019-08-08T08:00:00-07:00" + */ + completed_at?: string | null; + /** + * The outcome of the job. + * @example "success" + */ + conclusion: string | null; + /** + * The name of the job. + * @example "test-coverage" + */ + name: string; + /** @example 1 */ + number: number; + /** + * The time that the step started, in ISO 8601 format. + * @format date-time + * @example "2019-08-08T08:00:00-07:00" + */ + started_at?: string | null; + /** + * The phase of the lifecycle that the job is currently in. + * @example "queued" + */ + status: "queued" | "in_progress" | "completed"; + }[]; + /** @example "https://api.github.com/repos/github/hello-world/actions/jobs/21" */ + url: string; +} + +/** + * Key + * Key + */ +export interface Key { + /** @format date-time */ + created_at: string; + id: number; + key: string; + key_id: string; + read_only: boolean; + title: string; + url: string; + verified: boolean; +} + +/** + * Key Simple + * Key Simple + */ +export interface KeySimple { + id: number; + key: string; +} + +/** + * Label + * Color-coded labels help you categorize and filter your issues (just like labels in Gmail). + */ +export interface Label { + /** + * 6-character hex code, without the leading #, identifying the color + * @example "FFFFFF" + */ + color: string; + /** @example true */ + default: boolean; + /** @example "Something isn't working" */ + description: string | null; + /** @example 208045946 */ + id: number; + /** + * The name of the label. + * @example "bug" + */ + name: string; + /** @example "MDU6TGFiZWwyMDgwNDU5NDY=" */ + node_id: string; + /** + * URL for the label + * @format uri + * @example "https://api.github.com/repositories/42/labels/bug" + */ + url: string; +} + +/** + * Label Search Result Item + * Label Search Result Item + */ +export interface LabelSearchResultItem { + color: string; + default: boolean; + description: string | null; + id: number; + name: string; + node_id: string; + score: number; + text_matches?: SearchResultTextMatches; + /** @format uri */ + url: string; +} + +/** + * Language + * Language + */ +export type Language = Record; + +/** + * License + * License + */ +export interface License { + /** + * @example " + * + * The MIT License (MIT) + * + * Copyright (c) [year] [fullname] + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * " + */ + body: string; + /** @example ["include-copyright"] */ + conditions: string[]; + /** @example "A permissive license that is short and to the point. It lets people do anything with your code with proper attribution and without warranty." */ + description: string; + /** @example true */ + featured: boolean; + /** + * @format uri + * @example "http://choosealicense.com/licenses/mit/" + */ + html_url: string; + /** @example "Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file. Replace [year] with the current year and [fullname] with the name (or names) of the copyright holders." */ + implementation: string; + /** @example "mit" */ + key: string; + /** @example ["no-liability"] */ + limitations: string[]; + /** @example "MIT License" */ + name: string; + /** @example "MDc6TGljZW5zZW1pdA==" */ + node_id: string; + /** @example ["commercial-use","modifications","distribution","sublicense","private-use"] */ + permissions: string[]; + /** @example "MIT" */ + spdx_id: string | null; + /** + * @format uri + * @example "https://api.github.com/licenses/mit" + */ + url: string | null; +} + +/** + * License Content + * License Content + */ +export interface LicenseContent { + _links: { + /** @format uri */ + git: string | null; + /** @format uri */ + html: string | null; + /** @format uri */ + self: string; + }; + content: string; + /** @format uri */ + download_url: string | null; + encoding: string; + /** @format uri */ + git_url: string | null; + /** @format uri */ + html_url: string | null; + license: LicenseSimple | null; + name: string; + path: string; + sha: string; + size: number; + type: string; + /** @format uri */ + url: string; +} + +/** + * License Simple + * License Simple + */ +export interface LicenseSimple { + /** @format uri */ + html_url?: string; + /** @example "mit" */ + key: string; + /** @example "MIT License" */ + name: string; + /** @example "MDc6TGljZW5zZW1pdA==" */ + node_id: string; + /** @example "MIT" */ + spdx_id: string | null; + /** + * @format uri + * @example "https://api.github.com/licenses/mit" + */ + url: string | null; +} + +/** + * Link + * Hypermedia Link + */ +export interface Link { + href: string; +} + +/** + * Link With Type + * Hypermedia Link with Type + */ +export interface LinkWithType { + href: string; + type: string; +} + +/** Marketplace Account */ +export interface MarketplaceAccount { + /** @format email */ + email?: string | null; + id: number; + login: string; + node_id?: string; + /** @format email */ + organization_billing_email?: string | null; + type: string; + /** @format uri */ + url: string; +} + +/** + * Marketplace Listing Plan + * Marketplace Listing Plan + */ +export interface MarketplaceListingPlan { + /** + * @format uri + * @example "https://api.github.com/marketplace_listing/plans/1313/accounts" + */ + accounts_url: string; + /** @example ["Up to 25 private repositories","11 concurrent builds"] */ + bullets: string[]; + /** @example "A professional-grade CI solution" */ + description: string; + /** @example true */ + has_free_trial: boolean; + /** @example 1313 */ + id: number; + /** @example 1099 */ + monthly_price_in_cents: number; + /** @example "Pro" */ + name: string; + /** @example 3 */ + number: number; + /** @example "flat-rate" */ + price_model: string; + /** @example "published" */ + state: string; + unit_name: string | null; + /** + * @format uri + * @example "https://api.github.com/marketplace_listing/plans/1313" + */ + url: string; + /** @example 11870 */ + yearly_price_in_cents: number; +} + +/** + * Marketplace Purchase + * Marketplace Purchase + */ +export interface MarketplacePurchase { + id: number; + login: string; + marketplace_pending_change?: { + effective_date?: string; + id?: number; + is_installed?: boolean; + /** Marketplace Listing Plan */ + plan?: MarketplaceListingPlan; + unit_count?: number | null; + }; + marketplace_purchase: { + billing_cycle?: string; + free_trial_ends_on?: string | null; + is_installed?: boolean; + next_billing_date?: string | null; + on_free_trial?: boolean; + /** Marketplace Listing Plan */ + plan?: MarketplaceListingPlan; + unit_count?: number | null; + updated_at?: string; + }; + organization_billing_email?: string; + type: string; + url: string; +} + +/** + * Migration + * A migration. + */ +export interface Migration { + /** @format uri */ + archive_url?: string; + /** + * @format date-time + * @example "2015-07-06T15:33:38-07:00" + */ + created_at: string; + exclude?: any[]; + exclude_attachments: boolean; + /** @example "0b989ba4-242f-11e5-81e1-c7b6966d2516" */ + guid: string; + /** @example 79 */ + id: number; + /** @example true */ + lock_repositories: boolean; + node_id: string; + owner: SimpleUser | null; + repositories: Repository[]; + /** @example "pending" */ + state: string; + /** + * @format date-time + * @example "2015-07-06T15:33:38-07:00" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/orgs/octo-org/migrations/79" + */ + url: string; +} + +/** + * Milestone + * A collection of related issues and pull requests. + */ +export interface Milestone { + /** + * @format date-time + * @example "2013-02-12T13:22:01Z" + */ + closed_at: string | null; + /** @example 8 */ + closed_issues: number; + /** + * @format date-time + * @example "2011-04-10T20:09:31Z" + */ + created_at: string; + creator: SimpleUser | null; + /** @example "Tracking milestone for version 1.0" */ + description: string | null; + /** + * @format date-time + * @example "2012-10-09T23:39:01Z" + */ + due_on: string | null; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/milestones/v1.0" + */ + html_url: string; + /** @example 1002604 */ + id: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/milestones/1/labels" + */ + labels_url: string; + /** @example "MDk6TWlsZXN0b25lMTAwMjYwNA==" */ + node_id: string; + /** + * The number of the milestone. + * @example 42 + */ + number: number; + /** @example 4 */ + open_issues: number; + /** + * The state of the milestone. + * @default "open" + * @example "open" + */ + state: "open" | "closed"; + /** + * The title of the milestone. + * @example "v1.0" + */ + title: string; + /** + * @format date-time + * @example "2014-03-03T18:58:10Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/milestones/1" + */ + url: string; +} + +/** + * Minimal Repository + * Minimal Repository + */ +export interface MinimalRepository { + /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ + archive_url: string; + archived?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ + assignees_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ + blobs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ + branches_url: string; + clone_url?: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ + collaborators_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ + comments_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ + commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ + compare_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ + contents_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/contributors" + */ + contributors_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at?: string | null; + default_branch?: string; + delete_branch_on_merge?: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/deployments" + */ + deployments_url: string; + /** @example "This your first repo!" */ + description: string | null; + disabled?: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/downloads" + */ + downloads_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/events" + */ + events_url: string; + fork: boolean; + /** @example 0 */ + forks?: number; + forks_count?: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/forks" + */ + forks_url: string; + /** @example "octocat/Hello-World" */ + full_name: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ + git_commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ + git_refs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ + git_tags_url: string; + git_url?: string; + has_downloads?: boolean; + has_issues?: boolean; + has_pages?: boolean; + has_projects?: boolean; + has_wiki?: boolean; + homepage?: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/hooks" + */ + hooks_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World" + */ + html_url: string; + /** @example 1296269 */ + id: number; + is_template?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ + issue_comment_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ + issue_events_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ + issues_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ + keys_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ + labels_url: string; + language?: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/languages" + */ + languages_url: string; + license?: { + key?: string; + name?: string; + node_id?: string; + spdx_id?: string; + url?: string; + } | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/merges" + */ + merges_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ + milestones_url: string; + mirror_url?: string | null; + /** @example "Hello-World" */ + name: string; + network_count?: number; + /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ + node_id: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ + notifications_url: string; + /** @example 0 */ + open_issues?: number; + open_issues_count?: number; + owner: SimpleUser | null; + permissions?: { + admin?: boolean; + pull?: boolean; + push?: boolean; + }; + private: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ + pulls_url: string; + /** + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + pushed_at?: string | null; + /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ + releases_url: string; + size?: number; + ssh_url?: string; + stargazers_count?: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" + */ + stargazers_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ + statuses_url: string; + subscribers_count?: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" + */ + subscribers_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscription" + */ + subscription_url: string; + svn_url?: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/tags" + */ + tags_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/teams" + */ + teams_url: string; + temp_clone_token?: string; + template_repository?: Repository | null; + topics?: string[]; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ + trees_url: string; + /** + * @format date-time + * @example "2011-01-26T19:14:43Z" + */ + updated_at?: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World" + */ + url: string; + visibility?: string; + /** @example 0 */ + watchers?: number; + watchers_count?: number; +} + +/** + * Org Hook + * Org Hook + */ +export interface OrgHook { + /** @example true */ + active: boolean; + config: { + /** @example ""form"" */ + content_type?: string; + /** @example ""0"" */ + insecure_ssl?: string; + /** @example ""********"" */ + secret?: string; + /** @example ""http://example.com/2"" */ + url?: string; + }; + /** + * @format date-time + * @example "2011-09-06T17:26:27Z" + */ + created_at: string; + /** @example ["push","pull_request"] */ + events: string[]; + /** @example 1 */ + id: number; + /** @example "web" */ + name: string; + /** + * @format uri + * @example "https://api.github.com/orgs/octocat/hooks/1/pings" + */ + ping_url: string; + type: string; + /** + * @format date-time + * @example "2011-09-06T20:39:23Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/orgs/octocat/hooks/1" + */ + url: string; +} + +/** + * Org Membership + * Org Membership + */ +export interface OrgMembership { + /** Organization Simple */ + organization: OrganizationSimple; + /** + * @format uri + * @example "https://api.github.com/orgs/octocat" + */ + organization_url: string; + permissions?: { + can_create_repository: boolean; + }; + /** @example "admin" */ + role: string; + /** @example "active" */ + state: string; + /** + * @format uri + * @example "https://api.github.com/orgs/octocat/memberships/defunkt" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Actions Secret for an Organization + * Secrets for GitHub Actions for an organization. + */ +export interface OrganizationActionsSecret { + /** @format date-time */ + created_at: string; + /** + * The name of the secret. + * @example "SECRET_TOKEN" + */ + name: string; + /** + * @format uri + * @example "https://api.github.com/organizations/org/secrets/my_secret/repositories" + */ + selected_repositories_url?: string; + /** @format date-time */ + updated_at: string; + /** Visibility of a secret */ + visibility: "all" | "private" | "selected"; +} + +/** + * Organization Full + * Organization Full + */ +export interface OrganizationFull { + /** @example "https://github.com/images/error/octocat_happy.gif" */ + avatar_url: string; + /** + * @format email + * @example "org@example.com" + */ + billing_email?: string | null; + /** + * @format uri + * @example "https://github.com/blog" + */ + blog?: string; + /** @example 8 */ + collaborators?: number | null; + /** @example "GitHub" */ + company?: string; + /** + * @format date-time + * @example "2008-01-14T04:33:35Z" + */ + created_at: string; + default_repository_permission?: string | null; + /** @example "A great organization" */ + description: string | null; + /** @example 10000 */ + disk_usage?: number | null; + /** + * @format email + * @example "octocat@github.com" + */ + email?: string; + /** + * @format uri + * @example "https://api.github.com/orgs/github/events" + */ + events_url: string; + /** @example 20 */ + followers: number; + /** @example 0 */ + following: number; + /** @example true */ + has_organization_projects: boolean; + /** @example true */ + has_repository_projects: boolean; + /** @example "https://api.github.com/orgs/github/hooks" */ + hooks_url: string; + /** + * @format uri + * @example "https://github.com/octocat" + */ + html_url: string; + /** @example 1 */ + id: number; + /** @example true */ + is_verified?: boolean; + /** @example "https://api.github.com/orgs/github/issues" */ + issues_url: string; + /** @example "San Francisco" */ + location?: string; + /** @example "github" */ + login: string; + /** @example "all" */ + members_allowed_repository_creation_type?: string; + /** @example true */ + members_can_create_internal_repositories?: boolean; + /** @example true */ + members_can_create_pages?: boolean; + /** @example true */ + members_can_create_private_repositories?: boolean; + /** @example true */ + members_can_create_public_repositories?: boolean; + /** @example true */ + members_can_create_repositories?: boolean | null; + /** @example "https://api.github.com/orgs/github/members{/member}" */ + members_url: string; + /** @example "github" */ + name?: string; + /** @example "MDEyOk9yZ2FuaXphdGlvbjE=" */ + node_id: string; + /** @example 100 */ + owned_private_repos?: number; + plan?: { + filled_seats?: number; + name: string; + private_repos: number; + seats?: number; + space: number; + }; + /** @example 81 */ + private_gists?: number | null; + /** @example 1 */ + public_gists: number; + /** @example "https://api.github.com/orgs/github/public_members{/member}" */ + public_members_url: string; + /** @example 2 */ + public_repos: number; + /** + * @format uri + * @example "https://api.github.com/orgs/github/repos" + */ + repos_url: string; + /** @example 100 */ + total_private_repos?: number; + /** @example "github" */ + twitter_username?: string | null; + /** @example true */ + two_factor_requirement_enabled?: boolean | null; + /** @example "Organization" */ + type: string; + /** @format date-time */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/orgs/github" + */ + url: string; +} + +/** + * Organization Invitation + * Organization Invitation + */ +export interface OrganizationInvitation { + created_at: string; + email: string | null; + failed_at?: string; + failed_reason?: string; + id: number; + invitation_team_url: string; + /** @example ""https://api.github.com/organizations/16/invitations/1/teams"" */ + invitation_teams_url?: string; + /** Simple User */ + inviter: SimpleUser; + login: string | null; + /** @example ""MDIyOk9yZ2FuaXphdGlvbkludml0YXRpb24x"" */ + node_id: string; + role: string; + team_count: number; +} + +/** + * Organization Simple + * Organization Simple + */ +export interface OrganizationSimple { + /** @example "https://github.com/images/error/octocat_happy.gif" */ + avatar_url: string; + /** @example "A great organization" */ + description: string | null; + /** + * @format uri + * @example "https://api.github.com/orgs/github/events" + */ + events_url: string; + /** @example "https://api.github.com/orgs/github/hooks" */ + hooks_url: string; + /** @example 1 */ + id: number; + /** @example "https://api.github.com/orgs/github/issues" */ + issues_url: string; + /** @example "github" */ + login: string; + /** @example "https://api.github.com/orgs/github/members{/member}" */ + members_url: string; + /** @example "MDEyOk9yZ2FuaXphdGlvbjE=" */ + node_id: string; + /** @example "https://api.github.com/orgs/github/public_members{/member}" */ + public_members_url: string; + /** + * @format uri + * @example "https://api.github.com/orgs/github/repos" + */ + repos_url: string; + /** + * @format uri + * @example "https://api.github.com/orgs/github" + */ + url: string; +} + +export interface PackagesBillingUsage { + /** Free storage space (GB) for GitHub Packages. */ + included_gigabytes_bandwidth: number; + /** Sum of the free and paid storage space (GB) for GitHuub Packages. */ + total_gigabytes_bandwidth_used: number; + /** Total paid storage space (GB) for GitHuub Packages. */ + total_paid_gigabytes_bandwidth_used: number; +} + +/** + * GitHub Pages + * The configuration for GitHub Pages for a repository. + */ +export interface Page { + /** + * Whether the Page has a custom 404 page. + * @default false + * @example false + */ + custom_404: boolean; + /** + * The Pages site's custom domain + * @example "example.com" + */ + cname: string | null; + /** + * The web address the Page can be accessed from. + * @format uri + * @example "https://example.com" + */ + html_url?: string; + /** + * Whether the GitHub Pages site is publicly visible. If set to \`true\`, the site is accessible to anyone on the internet. If set to \`false\`, the site will only be accessible to users who have at least \`read\` access to the repository that published the site. + * @example true + */ + public: boolean; + source?: PagesSourceHash; + /** + * The status of the most recent build of the Page. + * @example "built" + */ + status: "built" | "building" | "errored" | null; + /** + * The API address for accessing this Page resource. + * @format uri + * @example "https://api.github.com/repos/github/hello-world/pages" + */ + url: string; +} + +/** + * Page Build + * Page Build + */ +export interface PageBuild { + commit: string; + /** @format date-time */ + created_at: string; + duration: number; + error: { + message: string | null; + }; + pusher: SimpleUser | null; + status: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; +} + +/** + * Page Build Status + * Page Build Status + */ +export interface PageBuildStatus { + /** @example "queued" */ + status: string; + /** + * @format uri + * @example "https://api.github.com/repos/github/hello-world/pages/builds/latest" + */ + url: string; +} + +/** Pages Source Hash */ +export interface PagesSourceHash { + branch: string; + path: string; +} + +/** Participation Stats */ +export interface ParticipationStats { + all: number[]; + owner: number[]; +} + +/** + * Porter Author + * Porter Author + */ +export interface PorterAuthor { + email: string; + id: number; + /** @format uri */ + import_url: string; + name: string; + remote_id: string; + remote_name: string; + /** @format uri */ + url: string; +} + +/** + * Porter Large File + * Porter Large File + */ +export interface PorterLargeFile { + oid: string; + path: string; + ref_name: string; + size: number; +} + +/** + * Private User + * Private User + */ +export interface PrivateUser { + /** + * @format uri + * @example "https://github.com/images/error/octocat_happy.gif" + */ + avatar_url: string; + /** @example "There once was..." */ + bio: string | null; + /** @example "https://github.com/blog" */ + blog: string | null; + business_plus?: boolean; + /** @example 8 */ + collaborators: number; + /** @example "GitHub" */ + company: string | null; + /** + * @format date-time + * @example "2008-01-14T04:33:35Z" + */ + created_at: string; + /** @example 10000 */ + disk_usage: number; + /** + * @format email + * @example "octocat@github.com" + */ + email: string | null; + /** @example "https://api.github.com/users/octocat/events{/privacy}" */ + events_url: string; + /** @example 20 */ + followers: number; + /** + * @format uri + * @example "https://api.github.com/users/octocat/followers" + */ + followers_url: string; + /** @example 0 */ + following: number; + /** @example "https://api.github.com/users/octocat/following{/other_user}" */ + following_url: string; + /** @example "https://api.github.com/users/octocat/gists{/gist_id}" */ + gists_url: string; + /** @example "41d064eb2195891e12d0413f63227ea7" */ + gravatar_id: string | null; + hireable: boolean | null; + /** + * @format uri + * @example "https://github.com/octocat" + */ + html_url: string; + /** @example 1 */ + id: number; + ldap_dn?: string; + /** @example "San Francisco" */ + location: string | null; + /** @example "octocat" */ + login: string; + /** @example "monalisa octocat" */ + name: string | null; + /** @example "MDQ6VXNlcjE=" */ + node_id: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/orgs" + */ + organizations_url: string; + /** @example 100 */ + owned_private_repos: number; + plan?: { + collaborators: number; + name: string; + private_repos: number; + space: number; + }; + /** @example 81 */ + private_gists: number; + /** @example 1 */ + public_gists: number; + /** @example 2 */ + public_repos: number; + /** + * @format uri + * @example "https://api.github.com/users/octocat/received_events" + */ + received_events_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/repos" + */ + repos_url: string; + site_admin: boolean; + /** @example "https://api.github.com/users/octocat/starred{/owner}{/repo}" */ + starred_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/subscriptions" + */ + subscriptions_url: string; + /** @format date-time */ + suspended_at?: string | null; + /** @example 100 */ + total_private_repos: number; + /** @example "monalisa" */ + twitter_username?: string | null; + /** @example true */ + two_factor_authentication: boolean; + /** @example "User" */ + type: string; + /** + * @format date-time + * @example "2008-01-14T04:33:35Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat" + */ + url: string; +} + +/** + * Project + * Projects are a way to organize columns and cards of work. + */ +export interface Project { + /** + * Body of the project + * @example "This project represents the sprint of the first week in January" + */ + body: string | null; + /** + * @format uri + * @example "https://api.github.com/projects/1002604/columns" + */ + columns_url: string; + /** + * @format date-time + * @example "2011-04-10T20:09:31Z" + */ + created_at: string; + creator: SimpleUser | null; + /** + * @format uri + * @example "https://github.com/api-playground/projects-test/projects/12" + */ + html_url: string; + /** @example 1002604 */ + id: number; + /** + * Name of the project + * @example "Week One Sprint" + */ + name: string; + /** @example "MDc6UHJvamVjdDEwMDI2MDQ=" */ + node_id: string; + /** @example 1 */ + number: number; + /** The baseline permission that all organization members have on this project. Only present if owner is an organization. */ + organization_permission?: "read" | "write" | "admin" | "none"; + /** + * @format uri + * @example "https://api.github.com/repos/api-playground/projects-test" + */ + owner_url: string; + /** Whether or not this project can be seen by everyone. Only present if owner is an organization. */ + private?: boolean; + /** + * State of the project; either 'open' or 'closed' + * @example "open" + */ + state: string; + /** + * @format date-time + * @example "2014-03-03T18:58:10Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/projects/1002604" + */ + url: string; +} + +/** + * Project Card + * Project cards represent a scope of work. + */ +export interface ProjectCard { + /** + * Whether or not the card is archived + * @example false + */ + archived?: boolean; + /** + * @format uri + * @example "https://api.github.com/projects/columns/367" + */ + column_url: string; + /** + * @format uri + * @example "https://api.github.com/repos/api-playground/projects-test/issues/3" + */ + content_url?: string; + /** + * @format date-time + * @example "2016-09-05T14:21:06Z" + */ + created_at: string; + creator: SimpleUser | null; + /** + * The project card's ID + * @example 42 + */ + id: number; + /** @example "MDExOlByb2plY3RDYXJkMTQ3OA==" */ + node_id: string; + /** @example "Add payload for delete Project column" */ + note: string | null; + /** + * @format uri + * @example "https://api.github.com/projects/120" + */ + project_url: string; + /** + * @format date-time + * @example "2016-09-05T14:20:22Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/projects/columns/cards/1478" + */ + url: string; +} + +/** + * Project Column + * Project columns contain cards of work. + */ +export interface ProjectColumn { + /** + * @format uri + * @example "https://api.github.com/projects/columns/367/cards" + */ + cards_url: string; + /** + * @format date-time + * @example "2016-09-05T14:18:44Z" + */ + created_at: string; + /** + * The unique identifier of the project column + * @example 42 + */ + id: number; + /** + * Name of the project column + * @example "Remaining tasks" + */ + name: string; + /** @example "MDEzOlByb2plY3RDb2x1bW4zNjc=" */ + node_id: string; + /** + * @format uri + * @example "https://api.github.com/projects/120" + */ + project_url: string; + /** + * @format date-time + * @example "2016-09-05T14:22:28Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/projects/columns/367" + */ + url: string; +} + +/** + * Protected Branch + * Branch protections protect branches + */ +export interface ProtectedBranch { + allow_deletions?: { + enabled: boolean; + }; + allow_force_pushes?: { + enabled: boolean; + }; + enforce_admins?: { + enabled: boolean; + /** @format uri */ + url: string; + }; + required_linear_history?: { + enabled: boolean; + }; + required_pull_request_reviews?: { + dismiss_stale_reviews?: boolean; + dismissal_restrictions?: { + teams: Team[]; + /** @format uri */ + teams_url: string; + /** @format uri */ + url: string; + users: SimpleUser[]; + /** @format uri */ + users_url: string; + }; + 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; + }; + /** Status Check Policy */ + required_status_checks?: StatusCheckPolicy; + /** Branch Restriction Policy */ + restrictions?: BranchRestrictionPolicy; + /** @format uri */ + url: string; +} + +/** + * Protected Branch Admin Enforced + * Protected Branch Admin Enforced + */ +export interface ProtectedBranchAdminEnforced { + /** @example true */ + enabled: boolean; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/enforce_admins" + */ + url: string; +} + +/** + * Protected Branch Pull Request Review + * Protected Branch Pull Request Review + */ +export interface ProtectedBranchPullRequestReview { + /** @example true */ + dismiss_stale_reviews: boolean; + dismissal_restrictions?: { + /** 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 true */ + require_code_owner_reviews: boolean; + /** + * @min 1 + * @max 6 + * @example 2 + */ + required_approving_review_count?: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/dismissal_restrictions" + */ + url?: string; +} + +/** + * Public User + * Public User + */ +export interface PublicUser { + /** @format uri */ + avatar_url: string; + bio: string | null; + blog: string | null; + /** @example 3 */ + collaborators?: number; + company: string | null; + /** @format date-time */ + created_at: string; + /** @example 1 */ + disk_usage?: number; + /** @format email */ + email: string | null; + events_url: string; + followers: number; + /** @format uri */ + followers_url: string; + following: number; + following_url: string; + gists_url: string; + gravatar_id: string | null; + hireable: boolean | null; + /** @format uri */ + html_url: string; + id: number; + location: string | null; + login: string; + name: string | null; + node_id: string; + /** @format uri */ + organizations_url: string; + /** @example 2 */ + owned_private_repos?: number; + plan?: { + collaborators: number; + name: string; + private_repos: number; + space: number; + }; + /** @example 1 */ + private_gists?: number; + public_gists: number; + public_repos: number; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + /** @format date-time */ + suspended_at?: string | null; + /** @example 2 */ + total_private_repos?: number; + twitter_username?: string | null; + type: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; +} + +/** + * Pull Request + * Pull requests let you tell others about changes you've pushed to a repository on GitHub. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary. + */ +export interface PullRequest { + _links: { + /** Hypermedia Link */ + comments: Link; + /** Hypermedia Link */ + commits: Link; + /** Hypermedia Link */ + html: Link; + /** Hypermedia Link */ + issue: 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; + /** @example 100 */ + additions: number; + assignee: SimpleUser | null; + assignees?: SimpleUser[] | null; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** The status of auto merging a pull request. */ + auto_merge: AutoMerge; + base: { + 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; + compare_url: string; + 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; + 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; + events_url: string; + /** @format uri */ + followers_url: string; + following_url: string; + gists_url: string; + gravatar_id: string | null; + /** @format uri */ + html_url: string; + id: number; + login: string; + node_id: string; + /** @format uri */ + organizations_url: string; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + type: string; + /** @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; + /** @format uri */ + subscribers_url: string; + /** @format uri */ + subscription_url: string; + /** @format uri */ + svn_url: string; + /** @format uri */ + tags_url: string; + /** @format uri */ + teams_url: string; + temp_clone_token?: string; + topics?: string[]; + trees_url: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + watchers: number; + watchers_count: number; + }; + sha: string; + user: { + /** @format uri */ + avatar_url: string; + events_url: string; + /** @format uri */ + followers_url: string; + following_url: string; + gists_url: string; + gravatar_id: string | null; + /** @format uri */ + html_url: string; + id: number; + login: string; + node_id: string; + /** @format uri */ + organizations_url: string; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + type: string; + /** @format uri */ + url: string; + }; + }; + /** @example "Please pull these awesome changes" */ + body: string | null; + /** @example 5 */ + changed_files: number; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + closed_at: string | null; + /** @example 10 */ + comments: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments" + */ + comments_url: string; + /** @example 3 */ + commits: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits" + */ + commits_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at: string; + /** @example 3 */ + deletions: number; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347.diff" + */ + diff_url: string; + /** + * Indicates whether or not the pull request is a draft. + * @example false + */ + draft?: boolean; + head: { + 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; + compare_url: string; + 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; + 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; + events_url: string; + /** @format uri */ + followers_url: string; + following_url: string; + gists_url: string; + gravatar_id: string | null; + /** @format uri */ + html_url: string; + id: number; + login: string; + node_id: string; + /** @format uri */ + organizations_url: string; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + type: string; + /** @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; + /** @format uri */ + subscribers_url: string; + /** @format uri */ + subscription_url: string; + /** @format uri */ + svn_url: string; + /** @format uri */ + tags_url: string; + /** @format uri */ + teams_url: string; + temp_clone_token?: string; + topics?: string[]; + trees_url: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + watchers: number; + watchers_count: number; + }; + sha: string; + user: { + /** @format uri */ + avatar_url: string; + events_url: string; + /** @format uri */ + followers_url: string; + following_url: string; + gists_url: string; + gravatar_id: string | null; + /** @format uri */ + html_url: string; + id: number; + login: string; + node_id: string; + /** @format uri */ + organizations_url: string; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + type: string; + /** @format uri */ + url: string; + }; + }; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347" + */ + html_url: string; + /** @example 1 */ + id: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347" + */ + issue_url: string; + labels: { + color?: string; + default?: boolean; + description?: string | null; + id?: number; + name?: string; + node_id?: string; + url?: string; + }[]; + /** @example true */ + locked: boolean; + /** + * Indicates whether maintainers can modify the pull request. + * @example true + */ + maintainer_can_modify: boolean; + /** @example "e5bd3914e2e596debea16f433f57875b5b90bcd6" */ + merge_commit_sha: string | null; + /** @example true */ + mergeable: boolean | null; + /** @example "clean" */ + mergeable_state: string; + merged: boolean; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + merged_at: string | null; + merged_by: SimpleUser | null; + milestone: Milestone | null; + /** @example "MDExOlB1bGxSZXF1ZXN0MQ==" */ + node_id: string; + /** + * Number uniquely identifying the pull request within its repository. + * @example 42 + */ + number: number; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347.patch" + */ + patch_url: string; + /** @example true */ + rebaseable?: boolean | null; + requested_reviewers?: SimpleUser[] | null; + requested_teams?: TeamSimple[] | null; + /** @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}" */ + review_comment_url: string; + /** @example 0 */ + review_comments: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments" + */ + review_comments_url: string; + /** + * State of this Pull Request. Either \`open\` or \`closed\`. + * @example "open" + */ + state: "open" | "closed"; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + statuses_url: string; + /** + * The title of the pull request. + * @example "Amazing new feature" + */ + title: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Pull Request Merge Result + * Pull Request Merge Result + */ +export interface PullRequestMergeResult { + merged: boolean; + message: string; + sha: string; +} + +/** Pull Request Minimal */ +export interface PullRequestMinimal { + base: { + ref: string; + repo: { + id: number; + name: string; + url: string; + }; + sha: string; + }; + head: { + ref: string; + repo: { + id: number; + name: string; + url: string; + }; + sha: string; + }; + id: number; + number: number; + url: string; +} + +/** + * Pull Request Review + * Pull Request Reviews are reviews on pull requests. + */ +export interface PullRequestReview { + _links: { + html: { + href: string; + }; + pull_request: { + href: string; + }; + }; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** + * The text of the review. + * @example "This looks great." + */ + body: string; + body_html?: string; + body_text?: string; + /** + * A commit SHA for the review. + * @example "54bb654c9e6025347f57900a4a5c2313a96b8035" + */ + commit_id: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/12#pullrequestreview-80" + */ + html_url: string; + /** + * Unique identifier of the review + * @example 42 + */ + id: number; + /** @example "MDE3OlB1bGxSZXF1ZXN0UmV2aWV3ODA=" */ + node_id: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/12" + */ + pull_request_url: string; + /** @example "CHANGES_REQUESTED" */ + state: string; + /** @format date-time */ + submitted_at?: string; + user: SimpleUser | null; +} + +/** + * Pull Request Review Comment + * Pull Request Review Comments are comments on a portion of the Pull Request's diff. + */ +export interface PullRequestReviewComment { + _links: { + html: { + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" + */ + href: string; + }; + pull_request: { + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" + */ + href: string; + }; + self: { + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" + */ + href: string; + }; + }; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** + * The text of the comment. + * @example "We should probably include a check for null values here." + */ + body: string; + /** @example ""

comment body

"" */ + body_html?: string; + /** @example ""comment body"" */ + body_text?: string; + /** + * The SHA of the commit to which the comment applies. + * @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + commit_id: string; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + created_at: string; + /** + * The diff of the line that the comment refers to. + * @example "@@ -16,33 +16,40 @@ public class Connection : IConnection..." + */ + diff_hunk: string; + /** + * HTML URL for the pull request review comment. + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" + */ + html_url: string; + /** + * The ID of the pull request review comment. + * @example 1 + */ + id: number; + /** + * The comment ID to reply to. + * @example 8 + */ + in_reply_to_id?: number; + /** + * The line of the blob to which the comment applies. The last line of the range for a multi-line comment + * @example 2 + */ + line?: number; + /** + * The node ID of the pull request review comment. + * @example "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw" + */ + node_id: string; + /** + * The SHA of the original commit to which the comment applies. + * @example "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840" + */ + original_commit_id: string; + /** + * The line of the blob to which the comment applies. The last line of the range for a multi-line comment + * @example 2 + */ + original_line?: number; + /** + * The index of the original line in the diff to which the comment applies. + * @example 4 + */ + original_position: number; + /** + * The first line of the range for a multi-line comment. + * @example 2 + */ + original_start_line?: number | null; + /** + * The relative path of the file to which the comment applies. + * @example "config/database.yaml" + */ + path: string; + /** + * The line index in the diff to which the comment applies. + * @example 1 + */ + position: number; + /** + * The ID of the pull request review to which the comment belongs. + * @example 42 + */ + pull_request_review_id: number | null; + /** + * URL for the pull request that the review comment belongs to. + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" + */ + pull_request_url: string; + reactions?: ReactionRollup; + /** + * The side of the diff to which the comment applies. The side of the last line of the range for a multi-line comment + * @default "RIGHT" + */ + side?: "LEFT" | "RIGHT"; + /** + * The first line of the range for a multi-line comment. + * @example 2 + */ + start_line?: number | null; + /** + * The side of the first line of the range for a multi-line comment. + * @default "RIGHT" + */ + start_side?: "LEFT" | "RIGHT" | null; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + updated_at: string; + /** + * URL for the pull request review comment + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" + */ + url: string; + /** Simple User */ + user: SimpleUser; +} + +/** + * Pull Request Review Request + * Pull Request Review Request + */ +export interface PullRequestReviewRequest { + teams: TeamSimple[]; + users: SimpleUser[]; +} + +/** + * Pull Request Simple + * Pull Request Simple + */ +export interface PullRequestSimple { + _links: { + /** Hypermedia Link */ + comments: Link; + /** Hypermedia Link */ + commits: Link; + /** Hypermedia Link */ + html: Link; + /** Hypermedia Link */ + issue: 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; + assignee: SimpleUser | null; + assignees?: SimpleUser[] | null; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** The status of auto merging a pull request. */ + auto_merge: AutoMerge; + base: { + label: string; + ref: string; + /** A git repository */ + repo: Repository; + sha: string; + user: SimpleUser | null; + }; + /** @example "Please pull these awesome changes" */ + body: string | null; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + closed_at: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347/comments" + */ + comments_url: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/commits" + */ + commits_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347.diff" + */ + diff_url: string; + /** + * Indicates whether or not the pull request is a draft. + * @example false + */ + draft?: boolean; + head: { + label: string; + ref: string; + /** A git repository */ + repo: Repository; + sha: string; + user: SimpleUser | null; + }; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347" + */ + html_url: string; + /** @example 1 */ + id: number; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/issues/1347" + */ + issue_url: string; + labels: { + color?: string; + default?: boolean; + description?: string; + id?: number; + name?: string; + node_id?: string; + url?: string; + }[]; + /** @example true */ + locked: boolean; + /** @example "e5bd3914e2e596debea16f433f57875b5b90bcd6" */ + merge_commit_sha: string | null; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + merged_at: string | null; + milestone: Milestone | null; + /** @example "MDExOlB1bGxSZXF1ZXN0MQ==" */ + node_id: string; + /** @example 1347 */ + number: number; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1347.patch" + */ + patch_url: string; + requested_reviewers?: SimpleUser[] | null; + requested_teams?: TeamSimple[] | null; + /** @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments{/number}" */ + review_comment_url: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347/comments" + */ + review_comments_url: string; + /** @example "open" */ + state: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e" + */ + statuses_url: string; + /** @example "new-feature" */ + title: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1347" + */ + url: string; + user: SimpleUser | null; +} + +/** Rate Limit */ +export interface RateLimit { + limit: number; + remaining: number; + reset: number; +} + +/** + * Rate Limit Overview + * Rate Limit Overview + */ +export interface RateLimitOverview { + rate: RateLimit; + resources: { + code_scanning_upload?: RateLimit; + core: RateLimit; + graphql?: RateLimit; + integration_manifest?: RateLimit; + search: RateLimit; + source_import?: RateLimit; + }; +} + +/** + * Reaction + * Reactions to conversations provide a way to help people express their feelings more simply and effectively. + */ +export interface Reaction { + /** + * The reaction to use + * @example "heart" + */ + content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + /** + * @format date-time + * @example "2016-05-20T20:09:31Z" + */ + created_at: string; + /** @example 1 */ + id: number; + /** @example "MDg6UmVhY3Rpb24x" */ + node_id: string; + user: SimpleUser | null; +} + +/** Reaction Rollup */ +export interface ReactionRollup { + "+1": number; + "-1": number; + confused: number; + eyes: number; + heart: number; + hooray: number; + laugh: number; + rocket: number; + total_count: number; + /** @format uri */ + url: string; +} + +/** + * Referrer Traffic + * Referrer Traffic + */ +export interface ReferrerTraffic { + /** @example 4 */ + count: number; + /** @example "Google" */ + referrer: string; + /** @example 3 */ + uniques: number; +} + +/** + * Release + * A release. + */ +export interface Release { + assets: ReleaseAsset[]; + /** @format uri */ + assets_url: string; + /** Simple User */ + author: SimpleUser; + body?: string | null; + body_html?: string; + body_text?: string; + /** @format date-time */ + created_at: string; + /** + * true to create a draft (unpublished) release, false to create a published one. + * @example false + */ + draft: boolean; + /** @format uri */ + html_url: string; + id: number; + name: string | null; + node_id: string; + /** + * Whether to identify the release as a prerelease or a full release. + * @example false + */ + prerelease: boolean; + /** @format date-time */ + published_at: string | null; + /** + * The name of the tag. + * @example "v1.0.0" + */ + tag_name: string; + /** @format uri */ + tarball_url: string | null; + /** + * Specifies the commitish value that determines where the Git tag is created from. + * @example "master" + */ + target_commitish: string; + upload_url: string; + /** @format uri */ + url: string; + /** @format uri */ + zipball_url: string | null; +} + +/** + * Release Asset + * Data related to a release. + */ +export interface ReleaseAsset { + /** @format uri */ + browser_download_url: string; + content_type: string; + /** @format date-time */ + created_at: string; + download_count: number; + id: number; + label: string | null; + /** + * The file name of the asset. + * @example "Team Environment" + */ + name: string; + node_id: string; + size: number; + /** State of the release asset. */ + state: "uploaded" | "open"; + /** @format date-time */ + updated_at: string; + uploader: SimpleUser | null; + /** @format uri */ + url: string; +} + +/** + * Repo Search Result Item + * Repo Search Result Item + */ +export interface RepoSearchResultItem { + 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; + /** @format uri */ + contributors_url: string; + /** @format date-time */ + created_at: string; + default_branch: string; + delete_branch_on_merge?: boolean; + /** @format uri */ + deployments_url: string; + description: string | null; + /** Returns whether or not this repository disabled. */ + 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; + 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: SimpleUser | null; + permissions?: { + admin: boolean; + pull: boolean; + push: boolean; + }; + private: boolean; + pulls_url: string; + /** @format date-time */ + pushed_at: string; + releases_url: string; + score: number; + size: number; + ssh_url: string; + stargazers_count: number; + /** @format uri */ + stargazers_url: string; + statuses_url: string; + /** @format uri */ + subscribers_url: string; + /** @format uri */ + subscription_url: string; + /** @format uri */ + svn_url: string; + /** @format uri */ + tags_url: string; + /** @format uri */ + teams_url: string; + temp_clone_token?: string; + text_matches?: SearchResultTextMatches; + topics?: string[]; + trees_url: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; + watchers: number; + watchers_count: number; +} + +/** + * Repository + * A git repository + */ +export interface Repository { + /** + * Whether to allow merge commits for pull requests. + * @default true + * @example true + */ + allow_merge_commit?: boolean; + /** + * Whether to allow rebase merges for pull requests. + * @default true + * @example true + */ + allow_rebase_merge?: boolean; + /** + * Whether to allow squash merges for pull requests. + * @default true + * @example true + */ + allow_squash_merge?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ + archive_url: string; + /** + * Whether the repository is archived. + * @default false + */ + archived: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ + assignees_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ + blobs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ + branches_url: string; + /** @example "https://github.com/octocat/Hello-World.git" */ + clone_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ + collaborators_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ + comments_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ + commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ + compare_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ + contents_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/contributors" + */ + contributors_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at: string | null; + /** + * The default branch of the repository. + * @example "master" + */ + default_branch: string; + /** + * Whether to delete head branches when pull requests are merged + * @default false + * @example false + */ + delete_branch_on_merge?: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/deployments" + */ + deployments_url: string; + /** @example "This your first repo!" */ + description: string | null; + /** Returns whether or not this repository disabled. */ + disabled: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/downloads" + */ + downloads_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/events" + */ + events_url: string; + fork: boolean; + forks: number; + /** @example 9 */ + forks_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/forks" + */ + forks_url: string; + /** @example "octocat/Hello-World" */ + full_name: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ + git_commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ + git_refs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ + git_tags_url: string; + /** @example "git:github.com/octocat/Hello-World.git" */ + git_url: string; + /** + * Whether downloads are enabled. + * @default true + * @example true + */ + has_downloads: boolean; + /** + * Whether issues are enabled. + * @default true + * @example true + */ + has_issues: boolean; + has_pages: boolean; + /** + * Whether projects are enabled. + * @default true + * @example true + */ + has_projects: boolean; + /** + * Whether the wiki is enabled. + * @default true + * @example true + */ + has_wiki: boolean; + /** + * @format uri + * @example "https://github.com" + */ + homepage: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/hooks" + */ + hooks_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World" + */ + html_url: string; + /** + * Unique identifier of the repository + * @example 42 + */ + id: number; + /** + * Whether this repository acts as a template that can be used to generate new repositories. + * @default false + * @example true + */ + is_template?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ + issue_comment_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ + issue_events_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ + issues_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ + keys_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ + labels_url: string; + language: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/languages" + */ + languages_url: string; + license: LicenseSimple | null; + master_branch?: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/merges" + */ + merges_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ + milestones_url: string; + /** + * @format uri + * @example "git:git.example.com/octocat/Hello-World" + */ + mirror_url: string | null; + /** + * The name of the repository. + * @example "Team Environment" + */ + name: string; + network_count?: number; + /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ + node_id: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ + notifications_url: string; + open_issues: number; + /** @example 0 */ + open_issues_count: number; + owner: SimpleUser | null; + permissions?: { + admin: boolean; + maintain?: boolean; + pull: boolean; + push: boolean; + triage?: boolean; + }; + /** + * Whether the repository is private or public. + * @default false + */ + private: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ + pulls_url: string; + /** + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + pushed_at: string | null; + /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ + releases_url: string; + /** @example 108 */ + size: number; + /** @example "git@github.com:octocat/Hello-World.git" */ + ssh_url: string; + /** @example 80 */ + stargazers_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" + */ + stargazers_url: string; + /** @example ""2020-07-09T00:17:42Z"" */ + starred_at?: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ + statuses_url: string; + subscribers_count?: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" + */ + subscribers_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscription" + */ + subscription_url: string; + /** + * @format uri + * @example "https://svn.github.com/octocat/Hello-World" + */ + svn_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/tags" + */ + tags_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/teams" + */ + teams_url: string; + temp_clone_token?: string; + template_repository?: { + 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; + temp_clone_token?: string; + topics?: string[]; + trees_url?: string; + updated_at?: string; + url?: string; + visibility?: string; + watchers_count?: number; + } | null; + topics?: string[]; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ + trees_url: string; + /** + * @format date-time + * @example "2011-01-26T19:14:43Z" + */ + updated_at: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World" + */ + url: string; + /** + * The repository visibility: public, private, or internal. + * @default "public" + */ + visibility?: string; + watchers: number; + /** @example 80 */ + watchers_count: number; +} + +/** + * Repository Collaborator Permission + * Repository Collaborator Permission + */ +export interface RepositoryCollaboratorPermission { + permission: string; + user: SimpleUser | null; +} + +/** + * Repository Invitation + * Repository invitations let you manage who you collaborate with. + */ +export interface RepositoryInvitation { + /** + * @format date-time + * @example "2016-06-13T14:52:50-05:00" + */ + created_at: string; + /** Whether or not the invitation has expired */ + expired?: boolean; + /** @example "https://github.com/octocat/Hello-World/invitations" */ + html_url: string; + /** + * Unique identifier of the repository invitation. + * @example 42 + */ + id: number; + invitee: SimpleUser | null; + inviter: SimpleUser | null; + node_id: string; + /** + * The permission associated with the invitation. + * @example "read" + */ + permissions: "read" | "write" | "admin"; + /** Minimal Repository */ + repository: MinimalRepository; + /** + * URL for the repository invitation + * @example "https://api.github.com/user/repository-invitations/1" + */ + url: string; +} + +/** + * Repository Invitation + * Repository invitations let you manage who you collaborate with. + */ +export interface RepositorySubscription { + /** + * @format date-time + * @example "2012-10-06T21:34:12Z" + */ + created_at: string; + /** Determines if all notifications should be blocked from this repository. */ + ignored: boolean; + reason: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example" + */ + repository_url: string; + /** + * Determines if notifications should be received from this repository. + * @example true + */ + subscribed: boolean; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/example/subscription" + */ + url: string; +} + +/** + * Legacy Review Comment + * Legacy Review Comment + */ +export interface ReviewComment { + _links: { + /** Hypermedia Link */ + html: Link; + /** Hypermedia Link */ + pull_request: Link; + /** Hypermedia Link */ + self: Link; + }; + /** How the author is associated with the repository. */ + author_association: AuthorAssociation; + /** @example "Great stuff" */ + body: string; + body_html?: string; + body_text?: string; + /** @example "6dcb09b5b57875f334f61aebed695e2e4193db5e" */ + commit_id: string; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + created_at: string; + /** @example "@@ -16,33 +16,40 @@ public class Connection : IConnection..." */ + diff_hunk: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/pull/1#discussion-diff-1" + */ + html_url: string; + /** @example 10 */ + id: number; + /** @example 8 */ + in_reply_to_id?: number; + /** + * The line of the blob to which the comment applies. The last line of the range for a multi-line comment + * @example 2 + */ + line?: number; + /** @example "MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDEw" */ + node_id: string; + /** @example "9c48853fa3dc5c1c3d6f1f1cd1f2743e72652840" */ + original_commit_id: string; + /** + * The original line of the blob to which the comment applies. The last line of the range for a multi-line comment + * @example 2 + */ + original_line?: number; + /** @example 4 */ + original_position: number; + /** + * The original first line of the range for a multi-line comment. + * @example 2 + */ + original_start_line?: number | null; + /** @example "file1.txt" */ + path: string; + /** @example 1 */ + position: number | null; + /** @example 42 */ + pull_request_review_id: number | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/1" + */ + pull_request_url: string; + /** + * The side of the first line of the range for a multi-line comment. + * @default "RIGHT" + */ + side?: "LEFT" | "RIGHT"; + /** + * The first line of the range for a multi-line comment. + * @example 2 + */ + start_line?: number | null; + /** + * The side of the first line of the range for a multi-line comment. + * @default "RIGHT" + */ + start_side?: "LEFT" | "RIGHT" | null; + /** + * @format date-time + * @example "2011-04-14T16:00:49Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/pulls/comments/1" + */ + url: string; + user: SimpleUser | null; +} + +/** + * Self hosted runners + * A self hosted runner + */ +export interface Runner { + busy: boolean; + /** + * The id of the runner. + * @example 5 + */ + id: number; + labels: { + /** Unique identifier of the label. */ + id?: number; + /** Name of the label. */ + name?: string; + /** The type of label. Read-only labels are applied automatically when the runner is configured. */ + type?: "read-only" | "custom"; + }[]; + /** + * The name of the runner. + * @example "iMac" + */ + name: string; + /** + * The Operating System of the runner. + * @example "macos" + */ + os: string; + /** + * The status of the runner. + * @example "online" + */ + status: string; +} + +/** + * Runner Application + * Runner Application + */ +export interface RunnerApplication { + architecture: string; + download_url: string; + filename: string; + os: string; +} + +export interface RunnerGroupsEnterprise { + allows_public_repositories: boolean; + default: boolean; + id: number; + name: string; + runners_url: string; + selected_organizations_url?: string; + visibility: string; +} + +export interface RunnerGroupsOrg { + allows_public_repositories: boolean; + default: boolean; + id: number; + inherited: boolean; + inherited_allows_public_repositories?: boolean; + name: string; + runners_url: string; + /** Link to the selected repositories resource for this runner group. Not present unless visibility was set to \`selected\` */ + selected_repositories_url?: string; + visibility: string; +} + +export interface ScimEnterpriseGroup { + displayName?: string; + externalId?: string | null; + id: string; + members?: { + $ref?: string; + display?: string; + value?: string; + }[]; + meta?: { + created?: string; + lastModified?: string; + location?: string; + resourceType?: string; + }; + schemas: string[]; +} + +export interface ScimEnterpriseUser { + active?: boolean; + emails?: { + primary?: boolean; + type?: string; + value?: string; + }[]; + externalId?: string; + groups?: { + value?: string; + }[]; + id: string; + meta?: { + created?: string; + lastModified?: string; + location?: string; + resourceType?: string; + }; + name?: { + familyName?: string; + givenName?: string; + }; + schemas: string[]; + userName?: string; +} + +/** + * Scim Error + * Scim Error + */ +export interface ScimError { + detail?: string | null; + documentation_url?: string | null; + message?: string | null; + schemas?: string[]; + scimType?: string | null; + status?: number; +} + +export interface ScimGroupListEnterprise { + Resources: { + displayName?: string; + externalId?: string | null; + id: string; + members?: { + $ref?: string; + display?: string; + value?: string; + }[]; + meta?: { + created?: string; + lastModified?: string; + location?: string; + resourceType?: string; + }; + schemas: string[]; + }[]; + itemsPerPage: number; + schemas: string[]; + startIndex: number; + totalResults: number; +} + +/** + * SCIM /Users + * SCIM /Users provisioning endpoints + */ +export interface ScimUser { + /** + * The active status of the User. + * @example true + */ + active: boolean; + /** + * The name of the user, suitable for display to end-users + * @example "Jon Doe" + */ + displayName?: string | null; + /** + * user emails + * @minItems 1 + * @example [{"value":"someone@example.com","primary":true},{"value":"another@example.com","primary":false}] + */ + emails: { + primary?: boolean; + value: string; + }[]; + /** + * The ID of the User. + * @example "a7b0f98395" + */ + externalId: string | null; + /** associated groups */ + groups?: { + display?: string; + value?: string; + }[]; + /** + * Unique identifier of an external identity + * @example "1b78eada-9baa-11e6-9eb6-a431576d590e" + */ + id: string; + meta: { + /** + * @format date-time + * @example "2019-01-24T22:45:36.000Z" + */ + created?: string; + /** + * @format date-time + * @example "2019-01-24T22:45:36.000Z" + */ + lastModified?: string; + /** + * @format uri + * @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: { + familyName: string | null; + formatted?: string | null; + givenName: string | null; + }; + /** + * Set of operations to be performed + * @minItems 1 + * @example [{"op":"replace","value":{"active":false}}] + */ + operations?: { + op: "add" | "remove" | "replace"; + path?: string; + value?: string | object | any[]; + }[]; + /** The ID of the organization. */ + organization_id?: number; + /** + * SCIM schema used. + * @minItems 1 + */ + schemas: string[]; + /** + * Configured by the admin. Could be an email, login, or username + * @example "someone@example.com" + */ + userName: string | null; +} + +/** + * SCIM User List + * SCIM User List + */ +export interface ScimUserList { + Resources: ScimUser[]; + /** @example 10 */ + itemsPerPage: number; + /** + * SCIM schema used. + * @minItems 1 + */ + schemas: string[]; + /** @example 1 */ + startIndex: number; + /** @example 3 */ + totalResults: number; +} + +export interface ScimUserListEnterprise { + Resources: { + active?: boolean; + emails?: { + primary?: boolean; + type?: string; + value?: string; + }[]; + externalId?: string; + groups?: { + value?: string; + }[]; + id: string; + meta?: { + created?: string; + lastModified?: string; + location?: string; + resourceType?: string; + }; + name?: { + familyName?: string; + givenName?: string; + }; + schemas: string[]; + userName?: string; + }[]; + itemsPerPage: number; + schemas: string[]; + startIndex: number; + totalResults: number; +} + +/** Scoped Installation */ +export interface ScopedInstallation { + /** Simple User */ + account: SimpleUser; + /** @example true */ + has_multiple_single_files?: boolean; + /** The permissions granted to the user-to-server access token. */ + permissions: AppPermissions; + /** + * @format uri + * @example "https://api.github.com/users/octocat/repos" + */ + repositories_url: string; + /** Describe whether all repositories have been selected or there's a selection involved */ + repository_selection: "all" | "selected"; + /** @example "config.yaml" */ + single_file_name: string | null; + /** @example ["config.yml",".github/issue_TEMPLATE.md"] */ + single_file_paths?: string[]; +} + +/** Search Result Text Matches */ +export type SearchResultTextMatches = { + fragment?: string; + matches?: { + indices?: number[]; + text?: string; + }[]; + object_type?: string | null; + object_url?: string; + property?: string; +}[]; + +export interface SecretScanningAlert { + /** The time that the alert was created in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + created_at?: AlertCreatedAt; + /** The GitHub URL of the alert resource. */ + html_url?: AlertHtmlUrl; + /** The security alert number. */ + number?: AlertNumber; + /** **Required when the \`state\` is \`resolved\`.** The reason for resolving the alert. Can be one of \`false_positive\`, \`wont_fix\`, \`revoked\`, or \`used_in_tests\`. */ + resolution?: SecretScanningAlertResolution; + /** + * The time that the alert was resolved in ISO 8601 format: \`YYYY-MM-DDTHH:MM:SSZ\`. + * @format date-time + */ + resolved_at?: string | null; + /** Simple User */ + resolved_by?: SimpleUser; + /** The secret that was detected. */ + secret?: string; + /** The type of secret that secret scanning detected. */ + secret_type?: string; + /** Sets the state of the secret scanning alert. Can be either \`open\` or \`resolved\`. You must provide \`resolution\` when you set the state to \`resolved\`. */ + state?: SecretScanningAlertState; + /** The REST API URL of the alert resource. */ + url?: AlertUrl; +} + +/** **Required when the \`state\` is \`resolved\`.** The reason for resolving the alert. Can be one of \`false_positive\`, \`wont_fix\`, \`revoked\`, or \`used_in_tests\`. */ +export type SecretScanningAlertResolution = "false_positive" | "wont_fix" | "revoked" | "used_in_tests" | null; + +/** Sets the state of the secret scanning alert. Can be either \`open\` or \`resolved\`. You must provide \`resolution\` when you set the state to \`resolved\`. */ +export enum SecretScanningAlertState { + Open = "open", + Resolved = "resolved", +} + +export interface SelectedActions { + /** Whether GitHub-owned actions are allowed. For example, this includes the actions in the \`actions\` organization. */ + github_owned_allowed: boolean; + /** Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, \`monalisa/octocat@*\`, \`monalisa/octocat@v2\`, \`monalisa/*\`." */ + patterns_allowed: string[]; + /** Whether actions in GitHub Marketplace from verified creators are allowed. Set to \`true\` to allow all GitHub Marketplace actions by verified creators. */ + verified_allowed: boolean; +} + +/** The API URL to use to get or set the actions that are allowed to run, when \`allowed_actions\` is set to \`selected\`. */ +export type SelectedActionsUrl = string; + +/** + * Short Blob + * Short Blob + */ +export interface ShortBlob { + sha: string; + url: string; +} + +/** + * Short Branch + * Short Branch + */ +export interface ShortBranch { + commit: { + sha: string; + /** @format uri */ + url: string; + }; + name: string; + protected: boolean; + /** Branch Protection */ + protection?: BranchProtection; + /** @format uri */ + protection_url?: string; +} + +/** + * Simple Commit + * Simple Commit + */ +export interface SimpleCommit { + author: { + email: string; + name: string; + } | null; + committer: { + email: string; + name: string; + } | null; + id: string; + message: string; + /** @format date-time */ + timestamp: string; + tree_id: string; +} + +/** Simple Commit Status */ +export interface SimpleCommitStatus { + /** @format uri */ + avatar_url: string | null; + context: string; + /** @format date-time */ + created_at: string; + description: string | null; + id: number; + node_id: string; + required?: boolean | null; + state: string; + /** @format uri */ + target_url: string; + /** @format date-time */ + updated_at: string; + /** @format uri */ + url: string; +} + +/** + * Simple User + * Simple User + */ +export type SimpleUser = { + /** + * @format uri + * @example "https://github.com/images/error/octocat_happy.gif" + */ + avatar_url: string; + /** @example "https://api.github.com/users/octocat/events{/privacy}" */ + events_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/followers" + */ + followers_url: string; + /** @example "https://api.github.com/users/octocat/following{/other_user}" */ + following_url: string; + /** @example "https://api.github.com/users/octocat/gists{/gist_id}" */ + gists_url: string; + /** @example "41d064eb2195891e12d0413f63227ea7" */ + gravatar_id: string | null; + /** + * @format uri + * @example "https://github.com/octocat" + */ + html_url: string; + /** @example 1 */ + id: number; + /** @example "octocat" */ + login: string; + /** @example "MDQ6VXNlcjE=" */ + node_id: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/orgs" + */ + organizations_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/received_events" + */ + received_events_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/repos" + */ + repos_url: string; + site_admin: boolean; + /** @example ""2020-07-09T00:17:55Z"" */ + starred_at?: string; + /** @example "https://api.github.com/users/octocat/starred{/owner}{/repo}" */ + starred_url: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat/subscriptions" + */ + subscriptions_url: string; + /** @example "User" */ + type: string; + /** + * @format uri + * @example "https://api.github.com/users/octocat" + */ + url: string; +}; + +/** + * Stargazer + * Stargazer + */ +export interface Stargazer { + /** @format date-time */ + starred_at: string; + user: SimpleUser | null; +} + +/** + * Starred Repository + * Starred Repository + */ +export interface StarredRepository { + /** A git repository */ + repo: Repository; + /** @format date-time */ + starred_at: string; +} + +/** + * Status + * The status of a commit. + */ +export interface Status { + avatar_url: string | null; + context: string; + created_at: string; + /** Simple User */ + creator: SimpleUser; + description: string; + id: number; + node_id: string; + state: string; + target_url: string; + updated_at: string; + url: string; +} + +/** + * Status Check Policy + * Status Check Policy + */ +export interface StatusCheckPolicy { + /** @example ["continuous-integration/travis-ci"] */ + contexts: string[]; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks/contexts" + */ + contexts_url: string; + /** @example true */ + strict: boolean; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_status_checks" + */ + url: string; +} + +/** + * Tag + * Tag + */ +export interface Tag { + commit: { + sha: string; + /** @format uri */ + url: string; + }; + /** @example "v0.1" */ + name: string; + node_id: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/tarball/v0.1" + */ + tarball_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World/zipball/v0.1" + */ + zipball_url: string; +} + +/** + * Team + * Groups of organization members that gives permissions on specified repositories. + */ +export interface Team { + description: string | null; + /** + * @format uri + * @example "https://github.com/orgs/rails/teams/core" + */ + html_url: string; + id: number; + members_url: string; + name: string; + node_id: string; + parent?: TeamSimple | null; + permission: string; + privacy?: string; + /** @format uri */ + repositories_url: string; + slug: string; + /** @format uri */ + url: string; +} + +/** + * Team Discussion + * A team discussion is a persistent record of a free-form conversation within a team. + */ +export interface TeamDiscussion { + author: SimpleUser | null; + /** + * The main text of the discussion. + * @example "Please suggest improvements to our workflow in comments." + */ + body: string; + /** @example "

Hi! This is an area for us to collaborate as a team

" */ + body_html: string; + /** + * The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. + * @example "0307116bbf7ced493b8d8a346c650b71" + */ + body_version: string; + /** @example 0 */ + comments_count: number; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/2343027/discussions/1/comments" + */ + comments_url: string; + /** + * @format date-time + * @example "2018-01-25T18:56:31Z" + */ + created_at: string; + /** + * @format uri + * @example "https://github.com/orgs/github/teams/justice-league/discussions/1" + */ + html_url: string; + /** @format date-time */ + last_edited_at: string | null; + /** @example "MDE0OlRlYW1EaXNjdXNzaW9uMQ==" */ + node_id: string; + /** + * The unique sequence number of a team discussion. + * @example 42 + */ + number: number; + /** + * Whether or not this discussion should be pinned for easy retrieval. + * @example true + */ + pinned: boolean; + /** + * Whether or not this discussion should be restricted to team members and organization administrators. + * @example true + */ + private: boolean; + reactions?: ReactionRollup; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/2343027" + */ + team_url: string; + /** + * The title of the discussion. + * @example "How can we improve our workflow?" + */ + title: string; + /** + * @format date-time + * @example "2018-01-25T18:56:31Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/2343027/discussions/1" + */ + url: string; +} + +/** + * Team Discussion Comment + * A reply to a discussion within a team. + */ +export interface TeamDiscussionComment { + author: SimpleUser | null; + /** + * The main text of the comment. + * @example "I agree with this suggestion." + */ + body: string; + /** @example "

Do you like apples?

" */ + body_html: string; + /** + * The current version of the body content. If provided, this update operation will be rejected if the given version does not match the latest version on the server. + * @example "0307116bbf7ced493b8d8a346c650b71" + */ + body_version: string; + /** + * @format date-time + * @example "2018-01-15T23:53:58Z" + */ + created_at: string; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/2403582/discussions/1" + */ + discussion_url: string; + /** + * @format uri + * @example "https://github.com/orgs/github/teams/justice-league/discussions/1/comments/1" + */ + html_url: string; + /** @format date-time */ + last_edited_at: string | null; + /** @example "MDIxOlRlYW1EaXNjdXNzaW9uQ29tbWVudDE=" */ + node_id: string; + /** + * The unique sequence number of a team discussion comment. + * @example 42 + */ + number: number; + reactions?: ReactionRollup; + /** + * @format date-time + * @example "2018-01-15T23:53:58Z" + */ + updated_at: string; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/2403582/discussions/1/comments/1" + */ + url: string; +} + +/** + * Full Team + * Groups of organization members that gives permissions on specified repositories. + */ +export interface TeamFull { + /** + * @format date-time + * @example "2017-07-14T16:53:42Z" + */ + created_at: string; + /** @example "A great team." */ + description: string | null; + /** + * @format uri + * @example "https://github.com/orgs/rails/teams/core" + */ + html_url: string; + /** + * Unique identifier of the team + * @example 42 + */ + id: number; + /** + * Distinguished Name (DN) that team maps to within LDAP environment + * @example "uid=example,ou=users,dc=github,dc=com" + */ + ldap_dn?: string; + /** @example 3 */ + members_count: number; + /** @example "https://api.github.com/organizations/1/team/1/members{/member}" */ + members_url: string; + /** + * Name of the team + * @example "Developers" + */ + name: string; + /** @example "MDQ6VGVhbTE=" */ + node_id: string; + /** Organization Full */ + organization: OrganizationFull; + parent?: TeamSimple | null; + /** + * Permission that the team will have for its repositories + * @example "push" + */ + permission: string; + /** + * The level of privacy this team should have + * @example "closed" + */ + privacy?: "closed" | "secret"; + /** @example 10 */ + repos_count: number; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/1/repos" + */ + repositories_url: string; + /** @example "justice-league" */ + slug: string; + /** + * @format date-time + * @example "2017-08-17T12:37:15Z" + */ + updated_at: string; + /** + * URL for the team + * @format uri + * @example "https://api.github.com/organizations/1/team/1" + */ + url: string; +} + +/** + * Team Membership + * Team Membership + */ +export interface TeamMembership { + /** + * The role of the user in the team. + * @default "member" + * @example "member" + */ + role: "member" | "maintainer"; + state: string; + /** @format uri */ + url: string; +} + +/** + * Team Project + * A team's access to a project. + */ +export interface TeamProject { + body: string | null; + columns_url: string; + created_at: string; + /** Simple User */ + creator: SimpleUser; + html_url: string; + id: number; + name: string; + node_id: string; + number: number; + /** The organization permission for this project. Only present when owner is an organization. */ + organization_permission?: string; + owner_url: string; + permissions: { + admin: boolean; + read: boolean; + write: boolean; + }; + /** Whether the project is private or not. Only present when owner is an organization. */ + private?: boolean; + state: string; + updated_at: string; + url: string; +} + +/** + * Team Repository + * A team's access to a repository. + */ +export interface TeamRepository { + /** + * Whether to allow merge commits for pull requests. + * @default true + * @example true + */ + allow_merge_commit?: boolean; + /** + * Whether to allow rebase merges for pull requests. + * @default true + * @example true + */ + allow_rebase_merge?: boolean; + /** + * Whether to allow squash merges for pull requests. + * @default true + * @example true + */ + allow_squash_merge?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}" */ + archive_url: string; + /** + * Whether the repository is archived. + * @default false + */ + archived: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/assignees{/user}" */ + assignees_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}" */ + blobs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/branches{/branch}" */ + branches_url: string; + /** @example "https://github.com/octocat/Hello-World.git" */ + clone_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}" */ + collaborators_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/comments{/number}" */ + comments_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/commits{/sha}" */ + commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}" */ + compare_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/contents/{+path}" */ + contents_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/contributors" + */ + contributors_url: string; + /** + * @format date-time + * @example "2011-01-26T19:01:12Z" + */ + created_at: string | null; + /** + * The default branch of the repository. + * @example "master" + */ + default_branch: string; + /** + * Whether to delete head branches when pull requests are merged + * @default false + * @example false + */ + delete_branch_on_merge?: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/deployments" + */ + deployments_url: string; + /** @example "This your first repo!" */ + description: string | null; + /** Returns whether or not this repository disabled. */ + disabled: boolean; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/downloads" + */ + downloads_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/events" + */ + events_url: string; + fork: boolean; + forks: number; + /** @example 9 */ + forks_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/forks" + */ + forks_url: string; + /** @example "octocat/Hello-World" */ + full_name: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}" */ + git_commits_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}" */ + git_refs_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}" */ + git_tags_url: string; + /** @example "git:github.com/octocat/Hello-World.git" */ + git_url: string; + /** + * Whether downloads are enabled. + * @default true + * @example true + */ + has_downloads: boolean; + /** + * Whether issues are enabled. + * @default true + * @example true + */ + has_issues: boolean; + has_pages: boolean; + /** + * Whether projects are enabled. + * @default true + * @example true + */ + has_projects: boolean; + /** + * Whether the wiki is enabled. + * @default true + * @example true + */ + has_wiki: boolean; + /** + * @format uri + * @example "https://github.com" + */ + homepage: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/hooks" + */ + hooks_url: string; + /** + * @format uri + * @example "https://github.com/octocat/Hello-World" + */ + html_url: string; + /** + * Unique identifier of the repository + * @example 42 + */ + id: number; + /** + * Whether this repository acts as a template that can be used to generate new repositories. + * @default false + * @example true + */ + is_template?: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}" */ + issue_comment_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues/events{/number}" */ + issue_events_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/issues{/number}" */ + issues_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/keys{/key_id}" */ + keys_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/labels{/name}" */ + labels_url: string; + language: string | null; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/languages" + */ + languages_url: string; + license: LicenseSimple | null; + master_branch?: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/merges" + */ + merges_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/milestones{/number}" */ + milestones_url: string; + /** + * @format uri + * @example "git:git.example.com/octocat/Hello-World" + */ + mirror_url: string | null; + /** + * The name of the repository. + * @example "Team Environment" + */ + name: string; + network_count?: number; + /** @example "MDEwOlJlcG9zaXRvcnkxMjk2MjY5" */ + node_id: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}" */ + notifications_url: string; + open_issues: number; + /** @example 0 */ + open_issues_count: number; + owner: SimpleUser | null; + permissions?: { + admin: boolean; + maintain?: boolean; + pull: boolean; + push: boolean; + triage?: boolean; + }; + /** + * Whether the repository is private or public. + * @default false + */ + private: boolean; + /** @example "http://api.github.com/repos/octocat/Hello-World/pulls{/number}" */ + pulls_url: string; + /** + * @format date-time + * @example "2011-01-26T19:06:43Z" + */ + pushed_at: string | null; + /** @example "http://api.github.com/repos/octocat/Hello-World/releases{/id}" */ + releases_url: string; + /** @example 108 */ + size: number; + /** @example "git@github.com:octocat/Hello-World.git" */ + ssh_url: string; + /** @example 80 */ + stargazers_count: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/stargazers" + */ + stargazers_url: string; + /** @example "http://api.github.com/repos/octocat/Hello-World/statuses/{sha}" */ + statuses_url: string; + subscribers_count?: number; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscribers" + */ + subscribers_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/subscription" + */ + subscription_url: string; + /** + * @format uri + * @example "https://svn.github.com/octocat/Hello-World" + */ + svn_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/tags" + */ + tags_url: string; + /** + * @format uri + * @example "http://api.github.com/repos/octocat/Hello-World/teams" + */ + teams_url: string; + temp_clone_token?: string; + template_repository?: Repository | null; + topics?: string[]; + /** @example "http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}" */ + trees_url: string; + /** + * @format date-time + * @example "2011-01-26T19:14:43Z" + */ + updated_at: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/octocat/Hello-World" + */ + url: string; + /** + * The repository visibility: public, private, or internal. + * @default "public" + */ + visibility?: string; + watchers: number; + /** @example 80 */ + watchers_count: number; +} + +/** + * Team Simple + * Groups of organization members that gives permissions on specified repositories. + */ +export type TeamSimple = { + /** + * Description of the team + * @example "A great team." + */ + description: string | null; + /** + * @format uri + * @example "https://github.com/orgs/rails/teams/core" + */ + html_url: string; + /** + * Unique identifier of the team + * @example 1 + */ + id: number; + /** + * Distinguished Name (DN) that team maps to within LDAP environment + * @example "uid=example,ou=users,dc=github,dc=com" + */ + ldap_dn?: string; + /** @example "https://api.github.com/organizations/1/team/1/members{/member}" */ + members_url: string; + /** + * Name of the team + * @example "Justice League" + */ + name: string; + /** @example "MDQ6VGVhbTE=" */ + node_id: string; + /** + * Permission that the team will have for its repositories + * @example "admin" + */ + permission: string; + /** + * The level of privacy this team should have + * @example "closed" + */ + privacy?: string; + /** + * @format uri + * @example "https://api.github.com/organizations/1/team/1/repos" + */ + repositories_url: string; + /** @example "justice-league" */ + slug: string; + /** + * URL for the team + * @format uri + * @example "https://api.github.com/organizations/1/team/1" + */ + url: string; +}; + +/** + * Thread + * Thread + */ +export interface Thread { + id: string; + last_read_at: string | null; + reason: string; + /** Minimal Repository */ + repository: MinimalRepository; + subject: { + latest_comment_url: string; + title: string; + type: string; + url: string; + }; + /** @example "https://api.github.com/notifications/threads/2/subscription" */ + subscription_url: string; + unread: boolean; + updated_at: string; + url: string; +} + +/** + * Thread Subscription + * Thread Subscription + */ +export interface ThreadSubscription { + /** + * @format date-time + * @example "2012-10-06T21:34:12Z" + */ + created_at: string | null; + ignored: boolean; + reason: string | null; + /** + * @format uri + * @example "https://api.github.com/repos/1" + */ + repository_url?: string; + /** @example true */ + subscribed: boolean; + /** + * @format uri + * @example "https://api.github.com/notifications/threads/1" + */ + thread_url?: string; + /** + * @format uri + * @example "https://api.github.com/notifications/threads/1/subscription" + */ + url: string; +} + +/** + * Topic + * A topic aggregates entities that are related to a subject. + */ +export interface Topic { + names: string[]; +} + +/** + * Topic Search Result Item + * Topic Search Result Item + */ +export interface TopicSearchResultItem { + aliases?: + | { + topic_relation?: { + id?: number; + name?: string; + relation_type?: string; + topic_id?: number; + }; + }[] + | null; + /** @format date-time */ + created_at: string; + created_by: string | null; + curated: boolean; + description: string | null; + display_name: string | null; + featured: boolean; + /** @format uri */ + logo_url?: string | null; + name: string; + related?: + | { + topic_relation?: { + id?: number; + name?: string; + relation_type?: string; + topic_id?: number; + }; + }[] + | null; + released: string | null; + repository_count?: number | null; + score: number; + short_description: string | null; + text_matches?: SearchResultTextMatches; + /** @format date-time */ + updated_at: string; +} + +/** Traffic */ +export interface Traffic { + count: number; + /** @format date-time */ + timestamp: string; + uniques: number; +} + +/** + * User Marketplace Purchase + * User Marketplace Purchase + */ +export interface UserMarketplacePurchase { + account: MarketplaceAccount; + /** @example "monthly" */ + billing_cycle: string; + /** + * @format date-time + * @example "2017-11-11T00:00:00Z" + */ + free_trial_ends_on: string | null; + /** + * @format date-time + * @example "2017-11-11T00:00:00Z" + */ + next_billing_date: string | null; + /** @example true */ + on_free_trial: boolean; + /** Marketplace Listing Plan */ + plan: MarketplaceListingPlan; + unit_count: number | null; + /** + * @format date-time + * @example "2017-11-02T01:12:12Z" + */ + updated_at: string | null; +} + +/** + * User Search Result Item + * User Search Result Item + */ +export interface UserSearchResultItem { + /** @format uri */ + avatar_url: string; + bio?: string | null; + blog?: string | null; + company?: string | null; + /** @format date-time */ + created_at?: string; + /** @format email */ + email?: string | null; + events_url: string; + followers?: number; + /** @format uri */ + followers_url: string; + following?: number; + following_url: string; + gists_url: string; + gravatar_id: string | null; + hireable?: boolean | null; + /** @format uri */ + html_url: string; + id: number; + location?: string | null; + login: string; + name?: string | null; + node_id: string; + /** @format uri */ + organizations_url: string; + public_gists?: number; + public_repos?: number; + /** @format uri */ + received_events_url: string; + /** @format uri */ + repos_url: string; + score: number; + site_admin: boolean; + starred_url: string; + /** @format uri */ + subscriptions_url: string; + /** @format date-time */ + suspended_at?: string | null; + text_matches?: SearchResultTextMatches; + type: string; + /** @format date-time */ + updated_at?: string; + /** @format uri */ + url: string; +} + +/** + * Validation Error + * Validation Error + */ +export interface ValidationError { + documentation_url: string; + errors?: { + code: string; + field?: string; + index?: number; + message?: string; + resource?: string; + value?: string | null | number | null | string[] | null; + }[]; + message: string; +} + +/** + * Validation Error Simple + * Validation Error Simple + */ +export interface ValidationErrorSimple { + documentation_url: string; + errors?: string[]; + message: string; +} + +/** Verification */ +export interface Verification { + payload: string | null; + reason: string; + signature: string | null; + verified: boolean; +} + +/** + * View Traffic + * View Traffic + */ +export interface ViewTraffic { + /** @example 14850 */ + count: number; + /** @example 3782 */ + uniques: number; + views: Traffic[]; +} + +/** + * Webhook Configuration + * Configuration object of the webhook + */ +export interface WebhookConfig { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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; + /** 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; + /** The URL to which the payloads will be delivered. */ + url?: WebhookConfigUrl; +} + +/** + * The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. + * @example ""json"" + */ +export type WebhookConfigContentType = 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.** + * @example ""0"" + */ +export type WebhookConfigInsecureSsl = 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). + * @example ""********"" + */ +export type WebhookConfigSecret = string; + +/** + * The URL to which the payloads will be delivered. + * @format uri + * @example "https://example.com/webhook" + */ +export type WebhookConfigUrl = string; + +/** + * Workflow + * A GitHub Actions workflow + */ +export interface Workflow { + /** @example "https://github.com/actions/setup-ruby/workflows/CI/badge.svg" */ + badge_url: string; + /** + * @format date-time + * @example "2019-12-06T14:20:20.000Z" + */ + created_at: string; + /** + * @format date-time + * @example "2019-12-06T14:20:20.000Z" + */ + deleted_at?: string; + /** @example "https://github.com/actions/setup-ruby/blob/master/.github/workflows/ruby.yaml" */ + html_url: string; + /** @example 5 */ + id: number; + /** @example "CI" */ + name: string; + /** @example "MDg6V29ya2Zsb3cxMg==" */ + node_id: string; + /** @example "ruby.yaml" */ + path: string; + /** @example "active" */ + state: "active" | "deleted"; + /** + * @format date-time + * @example "2019-12-06T14:20:20.000Z" + */ + updated_at: string; + /** @example "https://api.github.com/repos/actions/setup-ruby/workflows/5" */ + url: string; +} + +/** + * Workflow Run + * An invocation of a workflow + */ +export interface WorkflowRun { + /** + * The URL to the artifacts for the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/rerun/artifacts" + */ + artifacts_url: string; + /** + * The URL to cancel the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/cancel" + */ + cancel_url: string; + /** + * The URL to the associated check suite. + * @example "https://api.github.com/repos/github/hello-world/check-suites/12" + */ + check_suite_url: string; + /** @example "neutral" */ + conclusion: string | null; + /** @format date-time */ + created_at: string; + /** @example "push" */ + event: string; + /** @example "master" */ + head_branch: string | null; + /** Simple Commit */ + head_commit: SimpleCommit; + /** Minimal Repository */ + head_repository: MinimalRepository; + /** @example 5 */ + head_repository_id?: number; + /** + * The SHA of the head commit that points to the version of the worflow being run. + * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" + */ + head_sha: string; + /** @example "https://github.com/github/hello-world/suites/4" */ + html_url: string; + /** + * The ID of the workflow run. + * @example 5 + */ + id: number; + /** + * The URL to the jobs for the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/jobs" + */ + jobs_url: string; + /** + * The URL to download the logs for the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/logs" + */ + logs_url: string; + /** + * The name of the workflow run. + * @example "Build" + */ + name?: string; + /** @example "MDEwOkNoZWNrU3VpdGU1" */ + node_id: string; + pull_requests: PullRequestMinimal[] | null; + /** Minimal Repository */ + repository: MinimalRepository; + /** + * The URL to rerun the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/rerun" + */ + rerun_url: string; + /** + * The auto incrementing run number for the workflow run. + * @example 106 + */ + run_number: number; + /** @example "completed" */ + status: string | null; + /** @format date-time */ + updated_at: string; + /** + * The URL to the workflow run. + * @example "https://api.github.com/repos/github/hello-world/actions/runs/5" + */ + url: string; + /** + * The ID of the parent workflow. + * @example 5 + */ + workflow_id: number; + /** + * The URL to the workflow. + * @example "https://api.github.com/repos/github/hello-world/actions/workflows/main.yaml" + */ + workflow_url: string; +} + +/** + * Workflow Run Usage + * Workflow Run Usage + */ +export interface WorkflowRunUsage { + billable: { + MACOS?: { + jobs: number; + total_ms: number; + }; + UBUNTU?: { + jobs: number; + total_ms: number; + }; + WINDOWS?: { + jobs: number; + total_ms: number; + }; + }; + run_duration_ms: number; +} + +/** + * Workflow Usage + * Workflow Usage + */ +export interface WorkflowUsage { + billable: { + MACOS?: { + total_ms?: number; + }; + UBUNTU?: { + total_ms?: number; + }; + WINDOWS?: { + total_ms?: number; + }; + }; +} + +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://api.github.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) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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 v3 REST API + * @version 1.1.4 + * @license MIT (https://spdx.org/licenses/MIT) + * @termsOfService https://docs.github.com/articles/github-terms-of-service + * @baseUrl https://api.github.com + * @externalDocs https://docs.github.com/rest/ + * @contact Support (https://support.github.com/contact) + * + * GitHub's v3 REST API. + */ +export class Api extends HttpClient { + /** + * @description Get Hypermedia links to resources accessible in GitHub's REST API + * + * @tags meta + * @name MetaRoot + * @summary GitHub API Root + * @request GET:/ + */ + metaRoot = (params: RequestParams = {}) => + this.request< + { + /** @format uri */ + authorizations_url: string; + /** @format uri */ + code_search_url: string; + /** @format uri */ + commit_search_url: string; + /** @format uri */ + current_user_authorizations_html_url: string; + /** @format uri */ + current_user_repositories_url: string; + /** @format uri */ + current_user_url: string; + /** @format uri */ + emails_url: string; + /** @format uri */ + emojis_url: string; + /** @format uri */ + events_url: string; + /** @format uri */ + feeds_url: string; + /** @format uri */ + followers_url: string; + /** @format uri */ + following_url: string; + /** @format uri */ + gists_url: string; + /** @format uri */ + hub_url: string; + /** @format uri */ + issue_search_url: string; + /** @format uri */ + issues_url: string; + /** @format uri */ + keys_url: string; + /** @format uri */ + label_search_url: string; + /** @format uri */ + notifications_url: string; + /** @format uri */ + organization_repositories_url: string; + /** @format uri */ + organization_teams_url: string; + /** @format uri */ + organization_url: string; + /** @format uri */ + public_gists_url: string; + /** @format uri */ + rate_limit_url: string; + /** @format uri */ + repository_search_url: string; + /** @format uri */ + repository_url: string; + /** @format uri */ + starred_gists_url: string; + /** @format uri */ + starred_url: string; + /** @format uri */ + topic_search_url?: string; + /** @format uri */ + user_organizations_url: string; + /** @format uri */ + user_repositories_url: string; + /** @format uri */ + user_search_url: string; + /** @format uri */ + user_url: string; + }, + any + >({ + path: \`/\`, + method: "GET", + format: "json", + ...params, + }); + + app = { + /** + * @description Returns the GitHub App associated with the authentication credentials used. To see how many app installations are associated with this GitHub App, see the \`installations_count\` in the response. For more details about your app's installations, see the "[List installations for the authenticated app](https://docs.github.com/rest/reference/apps#list-installations-for-the-authenticated-app)" endpoint. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsGetAuthenticated + * @summary Get the authenticated app + * @request GET:/app + */ + appsGetAuthenticated: (params: RequestParams = {}) => + this.request({ + path: \`/app\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Returns the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)." You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsGetWebhookConfigForApp + * @summary Get a webhook configuration for an app + * @request GET:/app/hook/config + */ + appsGetWebhookConfigForApp: (params: RequestParams = {}) => + this.request({ + path: \`/app/hook/config\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Updates the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)." You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsUpdateWebhookConfigForApp + * @summary Update a webhook configuration for an app + * @request PATCH:/app/hook/config + */ + appsUpdateWebhookConfigForApp: ( + data: { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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; + /** 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; + /** The URL to which the payloads will be delivered. */ + url?: WebhookConfigUrl; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/app/hook/config\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. The permissions the installation has are included under the \`permissions\` key. + * + * @tags apps + * @name AppsListInstallations + * @summary List installations for the authenticated app + * @request GET:/app/installations + */ + appsListInstallations: ( + query?: { + outdated?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/app/installations\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Enables an authenticated GitHub App to find an installation's information using the installation id. The installation's account type (\`target_type\`) will be either an organization or a user account, depending which account the repository belongs to. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsGetInstallation + * @summary Get an installation for the authenticated app + * @request GET:/app/installations/{installation_id} + */ + appsGetInstallation: (installationId: number, params: RequestParams = {}) => + this.request< + Installation, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/app/installations/\${installationId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Uninstalls a GitHub App on a user, organization, or business account. If you prefer to temporarily suspend an app's access to your account's resources, then we recommend the "[Suspend an app installation](https://docs.github.com/v3/apps/#suspend-an-app-installation)" endpoint. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsDeleteInstallation + * @summary Delete an installation for the authenticated app + * @request DELETE:/app/installations/{installation_id} + */ + appsDeleteInstallation: (installationId: number, params: RequestParams = {}) => + this.request({ + path: \`/app/installations/\${installationId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of \`401 - Unauthorized\`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. To restrict the access to specific repositories, you can provide the \`repository_ids\` when creating the token. When you omit \`repository_ids\`, the response does not contain the \`repositories\` key. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsCreateInstallationAccessToken + * @summary Create an installation access token for an app + * @request POST:/app/installations/{installation_id}/access_tokens + */ + appsCreateInstallationAccessToken: ( + installationId: number, + data: { + /** The permissions granted to the user-to-server access token. */ + permissions?: AppPermissions; + /** List of repository names that the token should have access to */ + repositories?: string[]; + /** + * List of repository IDs that the token should have access to + * @example [1] + */ + repository_ids?: number[]; + }, + params: RequestParams = {}, + ) => + this.request< + InstallationToken, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/app/installations/\${installationId}/access_tokens\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description **Note:** Suspending a GitHub App installation is currently in beta and subject to change. Before you can suspend a GitHub App, the app owner must enable suspending installations for the app by opting-in to the beta. For more information, see "[Suspending a GitHub App installation](https://docs.github.com/apps/managing-github-apps/suspending-a-github-app-installation/)." Suspends a GitHub App on a user, organization, or business account, which blocks the app from accessing the account's resources. When a GitHub App is suspended, the app's access to the GitHub API or webhook events is blocked for that account. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsSuspendInstallation + * @summary Suspend an app installation + * @request PUT:/app/installations/{installation_id}/suspended + */ + appsSuspendInstallation: (installationId: number, params: RequestParams = {}) => + this.request({ + path: \`/app/installations/\${installationId}/suspended\`, + method: "PUT", + ...params, + }), + + /** + * @description **Note:** Suspending a GitHub App installation is currently in beta and subject to change. Before you can suspend a GitHub App, the app owner must enable suspending installations for the app by opting-in to the beta. For more information, see "[Suspending a GitHub App installation](https://docs.github.com/apps/managing-github-apps/suspending-a-github-app-installation/)." Removes a GitHub App installation suspension. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsUnsuspendInstallation + * @summary Unsuspend an app installation + * @request DELETE:/app/installations/{installation_id}/suspended + */ + appsUnsuspendInstallation: (installationId: number, params: RequestParams = {}) => + this.request({ + path: \`/app/installations/\${installationId}/suspended\`, + method: "DELETE", + ...params, + }), + }; + appManifests = { + /** + * @description Use this endpoint to complete the handshake necessary when implementing the [GitHub App Manifest flow](https://docs.github.com/apps/building-github-apps/creating-github-apps-from-a-manifest/). When you create a GitHub App with the manifest flow, you receive a temporary \`code\` used to retrieve the GitHub App's \`id\`, \`pem\` (private key), and \`webhook_secret\`. + * + * @tags apps + * @name AppsCreateFromManifest + * @summary Create a GitHub App from a manifest + * @request POST:/app-manifests/{code}/conversions + */ + appsCreateFromManifest: (code: string, params: RequestParams = {}) => + this.request< + Integration & { + client_id: string; + client_secret: string; + pem: string; + webhook_secret: string; + [key: string]: any; + }, + BasicError | ValidationErrorSimple + >({ + path: \`/app-manifests/\${code}/conversions\`, + method: "POST", + format: "json", + ...params, + }), + }; + applications = { + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the [list your authorizations](https://docs.github.com/rest/reference/oauth-authorizations#list-your-authorizations) API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). The \`scopes\` returned are the union of scopes authorized for the application. For example, if an application has one token with \`repo\` scope and another token with \`user\` scope, the grant will return \`["repo", "user"]\`. + * + * @tags oauth-authorizations + * @name OauthAuthorizationsListGrants + * @summary List your grants + * @request GET:/applications/grants + * @deprecated + */ + oauthAuthorizationsListGrants: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/applications/grants\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsGetGrant + * @summary Get a single grant + * @request GET:/applications/grants/{grant_id} + * @deprecated + */ + oauthAuthorizationsGetGrant: (grantId: number, params: RequestParams = {}) => + this.request({ + path: \`/applications/grants/\${grantId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user. Once deleted, the application has no access to your account and is no longer listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsDeleteGrant + * @summary Delete a grant + * @request DELETE:/applications/grants/{grant_id} + * @deprecated + */ + oauthAuthorizationsDeleteGrant: (grantId: number, params: RequestParams = {}) => + this.request({ + path: \`/applications/grants/\${grantId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. You must also provide a valid OAuth \`access_token\` as an input parameter and the grant for the token's owner will be deleted. Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). + * + * @tags apps + * @name AppsDeleteAuthorization + * @summary Delete an app authorization + * @request DELETE:/applications/{client_id}/grant + */ + appsDeleteAuthorization: ( + clientId: string, + data: { + /** The OAuth access token used to authenticate to the GitHub API. */ + access_token?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/applications/\${clientId}/grant\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. You must also provide a valid token as \`:access_token\` and the grant for the token's owner will be deleted. Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the Applications settings page under "Authorized OAuth Apps" on GitHub](https://github.com/settings/applications#authorized). + * + * @tags apps + * @name AppsRevokeGrantForApplication + * @summary Revoke a grant for an application + * @request DELETE:/applications/{client_id}/grants/{access_token} + * @deprecated + */ + appsRevokeGrantForApplication: (clientId: string, accessToken: string, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/grants/\${accessToken}\`, + method: "DELETE", + ...params, + }), + + /** + * @description OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) to use this endpoint, where the username is the OAuth application \`client_id\` and the password is its \`client_secret\`. Invalid tokens will return \`404 NOT FOUND\`. + * + * @tags apps + * @name AppsCheckToken + * @summary Check a token + * @request POST:/applications/{client_id}/token + */ + appsCheckToken: ( + clientId: string, + data: { + /** The access_token of the OAuth application. */ + access_token: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/applications/\${clientId}/token\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * + * @tags apps + * @name AppsResetToken + * @summary Reset a token + * @request PATCH:/applications/{client_id}/token + */ + appsResetToken: ( + clientId: string, + data: { + /** The access_token of the OAuth application. */ + access_token: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/applications/\${clientId}/token\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. + * + * @tags apps + * @name AppsDeleteToken + * @summary Delete an app token + * @request DELETE:/applications/{client_id}/token + */ + appsDeleteToken: ( + clientId: string, + data: { + /** The OAuth access token used to authenticate to the GitHub API. */ + access_token?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/applications/\${clientId}/token\`, + method: "DELETE", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Exchanges a non-repository scoped user-to-server OAuth access token for a repository scoped user-to-server OAuth access token. You can specify which repositories the token can access and which permissions are granted to the token. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * + * @tags apps + * @name AppsScopeToken + * @summary Create a scoped access token + * @request POST:/applications/{client_id}/token/scoped + */ + appsScopeToken: ( + clientId: string, + data: { + /** + * **Required.** The OAuth access token used to authenticate to the GitHub API. + * @example "e72e16c7e42f292c6912e7710c838347ae178b4a" + */ + access_token?: string; + /** The permissions granted to the user-to-server access token. */ + permissions?: AppPermissions; + /** The list of repository IDs to scope the user-to-server access token to. \`repositories\` may not be specified if \`repository_ids\` is specified. */ + repositories?: string[]; + /** + * The list of repository names to scope the user-to-server access token to. \`repository_ids\` may not be specified if \`repositories\` is specified. + * @example [1] + */ + repository_ids?: number[]; + /** + * The name of the user or organization to scope the user-to-server access token to. **Required** unless \`target_id\` is specified. + * @example "octocat" + */ + target?: string; + /** + * The ID of the user or organization to scope the user-to-server access token to. **Required** unless \`target\` is specified. + * @example 1 + */ + target_id?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/applications/\${clientId}/token/scoped\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * + * @tags apps + * @name AppsCheckAuthorization + * @summary Check an authorization + * @request GET:/applications/{client_id}/tokens/{access_token} + * @deprecated + */ + appsCheckAuthorization: (clientId: string, accessToken: string, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/tokens/\${accessToken}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. Invalid tokens will return \`404 NOT FOUND\`. + * + * @tags apps + * @name AppsResetAuthorization + * @summary Reset an authorization + * @request POST:/applications/{client_id}/tokens/{access_token} + * @deprecated + */ + appsResetAuthorization: (clientId: string, accessToken: string, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/tokens/\${accessToken}\`, + method: "POST", + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain \`access_token\` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving \`access_token\` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's \`client_id\` and \`client_secret\` as the username and password. + * + * @tags apps + * @name AppsRevokeAuthorizationForApplication + * @summary Revoke an authorization for an application + * @request DELETE:/applications/{client_id}/tokens/{access_token} + * @deprecated + */ + appsRevokeAuthorizationForApplication: (clientId: string, accessToken: string, params: RequestParams = {}) => + this.request({ + path: \`/applications/\${clientId}/tokens/\${accessToken}\`, + method: "DELETE", + ...params, + }), + }; + apps = { + /** + * @description **Note**: The \`:app_slug\` is just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., \`https://github.com/settings/apps/:app_slug\`). If the GitHub App you specify is public, you can access this endpoint without authenticating. If the GitHub App you specify is private, you must authenticate with a [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) or an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * + * @tags apps + * @name AppsGetBySlug + * @summary Get an app + * @request GET:/apps/{app_slug} + */ + appsGetBySlug: (appSlug: string, params: RequestParams = {}) => + this.request< + Integration, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/apps/\${appSlug}\`, + method: "GET", + format: "json", + ...params, + }), + }; + authorizations = { + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsListAuthorizations + * @summary List your authorizations + * @request GET:/authorizations + * @deprecated + */ + oauthAuthorizationsListAuthorizations: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/authorizations\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). Creates OAuth tokens using [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication). If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." To create tokens for a particular OAuth application using this endpoint, you must authenticate as the user you want to create an authorization for and provide the app's client ID and secret, found on your OAuth application's settings page. If your OAuth application intends to create multiple tokens for one user, use \`fingerprint\` to differentiate between them. You can also create tokens on GitHub from the [personal access tokens settings](https://github.com/settings/tokens) page. Read more about these tokens in [the GitHub Help documentation](https://help.github.com/articles/creating-an-access-token-for-command-line-use). Organizations that enforce SAML SSO require personal access tokens to be allowed. Read more about allowing tokens in [the GitHub Help documentation](https://help.github.com/articles/about-identity-and-access-management-with-saml-single-sign-on). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsCreateAuthorization + * @summary Create a new authorization + * @request POST:/authorizations + * @deprecated + */ + oauthAuthorizationsCreateAuthorization: ( + data: { + /** + * The OAuth app client key for which to create the token. + * @maxLength 20 + */ + client_id?: string; + /** + * The OAuth app client secret for which to create the token. + * @maxLength 40 + */ + client_secret?: string; + /** A unique string to distinguish an authorization from others created for the same client ID and user. */ + fingerprint?: string; + /** + * A note to remind you what the OAuth token is for. + * @example "Update all gems" + */ + note?: string; + /** A URL to remind you what app the OAuth token is for. */ + note_url?: string; + /** + * A list of scopes that this authorization is in. + * @example ["public_repo","user"] + */ + scopes?: string[] | null; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/authorizations\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). Creates a new authorization for the specified OAuth application, only if an authorization for that application doesn't already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one. If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsGetOrCreateAuthorizationForApp + * @summary Get-or-create an authorization for a specific app + * @request PUT:/authorizations/clients/{client_id} + * @deprecated + */ + oauthAuthorizationsGetOrCreateAuthorizationForApp: ( + clientId: string, + data: { + /** + * The OAuth app client secret for which to create the token. + * @maxLength 40 + */ + client_secret: string; + /** A unique string to distinguish an authorization from others created for the same client ID and user. */ + fingerprint?: string; + /** + * A note to remind you what the OAuth token is for. + * @example "Update all gems" + */ + note?: string; + /** A URL to remind you what app the OAuth token is for. */ + note_url?: string; + /** + * A list of scopes that this authorization is in. + * @example ["public_repo","user"] + */ + scopes?: string[] | null; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/authorizations/clients/\${clientId}\`, + method: "PUT", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). This method will create a new authorization for the specified OAuth application, only if an authorization for that application and fingerprint do not already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. \`fingerprint\` is a unique string to distinguish an authorization from others created for the same client ID and user. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one. If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." + * + * @tags oauth-authorizations + * @name OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint + * @summary Get-or-create an authorization for a specific app and fingerprint + * @request PUT:/authorizations/clients/{client_id}/{fingerprint} + * @deprecated + */ + oauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint: ( + clientId: string, + fingerprint: string, + data: { + /** + * The OAuth app client secret for which to create the token. + * @maxLength 40 + */ + client_secret: string; + /** + * A note to remind you what the OAuth token is for. + * @example "Update all gems" + */ + note?: string; + /** A URL to remind you what app the OAuth token is for. */ + note_url?: string; + /** + * A list of scopes that this authorization is in. + * @example ["public_repo","user"] + */ + scopes?: string[] | null; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/authorizations/clients/\${clientId}/\${fingerprint}\`, + method: "PUT", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsGetAuthorization + * @summary Get a single authorization + * @request GET:/authorizations/{authorization_id} + * @deprecated + */ + oauthAuthorizationsGetAuthorization: (authorizationId: number, params: RequestParams = {}) => + this.request({ + path: \`/authorizations/\${authorizationId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." You can only send one of these scope keys at a time. + * + * @tags oauth-authorizations + * @name OauthAuthorizationsUpdateAuthorization + * @summary Update an existing authorization + * @request PATCH:/authorizations/{authorization_id} + * @deprecated + */ + oauthAuthorizationsUpdateAuthorization: ( + authorizationId: number, + data: { + /** A list of scopes to add to this authorization. */ + add_scopes?: string[]; + /** A unique string to distinguish an authorization from others created for the same client ID and user. */ + fingerprint?: string; + /** + * A note to remind you what the OAuth token is for. + * @example "Update all gems" + */ + note?: string; + /** A URL to remind you what app the OAuth token is for. */ + note_url?: string; + /** A list of scopes to remove from this authorization. */ + remove_scopes?: string[]; + /** + * A list of scopes that this authorization is in. + * @example ["public_repo","user"] + */ + scopes?: string[] | null; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/authorizations/\${authorizationId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * + * @tags oauth-authorizations + * @name OauthAuthorizationsDeleteAuthorization + * @summary Delete an authorization + * @request DELETE:/authorizations/{authorization_id} + * @deprecated + */ + oauthAuthorizationsDeleteAuthorization: (authorizationId: number, params: RequestParams = {}) => + this.request({ + path: \`/authorizations/\${authorizationId}\`, + method: "DELETE", + ...params, + }), + }; + codesOfConduct = { + /** + * No description + * + * @tags codes-of-conduct + * @name CodesOfConductGetAllCodesOfConduct + * @summary Get all codes of conduct + * @request GET:/codes_of_conduct + */ + codesOfConductGetAllCodesOfConduct: (params: RequestParams = {}) => + this.request< + CodeOfConduct[], + { + documentation_url: string; + message: string; + } + >({ + path: \`/codes_of_conduct\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @tags codes-of-conduct + * @name CodesOfConductGetConductCode + * @summary Get a code of conduct + * @request GET:/codes_of_conduct/{key} + */ + codesOfConductGetConductCode: (key: string, params: RequestParams = {}) => + this.request< + CodeOfConduct, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/codes_of_conduct/\${key}\`, + method: "GET", + format: "json", + ...params, + }), + }; + contentReferences = { + /** + * @description Creates an attachment under a content reference URL in the body or comment of an issue or pull request. Use the \`id\` of the content reference from the [\`content_reference\` event](https://docs.github.com/webhooks/event-payloads/#content_reference) to create an attachment. The app must create a content attachment within six hours of the content reference URL being posted. See "[Using content attachments](https://docs.github.com/apps/using-content-attachments/)" for details about content attachments. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * + * @tags apps + * @name AppsCreateContentAttachment + * @summary Create a content attachment + * @request POST:/content_references/{content_reference_id}/attachments + */ + appsCreateContentAttachment: ( + contentReferenceId: number, + data: { + /** + * The body of the attachment + * @maxLength 262144 + * @example "Body of the attachment" + */ + body: string; + /** + * The title of the attachment + * @maxLength 1024 + * @example "Title of the attachment" + */ + title: string; + }, + params: RequestParams = {}, + ) => + this.request< + ContentReferenceAttachment, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/content_references/\${contentReferenceId}/attachments\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + emojis = { + /** + * @description Lists all the emojis available to use on GitHub. + * + * @tags emojis + * @name EmojisGet + * @summary Get emojis + * @request GET:/emojis + */ + emojisGet: (params: RequestParams = {}) => + this.request, any>({ + path: \`/emojis\`, + method: "GET", + format: "json", + ...params, + }), + }; + enterprises = { + /** + * @description Gets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminGetGithubActionsPermissionsEnterprise + * @summary Get GitHub Actions permissions for an enterprise + * @request GET:/enterprises/{enterprise}/actions/permissions + */ + enterpriseAdminGetGithubActionsPermissionsEnterprise: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Sets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetGithubActionsPermissionsEnterprise + * @summary Set GitHub Actions permissions for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions + */ + enterpriseAdminSetGithubActionsPermissionsEnterprise: ( + enterprise: string, + data: { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions?: AllowedActions; + /** The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ + enabled_organizations: EnabledOrganizations; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Lists the organizations that are selected to have GitHub Actions enabled in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise + * @summary List selected organizations enabled for GitHub Actions in an enterprise + * @request GET:/enterprises/{enterprise}/actions/permissions/organizations + */ + enterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise: ( + enterprise: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + organizations: OrganizationSimple[]; + total_count: number; + }, + any + >({ + path: \`/enterprises/\${enterprise}/actions/permissions/organizations\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise + * @summary Set selected organizations enabled for GitHub Actions in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions/organizations + */ + enterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise: ( + enterprise: string, + data: { + /** List of organization IDs to enable for GitHub Actions. */ + selected_organization_ids: number[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/organizations\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise + * @summary Enable a selected organization for GitHub Actions in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions/organizations/{org_id} + */ + enterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise: ( + enterprise: string, + orgId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/organizations/\${orgId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for \`enabled_organizations\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise + * @summary Disable a selected organization for GitHub Actions in an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/permissions/organizations/{org_id} + */ + enterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise: ( + enterprise: string, + orgId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/organizations/\${orgId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Gets the selected actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminGetAllowedActionsEnterprise + * @summary Get allowed actions for an enterprise + * @request GET:/enterprises/{enterprise}/actions/permissions/selected-actions + */ + enterpriseAdminGetAllowedActionsEnterprise: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/selected-actions\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Sets the actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetAllowedActionsEnterprise + * @summary Set allowed actions for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/permissions/selected-actions + */ + enterpriseAdminSetAllowedActionsEnterprise: ( + enterprise: string, + data: SelectedActions, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/permissions/selected-actions\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Lists all self-hosted runner groups for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListSelfHostedRunnerGroupsForEnterprise + * @summary List self-hosted runner groups for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups + */ + enterpriseAdminListSelfHostedRunnerGroupsForEnterprise: ( + enterprise: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + runner_groups: RunnerGroupsEnterprise[]; + total_count: number; + }, + any + >({ + path: \`/enterprises/\${enterprise}/actions/runner-groups\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Creates a new self-hosted runner group for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminCreateSelfHostedRunnerGroupForEnterprise + * @summary Create a self-hosted runner group for an enterprise + * @request POST:/enterprises/{enterprise}/actions/runner-groups + */ + enterpriseAdminCreateSelfHostedRunnerGroupForEnterprise: ( + enterprise: string, + data: { + /** Name of the runner group. */ + name: string; + /** List of runner IDs to add to the runner group. */ + runners?: number[]; + /** List of organization IDs that can access the runner group. */ + selected_organization_ids?: number[]; + /** Visibility of a runner group. You can select all organizations or select individual organization. Can be one of: \`all\` or \`selected\` */ + visibility?: "selected" | "all"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Gets a specific self-hosted runner group for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminGetSelfHostedRunnerGroupForEnterprise + * @summary Get a self-hosted runner group for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + */ + enterpriseAdminGetSelfHostedRunnerGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Updates the \`name\` and \`visibility\` of a self-hosted runner group in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise + * @summary Update a self-hosted runner group for an enterprise + * @request PATCH:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + */ + enterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + data: { + /** Name of the runner group. */ + name?: string; + /** + * Visibility of a runner group. You can select all organizations or select individual organizations. Can be one of: \`all\` or \`selected\` + * @default "all" + */ + visibility?: "selected" | "all"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Deletes a self-hosted runner group for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise + * @summary Delete a self-hosted runner group from an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + */ + enterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise: ( + enterprise: string, + runnerGroupId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists the organizations with access to a self-hosted runner group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary List organization access to a self-hosted runner group in an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations + */ + enterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise: ( + enterprise: string, + runnerGroupId: number, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + organizations: OrganizationSimple[]; + total_count: number; + }, + any + >({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/organizations\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Replaces the list of organizations that have access to a self-hosted runner configured in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary Set organization access for a self-hosted runner group in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations + */ + enterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise: ( + enterprise: string, + runnerGroupId: number, + data: { + /** List of organization IDs that can access the runner group. */ + selected_organization_ids: number[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/organizations\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Adds an organization to the list of selected organizations that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary Add organization access to a self-hosted runner group in an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} + */ + enterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise: ( + enterprise: string, + runnerGroupId: number, + orgId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/organizations/\${orgId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Removes an organization from the list of selected organizations that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)." You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise + * @summary Remove organization access to a self-hosted runner group in an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} + */ + enterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise: ( + enterprise: string, + runnerGroupId: number, + orgId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/organizations/\${orgId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists the self-hosted runners that are in a specific enterprise group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListSelfHostedRunnersInGroupForEnterprise + * @summary List self-hosted runners in a group for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners + */ + enterpriseAdminListSelfHostedRunnersInGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + runners: Runner[]; + total_count: number; + }, + any + >({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/runners\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Replaces the list of self-hosted runners that are part of an enterprise runner group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminSetSelfHostedRunnersInGroupForEnterprise + * @summary Set self-hosted runners in a group for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners + */ + enterpriseAdminSetSelfHostedRunnersInGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + data: { + /** List of runner IDs to add to the runner group. */ + runners: number[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/runners\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Adds a self-hosted runner to a runner group configured in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminAddSelfHostedRunnerToGroupForEnterprise + * @summary Add a self-hosted runner to a group for an enterprise + * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + enterpriseAdminAddSelfHostedRunnerToGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/runners/\${runnerId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Removes a self-hosted runner from a group configured in an enterprise. The runner is then returned to the default group. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise + * @summary Remove a self-hosted runner from a group for an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + enterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise: ( + enterprise: string, + runnerGroupId: number, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runner-groups/\${runnerGroupId}/runners/\${runnerId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists all self-hosted runners configured for an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListSelfHostedRunnersForEnterprise + * @summary List self-hosted runners for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runners + */ + enterpriseAdminListSelfHostedRunnersForEnterprise: ( + enterprise: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + runners?: Runner[]; + total_count?: number; + }, + any + >({ + path: \`/enterprises/\${enterprise}/actions/runners\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Lists binaries for the runner application that you can download and run. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminListRunnerApplicationsForEnterprise + * @summary List runner applications for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runners/downloads + */ + enterpriseAdminListRunnerApplicationsForEnterprise: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners/downloads\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Returns a token that you can pass to the \`config\` script. The token expires after one hour. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing \`TOKEN\` with the registration token provided by this endpoint. \`\`\` ./config.sh --url https://github.com/enterprises/octo-enterprise --token TOKEN \`\`\` + * + * @tags enterprise-admin + * @name EnterpriseAdminCreateRegistrationTokenForEnterprise + * @summary Create a registration token for an enterprise + * @request POST:/enterprises/{enterprise}/actions/runners/registration-token + */ + enterpriseAdminCreateRegistrationTokenForEnterprise: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners/registration-token\`, + method: "POST", + format: "json", + ...params, + }), + + /** + * @description Returns a token that you can pass to the \`config\` script to remove a self-hosted runner from an enterprise. The token expires after one hour. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from an enterprise, replace \`TOKEN\` with the remove token provided by this endpoint. \`\`\` ./config.sh remove --token TOKEN \`\`\` + * + * @tags enterprise-admin + * @name EnterpriseAdminCreateRemoveTokenForEnterprise + * @summary Create a remove token for an enterprise + * @request POST:/enterprises/{enterprise}/actions/runners/remove-token + */ + enterpriseAdminCreateRemoveTokenForEnterprise: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners/remove-token\`, + method: "POST", + format: "json", + ...params, + }), + + /** + * @description Gets a specific self-hosted runner configured in an enterprise. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminGetSelfHostedRunnerForEnterprise + * @summary Get a self-hosted runner for an enterprise + * @request GET:/enterprises/{enterprise}/actions/runners/{runner_id} + */ + enterpriseAdminGetSelfHostedRunnerForEnterprise: ( + enterprise: string, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners/\${runnerId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Forces the removal of a self-hosted runner from an enterprise. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the \`admin:enterprise\` scope to use this endpoint. + * + * @tags enterprise-admin + * @name EnterpriseAdminDeleteSelfHostedRunnerFromEnterprise + * @summary Delete a self-hosted runner from an enterprise + * @request DELETE:/enterprises/{enterprise}/actions/runners/{runner_id} + */ + enterpriseAdminDeleteSelfHostedRunnerFromEnterprise: ( + enterprise: string, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/actions/runners/\${runnerId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note:** The audit log REST API is currently in beta and is subject to change. Gets the audit log for an enterprise. To use this endpoint, you must be an enterprise admin, and you must use an access token with the \`admin:enterprise\` scope. + * + * @tags audit-log + * @name AuditLogGetAuditLog + * @summary Get the audit log for an enterprise + * @request GET:/enterprises/{enterprise}/audit-log + */ + auditLogGetAuditLog: ( + enterprise: string, + query?: { + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor. */ + after?: string; + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor. */ + before?: string; + /** + * The event types to include: + * + * - \`web\` - returns web (non-Git) events + * - \`git\` - returns Git events + * - \`all\` - returns both web and Git events + * + * The default is \`web\`. + */ + include?: "web" | "git" | "all"; + /** + * The order of audit log events. To list newest events first, specify \`desc\`. To list oldest events first, specify \`asc\`. + * + * The default is \`desc\`. + */ + order?: "desc" | "asc"; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** A search phrase. For more information, see [Searching the audit log](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#searching-the-audit-log). */ + phrase?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/enterprises/\${enterprise}/audit-log\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". The authenticated user must be an enterprise admin. + * + * @tags billing + * @name BillingGetGithubActionsBillingGhe + * @summary Get GitHub Actions billing for an enterprise + * @request GET:/enterprises/{enterprise}/settings/billing/actions + */ + billingGetGithubActionsBillingGhe: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/settings/billing/actions\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Gets the free and paid storage used for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." The authenticated user must be an enterprise admin. + * + * @tags billing + * @name BillingGetGithubPackagesBillingGhe + * @summary Get GitHub Packages billing for an enterprise + * @request GET:/enterprises/{enterprise}/settings/billing/packages + */ + billingGetGithubPackagesBillingGhe: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/settings/billing/packages\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." The authenticated user must be an enterprise admin. + * + * @tags billing + * @name BillingGetSharedStorageBillingGhe + * @summary Get shared storage billing for an enterprise + * @request GET:/enterprises/{enterprise}/settings/billing/shared-storage + */ + billingGetSharedStorageBillingGhe: (enterprise: string, params: RequestParams = {}) => + this.request({ + path: \`/enterprises/\${enterprise}/settings/billing/shared-storage\`, + method: "GET", + format: "json", + ...params, + }), + }; + events = { + /** + * @description We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago. + * + * @tags activity + * @name ActivityListPublicEvents + * @summary List public events + * @request GET:/events + */ + activityListPublicEvents: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + Event[], + | BasicError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/events\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + feeds = { + /** + * @description GitHub provides several timeline resources in [Atom](http://en.wikipedia.org/wiki/Atom_(standard)) format. The Feeds API lists all the feeds available to the authenticated user: * **Timeline**: The GitHub global public timeline * **User**: The public timeline for any user, using [URI template](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia) * **Current user public**: The public timeline for the authenticated user * **Current user**: The private timeline for the authenticated user * **Current user actor**: The private timeline for activity created by the authenticated user * **Current user organizations**: The private timeline for the organizations the authenticated user is a member of. * **Security advisories**: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub. **Note**: Private feeds are only returned when [authenticating via Basic Auth](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) since current feed URIs use the older, non revocable auth tokens. + * + * @tags activity + * @name ActivityGetFeeds + * @summary Get feeds + * @request GET:/feeds + */ + activityGetFeeds: (params: RequestParams = {}) => + this.request({ + path: \`/feeds\`, + method: "GET", + format: "json", + ...params, + }), + }; + gists = { + /** + * @description Lists the authenticated user's gists or if called anonymously, this endpoint returns all public gists: + * + * @tags gists + * @name GistsList + * @summary List gists for the authenticated user + * @request GET:/gists + */ + gistsList: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Allows you to add a new gist with one or more files. **Note:** Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally. + * + * @tags gists + * @name GistsCreate + * @summary Create a gist + * @request POST:/gists + */ + gistsCreate: ( + data: { + /** + * Description of the gist + * @example "Example Ruby script" + */ + description?: string; + /** + * Names and content for the files that make up the gist + * @example {"hello.rb":{"content":"puts \\"Hello, World!\\""}} + */ + files: Record< + string, + { + /** Content of the file */ + content: string; + } + >; + /** Flag indicating whether the gist is public */ + public?: boolean | "true" | "false"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description List public gists sorted by most recently updated to least recently updated. Note: With [pagination](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination), you can fetch up to 3000 gists. For example, you can fetch 100 pages with 30 gists per page or 30 pages with 100 gists per page. + * + * @tags gists + * @name GistsListPublic + * @summary List public gists + * @request GET:/gists/public + */ + gistsListPublic: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists/public\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description List the authenticated user's starred gists: + * + * @tags gists + * @name GistsListStarred + * @summary List starred gists + * @request GET:/gists/starred + */ + gistsListStarred: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists/starred\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsGet + * @summary Get a gist + * @request GET:/gists/{gist_id} + */ + gistsGet: (gistId: string, params: RequestParams = {}) => + this.request< + GistSimple, + | { + block?: { + created_at?: string; + html_url?: string | null; + reason?: string; + }; + documentation_url?: string; + message?: string; + } + | BasicError + >({ + path: \`/gists/\${gistId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Allows you to update or delete a gist file and rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged. + * + * @tags gists + * @name GistsUpdate + * @summary Update a gist + * @request PATCH:/gists/{gist_id} + */ + gistsUpdate: ( + gistId: string, + data: null & { + /** + * Description of the gist + * @example "Example Ruby script" + */ + description?: string; + /** + * Names of files to be updated + * @example {"hello.rb":{"content":"blah","filename":"goodbye.rb"}} + */ + files?: Record< + string, + (object | null) & { + /** The new content of the file */ + content?: string; + /** The new filename for the file */ + filename?: string | null; + } + >; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists/\${gistId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsDelete + * @summary Delete a gist + * @request DELETE:/gists/{gist_id} + */ + gistsDelete: (gistId: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsListComments + * @summary List gist comments + * @request GET:/gists/{gist_id}/comments + */ + gistsListComments: ( + gistId: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists/\${gistId}/comments\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsCreateComment + * @summary Create a gist comment + * @request POST:/gists/{gist_id}/comments + */ + gistsCreateComment: ( + gistId: string, + data: { + /** + * The comment text. + * @maxLength 65535 + * @example "Body of the attachment" + */ + body: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists/\${gistId}/comments\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsGetComment + * @summary Get a gist comment + * @request GET:/gists/{gist_id}/comments/{comment_id} + */ + gistsGetComment: (gistId: string, commentId: number, params: RequestParams = {}) => + this.request< + GistComment, + | { + block?: { + created_at?: string; + html_url?: string | null; + reason?: string; + }; + documentation_url?: string; + message?: string; + } + | BasicError + >({ + path: \`/gists/\${gistId}/comments/\${commentId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsUpdateComment + * @summary Update a gist comment + * @request PATCH:/gists/{gist_id}/comments/{comment_id} + */ + gistsUpdateComment: ( + gistId: string, + commentId: number, + data: { + /** + * The comment text. + * @maxLength 65535 + * @example "Body of the attachment" + */ + body: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists/\${gistId}/comments/\${commentId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsDeleteComment + * @summary Delete a gist comment + * @request DELETE:/gists/{gist_id}/comments/{comment_id} + */ + gistsDeleteComment: (gistId: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/comments/\${commentId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsListCommits + * @summary List gist commits + * @request GET:/gists/{gist_id}/commits + */ + gistsListCommits: ( + gistId: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists/\${gistId}/commits\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsListForks + * @summary List gist forks + * @request GET:/gists/{gist_id}/forks + */ + gistsListForks: ( + gistId: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/gists/\${gistId}/forks\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description **Note**: This was previously \`/gists/:gist_id/fork\`. + * + * @tags gists + * @name GistsFork + * @summary Fork a gist + * @request POST:/gists/{gist_id}/forks + */ + gistsFork: (gistId: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/forks\`, + method: "POST", + format: "json", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsCheckIsStarred + * @summary Check if a gist is starred + * @request GET:/gists/{gist_id}/star + */ + gistsCheckIsStarred: (gistId: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/star\`, + method: "GET", + ...params, + }), + + /** + * @description Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * + * @tags gists + * @name GistsStar + * @summary Star a gist + * @request PUT:/gists/{gist_id}/star + */ + gistsStar: (gistId: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/star\`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsUnstar + * @summary Unstar a gist + * @request DELETE:/gists/{gist_id}/star + */ + gistsUnstar: (gistId: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/star\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags gists + * @name GistsGetRevision + * @summary Get a gist revision + * @request GET:/gists/{gist_id}/{sha} + */ + gistsGetRevision: (gistId: string, sha: string, params: RequestParams = {}) => + this.request({ + path: \`/gists/\${gistId}/\${sha}\`, + method: "GET", + format: "json", + ...params, + }), + }; + gitignore = { + /** + * @description List all templates available to pass as an option when [creating a repository](https://docs.github.com/rest/reference/repos#create-a-repository-for-the-authenticated-user). + * + * @tags gitignore + * @name GitignoreGetAllTemplates + * @summary Get all gitignore templates + * @request GET:/gitignore/templates + */ + gitignoreGetAllTemplates: (params: RequestParams = {}) => + this.request({ + path: \`/gitignore/templates\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description The API also allows fetching the source of a single template. Use the raw [media type](https://docs.github.com/rest/overview/media-types/) to get the raw contents. + * + * @tags gitignore + * @name GitignoreGetTemplate + * @summary Get a gitignore template + * @request GET:/gitignore/templates/{name} + */ + gitignoreGetTemplate: (name: string, params: RequestParams = {}) => + this.request({ + path: \`/gitignore/templates/\${name}\`, + method: "GET", + format: "json", + ...params, + }), + }; + installation = { + /** + * @description List repositories that an app installation can access. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * + * @tags apps + * @name AppsListReposAccessibleToInstallation + * @summary List repositories accessible to the app installation + * @request GET:/installation/repositories + */ + appsListReposAccessibleToInstallation: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + repositories: Repository[]; + /** @example "selected" */ + repository_selection?: string; + total_count: number; + }, + BasicError + >({ + path: \`/installation/repositories\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Revokes the installation token you're using to authenticate as an installation and access this endpoint. Once an installation token is revoked, the token is invalidated and cannot be used. Other endpoints that require the revoked installation token must have a new installation token to work. You can create a new token using the "[Create an installation access token for an app](https://docs.github.com/rest/reference/apps#create-an-installation-access-token-for-an-app)" endpoint. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * + * @tags apps + * @name AppsRevokeInstallationAccessToken + * @summary Revoke an installation access token + * @request DELETE:/installation/token + */ + appsRevokeInstallationAccessToken: (params: RequestParams = {}) => + this.request({ + path: \`/installation/token\`, + method: "DELETE", + ...params, + }), + }; + issues = { + /** + * @description List issues assigned to the authenticated user across all visible repositories including owned repositories, member repositories, and organization repositories. You can use the \`filter\` query parameter to fetch issues that are not necessarily assigned to you. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * + * @tags issues + * @name IssuesList + * @summary List issues assigned to the authenticated user + * @request GET:/issues + */ + issuesList: ( + query?: { + collab?: boolean; + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: "asc" | "desc"; + /** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ + filter?: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + orgs?: boolean; + owned?: boolean; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + pulls?: boolean; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: "created" | "updated" | "comments"; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: "open" | "closed" | "all"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/issues\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + licenses = { + /** + * No description + * + * @tags licenses + * @name LicensesGetAllCommonlyUsed + * @summary Get all commonly used licenses + * @request GET:/licenses + */ + licensesGetAllCommonlyUsed: ( + query?: { + featured?: boolean; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/licenses\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags licenses + * @name LicensesGet + * @summary Get a license + * @request GET:/licenses/{license} + */ + licensesGet: (license: string, params: RequestParams = {}) => + this.request({ + path: \`/licenses/\${license}\`, + method: "GET", + format: "json", + ...params, + }), + }; + markdown = { + /** + * No description + * + * @tags markdown + * @name MarkdownRender + * @summary Render a Markdown document + * @request POST:/markdown + */ + markdownRender: ( + data: { + /** The repository context to use when creating references in \`gfm\` mode. */ + context?: string; + /** + * The rendering mode. + * @default "markdown" + * @example "markdown" + */ + mode?: "markdown" | "gfm"; + /** The Markdown text to render in HTML. */ + text: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/markdown\`, + method: "POST", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description You must send Markdown as plain text (using a \`Content-Type\` header of \`text/plain\` or \`text/x-markdown\`) to this endpoint, rather than using JSON format. In raw mode, [GitHub Flavored Markdown](https://github.github.com/gfm/) is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less. + * + * @tags markdown + * @name MarkdownRenderRaw + * @summary Render a Markdown document in raw mode + * @request POST:/markdown/raw + */ + markdownRenderRaw: (data: WebhookConfigUrl, params: RequestParams = {}) => + this.request({ + path: \`/markdown/raw\`, + method: "POST", + body: data, + type: ContentType.Text, + ...params, + }), + }; + marketplaceListing = { + /** + * @description Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsGetSubscriptionPlanForAccount + * @summary Get a subscription plan for an account + * @request GET:/marketplace_listing/accounts/{account_id} + */ + appsGetSubscriptionPlanForAccount: (accountId: number, params: RequestParams = {}) => + this.request({ + path: \`/marketplace_listing/accounts/\${accountId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Lists all plans that are part of your GitHub Marketplace listing. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsListPlans + * @summary List plans + * @request GET:/marketplace_listing/plans + */ + appsListPlans: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/marketplace_listing/plans\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Returns user and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsListAccountsForPlan + * @summary List accounts for a plan + * @request GET:/marketplace_listing/plans/{plan_id}/accounts + */ + appsListAccountsForPlan: ( + planId: number, + query?: { + /** To return the oldest accounts first, set to \`asc\`. Can be one of \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ + direction?: "asc" | "desc"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/marketplace_listing/plans/\${planId}/accounts\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsGetSubscriptionPlanForAccountStubbed + * @summary Get a subscription plan for an account (stubbed) + * @request GET:/marketplace_listing/stubbed/accounts/{account_id} + */ + appsGetSubscriptionPlanForAccountStubbed: (accountId: number, params: RequestParams = {}) => + this.request({ + path: \`/marketplace_listing/stubbed/accounts/\${accountId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Lists all plans that are part of your GitHub Marketplace listing. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsListPlansStubbed + * @summary List plans (stubbed) + * @request GET:/marketplace_listing/stubbed/plans + */ + appsListPlansStubbed: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/marketplace_listing/stubbed/plans\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Returns repository and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * + * @tags apps + * @name AppsListAccountsForPlanStubbed + * @summary List accounts for a plan (stubbed) + * @request GET:/marketplace_listing/stubbed/plans/{plan_id}/accounts + */ + appsListAccountsForPlanStubbed: ( + planId: number, + query?: { + /** To return the oldest accounts first, set to \`asc\`. Can be one of \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ + direction?: "asc" | "desc"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/marketplace_listing/stubbed/plans/\${planId}/accounts\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + meta = { + /** + * @description Returns meta information about GitHub, including a list of GitHub's IP addresses. For more information, see "[About GitHub's IP addresses](https://help.github.com/articles/about-github-s-ip-addresses/)." **Note:** The IP addresses shown in the documentation's response are only example values. You must always query the API directly to get the latest list of IP addresses. + * + * @tags meta + * @name MetaGet + * @summary Get GitHub meta information + * @request GET:/meta + */ + metaGet: (params: RequestParams = {}) => + this.request({ + path: \`/meta\`, + method: "GET", + format: "json", + ...params, + }), + }; + networks = { + /** + * No description + * + * @tags activity + * @name ActivityListPublicEventsForRepoNetwork + * @summary List public events for a network of repositories + * @request GET:/networks/{owner}/{repo}/events + */ + activityListPublicEventsForRepoNetwork: ( + owner: string, + repo: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/networks/\${owner}/\${repo}/events\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + notifications = { + /** + * @description List all notifications for the current user, sorted by most recently updated. + * + * @tags activity + * @name ActivityListNotificationsForAuthenticatedUser + * @summary List notifications for the authenticated user + * @request GET:/notifications + */ + activityListNotificationsForAuthenticatedUser: ( + query?: { + /** + * If \`true\`, show notifications marked as read. + * @default false + */ + all?: boolean; + /** Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + before?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * If \`true\`, only shows notifications in which the user is directly participating or mentioned. + * @default false + */ + participating?: boolean; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/notifications\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Marks all notifications as "read" removes it from the [default view on GitHub](https://github.com/notifications). If the number of notifications is too large to complete in one request, you will receive a \`202 Accepted\` status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the [List notifications for the authenticated user](https://docs.github.com/rest/reference/activity#list-notifications-for-the-authenticated-user) endpoint and pass the query parameter \`all=false\`. + * + * @tags activity + * @name ActivityMarkNotificationsAsRead + * @summary Mark notifications as read + * @request PUT:/notifications + */ + activityMarkNotificationsAsRead: ( + data: { + /** + * Describes the last point that notifications were checked. + * @format date-time + */ + last_read_at?: string; + /** Whether the notification has been read. */ + read?: boolean; + }, + params: RequestParams = {}, + ) => + this.request< + { + message?: string; + }, + BasicError + >({ + path: \`/notifications\`, + method: "PUT", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityGetThread + * @summary Get a thread + * @request GET:/notifications/threads/{thread_id} + */ + activityGetThread: (threadId: number, params: RequestParams = {}) => + this.request({ + path: \`/notifications/threads/\${threadId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityMarkThreadAsRead + * @summary Mark a thread as read + * @request PATCH:/notifications/threads/{thread_id} + */ + activityMarkThreadAsRead: (threadId: number, params: RequestParams = {}) => + this.request({ + path: \`/notifications/threads/\${threadId}\`, + method: "PATCH", + ...params, + }), + + /** + * @description This checks to see if the current user is subscribed to a thread. You can also [get a repository subscription](https://docs.github.com/rest/reference/activity#get-a-repository-subscription). Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were **@mentioned**, or manually subscribe to a thread. + * + * @tags activity + * @name ActivityGetThreadSubscriptionForAuthenticatedUser + * @summary Get a thread subscription for the authenticated user + * @request GET:/notifications/threads/{thread_id}/subscription + */ + activityGetThreadSubscriptionForAuthenticatedUser: (threadId: number, params: RequestParams = {}) => + this.request({ + path: \`/notifications/threads/\${threadId}/subscription\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description If you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an **@mention**. You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored. Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the [Delete a thread subscription](https://docs.github.com/rest/reference/activity#delete-a-thread-subscription) endpoint. + * + * @tags activity + * @name ActivitySetThreadSubscription + * @summary Set a thread subscription + * @request PUT:/notifications/threads/{thread_id}/subscription + */ + activitySetThreadSubscription: ( + threadId: number, + data: { + /** + * Whether to block all notifications from a thread. + * @default false + */ + ignored?: boolean; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/notifications/threads/\${threadId}/subscription\`, + method: "PUT", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Mutes all future notifications for a conversation until you comment on the thread or get an **@mention**. If you are watching the repository of the thread, you will still receive notifications. To ignore future notifications for a repository you are watching, use the [Set a thread subscription](https://docs.github.com/rest/reference/activity#set-a-thread-subscription) endpoint and set \`ignore\` to \`true\`. + * + * @tags activity + * @name ActivityDeleteThreadSubscription + * @summary Delete a thread subscription + * @request DELETE:/notifications/threads/{thread_id}/subscription + */ + activityDeleteThreadSubscription: (threadId: number, params: RequestParams = {}) => + this.request({ + path: \`/notifications/threads/\${threadId}/subscription\`, + method: "DELETE", + ...params, + }), + }; + octocat = { + /** + * @description Get the octocat as ASCII art + * + * @tags meta + * @name MetaGetOctocat + * @summary Get Octocat + * @request GET:/octocat + */ + metaGetOctocat: ( + query?: { + /** The words to show in Octocat's speech bubble */ + s?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/octocat\`, + method: "GET", + query: query, + ...params, + }), + }; + organizations = { + /** + * @description Lists all organizations, in the order that they were created on GitHub. **Note:** Pagination is powered exclusively by the \`since\` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of organizations. + * + * @tags orgs + * @name OrgsList + * @summary List organizations + * @request GET:/organizations + */ + orgsList: ( + query?: { + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** An organization ID. Only return organizations with an ID greater than this ID. */ + since?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/organizations\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + orgs = { + /** + * @description To see many of the organization response values, you need to be an authenticated organization owner with the \`admin:org\` scope. When the value of \`two_factor_requirement_enabled\` is \`true\`, the organization requires all members, billing managers, and outside collaborators to enable [two-factor authentication](https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/). GitHub Apps with the \`Organization plan\` permission can use this endpoint to retrieve information about an organization's GitHub plan. See "[Authenticating with GitHub Apps](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/)" for details. For an example response, see 'Response with GitHub plan information' below." + * + * @tags orgs + * @name OrgsGet + * @summary Get an organization + * @request GET:/orgs/{org} + */ + orgsGet: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description **Parameter Deprecation Notice:** GitHub will replace and discontinue \`members_allowed_repository_creation_type\` in favor of more granular permissions. The new input parameters are \`members_can_create_public_repositories\`, \`members_can_create_private_repositories\` for all organizations and \`members_can_create_internal_repositories\` for organizations associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see the [blog post](https://developer.github.com/changes/2019-12-03-internal-visibility-changes). Enables an authenticated organization owner with the \`admin:org\` scope to update the organization's profile and member privileges. + * + * @tags orgs + * @name OrgsUpdate + * @summary Update an organization + * @request PATCH:/orgs/{org} + */ + orgsUpdate: ( + org: string, + data: { + /** Billing email address. This address is not publicized. */ + billing_email?: string; + /** @example ""http://github.blog"" */ + blog?: string; + /** The company name. */ + company?: string; + /** + * Default permission level members have for organization repositories: + * \\* \`read\` - can pull, but not push to or administer this repository. + * \\* \`write\` - can pull and push, but not administer this repository. + * \\* \`admin\` - can pull, push, and administer this repository. + * \\* \`none\` - no permissions granted by default. + * @default "read" + */ + default_repository_permission?: "read" | "write" | "admin" | "none"; + /** The description of the company. */ + description?: string; + /** The publicly visible email address. */ + email?: string; + /** Toggles whether an organization can use organization projects. */ + has_organization_projects?: boolean; + /** Toggles whether repositories that belong to the organization can use repository projects. */ + has_repository_projects?: boolean; + /** The location. */ + location?: string; + /** + * Specifies which types of repositories non-admin organization members can create. Can be one of: + * \\* \`all\` - all organization members can create public and private repositories. + * \\* \`private\` - members can create private repositories. This option is only available to repositories that are part of an organization on GitHub Enterprise Cloud. + * \\* \`none\` - only admin members can create repositories. + * **Note:** This parameter is deprecated and will be removed in the future. Its return value ignores internal repositories. Using this parameter overrides values set in \`members_can_create_repositories\`. See the parameter deprecation notice in the operation description for details. + */ + members_allowed_repository_creation_type?: "all" | "private" | "none"; + /** + * Toggles whether organization members can create internal repositories, which are visible to all enterprise members. You can only allow members to create internal repositories if your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. Can be one of: + * \\* \`true\` - all organization members can create internal repositories. + * \\* \`false\` - only organization owners can create internal repositories. + * Default: \`true\`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation. + */ + members_can_create_internal_repositories?: boolean; + /** + * Toggles whether organization members can create GitHub Pages sites. Can be one of: + * \\* \`true\` - all organization members can create GitHub Pages sites. + * \\* \`false\` - no organization members can create GitHub Pages sites. Existing published sites will not be impacted. + * @default true + */ + members_can_create_pages?: boolean; + /** + * Toggles whether organization members can create private GitHub Pages sites. Can be one of: + * \\* \`true\` - all organization members can create private GitHub Pages sites. + * \\* \`false\` - no organization members can create private GitHub Pages sites. Existing published sites will not be impacted. + * @default true + */ + members_can_create_private_pages?: boolean; + /** + * Toggles whether organization members can create private repositories, which are visible to organization members with permission. Can be one of: + * \\* \`true\` - all organization members can create private repositories. + * \\* \`false\` - only organization owners can create private repositories. + * Default: \`true\`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation. + */ + members_can_create_private_repositories?: boolean; + /** + * Toggles whether organization members can create public GitHub Pages sites. Can be one of: + * \\* \`true\` - all organization members can create public GitHub Pages sites. + * \\* \`false\` - no organization members can create public GitHub Pages sites. Existing published sites will not be impacted. + * @default true + */ + members_can_create_public_pages?: boolean; + /** + * Toggles whether organization members can create public repositories, which are visible to anyone. Can be one of: + * \\* \`true\` - all organization members can create public repositories. + * \\* \`false\` - only organization owners can create public repositories. + * Default: \`true\`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation. + */ + members_can_create_public_repositories?: boolean; + /** + * Toggles the ability of non-admin organization members to create repositories. Can be one of: + * \\* \`true\` - all organization members can create repositories. + * \\* \`false\` - only organization owners can create repositories. + * Default: \`true\` + * **Note:** A parameter can override this parameter. See \`members_allowed_repository_creation_type\` in this table for details. **Note:** A parameter can override this parameter. See \`members_allowed_repository_creation_type\` in this table for details. + * @default true + */ + members_can_create_repositories?: boolean; + /** The shorthand name of the company. */ + name?: string; + /** The Twitter username of the company. */ + twitter_username?: string; + }, + params: RequestParams = {}, + ) => + this.request< + OrganizationFull, + | BasicError + | { + documentation_url: string; + message: string; + } + | (ValidationError | ValidationErrorSimple) + >({ + path: \`/orgs/\${org}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsGetGithubActionsPermissionsOrganization + * @summary Get GitHub Actions permissions for an organization + * @request GET:/orgs/{org}/actions/permissions + */ + actionsGetGithubActionsPermissionsOrganization: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/permissions\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Sets the GitHub Actions permissions policy for repositories and allowed actions in an organization. If the organization belongs to an enterprise that has set restrictive permissions at the enterprise level, such as \`allowed_actions\` to \`selected\` actions, then you cannot override them for the organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsSetGithubActionsPermissionsOrganization + * @summary Set GitHub Actions permissions for an organization + * @request PUT:/orgs/{org}/actions/permissions + */ + actionsSetGithubActionsPermissionsOrganization: ( + org: string, + data: { + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions?: AllowedActions; + /** The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: \`all\`, \`none\`, or \`selected\`. */ + enabled_repositories: EnabledRepositories; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/permissions\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Lists the selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsListSelectedRepositoriesEnabledGithubActionsOrganization + * @summary List selected repositories enabled for GitHub Actions in an organization + * @request GET:/orgs/{org}/actions/permissions/repositories + */ + actionsListSelectedRepositoriesEnabledGithubActionsOrganization: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + repositories: Repository[]; + total_count: number; + }, + any + >({ + path: \`/orgs/\${org}/actions/permissions/repositories\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Replaces the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsSetSelectedRepositoriesEnabledGithubActionsOrganization + * @summary Set selected repositories enabled for GitHub Actions in an organization + * @request PUT:/orgs/{org}/actions/permissions/repositories + */ + actionsSetSelectedRepositoriesEnabledGithubActionsOrganization: ( + org: string, + data: { + /** List of repository IDs to enable for GitHub Actions. */ + selected_repository_ids: number[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/repositories\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsEnableSelectedRepositoryGithubActionsOrganization + * @summary Enable a selected repository for GitHub Actions in an organization + * @request PUT:/orgs/{org}/actions/permissions/repositories/{repository_id} + */ + actionsEnableSelectedRepositoryGithubActionsOrganization: ( + org: string, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/repositories/\${repositoryId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Removes a repository from the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for \`enabled_repositories\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsDisableSelectedRepositoryGithubActionsOrganization + * @summary Disable a selected repository for GitHub Actions in an organization + * @request DELETE:/orgs/{org}/actions/permissions/repositories/{repository_id} + */ + actionsDisableSelectedRepositoryGithubActionsOrganization: ( + org: string, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/repositories/\${repositoryId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Gets the selected actions that are allowed in an organization. To use this endpoint, the organization permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."" You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsGetAllowedActionsOrganization + * @summary Get allowed actions for an organization + * @request GET:/orgs/{org}/actions/permissions/selected-actions + */ + actionsGetAllowedActionsOrganization: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/selected-actions\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Sets the actions that are allowed in an organization. To use this endpoint, the organization permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." If the organization belongs to an enterprise that has \`selected\` actions set at the enterprise level, then you cannot override any of the enterprise's allowed actions settings. To use the \`patterns_allowed\` setting for private repositories, the organization must belong to an enterprise. If the organization does not belong to an enterprise, then the \`patterns_allowed\` setting only applies to public repositories in the organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`administration\` organization permission to use this API. + * + * @tags actions + * @name ActionsSetAllowedActionsOrganization + * @summary Set allowed actions for an organization + * @request PUT:/orgs/{org}/actions/permissions/selected-actions + */ + actionsSetAllowedActionsOrganization: (org: string, data: SelectedActions, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/permissions/selected-actions\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists all self-hosted runner groups configured in an organization and inherited from an enterprise. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListSelfHostedRunnerGroupsForOrg + * @summary List self-hosted runner groups for an organization + * @request GET:/orgs/{org}/actions/runner-groups + */ + actionsListSelfHostedRunnerGroupsForOrg: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + runner_groups: RunnerGroupsOrg[]; + total_count: number; + }, + any + >({ + path: \`/orgs/\${org}/actions/runner-groups\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Creates a new self-hosted runner group for an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsCreateSelfHostedRunnerGroupForOrg + * @summary Create a self-hosted runner group for an organization + * @request POST:/orgs/{org}/actions/runner-groups + */ + actionsCreateSelfHostedRunnerGroupForOrg: ( + org: string, + data: { + /** Name of the runner group. */ + name: string; + /** List of runner IDs to add to the runner group. */ + runners?: number[]; + /** List of repository IDs that can access the runner group. */ + selected_repository_ids?: number[]; + /** + * Visibility of a runner group. You can select all repositories, select individual repositories, or limit access to private repositories. Can be one of: \`all\`, \`selected\`, or \`private\`. + * @default "all" + */ + visibility?: "selected" | "all" | "private"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Gets a specific self-hosted runner group for an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsGetSelfHostedRunnerGroupForOrg + * @summary Get a self-hosted runner group for an organization + * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id} + */ + actionsGetSelfHostedRunnerGroupForOrg: (org: string, runnerGroupId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Updates the \`name\` and \`visibility\` of a self-hosted runner group in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsUpdateSelfHostedRunnerGroupForOrg + * @summary Update a self-hosted runner group for an organization + * @request PATCH:/orgs/{org}/actions/runner-groups/{runner_group_id} + */ + actionsUpdateSelfHostedRunnerGroupForOrg: ( + org: string, + runnerGroupId: number, + data: { + /** Name of the runner group. */ + name?: string; + /** Visibility of a runner group. You can select all repositories, select individual repositories, or all private repositories. Can be one of: \`all\`, \`selected\`, or \`private\`. */ + visibility?: "selected" | "all" | "private"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Deletes a self-hosted runner group for an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsDeleteSelfHostedRunnerGroupFromOrg + * @summary Delete a self-hosted runner group from an organization + * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id} + */ + actionsDeleteSelfHostedRunnerGroupFromOrg: (org: string, runnerGroupId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists the repositories with access to a self-hosted runner group configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListRepoAccessToSelfHostedRunnerGroupInOrg + * @summary List repository access to a self-hosted runner group in an organization + * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories + */ + actionsListRepoAccessToSelfHostedRunnerGroupInOrg: ( + org: string, + runnerGroupId: number, + params: RequestParams = {}, + ) => + this.request< + { + repositories: Repository[]; + total_count: number; + }, + any + >({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/repositories\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Replaces the list of repositories that have access to a self-hosted runner group configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsSetRepoAccessToSelfHostedRunnerGroupInOrg + * @summary Set repository access for a self-hosted runner group in an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories + */ + actionsSetRepoAccessToSelfHostedRunnerGroupInOrg: ( + org: string, + runnerGroupId: number, + data: { + /** List of repository IDs that can access the runner group. */ + selected_repository_ids: number[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/repositories\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Adds a repository to the list of selected repositories that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsAddRepoAccessToSelfHostedRunnerGroupInOrg + * @summary Add repository access to a self-hosted runner group in an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} + */ + actionsAddRepoAccessToSelfHostedRunnerGroupInOrg: ( + org: string, + runnerGroupId: number, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/repositories/\${repositoryId}\`, + method: "PUT", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Removes a repository from the list of selected repositories that can access a self-hosted runner group. The runner group must have \`visibility\` set to \`selected\`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)." You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg + * @summary Remove repository access to a self-hosted runner group in an organization + * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} + */ + actionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg: ( + org: string, + runnerGroupId: number, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/repositories/\${repositoryId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists self-hosted runners that are in a specific organization group. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListSelfHostedRunnersInGroupForOrg + * @summary List self-hosted runners in a group for an organization + * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners + */ + actionsListSelfHostedRunnersInGroupForOrg: ( + org: string, + runnerGroupId: number, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + runners: Runner[]; + total_count: number; + }, + any + >({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/runners\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Replaces the list of self-hosted runners that are part of an organization runner group. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsSetSelfHostedRunnersInGroupForOrg + * @summary Set self-hosted runners in a group for an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners + */ + actionsSetSelfHostedRunnersInGroupForOrg: ( + org: string, + runnerGroupId: number, + data: { + /** List of runner IDs to add to the runner group. */ + runners: number[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/runners\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Adds a self-hosted runner to a runner group configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsAddSelfHostedRunnerToGroupForOrg + * @summary Add a self-hosted runner to a group for an organization + * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + actionsAddSelfHostedRunnerToGroupForOrg: ( + org: string, + runnerGroupId: number, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/runners/\${runnerId}\`, + method: "PUT", + ...params, + }), + + /** + * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Removes a self-hosted runner from a group configured in an organization. The runner is then returned to the default group. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsRemoveSelfHostedRunnerFromGroupForOrg + * @summary Remove a self-hosted runner from a group for an organization + * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + */ + actionsRemoveSelfHostedRunnerFromGroupForOrg: ( + org: string, + runnerGroupId: number, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/runner-groups/\${runnerGroupId}/runners/\${runnerId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists all self-hosted runners configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListSelfHostedRunnersForOrg + * @summary List self-hosted runners for an organization + * @request GET:/orgs/{org}/actions/runners + */ + actionsListSelfHostedRunnersForOrg: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + runners: Runner[]; + total_count: number; + }, + any + >({ + path: \`/orgs/\${org}/actions/runners\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Lists binaries for the runner application that you can download and run. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsListRunnerApplicationsForOrg + * @summary List runner applications for an organization + * @request GET:/orgs/{org}/actions/runners/downloads + */ + actionsListRunnerApplicationsForOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runners/downloads\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Returns a token that you can pass to the \`config\` script. The token expires after one hour. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing \`TOKEN\` with the registration token provided by this endpoint. \`\`\` ./config.sh --url https://github.com/octo-org --token TOKEN \`\`\` + * + * @tags actions + * @name ActionsCreateRegistrationTokenForOrg + * @summary Create a registration token for an organization + * @request POST:/orgs/{org}/actions/runners/registration-token + */ + actionsCreateRegistrationTokenForOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runners/registration-token\`, + method: "POST", + format: "json", + ...params, + }), + + /** + * @description Returns a token that you can pass to the \`config\` script to remove a self-hosted runner from an organization. The token expires after one hour. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from an organization, replace \`TOKEN\` with the remove token provided by this endpoint. \`\`\` ./config.sh remove --token TOKEN \`\`\` + * + * @tags actions + * @name ActionsCreateRemoveTokenForOrg + * @summary Create a remove token for an organization + * @request POST:/orgs/{org}/actions/runners/remove-token + */ + actionsCreateRemoveTokenForOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runners/remove-token\`, + method: "POST", + format: "json", + ...params, + }), + + /** + * @description Gets a specific self-hosted runner configured in an organization. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsGetSelfHostedRunnerForOrg + * @summary Get a self-hosted runner for an organization + * @request GET:/orgs/{org}/actions/runners/{runner_id} + */ + actionsGetSelfHostedRunnerForOrg: (org: string, runnerId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runners/\${runnerId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. + * + * @tags actions + * @name ActionsDeleteSelfHostedRunnerFromOrg + * @summary Delete a self-hosted runner from an organization + * @request DELETE:/orgs/{org}/actions/runners/{runner_id} + */ + actionsDeleteSelfHostedRunnerFromOrg: (org: string, runnerId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/runners/\${runnerId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists all secrets available in an organization without revealing their encrypted values. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsListOrgSecrets + * @summary List organization secrets + * @request GET:/orgs/{org}/actions/secrets + */ + actionsListOrgSecrets: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + secrets: OrganizationActionsSecret[]; + total_count: number; + }, + any + >({ + path: \`/orgs/\${org}/actions/secrets\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Gets your public key, which you need to encrypt secrets. You need to encrypt a secret before you can create or update secrets. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsGetOrgPublicKey + * @summary Get an organization public key + * @request GET:/orgs/{org}/actions/secrets/public-key + */ + actionsGetOrgPublicKey: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/public-key\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Gets a single organization secret without revealing its encrypted value. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsGetOrgSecret + * @summary Get an organization secret + * @request GET:/orgs/{org}/actions/secrets/{secret_name} + */ + actionsGetOrgSecret: (org: string, secretName: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Creates or updates an organization secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. #### Example encrypting a secret using Node.js Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library. \`\`\` const sodium = require('tweetsodium'); const key = "base64-encoded-public-key"; const value = "plain-text-secret"; // Convert the message and key to Uint8Array's (Buffer implements that interface) const messageBytes = Buffer.from(value); const keyBytes = Buffer.from(key, 'base64'); // Encrypt using LibSodium. const encryptedBytes = sodium.seal(messageBytes, keyBytes); // Base64 the encrypted secret const encrypted = Buffer.from(encryptedBytes).toString('base64'); console.log(encrypted); \`\`\` #### Example encrypting a secret using Python Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3. \`\`\` from base64 import b64encode from nacl import encoding, public def encrypt(public_key: str, secret_value: str) -> str: """Encrypt a Unicode string using the public key.""" public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder()) sealed_box = public.SealedBox(public_key) encrypted = sealed_box.encrypt(secret_value.encode("utf-8")) return b64encode(encrypted).decode("utf-8") \`\`\` #### Example encrypting a secret using C# Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package. \`\`\` var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret"); var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU="); var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey); Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox)); \`\`\` #### Example encrypting a secret using Ruby Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem. \`\`\`ruby require "rbnacl" require "base64" key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=") public_key = RbNaCl::PublicKey.new(key) box = RbNaCl::Boxes::Sealed.from_public_key(public_key) encrypted_secret = box.encrypt("my_secret") # Print the base64 encoded secret puts Base64.strict_encode64(encrypted_secret) \`\`\` + * + * @tags actions + * @name ActionsCreateOrUpdateOrgSecret + * @summary Create or update an organization secret + * @request PUT:/orgs/{org}/actions/secrets/{secret_name} + */ + actionsCreateOrUpdateOrgSecret: ( + org: string, + secretName: string, + data: { + /** Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get an organization public key](https://docs.github.com/rest/reference/actions#get-an-organization-public-key) endpoint. */ + encrypted_value?: string; + /** ID of the key you used to encrypt the secret. */ + key_id?: string; + /** An array of repository ids that can access the organization secret. You can only provide a list of repository ids when the \`visibility\` is set to \`selected\`. You can manage the list of selected repositories using the [List selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#list-selected-repositories-for-an-organization-secret), [Set selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#set-selected-repositories-for-an-organization-secret), and [Remove selected repository from an organization secret](https://docs.github.com/rest/reference/actions#remove-selected-repository-from-an-organization-secret) endpoints. */ + selected_repository_ids?: string[]; + /** + * Configures the access that repositories have to the organization secret. Can be one of: + * \\- \`all\` - All repositories in an organization can access the secret. + * \\- \`private\` - Private repositories in an organization can access the secret. + * \\- \`selected\` - Only specific repositories can access the secret. + */ + visibility?: "all" | "private" | "selected"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Deletes a secret in an organization using the secret name. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsDeleteOrgSecret + * @summary Delete an organization secret + * @request DELETE:/orgs/{org}/actions/secrets/{secret_name} + */ + actionsDeleteOrgSecret: (org: string, secretName: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists all repositories that have been selected when the \`visibility\` for repository access to a secret is set to \`selected\`. You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsListSelectedReposForOrgSecret + * @summary List selected repositories for an organization secret + * @request GET:/orgs/{org}/actions/secrets/{secret_name}/repositories + */ + actionsListSelectedReposForOrgSecret: (org: string, secretName: string, params: RequestParams = {}) => + this.request< + { + repositories: MinimalRepository[]; + total_count: number; + }, + any + >({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}/repositories\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Replaces all repositories for an organization secret when the \`visibility\` for repository access is set to \`selected\`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsSetSelectedReposForOrgSecret + * @summary Set selected repositories for an organization secret + * @request PUT:/orgs/{org}/actions/secrets/{secret_name}/repositories + */ + actionsSetSelectedReposForOrgSecret: ( + org: string, + secretName: string, + data: { + /** An array of repository ids that can access the organization secret. You can only provide a list of repository ids when the \`visibility\` is set to \`selected\`. You can add and remove individual repositories using the [Set selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#set-selected-repositories-for-an-organization-secret) and [Remove selected repository from an organization secret](https://docs.github.com/rest/reference/actions#remove-selected-repository-from-an-organization-secret) endpoints. */ + selected_repository_ids?: number[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}/repositories\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), + + /** + * @description Adds a repository to an organization secret when the \`visibility\` for repository access is set to \`selected\`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsAddSelectedRepoToOrgSecret + * @summary Add selected repository to an organization secret + * @request PUT:/orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} + */ + actionsAddSelectedRepoToOrgSecret: ( + org: string, + secretName: string, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}/repositories/\${repositoryId}\`, + method: "PUT", + ...params, + }), + + /** + * @description Removes a repository from an organization secret when the \`visibility\` for repository access is set to \`selected\`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the \`admin:org\` scope to use this endpoint. GitHub Apps must have the \`secrets\` organization permission to use this endpoint. + * + * @tags actions + * @name ActionsRemoveSelectedRepoFromOrgSecret + * @summary Remove selected repository from an organization secret + * @request DELETE:/orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} + */ + actionsRemoveSelectedRepoFromOrgSecret: ( + org: string, + secretName: string, + repositoryId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/actions/secrets/\${secretName}/repositories/\${repositoryId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Note:** The audit log REST API is currently in beta and is subject to change. Gets the audit log for an organization. For more information, see "[Reviewing the audit log for your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization)." To use this endpoint, you must be an organization owner, and you must use an access token with the \`admin:org\` scope. GitHub Apps must have the \`organization_administration\` read permission to use this endpoint. + * + * @tags orgs + * @name OrgsGetAuditLog + * @summary Get the audit log for an organization + * @request GET:/orgs/{org}/audit-log + */ + orgsGetAuditLog: ( + org: string, + query?: { + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor. */ + after?: string; + /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor. */ + before?: string; + /** + * The event types to include: + * + * - \`web\` - returns web (non-Git) events + * - \`git\` - returns Git events + * - \`all\` - returns both web and Git events + * + * The default is \`web\`. + */ + include?: "web" | "git" | "all"; + /** + * The order of audit log events. To list newest events first, specify \`desc\`. To list oldest events first, specify \`asc\`. + * + * The default is \`desc\`. + */ + order?: "desc" | "asc"; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** A search phrase. For more information, see [Searching the audit log](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#searching-the-audit-log). */ + phrase?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/audit-log\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description List the users blocked by an organization. + * + * @tags orgs + * @name OrgsListBlockedUsers + * @summary List users blocked by an organization + * @request GET:/orgs/{org}/blocks + */ + orgsListBlockedUsers: (org: string, params: RequestParams = {}) => + this.request< + SimpleUser[], + { + documentation_url: string; + message: string; + } + >({ + path: \`/orgs/\${org}/blocks\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsCheckBlockedUser + * @summary Check if a user is blocked by an organization + * @request GET:/orgs/{org}/blocks/{username} + */ + orgsCheckBlockedUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/blocks/\${username}\`, + method: "GET", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsBlockUser + * @summary Block a user from an organization + * @request PUT:/orgs/{org}/blocks/{username} + */ + orgsBlockUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/blocks/\${username}\`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsUnblockUser + * @summary Unblock a user from an organization + * @request DELETE:/orgs/{org}/blocks/{username} + */ + orgsUnblockUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/blocks/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products). An authenticated organization owner with the \`read:org\` scope can list all credential authorizations for an organization that uses SAML single sign-on (SSO). The credentials are either personal access tokens or SSH keys that organization members have authorized for the organization. For more information, see [About authentication with SAML single sign-on](https://help.github.com/en/articles/about-authentication-with-saml-single-sign-on). + * + * @tags orgs + * @name OrgsListSamlSsoAuthorizations + * @summary List SAML SSO authorizations for an organization + * @request GET:/orgs/{org}/credential-authorizations + */ + orgsListSamlSsoAuthorizations: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/credential-authorizations\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products). An authenticated organization owner with the \`admin:org\` scope can remove a credential authorization for an organization that uses SAML SSO. Once you remove someone's credential authorization, they will need to create a new personal access token or SSH key and authorize it for the organization they want to access. + * + * @tags orgs + * @name OrgsRemoveSamlSsoAuthorization + * @summary Remove a SAML SSO authorization for an organization + * @request DELETE:/orgs/{org}/credential-authorizations/{credential_id} + */ + orgsRemoveSamlSsoAuthorization: (org: string, credentialId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/credential-authorizations/\${credentialId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags activity + * @name ActivityListPublicOrgEvents + * @summary List public organization events + * @request GET:/orgs/{org}/events + */ + activityListPublicOrgEvents: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/events\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description The return hash contains \`failed_at\` and \`failed_reason\` fields which represent the time at which the invitation failed and the reason for the failure. + * + * @tags orgs + * @name OrgsListFailedInvitations + * @summary List failed organization invitations + * @request GET:/orgs/{org}/failed_invitations + */ + orgsListFailedInvitations: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/failed_invitations\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsListWebhooks + * @summary List organization webhooks + * @request GET:/orgs/{org}/hooks + */ + orgsListWebhooks: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/hooks\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Here's how you can create a hook that posts payloads in JSON format: + * + * @tags orgs + * @name OrgsCreateWebhook + * @summary Create an organization webhook + * @request POST:/orgs/{org}/hooks + */ + orgsCreateWebhook: ( + org: string, + data: { + /** + * Determines if notifications are sent when the webhook is triggered. Set to \`true\` to send notifications. + * @default true + */ + active?: boolean; + /** Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/orgs#create-hook-config-params). */ + config: { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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 ""password"" */ + password?: 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; + /** The URL to which the payloads will be delivered. */ + url: WebhookConfigUrl; + /** @example ""kdaigle"" */ + username?: string; + }; + /** + * Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. + * @default ["push"] + */ + events?: string[]; + /** Must be passed as "web". */ + name: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/hooks\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Returns a webhook configured in an organization. To get only the webhook \`config\` properties, see "[Get a webhook configuration for an organization](/rest/reference/orgs#get-a-webhook-configuration-for-an-organization)." + * + * @tags orgs + * @name OrgsGetWebhook + * @summary Get an organization webhook + * @request GET:/orgs/{org}/hooks/{hook_id} + */ + orgsGetWebhook: (org: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Updates a webhook configured in an organization. When you update a webhook, the \`secret\` will be overwritten. If you previously had a \`secret\` set, you must provide the same \`secret\` or set a new \`secret\` or the secret will be removed. If you are only updating individual webhook \`config\` properties, use "[Update a webhook configuration for an organization](/rest/reference/orgs#update-a-webhook-configuration-for-an-organization)." + * + * @tags orgs + * @name OrgsUpdateWebhook + * @summary Update an organization webhook + * @request PATCH:/orgs/{org}/hooks/{hook_id} + */ + orgsUpdateWebhook: ( + org: string, + hookId: number, + data: { + /** + * Determines if notifications are sent when the webhook is triggered. Set to \`true\` to send notifications. + * @default true + */ + active?: boolean; + /** Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/orgs#update-hook-config-params). */ + config?: { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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; + /** 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; + /** The URL to which the payloads will be delivered. */ + url: WebhookConfigUrl; + }; + /** + * Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. + * @default ["push"] + */ + events?: string[]; + /** @example ""web"" */ + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsDeleteWebhook + * @summary Delete an organization webhook + * @request DELETE:/orgs/{org}/hooks/{hook_id} + */ + orgsDeleteWebhook: (org: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Returns the webhook configuration for an organization. To get more information about the webhook, including the \`active\` state and \`events\`, use "[Get an organization webhook ](/rest/reference/orgs#get-an-organization-webhook)." Access tokens must have the \`admin:org_hook\` scope, and GitHub Apps must have the \`organization_hooks:read\` permission. + * + * @tags orgs + * @name OrgsGetWebhookConfigForOrg + * @summary Get a webhook configuration for an organization + * @request GET:/orgs/{org}/hooks/{hook_id}/config + */ + orgsGetWebhookConfigForOrg: (org: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}/config\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Updates the webhook configuration for an organization. To update more information about the webhook, including the \`active\` state and \`events\`, use "[Update an organization webhook ](/rest/reference/orgs#update-an-organization-webhook)." Access tokens must have the \`admin:org_hook\` scope, and GitHub Apps must have the \`organization_hooks:write\` permission. + * + * @tags orgs + * @name OrgsUpdateWebhookConfigForOrg + * @summary Update a webhook configuration for an organization + * @request PATCH:/orgs/{org}/hooks/{hook_id}/config + */ + orgsUpdateWebhookConfigForOrg: ( + org: string, + hookId: number, + data: { + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ + content_type?: WebhookConfigContentType; + /** 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; + /** 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; + /** The URL to which the payloads will be delivered. */ + url?: WebhookConfigUrl; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}/config\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description This will trigger a [ping event](https://docs.github.com/webhooks/#ping-event) to be sent to the hook. + * + * @tags orgs + * @name OrgsPingWebhook + * @summary Ping an organization webhook + * @request POST:/orgs/{org}/hooks/{hook_id}/pings + */ + orgsPingWebhook: (org: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/hooks/\${hookId}/pings\`, + method: "POST", + ...params, + }), + + /** + * @description Enables an authenticated GitHub App to find the organization's installation information. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * + * @tags apps + * @name AppsGetOrgInstallation + * @summary Get an organization installation for the authenticated app + * @request GET:/orgs/{org}/installation + */ + appsGetOrgInstallation: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/installation\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Lists all GitHub Apps in an organization. The installation count includes all GitHub Apps installed on repositories in the organization. You must be an organization owner with \`admin:read\` scope to use this endpoint. + * + * @tags orgs + * @name OrgsListAppInstallations + * @summary List app installations for an organization + * @request GET:/orgs/{org}/installations + */ + orgsListAppInstallations: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request< + { + installations: Installation[]; + total_count: number; + }, + any + >({ + path: \`/orgs/\${org}/installations\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Shows which type of GitHub user can interact with this organization and when the restriction expires. If there is no restrictions, you will see an empty response. + * + * @tags interactions + * @name InteractionsGetRestrictionsForOrg + * @summary Get interaction restrictions for an organization + * @request GET:/orgs/{org}/interaction-limits + */ + interactionsGetRestrictionsForOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/interaction-limits\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Temporarily restricts interactions to a certain type of GitHub user in any public repository in the given organization. You must be an organization owner to set these restrictions. Setting the interaction limit at the organization level will overwrite any interaction limits that are set for individual repositories owned by the organization. + * + * @tags interactions + * @name InteractionsSetRestrictionsForOrg + * @summary Set interaction restrictions for an organization + * @request PUT:/orgs/{org}/interaction-limits + */ + interactionsSetRestrictionsForOrg: (org: string, data: InteractionLimit, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/interaction-limits\`, + method: "PUT", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Removes all interaction restrictions from public repositories in the given organization. You must be an organization owner to remove restrictions. + * + * @tags interactions + * @name InteractionsRemoveRestrictionsForOrg + * @summary Remove interaction restrictions for an organization + * @request DELETE:/orgs/{org}/interaction-limits + */ + interactionsRemoveRestrictionsForOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/interaction-limits\`, + method: "DELETE", + ...params, + }), + + /** + * @description The return hash contains a \`role\` field which refers to the Organization Invitation role and will be one of the following values: \`direct_member\`, \`admin\`, \`billing_manager\`, \`hiring_manager\`, or \`reinstate\`. If the invitee is not a GitHub member, the \`login\` field in the return hash will be \`null\`. + * + * @tags orgs + * @name OrgsListPendingInvitations + * @summary List pending organization invitations + * @request GET:/orgs/{org}/invitations + */ + orgsListPendingInvitations: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/invitations\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Invite people to an organization by using their GitHub user ID or their email address. In order to create invitations in an organization, the authenticated user must be an organization owner. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * + * @tags orgs + * @name OrgsCreateInvitation + * @summary Create an organization invitation + * @request POST:/orgs/{org}/invitations + */ + orgsCreateInvitation: ( + org: string, + data: { + /** **Required unless you provide \`invitee_id\`**. Email address of the person you are inviting, which can be an existing GitHub user. */ + email?: string; + /** **Required unless you provide \`email\`**. GitHub user ID for the person you are inviting. */ + invitee_id?: number; + /** + * Specify role for new member. Can be one of: + * \\* \`admin\` - Organization owners with full administrative rights to the organization and complete access to all repositories and teams. + * \\* \`direct_member\` - Non-owner organization members with ability to see other members and join teams by invitation. + * \\* \`billing_manager\` - Non-owner organization members with ability to manage the billing settings of your organization. + * @default "direct_member" + */ + role?: "admin" | "direct_member" | "billing_manager"; + /** Specify IDs for the teams you want to invite new members to. */ + team_ids?: number[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/invitations\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Cancel an organization invitation. In order to cancel an organization invitation, the authenticated user must be an organization owner. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). + * + * @tags orgs + * @name OrgsCancelInvitation + * @summary Cancel an organization invitation + * @request DELETE:/orgs/{org}/invitations/{invitation_id} + */ + orgsCancelInvitation: (org: string, invitationId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/invitations/\${invitationId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description List all teams associated with an invitation. In order to see invitations in an organization, the authenticated user must be an organization owner. + * + * @tags orgs + * @name OrgsListInvitationTeams + * @summary List organization invitation teams + * @request GET:/orgs/{org}/invitations/{invitation_id}/teams + */ + orgsListInvitationTeams: ( + org: string, + invitationId: number, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/invitations/\${invitationId}/teams\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description List issues in an organization assigned to the authenticated user. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * + * @tags issues + * @name IssuesListForOrg + * @summary List organization issues assigned to the authenticated user + * @request GET:/orgs/{org}/issues + */ + issuesListForOrg: ( + org: string, + query?: { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: "asc" | "desc"; + /** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ + filter?: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: "created" | "updated" | "comments"; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: "open" | "closed" | "all"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/issues\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description List all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned. + * + * @tags orgs + * @name OrgsListMembers + * @summary List organization members + * @request GET:/orgs/{org}/members + */ + orgsListMembers: ( + org: string, + query?: { + /** + * Filter members returned in the list. Can be one of: + * \\* \`2fa_disabled\` - Members without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. Available for organization owners. + * \\* \`all\` - All members the authenticated user can see. + * @default "all" + */ + filter?: "2fa_disabled" | "all"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Filter members returned by their role. Can be one of: + * \\* \`all\` - All members of the organization, regardless of role. + * \\* \`admin\` - Organization owners. + * \\* \`member\` - Non-owner organization members. + * @default "all" + */ + role?: "all" | "admin" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/members\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Check if a user is, publicly or privately, a member of the organization. + * + * @tags orgs + * @name OrgsCheckMembershipForUser + * @summary Check organization membership for a user + * @request GET:/orgs/{org}/members/{username} + */ + orgsCheckMembershipForUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/members/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. + * + * @tags orgs + * @name OrgsRemoveMember + * @summary Remove an organization member + * @request DELETE:/orgs/{org}/members/{username} + */ + orgsRemoveMember: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/members/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description In order to get a user's membership with an organization, the authenticated user must be an organization member. + * + * @tags orgs + * @name OrgsGetMembershipForUser + * @summary Get organization membership for a user + * @request GET:/orgs/{org}/memberships/{username} + */ + orgsGetMembershipForUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/memberships/\${username}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Only authenticated organization owners can add a member to the organization or update the member's role. * If the authenticated user is _adding_ a member to the organization, the invited user will receive an email inviting them to the organization. The user's [membership status](https://docs.github.com/rest/reference/orgs#get-organization-membership-for-a-user) will be \`pending\` until they accept the invitation. * Authenticated users can _update_ a user's membership by passing the \`role\` parameter. If the authenticated user changes a member's role to \`admin\`, the affected user will receive an email notifying them that they've been made an organization owner. If the authenticated user changes an owner's role to \`member\`, no email will be sent. **Rate limits** To prevent abuse, the authenticated user is limited to 50 organization invitations per 24 hour period. If the organization is more than one month old or on a paid plan, the limit is 500 invitations per 24 hour period. + * + * @tags orgs + * @name OrgsSetMembershipForUser + * @summary Set organization membership for a user + * @request PUT:/orgs/{org}/memberships/{username} + */ + orgsSetMembershipForUser: ( + org: string, + username: string, + data: { + /** + * The role to give the user in the organization. Can be one of: + * \\* \`admin\` - The user will become an owner of the organization. + * \\* \`member\` - The user will become a non-owner member of the organization. + * @default "member" + */ + role?: "admin" | "member"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/memberships/\${username}\`, + method: "PUT", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description In order to remove a user's membership with an organization, the authenticated user must be an organization owner. If the specified user is an active member of the organization, this will remove them from the organization. If the specified user has been invited to the organization, this will cancel their invitation. The specified user will receive an email notification in both cases. + * + * @tags orgs + * @name OrgsRemoveMembershipForUser + * @summary Remove organization membership for a user + * @request DELETE:/orgs/{org}/memberships/{username} + */ + orgsRemoveMembershipForUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/memberships/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists the most recent migrations. + * + * @tags migrations + * @name MigrationsListForOrg + * @summary List organization migrations + * @request GET:/orgs/{org}/migrations + */ + migrationsListForOrg: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/migrations\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Initiates the generation of a migration archive. + * + * @tags migrations + * @name MigrationsStartForOrg + * @summary Start an organization migration + * @request POST:/orgs/{org}/migrations + */ + migrationsStartForOrg: ( + org: string, + data: { + exclude?: string[]; + /** + * Indicates whether attachments should be excluded from the migration (to reduce migration archive file size). + * @default false + */ + exclude_attachments?: boolean; + /** + * Indicates whether repositories should be locked (to prevent manipulation) while migrating data. + * @default false + */ + lock_repositories?: boolean; + /** A list of arrays indicating which repositories should be migrated. */ + repositories: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/migrations\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Fetches the status of a migration. The \`state\` of a migration can be one of the following values: * \`pending\`, which means the migration hasn't started yet. * \`exporting\`, which means the migration is in progress. * \`exported\`, which means the migration finished successfully. * \`failed\`, which means the migration failed. + * + * @tags migrations + * @name MigrationsGetStatusForOrg + * @summary Get an organization migration status + * @request GET:/orgs/{org}/migrations/{migration_id} + */ + migrationsGetStatusForOrg: (org: string, migrationId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/migrations/\${migrationId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Fetches the URL to a migration archive. + * + * @tags migrations + * @name MigrationsDownloadArchiveForOrg + * @summary Download an organization migration archive + * @request GET:/orgs/{org}/migrations/{migration_id}/archive + */ + migrationsDownloadArchiveForOrg: (org: string, migrationId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/migrations/\${migrationId}/archive\`, + method: "GET", + ...params, + }), + + /** + * @description Deletes a previous migration archive. Migration archives are automatically deleted after seven days. + * + * @tags migrations + * @name MigrationsDeleteArchiveForOrg + * @summary Delete an organization migration archive + * @request DELETE:/orgs/{org}/migrations/{migration_id}/archive + */ + migrationsDeleteArchiveForOrg: (org: string, migrationId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/migrations/\${migrationId}/archive\`, + method: "DELETE", + ...params, + }), + + /** + * @description Unlocks a repository that was locked for migration. You should unlock each migrated repository and [delete them](https://docs.github.com/rest/reference/repos#delete-a-repository) when the migration is complete and you no longer need the source data. + * + * @tags migrations + * @name MigrationsUnlockRepoForOrg + * @summary Unlock an organization repository + * @request DELETE:/orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock + */ + migrationsUnlockRepoForOrg: (org: string, migrationId: number, repoName: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/migrations/\${migrationId}/repos/\${repoName}/lock\`, + method: "DELETE", + ...params, + }), + + /** + * @description List all the repositories for this organization migration. + * + * @tags migrations + * @name MigrationsListReposForOrg + * @summary List repositories in an organization migration + * @request GET:/orgs/{org}/migrations/{migration_id}/repositories + */ + migrationsListReposForOrg: ( + org: string, + migrationId: number, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/migrations/\${migrationId}/repositories\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description List all users who are outside collaborators of an organization. + * + * @tags orgs + * @name OrgsListOutsideCollaborators + * @summary List outside collaborators for an organization + * @request GET:/orgs/{org}/outside_collaborators + */ + orgsListOutsideCollaborators: ( + org: string, + query?: { + /** + * Filter the list of outside collaborators. Can be one of: + * \\* \`2fa_disabled\`: Outside collaborators without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. + * \\* \`all\`: All outside collaborators. + * @default "all" + */ + filter?: "2fa_disabled" | "all"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/outside_collaborators\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description When an organization member is converted to an outside collaborator, they'll only have access to the repositories that their current team membership allows. The user will no longer be a member of the organization. For more information, see "[Converting an organization member to an outside collaborator](https://help.github.com/articles/converting-an-organization-member-to-an-outside-collaborator/)". + * + * @tags orgs + * @name OrgsConvertMemberToOutsideCollaborator + * @summary Convert an organization member to outside collaborator + * @request PUT:/orgs/{org}/outside_collaborators/{username} + */ + orgsConvertMemberToOutsideCollaborator: (org: string, username: string, params: RequestParams = {}) => + this.request< + void, + | { + documentation_url?: string; + message?: string; + } + | BasicError + >({ + path: \`/orgs/\${org}/outside_collaborators/\${username}\`, + method: "PUT", + ...params, + }), + + /** + * @description Removing a user from this list will remove them from all the organization's repositories. + * + * @tags orgs + * @name OrgsRemoveOutsideCollaborator + * @summary Remove outside collaborator from an organization + * @request DELETE:/orgs/{org}/outside_collaborators/{username} + */ + orgsRemoveOutsideCollaborator: (org: string, username: string, params: RequestParams = {}) => + this.request< + void, + { + documentation_url?: string; + message?: string; + } + >({ + path: \`/orgs/\${org}/outside_collaborators/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists the projects in an organization. Returns a \`404 Not Found\` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * + * @tags projects + * @name ProjectsListForOrg + * @summary List organization projects + * @request GET:/orgs/{org}/projects + */ + projectsListForOrg: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: "open" | "closed" | "all"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/projects\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Creates an organization project board. Returns a \`404 Not Found\` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * + * @tags projects + * @name ProjectsCreateForOrg + * @summary Create an organization project + * @request POST:/orgs/{org}/projects + */ + projectsCreateForOrg: ( + org: string, + data: { + /** The description of the project. */ + body?: string; + /** The name of the project. */ + name: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/projects\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Members of an organization can choose to have their membership publicized or not. + * + * @tags orgs + * @name OrgsListPublicMembers + * @summary List public organization members + * @request GET:/orgs/{org}/public_members + */ + orgsListPublicMembers: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/public_members\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsCheckPublicMembershipForUser + * @summary Check public organization membership for a user + * @request GET:/orgs/{org}/public_members/{username} + */ + orgsCheckPublicMembershipForUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/public_members/\${username}\`, + method: "GET", + ...params, + }), + + /** + * @description The user can publicize their own membership. (A user cannot publicize the membership for another user.) Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * + * @tags orgs + * @name OrgsSetPublicMembershipForAuthenticatedUser + * @summary Set public organization membership for the authenticated user + * @request PUT:/orgs/{org}/public_members/{username} + */ + orgsSetPublicMembershipForAuthenticatedUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/public_members/\${username}\`, + method: "PUT", + ...params, + }), + + /** + * No description + * + * @tags orgs + * @name OrgsRemovePublicMembershipForAuthenticatedUser + * @summary Remove public organization membership for the authenticated user + * @request DELETE:/orgs/{org}/public_members/{username} + */ + orgsRemovePublicMembershipForAuthenticatedUser: (org: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/public_members/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists repositories for the specified organization. + * + * @tags repos + * @name ReposListForOrg + * @summary List organization repositories + * @request GET:/orgs/{org}/repos + */ + reposListForOrg: ( + org: string, + query?: { + /** Can be one of \`asc\` or \`desc\`. Default: when using \`full_name\`: \`asc\`, otherwise \`desc\` */ + direction?: "asc" | "desc"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Can be one of \`created\`, \`updated\`, \`pushed\`, \`full_name\`. + * @default "created" + */ + sort?: "created" | "updated" | "pushed" | "full_name"; + /** Specifies the types of repositories you want returned. Can be one of \`all\`, \`public\`, \`private\`, \`forks\`, \`sources\`, \`member\`, \`internal\`. Default: \`all\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`type\` can also be \`internal\`. */ + type?: "all" | "public" | "private" | "forks" | "sources" | "member" | "internal"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/repos\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Creates a new repository in the specified organization. The authenticated user must be a member of the organization. **OAuth scope requirements** When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include: * \`public_repo\` scope or \`repo\` scope to create a public repository * \`repo\` scope to create a private repository + * + * @tags repos + * @name ReposCreateInOrg + * @summary Create an organization repository + * @request POST:/orgs/{org}/repos + */ + reposCreateInOrg: ( + org: string, + data: { + /** + * Either \`true\` to allow merging pull requests with a merge commit, or \`false\` to prevent merging pull requests with merge commits. + * @default true + */ + allow_merge_commit?: boolean; + /** + * Either \`true\` to allow rebase-merging pull requests, or \`false\` to prevent rebase-merging. + * @default true + */ + allow_rebase_merge?: boolean; + /** + * Either \`true\` to allow squash-merging pull requests, or \`false\` to prevent squash-merging. + * @default true + */ + allow_squash_merge?: boolean; + /** + * Pass \`true\` to create an initial commit with empty README. + * @default false + */ + auto_init?: boolean; + /** + * Either \`true\` to allow automatically deleting head branches when pull requests are merged, or \`false\` to prevent automatic deletion. + * @default false + */ + delete_branch_on_merge?: boolean; + /** A short description of the repository. */ + description?: string; + /** Desired language or platform [.gitignore template](https://github.com/github/gitignore) to apply. Use the name of the template without the extension. For example, "Haskell". */ + gitignore_template?: string; + /** + * Either \`true\` to enable issues for this repository or \`false\` to disable them. + * @default true + */ + has_issues?: boolean; + /** + * Either \`true\` to enable projects for this repository or \`false\` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is \`false\`, and if you pass \`true\`, the API returns an error. + * @default true + */ + has_projects?: boolean; + /** + * Either \`true\` to enable the wiki for this repository or \`false\` to disable it. + * @default true + */ + has_wiki?: boolean; + /** A URL with more information about the repository. */ + homepage?: string; + /** + * Either \`true\` to make this repo available as a template repository or \`false\` to prevent it. + * @default false + */ + is_template?: boolean; + /** Choose an [open source license template](https://choosealicense.com/) that best suits your needs, and then use the [license keyword](https://help.github.com/articles/licensing-a-repository/#searching-github-by-license-type) as the \`license_template\` string. For example, "mit" or "mpl-2.0". */ + license_template?: string; + /** The name of the repository. */ + name: string; + /** + * Either \`true\` to create a private repository or \`false\` to create a public one. + * @default false + */ + private?: boolean; + /** The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization. */ + team_id?: number; + /** + * Can be \`public\` or \`private\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`visibility\` can also be \`internal\`. For more information, see "[Creating an internal repository](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-repository-visibility#about-internal-repositories)" in the GitHub Help documentation. + * The \`visibility\` parameter overrides the \`private\` parameter when you use both parameters with the \`nebula-preview\` preview header. + */ + visibility?: "public" | "private" | "visibility" | "internal"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/repos\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Thread Subscription - * Thread Subscription - */ -export interface ThreadSubscription { - /** - * @format date-time - * @example "2012-10-06T21:34:12Z" - */ - created_at: string | null; - ignored: boolean; - reason: string | null; - /** - * @format uri - * @example "https://api.github.com/repos/1" - */ - repository_url?: string; - /** @example true */ - subscribed: boolean; - /** - * @format uri - * @example "https://api.github.com/notifications/threads/1" - */ - thread_url?: string; - /** - * @format uri - * @example "https://api.github.com/notifications/threads/1/subscription" - */ - url: string; -} + /** + * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Access tokens must have the \`repo\` or \`admin:org\` scope. + * + * @tags billing + * @name BillingGetGithubActionsBillingOrg + * @summary Get GitHub Actions billing for an organization + * @request GET:/orgs/{org}/settings/billing/actions + */ + billingGetGithubActionsBillingOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/settings/billing/actions\`, + method: "GET", + format: "json", + ...params, + }), -/** - * Topic - * A topic aggregates entities that are related to a subject. - */ -export interface Topic { - names: string[]; -} + /** + * @description Gets the free and paid storage usued for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`repo\` or \`admin:org\` scope. + * + * @tags billing + * @name BillingGetGithubPackagesBillingOrg + * @summary Get GitHub Packages billing for an organization + * @request GET:/orgs/{org}/settings/billing/packages + */ + billingGetGithubPackagesBillingOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/settings/billing/packages\`, + method: "GET", + format: "json", + ...params, + }), -/** - * Topic Search Result Item - * Topic Search Result Item - */ -export interface TopicSearchResultItem { - aliases?: - | { - topic_relation?: { - id?: number; - name?: string; - relation_type?: string; - topic_id?: number; - }; - }[] - | null; - /** @format date-time */ - created_at: string; - created_by: string | null; - curated: boolean; - description: string | null; - display_name: string | null; - featured: boolean; - /** @format uri */ - logo_url?: string | null; - name: string; - related?: - | { - topic_relation?: { - id?: number; - name?: string; - relation_type?: string; - topic_id?: number; - }; - }[] - | null; - released: string | null; - repository_count?: number | null; - score: number; - short_description: string | null; - text_matches?: SearchResultTextMatches; - /** @format date-time */ - updated_at: string; -} + /** + * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`repo\` or \`admin:org\` scope. + * + * @tags billing + * @name BillingGetSharedStorageBillingOrg + * @summary Get shared storage billing for an organization + * @request GET:/orgs/{org}/settings/billing/shared-storage + */ + billingGetSharedStorageBillingOrg: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/settings/billing/shared-storage\`, + method: "GET", + format: "json", + ...params, + }), -/** Traffic */ -export interface Traffic { - count: number; - /** @format date-time */ - timestamp: string; - uniques: number; -} + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups available in an organization. You can limit your page results using the \`per_page\` parameter. GitHub generates a url-encoded \`page\` token using a cursor value for where the next page begins. For more information on cursor pagination, see "[Offset and Cursor Pagination explained](https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89)." The \`per_page\` parameter provides pagination for a list of IdP groups the authenticated user can access in an organization. For example, if the user \`octocat\` wants to see two groups per page in \`octo-org\` via cURL, it would look like this: + * + * @tags teams + * @name TeamsListIdpGroupsForOrg + * @summary List IdP groups for an organization + * @request GET:/orgs/{org}/team-sync/groups + */ + teamsListIdpGroupsForOrg: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/team-sync/groups\`, + method: "GET", + query: query, + format: "json", + ...params, + }), -/** - * User Marketplace Purchase - * User Marketplace Purchase - */ -export interface UserMarketplacePurchase { - account: MarketplaceAccount; - /** @example "monthly" */ - billing_cycle: string; - /** - * @format date-time - * @example "2017-11-11T00:00:00Z" - */ - free_trial_ends_on: string | null; - /** - * @format date-time - * @example "2017-11-11T00:00:00Z" - */ - next_billing_date: string | null; - /** @example true */ - on_free_trial: boolean; - /** Marketplace Listing Plan */ - plan: MarketplaceListingPlan; - unit_count: number | null; - /** - * @format date-time - * @example "2017-11-02T01:12:12Z" - */ - updated_at: string | null; -} + /** + * @description Lists all teams in an organization that are visible to the authenticated user. + * + * @tags teams + * @name TeamsList + * @summary List teams + * @request GET:/orgs/{org}/teams + */ + teamsList: ( + org: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams\`, + method: "GET", + query: query, + format: "json", + ...params, + }), -/** - * User Search Result Item - * User Search Result Item - */ -export interface UserSearchResultItem { - /** @format uri */ - avatar_url: string; - bio?: string | null; - blog?: string | null; - company?: string | null; - /** @format date-time */ - created_at?: string; - /** @format email */ - email?: string | null; - events_url: string; - followers?: number; - /** @format uri */ - followers_url: string; - following?: number; - following_url: string; - gists_url: string; - gravatar_id: string | null; - hireable?: boolean | null; - /** @format uri */ - html_url: string; - id: number; - location?: string | null; - login: string; - name?: string | null; - node_id: string; - /** @format uri */ - organizations_url: string; - public_gists?: number; - public_repos?: number; - /** @format uri */ - received_events_url: string; - /** @format uri */ - repos_url: string; - score: number; - site_admin: boolean; - starred_url: string; - /** @format uri */ - subscriptions_url: string; - /** @format date-time */ - suspended_at?: string | null; - text_matches?: SearchResultTextMatches; - type: string; - /** @format date-time */ - updated_at?: string; - /** @format uri */ - url: string; -} + /** + * @description To create a team, the authenticated user must be a member or owner of \`{org}\`. By default, organization members can create teams. Organization owners can limit team creation to organization owners. For more information, see "[Setting team creation permissions](https://help.github.com/en/articles/setting-team-creation-permissions-in-your-organization)." When you create a new team, you automatically become a team maintainer without explicitly adding yourself to the optional array of \`maintainers\`. For more information, see "[About teams](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/about-teams)". + * + * @tags teams + * @name TeamsCreate + * @summary Create a team + * @request POST:/orgs/{org}/teams + */ + teamsCreate: ( + org: string, + data: { + /** The description of the team. */ + description?: string; + /** List GitHub IDs for organization members who will become team maintainers. */ + maintainers?: string[]; + /** The name of the team. */ + name: string; + /** The ID of a team to set as the parent team. */ + parent_team_id?: number; + /** + * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer newly-added repositories. + * \\* \`push\` - team members can pull and push, but not administer newly-added repositories. + * \\* \`admin\` - team members can pull, push and administer newly-added repositories. + * @default "pull" + */ + permission?: "pull" | "push" | "admin"; + /** + * The level of privacy this team should have. The options are: + * **For a non-nested team:** + * \\* \`secret\` - only visible to organization owners and members of this team. + * \\* \`closed\` - visible to all members of this organization. + * Default: \`secret\` + * **For a parent or child team:** + * \\* \`closed\` - visible to all members of this organization. + * Default for child team: \`closed\` + */ + privacy?: "secret" | "closed"; + /** The full name (e.g., "organization-name/repository-name") of repositories to add the team to. */ + repo_names?: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Validation Error - * Validation Error - */ -export interface ValidationError { - documentation_url: string; - errors?: { - code: string; - field?: string; - index?: number; - message?: string; - resource?: string; - value?: string | null | number | null | string[] | null; - }[]; - message: string; -} + /** + * @description Gets a team using the team's \`slug\`. GitHub generates the \`slug\` from the team \`name\`. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}\`. + * + * @tags teams + * @name TeamsGetByName + * @summary Get a team by name + * @request GET:/orgs/{org}/teams/{team_slug} + */ + teamsGetByName: (org: string, teamSlug: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}\`, + method: "GET", + format: "json", + ...params, + }), -/** - * Validation Error Simple - * Validation Error Simple - */ -export interface ValidationErrorSimple { - documentation_url: string; - errors?: string[]; - message: string; -} + /** + * @description To edit a team, the authenticated user must either be an organization owner or a team maintainer. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}\`. + * + * @tags teams + * @name TeamsUpdateInOrg + * @summary Update a team + * @request PATCH:/orgs/{org}/teams/{team_slug} + */ + teamsUpdateInOrg: ( + org: string, + teamSlug: string, + data: { + /** The description of the team. */ + description?: string; + /** The name of the team. */ + name: string; + /** The ID of a team to set as the parent team. */ + parent_team_id?: number; + /** + * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer newly-added repositories. + * \\* \`push\` - team members can pull and push, but not administer newly-added repositories. + * \\* \`admin\` - team members can pull, push and administer newly-added repositories. + * @default "pull" + */ + permission?: "pull" | "push" | "admin"; + /** + * The level of privacy this team should have. Editing teams without specifying this parameter leaves \`privacy\` intact. When a team is nested, the \`privacy\` for parent teams cannot be \`secret\`. The options are: + * **For a non-nested team:** + * \\* \`secret\` - only visible to organization owners and members of this team. + * \\* \`closed\` - visible to all members of this organization. + * **For a parent or child team:** + * \\* \`closed\` - visible to all members of this organization. + */ + privacy?: "secret" | "closed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), -/** Verification */ -export interface Verification { - payload: string | null; - reason: string; - signature: string | null; - verified: boolean; -} + /** + * @description To delete a team, the authenticated user must be an organization owner or team maintainer. If you are an organization owner, deleting a parent team will delete all of its child teams as well. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}\`. + * + * @tags teams + * @name TeamsDeleteInOrg + * @summary Delete a team + * @request DELETE:/orgs/{org}/teams/{team_slug} + */ + teamsDeleteInOrg: (org: string, teamSlug: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}\`, + method: "DELETE", + ...params, + }), -/** - * View Traffic - * View Traffic - */ -export interface ViewTraffic { - /** @example 14850 */ - count: number; - /** @example 3782 */ - uniques: number; - views: Traffic[]; -} + /** + * @description List all discussions on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions\`. + * + * @tags teams + * @name TeamsListDiscussionsInOrg + * @summary List discussions + * @request GET:/orgs/{org}/teams/{team_slug}/discussions + */ + teamsListDiscussionsInOrg: ( + org: string, + teamSlug: string, + query?: { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: "asc" | "desc"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions\`, + method: "GET", + query: query, + format: "json", + ...params, + }), -/** - * Webhook Configuration - * Configuration object of the webhook - */ -export interface WebhookConfig { - /** The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. */ - content_type?: WebhookConfigContentType; - /** 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; - /** 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; - /** The URL to which the payloads will be delivered. */ - url?: WebhookConfigUrl; -} + /** + * @description Creates a new discussion post on a team's page. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/{org_id}/team/{team_id}/discussions\`. + * + * @tags teams + * @name TeamsCreateDiscussionInOrg + * @summary Create a discussion + * @request POST:/orgs/{org}/teams/{team_slug}/discussions + */ + teamsCreateDiscussionInOrg: ( + org: string, + teamSlug: string, + data: { + /** The discussion post's body text. */ + body: string; + /** + * Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to \`true\` to create a private post. + * @default false + */ + private?: boolean; + /** The discussion post's title. */ + title: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. - * @example ""json"" - */ -export type WebhookConfigContentType = string; + /** + * @description Get a specific discussion on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}\`. + * + * @tags teams + * @name TeamsGetDiscussionInOrg + * @summary Get a discussion + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + */ + teamsGetDiscussionInOrg: (org: string, teamSlug: string, discussionNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}\`, + method: "GET", + format: "json", + ...params, + }), -/** - * 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.** - * @example ""0"" - */ -export type WebhookConfigInsecureSsl = string; + /** + * @description Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}\`. + * + * @tags teams + * @name TeamsUpdateDiscussionInOrg + * @summary Update a discussion + * @request PATCH:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + */ + teamsUpdateDiscussionInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + data: { + /** The discussion post's body text. */ + body?: string; + /** The discussion post's title. */ + title?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * 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). - * @example ""********"" - */ -export type WebhookConfigSecret = string; + /** + * @description Delete a discussion from a team's page. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}\`. + * + * @tags teams + * @name TeamsDeleteDiscussionInOrg + * @summary Delete a discussion + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + */ + teamsDeleteDiscussionInOrg: (org: string, teamSlug: string, discussionNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}\`, + method: "DELETE", + ...params, + }), -/** - * The URL to which the payloads will be delivered. - * @format uri - * @example "https://example.com/webhook" - */ -export type WebhookConfigUrl = string; + /** + * @description List all comments on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments\`. + * + * @tags teams + * @name TeamsListDiscussionCommentsInOrg + * @summary List discussion comments + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments + */ + teamsListDiscussionCommentsInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + query?: { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: "asc" | "desc"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments\`, + method: "GET", + query: query, + format: "json", + ...params, + }), -/** - * Workflow - * A GitHub Actions workflow - */ -export interface Workflow { - /** @example "https://github.com/actions/setup-ruby/workflows/CI/badge.svg" */ - badge_url: string; - /** - * @format date-time - * @example "2019-12-06T14:20:20.000Z" - */ - created_at: string; - /** - * @format date-time - * @example "2019-12-06T14:20:20.000Z" - */ - deleted_at?: string; - /** @example "https://github.com/actions/setup-ruby/blob/master/.github/workflows/ruby.yaml" */ - html_url: string; - /** @example 5 */ - id: number; - /** @example "CI" */ - name: string; - /** @example "MDg6V29ya2Zsb3cxMg==" */ - node_id: string; - /** @example "ruby.yaml" */ - path: string; - /** @example "active" */ - state: "active" | "deleted"; - /** - * @format date-time - * @example "2019-12-06T14:20:20.000Z" - */ - updated_at: string; - /** @example "https://api.github.com/repos/actions/setup-ruby/workflows/5" */ - url: string; -} + /** + * @description Creates a new comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments\`. + * + * @tags teams + * @name TeamsCreateDiscussionCommentInOrg + * @summary Create a discussion comment + * @request POST:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments + */ + teamsCreateDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + data: { + /** The discussion comment's body text. */ + body: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Workflow Run - * An invocation of a workflow - */ -export interface WorkflowRun { - /** - * The URL to the artifacts for the workflow run. - * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/rerun/artifacts" - */ - artifacts_url: string; - /** - * The URL to cancel the workflow run. - * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/cancel" - */ - cancel_url: string; - /** - * The URL to the associated check suite. - * @example "https://api.github.com/repos/github/hello-world/check-suites/12" - */ - check_suite_url: string; - /** @example "neutral" */ - conclusion: string | null; - /** @format date-time */ - created_at: string; - /** @example "push" */ - event: string; - /** @example "master" */ - head_branch: string | null; - /** Simple Commit */ - head_commit: SimpleCommit; - /** Minimal Repository */ - head_repository: MinimalRepository; - /** @example 5 */ - head_repository_id?: number; - /** - * The SHA of the head commit that points to the version of the worflow being run. - * @example "009b8a3a9ccbb128af87f9b1c0f4c62e8a304f6d" - */ - head_sha: string; - /** @example "https://github.com/github/hello-world/suites/4" */ - html_url: string; - /** - * The ID of the workflow run. - * @example 5 - */ - id: number; - /** - * The URL to the jobs for the workflow run. - * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/jobs" - */ - jobs_url: string; - /** - * The URL to download the logs for the workflow run. - * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/logs" - */ - logs_url: string; - /** - * The name of the workflow run. - * @example "Build" - */ - name?: string; - /** @example "MDEwOkNoZWNrU3VpdGU1" */ - node_id: string; - pull_requests: PullRequestMinimal[] | null; - /** Minimal Repository */ - repository: MinimalRepository; - /** - * The URL to rerun the workflow run. - * @example "https://api.github.com/repos/github/hello-world/actions/runs/5/rerun" - */ - rerun_url: string; - /** - * The auto incrementing run number for the workflow run. - * @example 106 - */ - run_number: number; - /** @example "completed" */ - status: string | null; - /** @format date-time */ - updated_at: string; - /** - * The URL to the workflow run. - * @example "https://api.github.com/repos/github/hello-world/actions/runs/5" - */ - url: string; - /** - * The ID of the parent workflow. - * @example 5 - */ - workflow_id: number; - /** - * The URL to the workflow. - * @example "https://api.github.com/repos/github/hello-world/actions/workflows/main.yaml" - */ - workflow_url: string; -} + /** + * @description Get a specific comment on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}\`. + * + * @tags teams + * @name TeamsGetDiscussionCommentInOrg + * @summary Get a discussion comment + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + */ + teamsGetDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "GET", + format: "json", + ...params, + }), -/** - * Workflow Run Usage - * Workflow Run Usage - */ -export interface WorkflowRunUsage { - billable: { - MACOS?: { - jobs: number; - total_ms: number; - }; - UBUNTU?: { - jobs: number; - total_ms: number; - }; - WINDOWS?: { - jobs: number; - total_ms: number; - }; - }; - run_duration_ms: number; -} + /** + * @description Edits the body text of a discussion comment. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}\`. + * + * @tags teams + * @name TeamsUpdateDiscussionCommentInOrg + * @summary Update a discussion comment + * @request PATCH:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + */ + teamsUpdateDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + data: { + /** The discussion comment's body text. */ + body: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), -/** - * Workflow Usage - * Workflow Usage - */ -export interface WorkflowUsage { - billable: { - MACOS?: { - total_ms?: number; - }; - UBUNTU?: { - total_ms?: number; - }; - WINDOWS?: { - total_ms?: number; - }; - }; -} + /** + * @description Deletes a comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}\`. + * + * @tags teams + * @name TeamsDeleteDiscussionCommentInOrg + * @summary Delete a discussion comment + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + */ + teamsDeleteDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "DELETE", + ...params, + }), -export type QueryParamsType = Record; -export type ResponseFormat = keyof Omit; + /** + * @description List the reactions to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments/). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions\`. + * + * @tags reactions + * @name ReactionsListForTeamDiscussionCommentInOrg + * @summary List reactions for a team discussion comment + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions + */ + reactionsListForTeamDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + query?: { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ + content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}/reactions\`, + method: "GET", + query: query, + format: "json", + ...params, + }), -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; -} + /** + * @description Create a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion comment. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions\`. + * + * @tags reactions + * @name ReactionsCreateForTeamDiscussionCommentInOrg + * @summary Create reaction for a team discussion comment + * @request POST:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions + */ + reactionsCreateForTeamDiscussionCommentInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + data: { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion comment. */ + content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), -export type RequestParams = Omit; + /** + * @description **Note:** You can also specify a team or organization with \`team_id\` and \`org_id\` using the route \`DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id\`. Delete a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags reactions + * @name ReactionsDeleteForTeamDiscussionComment + * @summary Delete team discussion comment reaction + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id} + */ + reactionsDeleteForTeamDiscussionComment: ( + org: string, + teamSlug: string, + discussionNumber: number, + commentNumber: number, + reactionId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/comments/\${commentNumber}/reactions/\${reactionId}\`, + method: "DELETE", + ...params, + }), -export interface ApiConfig { - baseUrl?: string; - baseApiParams?: Omit; - securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; - customFetch?: typeof fetch; -} + /** + * @description List the reactions to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions\`. + * + * @tags reactions + * @name ReactionsListForTeamDiscussionInOrg + * @summary List reactions for a team discussion + * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions + */ + reactionsListForTeamDiscussionInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + query?: { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ + content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/reactions\`, + method: "GET", + query: query, + format: "json", + ...params, + }), -export interface HttpResponse extends Response { - data: D; - error: E; -} + /** + * @description Create a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions\`. + * + * @tags reactions + * @name ReactionsCreateForTeamDiscussionInOrg + * @summary Create reaction for a team discussion + * @request POST:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions + */ + reactionsCreateForTeamDiscussionInOrg: ( + org: string, + teamSlug: string, + discussionNumber: number, + data: { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion. */ + content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), -type CancelToken = Symbol | string | number; + /** + * @description **Note:** You can also specify a team or organization with \`team_id\` and \`org_id\` using the route \`DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions/:reaction_id\`. Delete a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags reactions + * @name ReactionsDeleteForTeamDiscussion + * @summary Delete team discussion reaction + * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions/{reaction_id} + */ + reactionsDeleteForTeamDiscussion: ( + org: string, + teamSlug: string, + discussionNumber: number, + reactionId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/discussions/\${discussionNumber}/reactions/\${reactionId}\`, + method: "DELETE", + ...params, + }), -export enum ContentType { - Json = "application/json", - FormData = "multipart/form-data", - UrlEncoded = "application/x-www-form-urlencoded", - Text = "text/plain", -} + /** + * @description The return hash contains a \`role\` field which refers to the Organization Invitation role and will be one of the following values: \`direct_member\`, \`admin\`, \`billing_manager\`, \`hiring_manager\`, or \`reinstate\`. If the invitee is not a GitHub member, the \`login\` field in the return hash will be \`null\`. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/invitations\`. + * + * @tags teams + * @name TeamsListPendingInvitationsInOrg + * @summary List pending team invitations + * @request GET:/orgs/{org}/teams/{team_slug}/invitations + */ + teamsListPendingInvitationsInOrg: ( + org: string, + teamSlug: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/invitations\`, + method: "GET", + query: query, + format: "json", + ...params, + }), -export class HttpClient { - public baseUrl: string = "https://api.github.com"; - private securityData: SecurityDataType | null = null; - private securityWorker?: ApiConfig["securityWorker"]; - private abortControllers = new Map(); - private customFetch = (...fetchParams: Parameters) => fetch(...fetchParams); + /** + * @description Team members will include the members of child teams. To list members in a team, the team must be visible to the authenticated user. + * + * @tags teams + * @name TeamsListMembersInOrg + * @summary List team members + * @request GET:/orgs/{org}/teams/{team_slug}/members + */ + teamsListMembersInOrg: ( + org: string, + teamSlug: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Filters members returned by their role in the team. Can be one of: + * \\* \`member\` - normal members of the team. + * \\* \`maintainer\` - team maintainers. + * \\* \`all\` - all members of the team. + * @default "all" + */ + role?: "member" | "maintainer" | "all"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/members\`, + method: "GET", + query: query, + format: "json", + ...params, + }), - private baseApiParams: RequestParams = { - credentials: "same-origin", - headers: {}, - redirect: "follow", - referrerPolicy: "no-referrer", - }; + /** + * @description Team members will include the members of child teams. To get a user's membership with a team, the team must be visible to the authenticated user. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/memberships/{username}\`. **Note:** The \`role\` for organization owners returns as \`maintainer\`. For more information about \`maintainer\` roles, see [Create a team](https://docs.github.com/rest/reference/teams#create-a-team). + * + * @tags teams + * @name TeamsGetMembershipForUserInOrg + * @summary Get team membership for a user + * @request GET:/orgs/{org}/teams/{team_slug}/memberships/{username} + */ + teamsGetMembershipForUserInOrg: (org: string, teamSlug: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/memberships/\${username}\`, + method: "GET", + format: "json", + ...params, + }), - constructor(apiConfig: ApiConfig = {}) { - Object.assign(this, apiConfig); - } + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Adds an organization member to a team. An authenticated organization owner or team maintainer can add organization members to a team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." An organization owner can add someone who is not part of the team's organization to a team. When an organization owner adds someone to a team who is not an organization member, this endpoint will send an invitation to the person via email. This newly-created membership will be in the "pending" state until the person accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PUT /organizations/{org_id}/team/{team_id}/memberships/{username}\`. + * + * @tags teams + * @name TeamsAddOrUpdateMembershipForUserInOrg + * @summary Add or update team membership for a user + * @request PUT:/orgs/{org}/teams/{team_slug}/memberships/{username} + */ + teamsAddOrUpdateMembershipForUserInOrg: ( + org: string, + teamSlug: string, + username: string, + data: { + /** + * The role that this user should have in the team. Can be one of: + * \\* \`member\` - a normal member of the team. + * \\* \`maintainer\` - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description. + * @default "member" + */ + role?: "member" | "maintainer"; + }, + params: RequestParams = {}, + ) => + this.request< + TeamMembership, + void | { + errors?: { + code?: string; + field?: string; + resource?: string; + }[]; + message?: string; + } + >({ + path: \`/orgs/\${org}/teams/\${teamSlug}/memberships/\${username}\`, + method: "PUT", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), - public setSecurityData = (data: SecurityDataType | null) => { - this.securityData = data; - }; + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/memberships/{username}\`. + * + * @tags teams + * @name TeamsRemoveMembershipForUserInOrg + * @summary Remove team membership for a user + * @request DELETE:/orgs/{org}/teams/{team_slug}/memberships/{username} + */ + teamsRemoveMembershipForUserInOrg: (org: string, teamSlug: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/memberships/\${username}\`, + method: "DELETE", + ...params, + }), - protected encodeQueryParam(key: string, value: any) { - const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; - } + /** + * @description Lists the organization projects for a team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/projects\`. + * + * @tags teams + * @name TeamsListProjectsInOrg + * @summary List team projects + * @request GET:/orgs/{org}/teams/{team_slug}/projects + */ + teamsListProjectsInOrg: ( + org: string, + teamSlug: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/projects\`, + method: "GET", + query: query, + format: "json", + ...params, + }), - protected addQueryParam(query: QueryParamsType, key: string) { - return this.encodeQueryParam(key, query[key]); - } + /** + * @description Checks whether a team has \`read\`, \`write\`, or \`admin\` permissions for an organization project. The response includes projects inherited from a parent team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/projects/{project_id}\`. + * + * @tags teams + * @name TeamsCheckPermissionsForProjectInOrg + * @summary Check team permissions for a project + * @request GET:/orgs/{org}/teams/{team_slug}/projects/{project_id} + */ + teamsCheckPermissionsForProjectInOrg: ( + org: string, + teamSlug: string, + projectId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/projects/\${projectId}\`, + method: "GET", + format: "json", + ...params, + }), - protected addArrayQueryParam(query: QueryParamsType, key: string) { - const value = query[key]; - return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); - } + /** + * @description Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have \`admin\` permissions for the project. The project and team must be part of the same organization. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PUT /organizations/{org_id}/team/{team_id}/projects/{project_id}\`. + * + * @tags teams + * @name TeamsAddOrUpdateProjectPermissionsInOrg + * @summary Add or update team project permissions + * @request PUT:/orgs/{org}/teams/{team_slug}/projects/{project_id} + */ + teamsAddOrUpdateProjectPermissionsInOrg: ( + org: string, + teamSlug: string, + projectId: number, + data: { + /** + * The permission to grant to the team for this project. Can be one of: + * \\* \`read\` - team members can read, but not write to or administer this project. + * \\* \`write\` - team members can read and write, but not administer this project. + * \\* \`admin\` - team members can read, write and administer this project. + * Default: the team's \`permission\` attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + */ + permission?: "read" | "write" | "admin"; + }, + params: RequestParams = {}, + ) => + this.request< + void, + { + documentation_url?: string; + message?: string; + } + >({ + path: \`/orgs/\${org}/teams/\${teamSlug}/projects/\${projectId}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), - 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("&"); - } + /** + * @description Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have \`read\` access to both the team and project, or \`admin\` access to the team or project. This endpoint removes the project from the team, but does not delete the project. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/projects/{project_id}\`. + * + * @tags teams + * @name TeamsRemoveProjectInOrg + * @summary Remove a project from a team + * @request DELETE:/orgs/{org}/teams/{team_slug}/projects/{project_id} + */ + teamsRemoveProjectInOrg: (org: string, teamSlug: string, projectId: number, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/projects/\${projectId}\`, + method: "DELETE", + ...params, + }), - protected addQueryParams(rawQuery?: QueryParamsType): string { - const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; - } + /** + * @description Lists a team's repositories visible to the authenticated user. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/repos\`. + * + * @tags teams + * @name TeamsListReposInOrg + * @summary List team repositories + * @request GET:/orgs/{org}/teams/{team_slug}/repos + */ + teamsListReposInOrg: ( + org: string, + teamSlug: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/repos\`, + method: "GET", + query: query, + format: "json", + ...params, + }), - 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), - }; + /** + * @description Checks whether a team has \`admin\`, \`push\`, \`maintain\`, \`triage\`, or \`pull\` permission for a repository. Repositories inherited through a parent team will also be checked. You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`application/vnd.github.v3.repository+json\` accept header. If a team doesn't have permission for the repository, you will receive a \`404 Not Found\` response status. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}\`. + * + * @tags teams + * @name TeamsCheckPermissionsForRepoInOrg + * @summary Check team permissions for a repository + * @request GET:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + */ + teamsCheckPermissionsForRepoInOrg: ( + org: string, + teamSlug: string, + owner: string, + repo: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/repos/\${owner}/\${repo}\`, + method: "GET", + format: "json", + ...params, + }), - protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { - return { - ...this.baseApiParams, - ...params1, - ...(params2 || {}), - headers: { - ...(this.baseApiParams.headers || {}), - ...(params1.headers || {}), - ...((params2 && params2.headers) || {}), + /** + * @description To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a \`422 Unprocessable Entity\` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PUT /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}\`. For more information about the permission levels, see "[Repository permission levels for an organization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)". + * + * @tags teams + * @name TeamsAddOrUpdateRepoPermissionsInOrg + * @summary Add or update team repository permissions + * @request PUT:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + */ + teamsAddOrUpdateRepoPermissionsInOrg: ( + org: string, + teamSlug: string, + owner: string, + repo: string, + data: { + /** + * The permission to grant the team on this repository. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer this repository. + * \\* \`push\` - team members can pull and push, but not administer this repository. + * \\* \`admin\` - team members can pull, push and administer this repository. + * \\* \`maintain\` - team members can manage the repository without access to sensitive or destructive actions. Recommended for project managers. Only applies to repositories owned by organizations. + * \\* \`triage\` - team members can proactively manage issues and pull requests without write access. Recommended for contributors who triage a repository. Only applies to repositories owned by organizations. + * + * If no permission is specified, the team's \`permission\` attribute will be used to determine what permission to grant the team on this repository. + */ + permission?: "pull" | "push" | "admin" | "maintain" | "triage"; }, - }; - } + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/repos/\${owner}/\${repo}\`, + method: "PUT", + body: data, + type: ContentType.Json, + ...params, + }), - 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; - } + /** + * @description If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. This does not delete the repository, it just removes it from the team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`DELETE /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}\`. + * + * @tags teams + * @name TeamsRemoveRepoInOrg + * @summary Remove a repository from a team + * @request DELETE:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + */ + teamsRemoveRepoInOrg: (org: string, teamSlug: string, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/repos/\${owner}/\${repo}\`, + method: "DELETE", + ...params, + }), - const abortController = new AbortController(); - this.abortControllers.set(cancelToken, abortController); - return abortController.signal; - }; + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups connected to a team on GitHub. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/team-sync/group-mappings\`. + * + * @tags teams + * @name TeamsListIdpGroupsInOrg + * @summary List IdP groups for a team + * @request GET:/orgs/{org}/teams/{team_slug}/team-sync/group-mappings + */ + teamsListIdpGroupsInOrg: (org: string, teamSlug: string, params: RequestParams = {}) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/team-sync/group-mappings\`, + method: "GET", + format: "json", + ...params, + }), - public abortRequest = (cancelToken: CancelToken) => { - const abortController = this.abortControllers.get(cancelToken); + /** + * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty \`groups\` array will remove all connections for a team. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`PATCH /organizations/{org_id}/team/{team_id}/team-sync/group-mappings\`. + * + * @tags teams + * @name TeamsCreateOrUpdateIdpGroupConnectionsInOrg + * @summary Create or update IdP group connections + * @request PATCH:/orgs/{org}/teams/{team_slug}/team-sync/group-mappings + */ + teamsCreateOrUpdateIdpGroupConnectionsInOrg: ( + org: string, + teamSlug: string, + data: { + /** The IdP groups you want to connect to a GitHub team. When updating, the new \`groups\` object will replace the original one. You must include any existing groups that you don't want to remove. */ + groups: { + /** Description of the IdP group. */ + group_description: string; + /** ID of the IdP group. */ + group_id: string; + /** Name of the IdP group. */ + group_name: string; + }[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/team-sync/group-mappings\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), - if (abortController) { - abortController.abort(); - this.abortControllers.delete(cancelToken); - } + /** + * @description Lists the child teams of the team specified by \`{team_slug}\`. **Note:** You can also specify a team by \`org_id\` and \`team_id\` using the route \`GET /organizations/{org_id}/team/{team_id}/teams\`. + * + * @tags teams + * @name TeamsListChildInOrg + * @summary List child teams + * @request GET:/orgs/{org}/teams/{team_slug}/teams + */ + teamsListChildInOrg: ( + org: string, + teamSlug: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/orgs/\${org}/teams/\${teamSlug}/teams\`, + method: "GET", + query: query, + format: "json", + ...params, + }), }; + projects = { + /** + * No description + * + * @tags projects + * @name ProjectsGetCard + * @summary Get a project card + * @request GET:/projects/columns/cards/{card_id} + */ + projectsGetCard: (cardId: number, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/cards/\${cardId}\`, + method: "GET", + format: "json", + ...params, + }), - 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 } : {}), + /** + * No description + * + * @tags projects + * @name ProjectsUpdateCard + * @summary Update an existing project card + * @request PATCH:/projects/columns/cards/{card_id} + */ + projectsUpdateCard: ( + cardId: number, + data: { + /** + * Whether or not the card is archived + * @example false + */ + archived?: boolean; + /** + * The project card's note + * @example "Update all gems" + */ + note?: string | null; }, - signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() as HttpResponse; - r.data = null as unknown as T; - r.error = null as unknown as E; + params: RequestParams = {}, + ) => + this.request({ + path: \`/projects/columns/cards/\${cardId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), - 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; - }); + /** + * No description + * + * @tags projects + * @name ProjectsDeleteCard + * @summary Delete a project card + * @request DELETE:/projects/columns/cards/{card_id} + */ + projectsDeleteCard: (cardId: number, params: RequestParams = {}) => + this.request< + void, + | BasicError + | { + documentation_url?: string; + errors?: string[]; + message?: string; + } + >({ + path: \`/projects/columns/cards/\${cardId}\`, + method: "DELETE", + ...params, + }), - if (cancelToken) { - this.abortControllers.delete(cancelToken); - } + /** + * No description + * + * @tags projects + * @name ProjectsMoveCard + * @summary Move a project card + * @request POST:/projects/columns/cards/{card_id}/moves + */ + projectsMoveCard: ( + cardId: number, + data: { + /** + * The unique identifier of the column the card should be moved to + * @example 42 + */ + column_id?: number; + /** + * The position of the card in a column + * @pattern ^(?:top|bottom|after:\\d+)$ + * @example "bottom" + */ + position: string; + }, + params: RequestParams = {}, + ) => + this.request< + object, + | BasicError + | { + documentation_url?: string; + errors?: { + code?: string; + field?: string; + message?: string; + resource?: string; + }[]; + message?: string; + } + | ValidationError + | { + code?: string; + documentation_url?: string; + errors?: { + code?: string; + message?: string; + }[]; + message?: string; + } + >({ + path: \`/projects/columns/cards/\${cardId}/moves\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), - if (!response.ok) throw data; - return data; - }); - }; -} + /** + * No description + * + * @tags projects + * @name ProjectsGetColumn + * @summary Get a project column + * @request GET:/projects/columns/{column_id} + */ + projectsGetColumn: (columnId: number, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/\${columnId}\`, + method: "GET", + format: "json", + ...params, + }), -/** - * @title GitHub v3 REST API - * @version 1.1.4 - * @license MIT (https://spdx.org/licenses/MIT) - * @termsOfService https://docs.github.com/articles/github-terms-of-service - * @baseUrl https://api.github.com - * @externalDocs https://docs.github.com/rest/ - * @contact Support (https://support.github.com/contact) - * - * GitHub's v3 REST API. - */ -export class Api extends HttpClient { - /** - * @description Get Hypermedia links to resources accessible in GitHub's REST API - * - * @tags meta - * @name MetaRoot - * @summary GitHub API Root - * @request GET:/ - */ - metaRoot = (params: RequestParams = {}) => - this.request< - { - /** @format uri */ - authorizations_url: string; - /** @format uri */ - code_search_url: string; - /** @format uri */ - commit_search_url: string; - /** @format uri */ - current_user_authorizations_html_url: string; - /** @format uri */ - current_user_repositories_url: string; - /** @format uri */ - current_user_url: string; - /** @format uri */ - emails_url: string; - /** @format uri */ - emojis_url: string; - /** @format uri */ - events_url: string; - /** @format uri */ - feeds_url: string; - /** @format uri */ - followers_url: string; - /** @format uri */ - following_url: string; - /** @format uri */ - gists_url: string; - /** @format uri */ - hub_url: string; - /** @format uri */ - issue_search_url: string; - /** @format uri */ - issues_url: string; - /** @format uri */ - keys_url: string; - /** @format uri */ - label_search_url: string; - /** @format uri */ - notifications_url: string; - /** @format uri */ - organization_repositories_url: string; - /** @format uri */ - organization_teams_url: string; - /** @format uri */ - organization_url: string; - /** @format uri */ - public_gists_url: string; - /** @format uri */ - rate_limit_url: string; - /** @format uri */ - repository_search_url: string; - /** @format uri */ - repository_url: string; - /** @format uri */ - starred_gists_url: string; - /** @format uri */ - starred_url: string; - /** @format uri */ - topic_search_url?: string; - /** @format uri */ - user_organizations_url: string; - /** @format uri */ - user_repositories_url: string; - /** @format uri */ - user_search_url: string; - /** @format uri */ - user_url: string; + /** + * No description + * + * @tags projects + * @name ProjectsUpdateColumn + * @summary Update an existing project column + * @request PATCH:/projects/columns/{column_id} + */ + projectsUpdateColumn: ( + columnId: number, + data: { + /** + * Name of the project column + * @example "Remaining tasks" + */ + name: string; }, - any - >({ - path: `/`, - method: "GET", - format: "json", - ...params, - }); + params: RequestParams = {}, + ) => + this.request({ + path: \`/projects/columns/\${columnId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsDeleteColumn + * @summary Delete a project column + * @request DELETE:/projects/columns/{column_id} + */ + projectsDeleteColumn: (columnId: number, params: RequestParams = {}) => + this.request({ + path: \`/projects/columns/\${columnId}\`, + method: "DELETE", + ...params, + }), - app = { /** - * @description Returns the GitHub App associated with the authentication credentials used. To see how many app installations are associated with this GitHub App, see the `installations_count` in the response. For more details about your app's installations, see the "[List installations for the authenticated app](https://docs.github.com/rest/reference/apps#list-installations-for-the-authenticated-app)" endpoint. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * No description * - * @tags apps - * @name AppsGetAuthenticated - * @summary Get the authenticated app - * @request GET:/app + * @tags projects + * @name ProjectsListCards + * @summary List project cards + * @request GET:/projects/columns/{column_id}/cards */ - appsGetAuthenticated: (params: RequestParams = {}) => - this.request({ - path: `/app`, + projectsListCards: ( + columnId: number, + query?: { + /** + * Filters the project cards that are returned by the card's state. Can be one of \`all\`,\`archived\`, or \`not_archived\`. + * @default "not_archived" + */ + archived_state?: "all" | "archived" | "not_archived"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/projects/columns/\${columnId}/cards\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description Returns the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)." You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @description **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. * - * @tags apps - * @name AppsGetWebhookConfigForApp - * @summary Get a webhook configuration for an app - * @request GET:/app/hook/config + * @tags projects + * @name ProjectsCreateCard + * @summary Create a project card + * @request POST:/projects/columns/{column_id}/cards */ - appsGetWebhookConfigForApp: (params: RequestParams = {}) => - this.request({ - path: `/app/hook/config`, + projectsCreateCard: ( + columnId: number, + data: + | { + /** + * The project card's note + * @example "Update all gems" + */ + note: string | null; + } + | { + /** + * The unique identifier of the content associated with the card + * @example 42 + */ + content_id: number; + /** + * The piece of content associated with the card + * @example "PullRequest" + */ + content_type: string; + }, + params: RequestParams = {}, + ) => + this.request< + ProjectCard, + | BasicError + | (ValidationError | ValidationErrorSimple) + | { + code?: string; + documentation_url?: string; + errors?: { + code?: string; + message?: string; + }[]; + message?: string; + } + >({ + path: \`/projects/columns/\${columnId}/cards\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags projects + * @name ProjectsMoveColumn + * @summary Move a project column + * @request POST:/projects/columns/{column_id}/moves + */ + projectsMoveColumn: ( + columnId: number, + data: { + /** + * The position of the column in a project + * @pattern ^(?:first|last|after:\\d+)$ + * @example "last" + */ + position: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/projects/columns/\${columnId}/moves\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Gets a project by its \`id\`. Returns a \`404 Not Found\` status if projects are disabled. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. + * + * @tags projects + * @name ProjectsGet + * @summary Get a project + * @request GET:/projects/{project_id} + */ + projectsGet: (projectId: number, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${projectId}\`, method: "GET", format: "json", ...params, }), /** - * @description Updates the webhook configuration for a GitHub App. For more information about configuring a webhook for your app, see "[Creating a GitHub App](/developers/apps/creating-a-github-app)." You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @description Updates a project board's information. Returns a \`404 Not Found\` status if projects are disabled. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. * - * @tags apps - * @name AppsUpdateWebhookConfigForApp - * @summary Update a webhook configuration for an app - * @request PATCH:/app/hook/config + * @tags projects + * @name ProjectsUpdate + * @summary Update a project + * @request PATCH:/projects/{project_id} */ - appsUpdateWebhookConfigForApp: ( + projectsUpdate: ( + projectId: number, data: { - /** The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. */ - content_type?: WebhookConfigContentType; - /** 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; - /** 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; - /** The URL to which the payloads will be delivered. */ - url?: WebhookConfigUrl; + /** + * Body of the project + * @example "This project represents the sprint of the first week in January" + */ + body?: string | null; + /** + * Name of the project + * @example "Week One Sprint" + */ + name?: string; + /** The baseline permission that all organization members have on this project */ + organization_permission?: "read" | "write" | "admin" | "none"; + /** Whether or not this project can be seen by everyone. */ + private?: boolean; + /** + * State of the project; either 'open' or 'closed' + * @example "open" + */ + state?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/app/hook/config`, + this.request< + Project, + | BasicError + | { + documentation_url?: string; + errors?: string[]; + message?: string; + } + | void + | ValidationErrorSimple + >({ + path: \`/projects/\${projectId}\`, method: "PATCH", body: data, type: ContentType.Json, @@ -9005,16 +22965,47 @@ export class Api extends HttpClient + this.request< + void, + | BasicError + | { + documentation_url?: string; + errors?: string[]; + message?: string; + } + >({ + path: \`/projects/\${projectId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists the collaborators for an organization project. For a project, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. You must be an organization owner or a project \`admin\` to list collaborators. + * + * @tags projects + * @name ProjectsListCollaborators + * @summary List project collaborators + * @request GET:/projects/{project_id}/collaborators + */ + projectsListCollaborators: ( + projectId: number, query?: { - outdated?: string; + /** + * Filters the collaborators by their affiliation. Can be one of: + * \\* \`outside\`: Outside collaborators of a project that are not a member of the project's organization. + * \\* \`direct\`: Collaborators with permissions to a project, regardless of organization membership status. + * \\* \`all\`: All collaborators the authenticated user can see. + * @default "all" + */ + affiliation?: "outside" | "direct" | "all"; /** * Page number of the results to fetch. * @default 1 @@ -9025,82 +23016,48 @@ export class Api extends HttpClient - this.request({ - path: `/app/installations`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Enables an authenticated GitHub App to find an installation's information using the installation id. The installation's account type (`target_type`) will be either an organization or a user account, depending which account the repository belongs to. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. - * - * @tags apps - * @name AppsGetInstallation - * @summary Get an installation for the authenticated app - * @request GET:/app/installations/{installation_id} - */ - appsGetInstallation: (installationId: number, params: RequestParams = {}) => this.request< - Installation, + SimpleUser[], | BasicError | { documentation_url: string; message: string; } + | ValidationError >({ - path: `/app/installations/${installationId}`, + path: \`/projects/\${projectId}/collaborators\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description Uninstalls a GitHub App on a user, organization, or business account. If you prefer to temporarily suspend an app's access to your account's resources, then we recommend the "[Suspend an app installation](https://docs.github.com/v3/apps/#suspend-an-app-installation)" endpoint. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. - * - * @tags apps - * @name AppsDeleteInstallation - * @summary Delete an installation for the authenticated app - * @request DELETE:/app/installations/{installation_id} - */ - appsDeleteInstallation: (installationId: number, params: RequestParams = {}) => - this.request({ - path: `/app/installations/${installationId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. To restrict the access to specific repositories, you can provide the `repository_ids` when creating the token. When you omit `repository_ids`, the response does not contain the `repositories` key. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @description Adds a collaborator to an organization project and sets their permission level. You must be an organization owner or a project \`admin\` to add a collaborator. * - * @tags apps - * @name AppsCreateInstallationAccessToken - * @summary Create an installation access token for an app - * @request POST:/app/installations/{installation_id}/access_tokens + * @tags projects + * @name ProjectsAddCollaborator + * @summary Add project collaborator + * @request PUT:/projects/{project_id}/collaborators/{username} */ - appsCreateInstallationAccessToken: ( - installationId: number, + projectsAddCollaborator: ( + projectId: number, + username: string, data: { - /** The permissions granted to the user-to-server access token. */ - permissions?: AppPermissions; - /** List of repository names that the token should have access to */ - repositories?: string[]; /** - * List of repository IDs that the token should have access to - * @example [1] + * The permission to grant the collaborator. + * @default "write" + * @example "write" */ - repository_ids?: number[]; + permission?: "read" | "write" | "admin"; }, params: RequestParams = {}, ) => this.request< - InstallationToken, + void, | BasicError | { documentation_url: string; @@ -9108,81 +23065,70 @@ export class Api extends HttpClient({ - path: `/app/installations/${installationId}/access_tokens`, - method: "POST", + path: \`/projects/\${projectId}/collaborators/\${username}\`, + method: "PUT", body: data, type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description **Note:** Suspending a GitHub App installation is currently in beta and subject to change. Before you can suspend a GitHub App, the app owner must enable suspending installations for the app by opting-in to the beta. For more information, see "[Suspending a GitHub App installation](https://docs.github.com/apps/managing-github-apps/suspending-a-github-app-installation/)." Suspends a GitHub App on a user, organization, or business account, which blocks the app from accessing the account's resources. When a GitHub App is suspended, the app's access to the GitHub API or webhook events is blocked for that account. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. - * - * @tags apps - * @name AppsSuspendInstallation - * @summary Suspend an app installation - * @request PUT:/app/installations/{installation_id}/suspended - */ - appsSuspendInstallation: (installationId: number, params: RequestParams = {}) => - this.request({ - path: `/app/installations/${installationId}/suspended`, - method: "PUT", ...params, }), /** - * @description **Note:** Suspending a GitHub App installation is currently in beta and subject to change. Before you can suspend a GitHub App, the app owner must enable suspending installations for the app by opting-in to the beta. For more information, see "[Suspending a GitHub App installation](https://docs.github.com/apps/managing-github-apps/suspending-a-github-app-installation/)." Removes a GitHub App installation suspension. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @description Removes a collaborator from an organization project. You must be an organization owner or a project \`admin\` to remove a collaborator. * - * @tags apps - * @name AppsUnsuspendInstallation - * @summary Unsuspend an app installation - * @request DELETE:/app/installations/{installation_id}/suspended + * @tags projects + * @name ProjectsRemoveCollaborator + * @summary Remove user as a collaborator + * @request DELETE:/projects/{project_id}/collaborators/{username} */ - appsUnsuspendInstallation: (installationId: number, params: RequestParams = {}) => - this.request({ - path: `/app/installations/${installationId}/suspended`, + projectsRemoveCollaborator: (projectId: number, username: string, params: RequestParams = {}) => + this.request< + void, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/projects/\${projectId}/collaborators/\${username}\`, method: "DELETE", ...params, }), - }; - appManifests = { + /** - * @description Use this endpoint to complete the handshake necessary when implementing the [GitHub App Manifest flow](https://docs.github.com/apps/building-github-apps/creating-github-apps-from-a-manifest/). When you create a GitHub App with the manifest flow, you receive a temporary `code` used to retrieve the GitHub App's `id`, `pem` (private key), and `webhook_secret`. + * @description Returns the collaborator's permission level for an organization project. Possible values for the \`permission\` key: \`admin\`, \`write\`, \`read\`, \`none\`. You must be an organization owner or a project \`admin\` to review a user's permission level. * - * @tags apps - * @name AppsCreateFromManifest - * @summary Create a GitHub App from a manifest - * @request POST:/app-manifests/{code}/conversions + * @tags projects + * @name ProjectsGetPermissionForUser + * @summary Get project permission for a user + * @request GET:/projects/{project_id}/collaborators/{username}/permission */ - appsCreateFromManifest: (code: string, params: RequestParams = {}) => + projectsGetPermissionForUser: (projectId: number, username: string, params: RequestParams = {}) => this.request< - Integration & { - client_id: string; - client_secret: string; - pem: string; - webhook_secret: string; - [key: string]: any; - }, - BasicError | ValidationErrorSimple + RepositoryCollaboratorPermission, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError >({ - path: `/app-manifests/${code}/conversions`, - method: "POST", + path: \`/projects/\${projectId}/collaborators/\${username}/permission\`, + method: "GET", format: "json", ...params, }), - }; - applications = { + /** - * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). You can use this API to list the set of OAuth applications that have been granted access to your account. Unlike the [list your authorizations](https://docs.github.com/rest/reference/oauth-authorizations#list-your-authorizations) API, this API does not manage individual tokens. This API will return one entry for each OAuth application that has been granted access to your account, regardless of the number of tokens an application has generated for your user. The list of OAuth applications returned matches what is shown on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). The `scopes` returned are the union of scopes authorized for the application. For example, if an application has one token with `repo` scope and another token with `user` scope, the grant will return `["repo", "user"]`. + * No description * - * @tags oauth-authorizations - * @name OauthAuthorizationsListGrants - * @summary List your grants - * @request GET:/applications/grants - * @deprecated + * @tags projects + * @name ProjectsListColumns + * @summary List project columns + * @request GET:/projects/{project_id}/columns */ - oauthAuthorizationsListGrants: ( + projectsListColumns: ( + projectId: number, query?: { /** * Page number of the results to fetch. @@ -9197,8 +23143,8 @@ export class Api extends HttpClient - this.request({ - path: `/applications/grants`, + this.request({ + path: \`/projects/\${projectId}/columns\`, method: "GET", query: query, format: "json", @@ -9206,121 +23152,169 @@ export class Api extends HttpClient - this.request({ - path: `/applications/grants/${grantId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user. Once deleted, the application has no access to your account and is no longer listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). - * - * @tags oauth-authorizations - * @name OauthAuthorizationsDeleteGrant - * @summary Delete a grant - * @request DELETE:/applications/grants/{grant_id} - * @deprecated - */ - oauthAuthorizationsDeleteGrant: (grantId: number, params: RequestParams = {}) => - this.request({ - path: `/applications/grants/${grantId}`, - method: "DELETE", - ...params, - }), - - /** - * @description OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. You must also provide a valid OAuth `access_token` as an input parameter and the grant for the token's owner will be deleted. Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the application authorizations settings screen within GitHub](https://github.com/settings/applications#authorized). + * No description * - * @tags apps - * @name AppsDeleteAuthorization - * @summary Delete an app authorization - * @request DELETE:/applications/{client_id}/grant + * @tags projects + * @name ProjectsCreateColumn + * @summary Create a project column + * @request POST:/projects/{project_id}/columns */ - appsDeleteAuthorization: ( - clientId: string, + projectsCreateColumn: ( + projectId: number, data: { - /** The OAuth access token used to authenticate to the GitHub API. */ - access_token?: string; + /** + * Name of the project column + * @example "Remaining tasks" + */ + name: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/applications/${clientId}/grant`, - method: "DELETE", + this.request({ + path: \`/projects/\${projectId}/columns\`, + method: "POST", body: data, type: ContentType.Json, + format: "json", ...params, }), - + }; + rateLimit = { /** - * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth application owners can revoke a grant for their OAuth application and a specific user. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. You must also provide a valid token as `:access_token` and the grant for the token's owner will be deleted. Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for the user. Once deleted, the application will have no access to the user's account and will no longer be listed on [the Applications settings page under "Authorized OAuth Apps" on GitHub](https://github.com/settings/applications#authorized). + * @description **Note:** Accessing this endpoint does not count against your REST API rate limit. **Note:** The \`rate\` object is deprecated. If you're writing new API client code or updating existing code, you should use the \`core\` object instead of the \`rate\` object. The \`core\` object contains the same information that is present in the \`rate\` object. * - * @tags apps - * @name AppsRevokeGrantForApplication - * @summary Revoke a grant for an application - * @request DELETE:/applications/{client_id}/grants/{access_token} + * @tags rate-limit + * @name RateLimitGet + * @summary Get rate limit status for the authenticated user + * @request GET:/rate_limit + */ + rateLimitGet: (params: RequestParams = {}) => + this.request({ + path: \`/rate_limit\`, + method: "GET", + format: "json", + ...params, + }), + }; + reactions = { + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Reactions API. We recommend migrating your existing code to use the new delete reactions endpoints. For more information, see this [blog post](https://developer.github.com/changes/2020-02-26-new-delete-reactions-endpoints/). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), when deleting a [team discussion](https://docs.github.com/rest/reference/teams#discussions) or [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). + * + * @tags reactions + * @name ReactionsDeleteLegacy + * @summary Delete a reaction (Legacy) + * @request DELETE:/reactions/{reaction_id} * @deprecated */ - appsRevokeGrantForApplication: (clientId: string, accessToken: string, params: RequestParams = {}) => - this.request({ - path: `/applications/${clientId}/grants/${accessToken}`, + reactionsDeleteLegacy: (reactionId: number, params: RequestParams = {}) => + this.request< + void, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/reactions/\${reactionId}\`, method: "DELETE", ...params, }), - + }; + repos = { /** - * @description OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) to use this endpoint, where the username is the OAuth application `client_id` and the password is its `client_secret`. Invalid tokens will return `404 NOT FOUND`. + * @description When you pass the \`scarlet-witch-preview\` media type, requests to get a repository will also return the repository's code of conduct if it can be detected from the repository's code of conduct file. The \`parent\` and \`source\` objects are present when the repository is a fork. \`parent\` is the repository this repository was forked from, \`source\` is the ultimate source for the network. * - * @tags apps - * @name AppsCheckToken - * @summary Check a token - * @request POST:/applications/{client_id}/token + * @tags repos + * @name ReposGet + * @summary Get a repository + * @request GET:/repos/{owner}/{repo} */ - appsCheckToken: ( - clientId: string, - data: { - /** The access_token of the OAuth application. */ - access_token: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/applications/${clientId}/token`, - method: "POST", - body: data, - type: ContentType.Json, + reposGet: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}\`, + method: "GET", format: "json", ...params, }), /** - * @description OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`. + * @description **Note**: To edit a repository's topics, use the [Replace all repository topics](https://docs.github.com/rest/reference/repos#replace-all-repository-topics) endpoint. * - * @tags apps - * @name AppsResetToken - * @summary Reset a token - * @request PATCH:/applications/{client_id}/token + * @tags repos + * @name ReposUpdate + * @summary Update a repository + * @request PATCH:/repos/{owner}/{repo} */ - appsResetToken: ( - clientId: string, + reposUpdate: ( + owner: string, + repo: string, data: { - /** The access_token of the OAuth application. */ - access_token: string; + /** + * Either \`true\` to allow merging pull requests with a merge commit, or \`false\` to prevent merging pull requests with merge commits. + * @default true + */ + allow_merge_commit?: boolean; + /** + * Either \`true\` to allow rebase-merging pull requests, or \`false\` to prevent rebase-merging. + * @default true + */ + allow_rebase_merge?: boolean; + /** + * Either \`true\` to allow squash-merging pull requests, or \`false\` to prevent squash-merging. + * @default true + */ + allow_squash_merge?: boolean; + /** + * \`true\` to archive this repository. **Note**: You cannot unarchive repositories through the API. + * @default false + */ + archived?: boolean; + /** Updates the default branch for this repository. */ + default_branch?: string; + /** + * Either \`true\` to allow automatically deleting head branches when pull requests are merged, or \`false\` to prevent automatic deletion. + * @default false + */ + delete_branch_on_merge?: boolean; + /** A short description of the repository. */ + description?: string; + /** + * Either \`true\` to enable issues for this repository or \`false\` to disable them. + * @default true + */ + has_issues?: boolean; + /** + * Either \`true\` to enable projects for this repository or \`false\` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is \`false\`, and if you pass \`true\`, the API returns an error. + * @default true + */ + has_projects?: boolean; + /** + * Either \`true\` to enable the wiki for this repository or \`false\` to disable it. + * @default true + */ + has_wiki?: boolean; + /** A URL with more information about the repository. */ + homepage?: string; + /** + * Either \`true\` to make this repo available as a template repository or \`false\` to prevent it. + * @default false + */ + is_template?: boolean; + /** The name of the repository. */ + name?: string; + /** + * Either \`true\` to make the repository private or \`false\` to make it public. Default: \`false\`. + * **Note**: You will get a \`422\` error if the organization restricts [changing repository visibility](https://help.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of private. **Note**: You will get a \`422\` error if the organization restricts [changing repository visibility](https://help.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of private. + * @default false + */ + private?: boolean; + /** Can be \`public\` or \`private\`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, \`visibility\` can also be \`internal\`. The \`visibility\` parameter overrides the \`private\` parameter when you use both along with the \`nebula-preview\` preview header. */ + visibility?: "public" | "private" | "visibility" | "internal"; }, params: RequestParams = {}, ) => - this.request({ - path: `/applications/${clientId}/token`, + this.request({ + path: \`/repos/\${owner}/\${repo}\`, method: "PATCH", body: data, type: ContentType.Json, @@ -9329,550 +23323,443 @@ export class Api extends HttpClient - this.request({ - path: `/applications/${clientId}/token`, + reposDelete: (owner: string, repo: string, params: RequestParams = {}) => + this.request< + void, + | { + documentation_url?: string; + message?: string; + } + | BasicError + >({ + path: \`/repos/\${owner}/\${repo}\`, method: "DELETE", - body: data, - type: ContentType.Json, ...params, }), /** - * @description Exchanges a non-repository scoped user-to-server OAuth access token for a repository scoped user-to-server OAuth access token. You can specify which repositories the token can access and which permissions are granted to the token. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`. + * @description Lists all artifacts for a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags apps - * @name AppsScopeToken - * @summary Create a scoped access token - * @request POST:/applications/{client_id}/token/scoped + * @tags actions + * @name ActionsListArtifactsForRepo + * @summary List artifacts for a repository + * @request GET:/repos/{owner}/{repo}/actions/artifacts */ - appsScopeToken: ( - clientId: string, - data: { - /** - * **Required.** The OAuth access token used to authenticate to the GitHub API. - * @example "e72e16c7e42f292c6912e7710c838347ae178b4a" - */ - access_token?: string; - /** The permissions granted to the user-to-server access token. */ - permissions?: AppPermissions; - /** The list of repository IDs to scope the user-to-server access token to. `repositories` may not be specified if `repository_ids` is specified. */ - repositories?: string[]; - /** - * The list of repository names to scope the user-to-server access token to. `repository_ids` may not be specified if `repositories` is specified. - * @example [1] - */ - repository_ids?: number[]; + actionsListArtifactsForRepo: ( + owner: string, + repo: string, + query?: { /** - * The name of the user or organization to scope the user-to-server access token to. **Required** unless `target_id` is specified. - * @example "octocat" + * Page number of the results to fetch. + * @default 1 */ - target?: string; + page?: number; /** - * The ID of the user or organization to scope the user-to-server access token to. **Required** unless `target` is specified. - * @example 1 + * Results per page (max 100) + * @default 30 */ - target_id?: number; + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/applications/${clientId}/token/scoped`, - method: "POST", - body: data, - type: ContentType.Json, + this.request< + { + artifacts: Artifact[]; + total_count: number; + }, + any + >({ + path: \`/repos/\${owner}/\${repo}/actions/artifacts\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth applications can use a special API method for checking OAuth token validity without exceeding the normal rate limits for failed login attempts. Authentication works differently with this particular endpoint. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`. + * @description Gets a specific artifact for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags apps - * @name AppsCheckAuthorization - * @summary Check an authorization - * @request GET:/applications/{client_id}/tokens/{access_token} - * @deprecated + * @tags actions + * @name ActionsGetArtifact + * @summary Get an artifact + * @request GET:/repos/{owner}/{repo}/actions/artifacts/{artifact_id} */ - appsCheckAuthorization: (clientId: string, accessToken: string, params: RequestParams = {}) => - this.request({ - path: `/applications/${clientId}/tokens/${accessToken}`, + actionsGetArtifact: (owner: string, repo: string, artifactId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/artifacts/\${artifactId}\`, method: "GET", format: "json", ...params, }), /** - * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth applications can use this API method to reset a valid OAuth token without end-user involvement. Applications must save the "token" property in the response because changes take effect immediately. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. Invalid tokens will return `404 NOT FOUND`. + * @description Deletes an artifact for a workflow run. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. * - * @tags apps - * @name AppsResetAuthorization - * @summary Reset an authorization - * @request POST:/applications/{client_id}/tokens/{access_token} - * @deprecated + * @tags actions + * @name ActionsDeleteArtifact + * @summary Delete an artifact + * @request DELETE:/repos/{owner}/{repo}/actions/artifacts/{artifact_id} */ - appsResetAuthorization: (clientId: string, accessToken: string, params: RequestParams = {}) => - this.request({ - path: `/applications/${clientId}/tokens/${accessToken}`, - method: "POST", - format: "json", + actionsDeleteArtifact: (owner: string, repo: string, artifactId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/artifacts/\${artifactId}\`, + method: "DELETE", ...params, }), /** - * @description **Deprecation Notice:** GitHub will discontinue OAuth endpoints that contain `access_token` in the path parameter. We have introduced new endpoints that allow you to securely manage tokens for OAuth Apps by moving `access_token` to the request body. For more information, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-app-endpoint/). OAuth application owners can revoke a single token for an OAuth application. You must use [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) when accessing this endpoint, using the OAuth application's `client_id` and `client_secret` as the username and password. + * @description Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for \`Location:\` in the response header to find the URL for the download. The \`:archive_format\` must be \`zip\`. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags apps - * @name AppsRevokeAuthorizationForApplication - * @summary Revoke an authorization for an application - * @request DELETE:/applications/{client_id}/tokens/{access_token} - * @deprecated + * @tags actions + * @name ActionsDownloadArtifact + * @summary Download an artifact + * @request GET:/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format} */ - appsRevokeAuthorizationForApplication: (clientId: string, accessToken: string, params: RequestParams = {}) => - this.request({ - path: `/applications/${clientId}/tokens/${accessToken}`, - method: "DELETE", + actionsDownloadArtifact: ( + owner: string, + repo: string, + artifactId: number, + archiveFormat: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/artifacts/\${artifactId}/\${archiveFormat}\`, + method: "GET", ...params, }), - }; - apps = { + /** - * @description **Note**: The `:app_slug` is just the URL-friendly name of your GitHub App. You can find this on the settings page for your GitHub App (e.g., `https://github.com/settings/apps/:app_slug`). If the GitHub App you specify is public, you can access this endpoint without authenticating. If the GitHub App you specify is private, you must authenticate with a [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) or an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * @description Gets a specific job in a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags apps - * @name AppsGetBySlug - * @summary Get an app - * @request GET:/apps/{app_slug} + * @tags actions + * @name ActionsGetJobForWorkflowRun + * @summary Get a job for a workflow run + * @request GET:/repos/{owner}/{repo}/actions/jobs/{job_id} */ - appsGetBySlug: (appSlug: string, params: RequestParams = {}) => - this.request< - Integration, - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/apps/${appSlug}`, + actionsGetJobForWorkflowRun: (owner: string, repo: string, jobId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/jobs/\${jobId}\`, method: "GET", format: "json", ...params, }), - }; - authorizations = { + /** - * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * @description Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look for \`Location:\` in the response header to find the URL for the download. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags oauth-authorizations - * @name OauthAuthorizationsListAuthorizations - * @summary List your authorizations - * @request GET:/authorizations - * @deprecated + * @tags actions + * @name ActionsDownloadJobLogsForWorkflowRun + * @summary Download job logs for a workflow run + * @request GET:/repos/{owner}/{repo}/actions/jobs/{job_id}/logs */ - oauthAuthorizationsListAuthorizations: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/authorizations`, + actionsDownloadJobLogsForWorkflowRun: (owner: string, repo: string, jobId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/jobs/\${jobId}/logs\`, + method: "GET", + ...params, + }), + + /** + * @description Gets the GitHub Actions permissions policy for a repository, including whether GitHub Actions is enabled and the actions allowed to run in the repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. + * + * @tags actions + * @name ActionsGetGithubActionsPermissionsRepository + * @summary Get GitHub Actions permissions for a repository + * @request GET:/repos/{owner}/{repo}/actions/permissions + */ + actionsGetGithubActionsPermissionsRepository: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/permissions\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). Creates OAuth tokens using [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication). If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." To create tokens for a particular OAuth application using this endpoint, you must authenticate as the user you want to create an authorization for and provide the app's client ID and secret, found on your OAuth application's settings page. If your OAuth application intends to create multiple tokens for one user, use `fingerprint` to differentiate between them. You can also create tokens on GitHub from the [personal access tokens settings](https://github.com/settings/tokens) page. Read more about these tokens in [the GitHub Help documentation](https://help.github.com/articles/creating-an-access-token-for-command-line-use). Organizations that enforce SAML SSO require personal access tokens to be allowed. Read more about allowing tokens in [the GitHub Help documentation](https://help.github.com/articles/about-identity-and-access-management-with-saml-single-sign-on). + * @description Sets the GitHub Actions permissions policy for enabling GitHub Actions and allowed actions in the repository. If the repository belongs to an organization or enterprise that has set restrictive permissions at the organization or enterprise levels, such as \`allowed_actions\` to \`selected\` actions, then you cannot override them for the repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. * - * @tags oauth-authorizations - * @name OauthAuthorizationsCreateAuthorization - * @summary Create a new authorization - * @request POST:/authorizations - * @deprecated + * @tags actions + * @name ActionsSetGithubActionsPermissionsRepository + * @summary Set GitHub Actions permissions for a repository + * @request PUT:/repos/{owner}/{repo}/actions/permissions */ - oauthAuthorizationsCreateAuthorization: ( + actionsSetGithubActionsPermissionsRepository: ( + owner: string, + repo: string, data: { - /** - * The OAuth app client key for which to create the token. - * @maxLength 20 - */ - client_id?: string; - /** - * The OAuth app client secret for which to create the token. - * @maxLength 40 - */ - client_secret?: string; - /** A unique string to distinguish an authorization from others created for the same client ID and user. */ - fingerprint?: string; - /** - * A note to remind you what the OAuth token is for. - * @example "Update all gems" - */ - note?: string; - /** A URL to remind you what app the OAuth token is for. */ - note_url?: string; - /** - * A list of scopes that this authorization is in. - * @example ["public_repo","user"] - */ - scopes?: string[] | null; + /** The permissions policy that controls the actions that are allowed to run. Can be one of: \`all\`, \`local_only\`, or \`selected\`. */ + allowed_actions?: AllowedActions; + /** Whether GitHub Actions is enabled on the repository. */ + enabled: ActionsEnabled; }, params: RequestParams = {}, ) => - this.request({ - path: `/authorizations`, - method: "POST", + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/permissions\`, + method: "PUT", body: data, type: ContentType.Json, + ...params, + }), + + /** + * @description Gets the settings for selected actions that are allowed in a repository. To use this endpoint, the repository policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)." You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. + * + * @tags actions + * @name ActionsGetAllowedActionsRepository + * @summary Get allowed actions for a repository + * @request GET:/repos/{owner}/{repo}/actions/permissions/selected-actions + */ + actionsGetAllowedActionsRepository: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/permissions/selected-actions\`, + method: "GET", format: "json", ...params, }), /** - * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). Creates a new authorization for the specified OAuth application, only if an authorization for that application doesn't already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one. If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * @description Sets the actions that are allowed in a repository. To use this endpoint, the repository permission policy for \`allowed_actions\` must be configured to \`selected\`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)." If the repository belongs to an organization or enterprise that has \`selected\` actions set at the organization or enterprise levels, then you cannot override any of the allowed actions settings. To use the \`patterns_allowed\` setting for private repositories, the repository must belong to an enterprise. If the repository does not belong to an enterprise, then the \`patterns_allowed\` setting only applies to public repositories. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`administration\` repository permission to use this API. * - * @tags oauth-authorizations - * @name OauthAuthorizationsGetOrCreateAuthorizationForApp - * @summary Get-or-create an authorization for a specific app - * @request PUT:/authorizations/clients/{client_id} - * @deprecated + * @tags actions + * @name ActionsSetAllowedActionsRepository + * @summary Set allowed actions for a repository + * @request PUT:/repos/{owner}/{repo}/actions/permissions/selected-actions */ - oauthAuthorizationsGetOrCreateAuthorizationForApp: ( - clientId: string, - data: { - /** - * The OAuth app client secret for which to create the token. - * @maxLength 40 - */ - client_secret: string; - /** A unique string to distinguish an authorization from others created for the same client ID and user. */ - fingerprint?: string; - /** - * A note to remind you what the OAuth token is for. - * @example "Update all gems" - */ - note?: string; - /** A URL to remind you what app the OAuth token is for. */ - note_url?: string; - /** - * A list of scopes that this authorization is in. - * @example ["public_repo","user"] - */ - scopes?: string[] | null; - }, + actionsSetAllowedActionsRepository: ( + owner: string, + repo: string, + data: SelectedActions, params: RequestParams = {}, ) => - this.request({ - path: `/authorizations/clients/${clientId}`, + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/permissions/selected-actions\`, method: "PUT", body: data, type: ContentType.Json, - format: "json", ...params, }), /** - * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). **Warning:** Apps must use the [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow) to obtain OAuth tokens that work with GitHub SAML organizations. OAuth tokens created using the Authorizations API will be unable to access GitHub SAML organizations. For more information, see the [blog post](https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api). This method will create a new authorization for the specified OAuth application, only if an authorization for that application and fingerprint do not already exist for the user. The URL includes the 20 character client ID for the OAuth app that is requesting the token. `fingerprint` is a unique string to distinguish an authorization from others created for the same client ID and user. It returns the user's existing authorization for the application if one is present. Otherwise, it creates and returns a new one. If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." + * @description Lists all self-hosted runners configured in a repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. * - * @tags oauth-authorizations - * @name OauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint - * @summary Get-or-create an authorization for a specific app and fingerprint - * @request PUT:/authorizations/clients/{client_id}/{fingerprint} - * @deprecated + * @tags actions + * @name ActionsListSelfHostedRunnersForRepo + * @summary List self-hosted runners for a repository + * @request GET:/repos/{owner}/{repo}/actions/runners */ - oauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint: ( - clientId: string, - fingerprint: string, - data: { - /** - * The OAuth app client secret for which to create the token. - * @maxLength 40 - */ - client_secret: string; + actionsListSelfHostedRunnersForRepo: ( + owner: string, + repo: string, + query?: { /** - * A note to remind you what the OAuth token is for. - * @example "Update all gems" + * Page number of the results to fetch. + * @default 1 */ - note?: string; - /** A URL to remind you what app the OAuth token is for. */ - note_url?: string; + page?: number; /** - * A list of scopes that this authorization is in. - * @example ["public_repo","user"] + * Results per page (max 100) + * @default 30 */ - scopes?: string[] | null; + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/authorizations/clients/${clientId}/${fingerprint}`, - method: "PUT", - body: data, - type: ContentType.Json, + this.request< + { + runners: Runner[]; + total_count: number; + }, + any + >({ + path: \`/repos/\${owner}/\${repo}/actions/runners\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * @description Lists binaries for the runner application that you can download and run. You must authenticate using an access token with the \`repo\` scope to use this endpoint. * - * @tags oauth-authorizations - * @name OauthAuthorizationsGetAuthorization - * @summary Get a single authorization - * @request GET:/authorizations/{authorization_id} - * @deprecated + * @tags actions + * @name ActionsListRunnerApplicationsForRepo + * @summary List runner applications for a repository + * @request GET:/repos/{owner}/{repo}/actions/runners/downloads */ - oauthAuthorizationsGetAuthorization: (authorizationId: number, params: RequestParams = {}) => - this.request({ - path: `/authorizations/${authorizationId}`, + actionsListRunnerApplicationsForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners/downloads\`, method: "GET", format: "json", ...params, }), /** - * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations/), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/developers/apps/authorizing-oauth-apps#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). If you have two-factor authentication setup, Basic Authentication for this endpoint requires that you use a one-time password (OTP) and your username and password instead of tokens. For more information, see "[Working with two-factor authentication](https://docs.github.com/rest/overview/other-authentication-methods#working-with-two-factor-authentication)." You can only send one of these scope keys at a time. + * @description Returns a token that you can pass to the \`config\` script. The token expires after one hour. You must authenticate using an access token with the \`repo\` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing \`TOKEN\` with the registration token provided by this endpoint. \`\`\` ./config.sh --url https://github.com/octo-org/octo-repo-artifacts --token TOKEN \`\`\` * - * @tags oauth-authorizations - * @name OauthAuthorizationsUpdateAuthorization - * @summary Update an existing authorization - * @request PATCH:/authorizations/{authorization_id} - * @deprecated + * @tags actions + * @name ActionsCreateRegistrationTokenForRepo + * @summary Create a registration token for a repository + * @request POST:/repos/{owner}/{repo}/actions/runners/registration-token */ - oauthAuthorizationsUpdateAuthorization: ( - authorizationId: number, - data: { - /** A list of scopes to add to this authorization. */ - add_scopes?: string[]; - /** A unique string to distinguish an authorization from others created for the same client ID and user. */ - fingerprint?: string; - /** - * A note to remind you what the OAuth token is for. - * @example "Update all gems" - */ - note?: string; - /** A URL to remind you what app the OAuth token is for. */ - note_url?: string; - /** A list of scopes to remove from this authorization. */ - remove_scopes?: string[]; - /** - * A list of scopes that this authorization is in. - * @example ["public_repo","user"] - */ - scopes?: string[] | null; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/authorizations/${authorizationId}`, - method: "PATCH", - body: data, - type: ContentType.Json, + actionsCreateRegistrationTokenForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners/registration-token\`, + method: "POST", format: "json", ...params, }), /** - * @description **Deprecation Notice:** GitHub will discontinue the [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations), which is used by integrations to create personal access tokens and OAuth tokens, and you must now create these tokens using our [web application flow](https://docs.github.com/apps/building-oauth-apps/authorizing-oauth-apps/#web-application-flow). The [OAuth Authorizations API](https://docs.github.com/rest/reference/oauth-authorizations) will be removed on November, 13, 2020. For more information, including scheduled brownouts, see the [blog post](https://developer.github.com/changes/2020-02-14-deprecating-oauth-auth-endpoint/). + * @description Returns a token that you can pass to remove a self-hosted runner from a repository. The token expires after one hour. You must authenticate using an access token with the \`repo\` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from a repository, replace TOKEN with the remove token provided by this endpoint. \`\`\` ./config.sh remove --token TOKEN \`\`\` * - * @tags oauth-authorizations - * @name OauthAuthorizationsDeleteAuthorization - * @summary Delete an authorization - * @request DELETE:/authorizations/{authorization_id} - * @deprecated + * @tags actions + * @name ActionsCreateRemoveTokenForRepo + * @summary Create a remove token for a repository + * @request POST:/repos/{owner}/{repo}/actions/runners/remove-token */ - oauthAuthorizationsDeleteAuthorization: (authorizationId: number, params: RequestParams = {}) => - this.request({ - path: `/authorizations/${authorizationId}`, - method: "DELETE", + actionsCreateRemoveTokenForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners/remove-token\`, + method: "POST", + format: "json", ...params, }), - }; - codesOfConduct = { + /** - * No description + * @description Gets a specific self-hosted runner configured in a repository. You must authenticate using an access token with the \`repo\` scope to use this endpoint. * - * @tags codes-of-conduct - * @name CodesOfConductGetAllCodesOfConduct - * @summary Get all codes of conduct - * @request GET:/codes_of_conduct + * @tags actions + * @name ActionsGetSelfHostedRunnerForRepo + * @summary Get a self-hosted runner for a repository + * @request GET:/repos/{owner}/{repo}/actions/runners/{runner_id} */ - codesOfConductGetAllCodesOfConduct: (params: RequestParams = {}) => - this.request< - CodeOfConduct[], - { - documentation_url: string; - message: string; - } - >({ - path: `/codes_of_conduct`, + actionsGetSelfHostedRunnerForRepo: (owner: string, repo: string, runnerId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners/\${runnerId}\`, method: "GET", format: "json", ...params, }), /** - * No description + * @description Forces the removal of a self-hosted runner from a repository. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the \`repo\` scope to use this endpoint. * - * @tags codes-of-conduct - * @name CodesOfConductGetConductCode - * @summary Get a code of conduct - * @request GET:/codes_of_conduct/{key} + * @tags actions + * @name ActionsDeleteSelfHostedRunnerFromRepo + * @summary Delete a self-hosted runner from a repository + * @request DELETE:/repos/{owner}/{repo}/actions/runners/{runner_id} */ - codesOfConductGetConductCode: (key: string, params: RequestParams = {}) => - this.request< - CodeOfConduct, - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/codes_of_conduct/${key}`, - method: "GET", - format: "json", + actionsDeleteSelfHostedRunnerFromRepo: ( + owner: string, + repo: string, + runnerId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runners/\${runnerId}\`, + method: "DELETE", ...params, }), - }; - contentReferences = { + /** - * @description Creates an attachment under a content reference URL in the body or comment of an issue or pull request. Use the `id` of the content reference from the [`content_reference` event](https://docs.github.com/webhooks/event-payloads/#content_reference) to create an attachment. The app must create a content attachment within six hours of the content reference URL being posted. See "[Using content attachments](https://docs.github.com/apps/using-content-attachments/)" for details about content attachments. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * @description Lists all workflow runs for a repository. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags apps - * @name AppsCreateContentAttachment - * @summary Create a content attachment - * @request POST:/content_references/{content_reference_id}/attachments + * @tags actions + * @name ActionsListWorkflowRunsForRepo + * @summary List workflow runs for a repository + * @request GET:/repos/{owner}/{repo}/actions/runs */ - appsCreateContentAttachment: ( - contentReferenceId: number, - data: { + actionsListWorkflowRunsForRepo: ( + owner: string, + repo: string, + query?: { + /** Returns someone's workflow runs. Use the login for the user who created the \`push\` associated with the check suite or workflow run. */ + actor?: string; + /** Returns workflow runs associated with a branch. Use the name of the branch of the \`push\`. */ + branch?: string; + /** Returns workflow run triggered by the event you specify. For example, \`push\`, \`pull_request\` or \`issue\`. For more information, see "[Events that trigger workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." */ + event?: string; /** - * The body of the attachment - * @maxLength 262144 - * @example "Body of the attachment" + * Page number of the results to fetch. + * @default 1 */ - body: string; + page?: number; /** - * The title of the attachment - * @maxLength 1024 - * @example "Title of the attachment" + * Results per page (max 100) + * @default 30 */ - title: string; + per_page?: number; + /** Returns workflow runs associated with the check run \`status\` or \`conclusion\` you specify. For example, a conclusion can be \`success\` or a status can be \`completed\`. For more information, see the \`status\` and \`conclusion\` options available in "[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run)." */ + status?: "completed" | "status" | "conclusion"; }, params: RequestParams = {}, ) => this.request< - ContentReferenceAttachment, - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationError + { + total_count: number; + workflow_runs: WorkflowRun[]; + }, + any >({ - path: `/content_references/${contentReferenceId}/attachments`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - emojis = { - /** - * @description Lists all the emojis available to use on GitHub. - * - * @tags emojis - * @name EmojisGet - * @summary Get emojis - * @request GET:/emojis - */ - emojisGet: (params: RequestParams = {}) => - this.request, any>({ - path: `/emojis`, + path: \`/repos/\${owner}/\${repo}/actions/runs\`, method: "GET", + query: query, format: "json", ...params, }), - }; - enterprises = { + /** - * @description Gets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Gets a specific workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminGetGithubActionsPermissionsEnterprise - * @summary Get GitHub Actions permissions for an enterprise - * @request GET:/enterprises/{enterprise}/actions/permissions + * @tags actions + * @name ActionsGetWorkflowRun + * @summary Get a workflow run + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id} */ - enterpriseAdminGetGithubActionsPermissionsEnterprise: (enterprise: string, params: RequestParams = {}) => - this.request({ - path: `/enterprises/${enterprise}/actions/permissions`, + actionsGetWorkflowRun: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}\`, method: "GET", format: "json", ...params, }), /** - * @description Sets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Delete a specific workflow run. Anyone with write access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:write\` permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminSetGithubActionsPermissionsEnterprise - * @summary Set GitHub Actions permissions for an enterprise - * @request PUT:/enterprises/{enterprise}/actions/permissions + * @tags actions + * @name ActionsDeleteWorkflowRun + * @summary Delete a workflow run + * @request DELETE:/repos/{owner}/{repo}/actions/runs/{run_id} */ - enterpriseAdminSetGithubActionsPermissionsEnterprise: ( - enterprise: string, - data: { - /** The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. */ - allowed_actions?: AllowedActions; - /** The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`. */ - enabled_organizations: EnabledOrganizations; - }, - params: RequestParams = {}, - ) => + actionsDeleteWorkflowRun: (owner: string, repo: string, runId: number, params: RequestParams = {}) => this.request({ - path: `/enterprises/${enterprise}/actions/permissions`, - method: "PUT", - body: data, - type: ContentType.Json, + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}\`, + method: "DELETE", ...params, }), /** - * @description Lists the organizations that are selected to have GitHub Actions enabled in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Lists artifacts for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise - * @summary List selected organizations enabled for GitHub Actions in an enterprise - * @request GET:/enterprises/{enterprise}/actions/permissions/organizations + * @tags actions + * @name ActionsListWorkflowRunArtifacts + * @summary List workflow run artifacts + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/artifacts */ - enterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterprise: ( - enterprise: string, + actionsListWorkflowRunArtifacts: ( + owner: string, + repo: string, + runId: number, query?: { /** * Page number of the results to fetch. @@ -9889,12 +23776,12 @@ export class Api extends HttpClient this.request< { - organizations: OrganizationSimple[]; + artifacts: Artifact[]; total_count: number; }, any >({ - path: `/enterprises/${enterprise}/actions/permissions/organizations`, + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/artifacts\`, method: "GET", query: query, format: "json", @@ -9902,114 +23789,139 @@ export class Api extends HttpClient + actionsCancelWorkflowRun: (owner: string, repo: string, runId: number, params: RequestParams = {}) => this.request({ - path: `/enterprises/${enterprise}/actions/permissions/organizations`, - method: "PUT", - body: data, - type: ContentType.Json, + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/cancel\`, + method: "POST", ...params, }), /** - * @description Adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Lists jobs for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). * - * @tags enterprise-admin - * @name EnterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise - * @summary Enable a selected organization for GitHub Actions in an enterprise - * @request PUT:/enterprises/{enterprise}/actions/permissions/organizations/{org_id} + * @tags actions + * @name ActionsListJobsForWorkflowRun + * @summary List jobs for a workflow run + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/jobs */ - enterpriseAdminEnableSelectedOrganizationGithubActionsEnterprise: ( - enterprise: string, - orgId: number, + actionsListJobsForWorkflowRun: ( + owner: string, + repo: string, + runId: number, + query?: { + /** + * Filters jobs by their \`completed_at\` timestamp. Can be one of: + * \\* \`latest\`: Returns jobs from the most recent execution of the workflow run. + * \\* \`all\`: Returns all jobs for a workflow run, including from old executions of the workflow run. + * @default "latest" + */ + filter?: "latest" | "all"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, params: RequestParams = {}, ) => - this.request({ - path: `/enterprises/${enterprise}/actions/permissions/organizations/${orgId}`, - method: "PUT", + this.request< + { + jobs: Job[]; + total_count: number; + }, + any + >({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/jobs\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description Removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for `enabled_organizations` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Gets a redirect URL to download an archive of log files for a workflow run. This link expires after 1 minute. Look for \`Location:\` in the response header to find the URL for the download. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise - * @summary Disable a selected organization for GitHub Actions in an enterprise - * @request DELETE:/enterprises/{enterprise}/actions/permissions/organizations/{org_id} + * @tags actions + * @name ActionsDownloadWorkflowRunLogs + * @summary Download workflow run logs + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/logs */ - enterpriseAdminDisableSelectedOrganizationGithubActionsEnterprise: ( - enterprise: string, - orgId: number, - params: RequestParams = {}, - ) => + actionsDownloadWorkflowRunLogs: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/logs\`, + method: "GET", + ...params, + }), + + /** + * @description Deletes all logs for a workflow run. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * + * @tags actions + * @name ActionsDeleteWorkflowRunLogs + * @summary Delete workflow run logs + * @request DELETE:/repos/{owner}/{repo}/actions/runs/{run_id}/logs + */ + actionsDeleteWorkflowRunLogs: (owner: string, repo: string, runId: number, params: RequestParams = {}) => this.request({ - path: `/enterprises/${enterprise}/actions/permissions/organizations/${orgId}`, + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/logs\`, method: "DELETE", ...params, }), /** - * @description Gets the selected actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Re-runs your workflow run using its \`id\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminGetAllowedActionsEnterprise - * @summary Get allowed actions for an enterprise - * @request GET:/enterprises/{enterprise}/actions/permissions/selected-actions + * @tags actions + * @name ActionsReRunWorkflow + * @summary Re-run a workflow + * @request POST:/repos/{owner}/{repo}/actions/runs/{run_id}/rerun */ - enterpriseAdminGetAllowedActionsEnterprise: (enterprise: string, params: RequestParams = {}) => - this.request({ - path: `/enterprises/${enterprise}/actions/permissions/selected-actions`, - method: "GET", - format: "json", + actionsReRunWorkflow: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/rerun\`, + method: "POST", ...params, }), /** - * @description Sets the actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an enterprise](#set-github-actions-permissions-for-an-enterprise)." You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Gets the number of billable minutes and total run time for a specific workflow run. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminSetAllowedActionsEnterprise - * @summary Set allowed actions for an enterprise - * @request PUT:/enterprises/{enterprise}/actions/permissions/selected-actions + * @tags actions + * @name ActionsGetWorkflowRunUsage + * @summary Get workflow run usage + * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/timing */ - enterpriseAdminSetAllowedActionsEnterprise: ( - enterprise: string, - data: SelectedActions, - params: RequestParams = {}, - ) => - this.request({ - path: `/enterprises/${enterprise}/actions/permissions/selected-actions`, - method: "PUT", - body: data, - type: ContentType.Json, + actionsGetWorkflowRunUsage: (owner: string, repo: string, runId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/runs/\${runId}/timing\`, + method: "GET", + format: "json", ...params, }), /** - * @description Lists all self-hosted runner groups for an enterprise. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Lists all secrets available in a repository without revealing their encrypted values. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminListSelfHostedRunnerGroupsForEnterprise - * @summary List self-hosted runner groups for an enterprise - * @request GET:/enterprises/{enterprise}/actions/runner-groups + * @tags actions + * @name ActionsListRepoSecrets + * @summary List repository secrets + * @request GET:/repos/{owner}/{repo}/actions/secrets */ - enterpriseAdminListSelfHostedRunnerGroupsForEnterprise: ( - enterprise: string, + actionsListRepoSecrets: ( + owner: string, + repo: string, query?: { /** * Page number of the results to fetch. @@ -10026,12 +23938,12 @@ export class Api extends HttpClient this.request< { - runner_groups: RunnerGroupsEnterprise[]; + secrets: ActionsSecret[]; total_count: number; }, any >({ - path: `/enterprises/${enterprise}/actions/runner-groups`, + path: \`/repos/\${owner}/\${repo}/actions/secrets\`, method: "GET", query: query, format: "json", @@ -10039,117 +23951,91 @@ export class Api extends HttpClient - this.request({ - path: `/enterprises/${enterprise}/actions/runner-groups`, - method: "POST", - body: data, - type: ContentType.Json, + actionsGetRepoPublicKey: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/secrets/public-key\`, + method: "GET", format: "json", ...params, }), /** - * @description Gets a specific self-hosted runner group for an enterprise. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Gets a single repository secret without revealing its encrypted value. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminGetSelfHostedRunnerGroupForEnterprise - * @summary Get a self-hosted runner group for an enterprise - * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + * @tags actions + * @name ActionsGetRepoSecret + * @summary Get a repository secret + * @request GET:/repos/{owner}/{repo}/actions/secrets/{secret_name} */ - enterpriseAdminGetSelfHostedRunnerGroupForEnterprise: ( - enterprise: string, - runnerGroupId: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}`, + actionsGetRepoSecret: (owner: string, repo: string, secretName: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/secrets/\${secretName}\`, method: "GET", format: "json", ...params, }), /** - * @description Updates the `name` and `visibility` of a self-hosted runner group in an enterprise. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Creates or updates a repository secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. #### Example encrypting a secret using Node.js Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library. \`\`\` const sodium = require('tweetsodium'); const key = "base64-encoded-public-key"; const value = "plain-text-secret"; // Convert the message and key to Uint8Array's (Buffer implements that interface) const messageBytes = Buffer.from(value); const keyBytes = Buffer.from(key, 'base64'); // Encrypt using LibSodium. const encryptedBytes = sodium.seal(messageBytes, keyBytes); // Base64 the encrypted secret const encrypted = Buffer.from(encryptedBytes).toString('base64'); console.log(encrypted); \`\`\` #### Example encrypting a secret using Python Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3. \`\`\` from base64 import b64encode from nacl import encoding, public def encrypt(public_key: str, secret_value: str) -> str: """Encrypt a Unicode string using the public key.""" public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder()) sealed_box = public.SealedBox(public_key) encrypted = sealed_box.encrypt(secret_value.encode("utf-8")) return b64encode(encrypted).decode("utf-8") \`\`\` #### Example encrypting a secret using C# Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package. \`\`\` var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret"); var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU="); var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey); Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox)); \`\`\` #### Example encrypting a secret using Ruby Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem. \`\`\`ruby require "rbnacl" require "base64" key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=") public_key = RbNaCl::PublicKey.new(key) box = RbNaCl::Boxes::Sealed.from_public_key(public_key) encrypted_secret = box.encrypt("my_secret") # Print the base64 encoded secret puts Base64.strict_encode64(encrypted_secret) \`\`\` * - * @tags enterprise-admin - * @name EnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise - * @summary Update a self-hosted runner group for an enterprise - * @request PATCH:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + * @tags actions + * @name ActionsCreateOrUpdateRepoSecret + * @summary Create or update a repository secret + * @request PUT:/repos/{owner}/{repo}/actions/secrets/{secret_name} */ - enterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise: ( - enterprise: string, - runnerGroupId: number, + actionsCreateOrUpdateRepoSecret: ( + owner: string, + repo: string, + secretName: string, data: { - /** Name of the runner group. */ - name?: string; - /** - * Visibility of a runner group. You can select all organizations or select individual organizations. Can be one of: `all` or `selected` - * @default "all" - */ - visibility?: "selected" | "all"; + /** Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get a repository public key](https://docs.github.com/rest/reference/actions#get-a-repository-public-key) endpoint. */ + encrypted_value?: string; + /** ID of the key you used to encrypt the secret. */ + key_id?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}`, - method: "PATCH", + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/secrets/\${secretName}\`, + method: "PUT", body: data, type: ContentType.Json, - format: "json", ...params, }), /** - * @description Deletes a self-hosted runner group for an enterprise. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Deletes a secret in a repository using the secret name. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`secrets\` repository permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise - * @summary Delete a self-hosted runner group from an enterprise - * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id} + * @tags actions + * @name ActionsDeleteRepoSecret + * @summary Delete a repository secret + * @request DELETE:/repos/{owner}/{repo}/actions/secrets/{secret_name} */ - enterpriseAdminDeleteSelfHostedRunnerGroupFromEnterprise: ( - enterprise: string, - runnerGroupId: number, - params: RequestParams = {}, - ) => + actionsDeleteRepoSecret: (owner: string, repo: string, secretName: string, params: RequestParams = {}) => this.request({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}`, + path: \`/repos/\${owner}/\${repo}/actions/secrets/\${secretName}\`, method: "DELETE", ...params, }), /** - * @description Lists the organizations with access to a self-hosted runner group. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Lists the workflows in a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. GitHub Apps must have the \`actions:read\` permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise - * @summary List organization access to a self-hosted runner group in an enterprise - * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations + * @tags actions + * @name ActionsListRepoWorkflows + * @summary List repository workflows + * @request GET:/repos/{owner}/{repo}/actions/workflows */ - enterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterprise: ( - enterprise: string, - runnerGroupId: number, + actionsListRepoWorkflows: ( + owner: string, + repo: string, query?: { /** * Page number of the results to fetch. @@ -10166,12 +24052,12 @@ export class Api extends HttpClient this.request< { - organizations: OrganizationSimple[]; total_count: number; + workflows: Workflow[]; }, any >({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}/organizations`, + path: \`/repos/\${owner}/\${repo}/actions/workflows\`, method: "GET", query: query, format: "json", @@ -10179,82 +24065,98 @@ export class Api extends HttpClient + actionsGetWorkflow: (owner: string, repo: string, workflowId: number | string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Disables a workflow and sets the \`state\` of the workflow to \`disabled_manually\`. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. + * + * @tags actions + * @name ActionsDisableWorkflow + * @summary Disable a workflow + * @request PUT:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable + */ + actionsDisableWorkflow: (owner: string, repo: string, workflowId: number | string, params: RequestParams = {}) => this.request({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}/organizations`, + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}/disable\`, method: "PUT", - body: data, - type: ContentType.Json, ...params, }), /** - * @description Adds an organization to the list of selected organizations that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)." You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description You can use this endpoint to manually trigger a GitHub Actions workflow run. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You must configure your GitHub Actions workflow to run when the [\`workflow_dispatch\` webhook](/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch) event occurs. The \`inputs\` are configured in the workflow file. For more information about how to configure the \`workflow_dispatch\` event in the workflow file, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)." You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. For more information, see "[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line)." * - * @tags enterprise-admin - * @name EnterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise - * @summary Add organization access to a self-hosted runner group in an enterprise - * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} + * @tags actions + * @name ActionsCreateWorkflowDispatch + * @summary Create a workflow dispatch event + * @request POST:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches */ - enterpriseAdminAddOrgAccessToSelfHostedRunnerGroupInEnterprise: ( - enterprise: string, - runnerGroupId: number, - orgId: number, + actionsCreateWorkflowDispatch: ( + owner: string, + repo: string, + workflowId: number | string, + data: { + /** Input keys and values configured in the workflow file. The maximum number of properties is 10. Any default properties configured in the workflow file will be used when \`inputs\` are omitted. */ + inputs?: Record; + /** The git reference for the workflow. The reference can be a branch or tag name. */ + ref: string; + }, params: RequestParams = {}, ) => this.request({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}/organizations/${orgId}`, - method: "PUT", + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}/dispatches\`, + method: "POST", + body: data, + type: ContentType.Json, ...params, }), /** - * @description Removes an organization from the list of selected organizations that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an enterprise](#create-a-self-hosted-runner-group-for-an-enterprise)." You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Enables a workflow and sets the \`state\` of the workflow to \`active\`. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You must authenticate using an access token with the \`repo\` scope to use this endpoint. GitHub Apps must have the \`actions:write\` permission to use this endpoint. * - * @tags enterprise-admin - * @name EnterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise - * @summary Remove organization access to a self-hosted runner group in an enterprise - * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/organizations/{org_id} + * @tags actions + * @name ActionsEnableWorkflow + * @summary Enable a workflow + * @request PUT:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable */ - enterpriseAdminRemoveOrgAccessToSelfHostedRunnerGroupInEnterprise: ( - enterprise: string, - runnerGroupId: number, - orgId: number, - params: RequestParams = {}, - ) => + actionsEnableWorkflow: (owner: string, repo: string, workflowId: number | string, params: RequestParams = {}) => this.request({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}/organizations/${orgId}`, - method: "DELETE", + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}/enable\`, + method: "PUT", ...params, }), /** - * @description Lists the self-hosted runners that are in a specific enterprise group. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description List all workflow runs for a workflow. You can replace \`workflow_id\` with the workflow file name. For example, you could use \`main.yaml\`. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the \`repo\` scope. * - * @tags enterprise-admin - * @name EnterpriseAdminListSelfHostedRunnersInGroupForEnterprise - * @summary List self-hosted runners in a group for an enterprise - * @request GET:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners + * @tags actions + * @name ActionsListWorkflowRuns + * @summary List workflow runs + * @request GET:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs */ - enterpriseAdminListSelfHostedRunnersInGroupForEnterprise: ( - enterprise: string, - runnerGroupId: number, + actionsListWorkflowRuns: ( + owner: string, + repo: string, + workflowId: number | string, query?: { + /** Returns someone's workflow runs. Use the login for the user who created the \`push\` associated with the check suite or workflow run. */ + actor?: string; + /** Returns workflow runs associated with a branch. Use the name of the branch of the \`push\`. */ + branch?: string; + /** Returns workflow run triggered by the event you specify. For example, \`push\`, \`pull_request\` or \`issue\`. For more information, see "[Events that trigger workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." */ + event?: string; /** * Page number of the results to fetch. * @default 1 @@ -10265,17 +24167,19 @@ export class Api extends HttpClient this.request< { - runners: Runner[]; total_count: number; + workflow_runs: WorkflowRun[]; }, any >({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}/runners`, + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}/runs\`, method: "GET", query: query, format: "json", @@ -10283,80 +24187,110 @@ export class Api extends HttpClient + this.request({ + path: \`/repos/\${owner}/\${repo}/actions/workflows/\${workflowId}/timing\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Lists the [available assignees](https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/) for issues in a repository. + * + * @tags issues + * @name IssuesListAssignees + * @summary List assignees + * @request GET:/repos/{owner}/{repo}/assignees + */ + issuesListAssignees: ( + owner: string, + repo: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}/runners`, - method: "PUT", - body: data, - type: ContentType.Json, + this.request({ + path: \`/repos/\${owner}/\${repo}/assignees\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description Adds a self-hosted runner to a runner group configured in an enterprise. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Checks if a user has permission to be assigned to an issue in this repository. If the \`assignee\` can be assigned to issues in the repository, a \`204\` header with no content is returned. Otherwise a \`404\` status code is returned. * - * @tags enterprise-admin - * @name EnterpriseAdminAddSelfHostedRunnerToGroupForEnterprise - * @summary Add a self-hosted runner to a group for an enterprise - * @request PUT:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + * @tags issues + * @name IssuesCheckUserCanBeAssigned + * @summary Check if a user can be assigned + * @request GET:/repos/{owner}/{repo}/assignees/{assignee} */ - enterpriseAdminAddSelfHostedRunnerToGroupForEnterprise: ( - enterprise: string, - runnerGroupId: number, - runnerId: number, - params: RequestParams = {}, - ) => + issuesCheckUserCanBeAssigned: (owner: string, repo: string, assignee: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/assignees/\${assignee}\`, + method: "GET", + ...params, + }), + + /** + * @description Enables automated security fixes for a repository. The authenticated user must have admin access to the repository. For more information, see "[Configuring automated security fixes](https://help.github.com/en/articles/configuring-automated-security-fixes)". + * + * @tags repos + * @name ReposEnableAutomatedSecurityFixes + * @summary Enable automated security fixes + * @request PUT:/repos/{owner}/{repo}/automated-security-fixes + */ + reposEnableAutomatedSecurityFixes: (owner: string, repo: string, params: RequestParams = {}) => this.request({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}/runners/${runnerId}`, + path: \`/repos/\${owner}/\${repo}/automated-security-fixes\`, method: "PUT", ...params, }), /** - * @description Removes a self-hosted runner from a group configured in an enterprise. The runner is then returned to the default group. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Disables automated security fixes for a repository. The authenticated user must have admin access to the repository. For more information, see "[Configuring automated security fixes](https://help.github.com/en/articles/configuring-automated-security-fixes)". * - * @tags enterprise-admin - * @name EnterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise - * @summary Remove a self-hosted runner from a group for an enterprise - * @request DELETE:/enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + * @tags repos + * @name ReposDisableAutomatedSecurityFixes + * @summary Disable automated security fixes + * @request DELETE:/repos/{owner}/{repo}/automated-security-fixes */ - enterpriseAdminRemoveSelfHostedRunnerFromGroupForEnterprise: ( - enterprise: string, - runnerGroupId: number, - runnerId: number, - params: RequestParams = {}, - ) => + reposDisableAutomatedSecurityFixes: (owner: string, repo: string, params: RequestParams = {}) => this.request({ - path: `/enterprises/${enterprise}/actions/runner-groups/${runnerGroupId}/runners/${runnerId}`, + path: \`/repos/\${owner}/\${repo}/automated-security-fixes\`, method: "DELETE", ...params, }), /** - * @description Lists all self-hosted runners configured for an enterprise. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * No description * - * @tags enterprise-admin - * @name EnterpriseAdminListSelfHostedRunnersForEnterprise - * @summary List self-hosted runners for an enterprise - * @request GET:/enterprises/{enterprise}/actions/runners + * @tags repos + * @name ReposListBranches + * @summary List branches + * @request GET:/repos/{owner}/{repo}/branches */ - enterpriseAdminListSelfHostedRunnersForEnterprise: ( - enterprise: string, + reposListBranches: ( + owner: string, + repo: string, query?: { /** * Page number of the results to fetch. @@ -10368,331 +24302,405 @@ export class Api extends HttpClient + this.request({ + path: \`/repos/\${owner}/\${repo}/branches\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposGetBranch + * @summary Get a branch + * @request GET:/repos/{owner}/{repo}/branches/{branch} + */ + reposGetBranch: (owner: string, repo: string, branch: string, params: RequestParams = {}) => this.request< - { - runners?: Runner[]; - total_count?: number; - }, - any + BranchWithProtection, + | BasicError + | { + documentation_url: string; + message: string; + } >({ - path: `/enterprises/${enterprise}/actions/runners`, + path: \`/repos/\${owner}/\${repo}/branches/\${branch}\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description Lists binaries for the runner application that you can download and run. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. * - * @tags enterprise-admin - * @name EnterpriseAdminListRunnerApplicationsForEnterprise - * @summary List runner applications for an enterprise - * @request GET:/enterprises/{enterprise}/actions/runners/downloads + * @tags repos + * @name ReposGetBranchProtection + * @summary Get branch protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection */ - enterpriseAdminListRunnerApplicationsForEnterprise: (enterprise: string, params: RequestParams = {}) => - this.request({ - path: `/enterprises/${enterprise}/actions/runners/downloads`, + reposGetBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection\`, method: "GET", format: "json", ...params, }), /** - * @description Returns a token that you can pass to the `config` script. The token expires after one hour. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint. ``` ./config.sh --url https://github.com/enterprises/octo-enterprise --token TOKEN ``` + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Protecting a branch requires admin or owner permissions to the repository. **Note**: Passing new arrays of \`users\` and \`teams\` replaces their previous values. **Note**: The list of users, apps, and teams in total is limited to 100 items. * - * @tags enterprise-admin - * @name EnterpriseAdminCreateRegistrationTokenForEnterprise - * @summary Create a registration token for an enterprise - * @request POST:/enterprises/{enterprise}/actions/runners/registration-token + * @tags repos + * @name ReposUpdateBranchProtection + * @summary Update branch protection + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection */ - enterpriseAdminCreateRegistrationTokenForEnterprise: (enterprise: string, params: RequestParams = {}) => - this.request({ - path: `/enterprises/${enterprise}/actions/runners/registration-token`, - method: "POST", + reposUpdateBranchProtection: ( + owner: string, + repo: string, + branch: string, + data: { + /** Allows deletion of the protected branch by anyone with write access to the repository. Set to \`false\` to prevent deletion of the protected branch. Default: \`false\`. For more information, see "[Enabling force pushes to a protected branch](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)" in the GitHub Help documentation. */ + allow_deletions?: boolean; + /** Permits force pushes to the protected branch by anyone with write access to the repository. Set to \`true\` to allow force pushes. Set to \`false\` or \`null\` to block force pushes. Default: \`false\`. For more information, see "[Enabling force pushes to a protected branch](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)" in the GitHub Help documentation." */ + allow_force_pushes?: boolean | null; + /** Enforce all configured restrictions for administrators. Set to \`true\` to enforce required status checks for repository administrators. Set to \`null\` to disable. */ + enforce_admins: boolean | null; + /** Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Set to \`true\` to enforce a linear commit history. Set to \`false\` to disable a linear commit Git history. Your repository must allow squash merging or rebase merging before you can enable a linear commit history. Default: \`false\`. For more information, see "[Requiring a linear commit history](https://help.github.com/github/administering-a-repository/requiring-a-linear-commit-history)" in the GitHub Help documentation. */ + required_linear_history?: boolean; + /** Require at least one approving review on a pull request, before merging. Set to \`null\` to disable. */ + required_pull_request_reviews: { + /** Set to \`true\` if you want to automatically dismiss approving reviews when someone pushes a new commit. */ + dismiss_stale_reviews?: boolean; + /** Specify which users and teams can dismiss pull request reviews. Pass an empty \`dismissal_restrictions\` object to disable. User and team \`dismissal_restrictions\` are only available for organization-owned repositories. Omit this parameter for personal repositories. */ + dismissal_restrictions?: { + /** The list of team \`slug\`s with dismissal access */ + teams?: string[]; + /** The list of user \`login\`s with dismissal access */ + users?: string[]; + }; + /** Blocks merging pull requests until [code owners](https://help.github.com/articles/about-code-owners/) review them. */ + require_code_owner_reviews?: boolean; + /** Specify the number of reviewers required to approve pull requests. Use a number between 1 and 6. */ + required_approving_review_count?: number; + } | null; + /** Require status checks to pass before merging. Set to \`null\` to disable. */ + required_status_checks: { + /** The list of status checks to require in order to merge into this branch */ + contexts: string[]; + /** Require branches to be up to date before merging. */ + strict: boolean; + } | null; + /** Restrict who can push to the protected branch. User, app, and team \`restrictions\` are only available for organization-owned repositories. Set to \`null\` to disable. */ + restrictions: { + /** The list of app \`slug\`s with push access */ + apps?: string[]; + /** The list of team \`slug\`s with push access */ + teams: string[]; + /** The list of user \`login\`s with push access */ + users: string[]; + } | null; + }, + params: RequestParams = {}, + ) => + this.request< + ProtectedBranch, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationErrorSimple + >({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection\`, + method: "PUT", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Returns a token that you can pass to the `config` script to remove a self-hosted runner from an enterprise. The token expires after one hour. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from an enterprise, replace `TOKEN` with the remove token provided by this endpoint. ``` ./config.sh remove --token TOKEN ``` + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. * - * @tags enterprise-admin - * @name EnterpriseAdminCreateRemoveTokenForEnterprise - * @summary Create a remove token for an enterprise - * @request POST:/enterprises/{enterprise}/actions/runners/remove-token + * @tags repos + * @name ReposDeleteBranchProtection + * @summary Delete branch protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection */ - enterpriseAdminCreateRemoveTokenForEnterprise: (enterprise: string, params: RequestParams = {}) => - this.request({ - path: `/enterprises/${enterprise}/actions/runners/remove-token`, + reposDeleteBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection\`, + method: "DELETE", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposGetAdminBranchProtection + * @summary Get admin branch protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + */ + reposGetAdminBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/enforce_admins\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Adding admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled. + * + * @tags repos + * @name ReposSetAdminBranchProtection + * @summary Set admin branch protection + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + */ + reposSetAdminBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/enforce_admins\`, method: "POST", format: "json", ...params, }), /** - * @description Gets a specific self-hosted runner configured in an enterprise. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removing admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled. + * + * @tags repos + * @name ReposDeleteAdminBranchProtection + * @summary Delete admin branch protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + */ + reposDeleteAdminBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/enforce_admins\`, + method: "DELETE", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * + * @tags repos + * @name ReposGetPullRequestReviewProtection + * @summary Get pull request review protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + */ + reposGetPullRequestReviewProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_pull_request_reviews\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Updating pull request review enforcement requires admin or owner permissions to the repository and branch protection to be enabled. **Note**: Passing new arrays of \`users\` and \`teams\` replaces their previous values. * - * @tags enterprise-admin - * @name EnterpriseAdminGetSelfHostedRunnerForEnterprise - * @summary Get a self-hosted runner for an enterprise - * @request GET:/enterprises/{enterprise}/actions/runners/{runner_id} + * @tags repos + * @name ReposUpdatePullRequestReviewProtection + * @summary Update pull request review protection + * @request PATCH:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews */ - enterpriseAdminGetSelfHostedRunnerForEnterprise: ( - enterprise: string, - runnerId: number, + reposUpdatePullRequestReviewProtection: ( + owner: string, + repo: string, + branch: string, + data: { + /** Set to \`true\` if you want to automatically dismiss approving reviews when someone pushes a new commit. */ + dismiss_stale_reviews?: boolean; + /** Specify which users and teams can dismiss pull request reviews. Pass an empty \`dismissal_restrictions\` object to disable. User and team \`dismissal_restrictions\` are only available for organization-owned repositories. Omit this parameter for personal repositories. */ + dismissal_restrictions?: { + /** The list of team \`slug\`s with dismissal access */ + teams?: string[]; + /** The list of user \`login\`s with dismissal access */ + users?: string[]; + }; + /** Blocks merging pull requests until [code owners](https://help.github.com/articles/about-code-owners/) have reviewed. */ + require_code_owner_reviews?: boolean; + /** Specifies the number of reviewers required to approve pull requests. Use a number between 1 and 6. */ + required_approving_review_count?: number; + }, params: RequestParams = {}, ) => - this.request({ - path: `/enterprises/${enterprise}/actions/runners/${runnerId}`, - method: "GET", + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_pull_request_reviews\`, + method: "PATCH", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Forces the removal of a self-hosted runner from an enterprise. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the `admin:enterprise` scope to use this endpoint. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. * - * @tags enterprise-admin - * @name EnterpriseAdminDeleteSelfHostedRunnerFromEnterprise - * @summary Delete a self-hosted runner from an enterprise - * @request DELETE:/enterprises/{enterprise}/actions/runners/{runner_id} + * @tags repos + * @name ReposDeletePullRequestReviewProtection + * @summary Delete pull request review protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews */ - enterpriseAdminDeleteSelfHostedRunnerFromEnterprise: ( - enterprise: string, - runnerId: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/enterprises/${enterprise}/actions/runners/${runnerId}`, + reposDeletePullRequestReviewProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_pull_request_reviews\`, method: "DELETE", ...params, }), /** - * @description **Note:** The audit log REST API is currently in beta and is subject to change. Gets the audit log for an enterprise. To use this endpoint, you must be an enterprise admin, and you must use an access token with the `admin:enterprise` scope. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to check whether a branch requires signed commits. An enabled status of \`true\` indicates you must sign commits on this branch. For more information, see [Signing commits with GPG](https://help.github.com/articles/signing-commits-with-gpg) in GitHub Help. **Note**: You must enable branch protection to require signed commits. * - * @tags audit-log - * @name AuditLogGetAuditLog - * @summary Get the audit log for an enterprise - * @request GET:/enterprises/{enterprise}/audit-log + * @tags repos + * @name ReposGetCommitSignatureProtection + * @summary Get commit signature protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures */ - auditLogGetAuditLog: ( - enterprise: string, - query?: { - /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor. */ - after?: string; - /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor. */ - before?: string; - /** - * The event types to include: - * - * - `web` - returns web (non-Git) events - * - `git` - returns Git events - * - `all` - returns both web and Git events - * - * The default is `web`. - */ - include?: "web" | "git" | "all"; - /** - * The order of audit log events. To list newest events first, specify `desc`. To list oldest events first, specify `asc`. - * - * The default is `desc`. - */ - order?: "desc" | "asc"; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** A search phrase. For more information, see [Searching the audit log](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#searching-the-audit-log). */ - phrase?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/enterprises/${enterprise}/audit-log`, + reposGetCommitSignatureProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_signatures\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". The authenticated user must be an enterprise admin. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits. * - * @tags billing - * @name BillingGetGithubActionsBillingGhe - * @summary Get GitHub Actions billing for an enterprise - * @request GET:/enterprises/{enterprise}/settings/billing/actions + * @tags repos + * @name ReposCreateCommitSignatureProtection + * @summary Create commit signature protection + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures */ - billingGetGithubActionsBillingGhe: (enterprise: string, params: RequestParams = {}) => - this.request({ - path: `/enterprises/${enterprise}/settings/billing/actions`, - method: "GET", + reposCreateCommitSignatureProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_signatures\`, + method: "POST", format: "json", ...params, }), /** - * @description Gets the free and paid storage used for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." The authenticated user must be an enterprise admin. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to disable required signed commits on a branch. You must enable branch protection to require signed commits. * - * @tags billing - * @name BillingGetGithubPackagesBillingGhe - * @summary Get GitHub Packages billing for an enterprise - * @request GET:/enterprises/{enterprise}/settings/billing/packages + * @tags repos + * @name ReposDeleteCommitSignatureProtection + * @summary Delete commit signature protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures */ - billingGetGithubPackagesBillingGhe: (enterprise: string, params: RequestParams = {}) => - this.request({ - path: `/enterprises/${enterprise}/settings/billing/packages`, - method: "GET", - format: "json", + reposDeleteCommitSignatureProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_signatures\`, + method: "DELETE", ...params, }), /** - * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." The authenticated user must be an enterprise admin. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. * - * @tags billing - * @name BillingGetSharedStorageBillingGhe - * @summary Get shared storage billing for an enterprise - * @request GET:/enterprises/{enterprise}/settings/billing/shared-storage + * @tags repos + * @name ReposGetStatusChecksProtection + * @summary Get status checks protection + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks */ - billingGetSharedStorageBillingGhe: (enterprise: string, params: RequestParams = {}) => - this.request({ - path: `/enterprises/${enterprise}/settings/billing/shared-storage`, + reposGetStatusChecksProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks\`, method: "GET", format: "json", ...params, }), - }; - events = { + /** - * @description We delay the public events feed by five minutes, which means the most recent event returned by the public events API actually occurred at least five minutes ago. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Updating required status checks requires admin or owner permissions to the repository and branch protection to be enabled. * - * @tags activity - * @name ActivityListPublicEvents - * @summary List public events - * @request GET:/events + * @tags repos + * @name ReposUpdateStatusCheckProtection + * @summary Update status check protection + * @request PATCH:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks */ - activityListPublicEvents: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + reposUpdateStatusCheckProtection: ( + owner: string, + repo: string, + branch: string, + data: { + /** The list of status checks to require in order to merge into this branch */ + contexts?: string[]; + /** Require branches to be up to date before merging. */ + strict?: boolean; }, params: RequestParams = {}, ) => - this.request< - Event[], - | BasicError - | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/events`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks\`, + method: "PATCH", + body: data, + type: ContentType.Json, format: "json", ...params, }), - }; - feeds = { + /** - * @description GitHub provides several timeline resources in [Atom](http://en.wikipedia.org/wiki/Atom_(standard)) format. The Feeds API lists all the feeds available to the authenticated user: * **Timeline**: The GitHub global public timeline * **User**: The public timeline for any user, using [URI template](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia) * **Current user public**: The public timeline for the authenticated user * **Current user**: The private timeline for the authenticated user * **Current user actor**: The private timeline for activity created by the authenticated user * **Current user organizations**: The private timeline for the organizations the authenticated user is a member of. * **Security advisories**: A collection of public announcements that provide information about security-related vulnerabilities in software on GitHub. **Note**: Private feeds are only returned when [authenticating via Basic Auth](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) since current feed URIs use the older, non revocable auth tokens. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. * - * @tags activity - * @name ActivityGetFeeds - * @summary Get feeds - * @request GET:/feeds + * @tags repos + * @name ReposRemoveStatusCheckProtection + * @summary Remove status check protection + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks */ - activityGetFeeds: (params: RequestParams = {}) => - this.request({ - path: `/feeds`, - method: "GET", - format: "json", + reposRemoveStatusCheckProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks\`, + method: "DELETE", ...params, }), - }; - gists = { + /** - * @description Lists the authenticated user's gists or if called anonymously, this endpoint returns all public gists: + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. * - * @tags gists - * @name GistsList - * @summary List gists for the authenticated user - * @request GET:/gists + * @tags repos + * @name ReposGetAllStatusCheckContexts + * @summary Get all status check contexts + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts */ - gistsList: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists`, + reposGetAllStatusCheckContexts: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks/contexts\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description Allows you to add a new gist with one or more files. **Note:** Don't name your files "gistfile" with a numerical suffix. This is the format of the automatic naming scheme that Gist uses internally. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. * - * @tags gists - * @name GistsCreate - * @summary Create a gist - * @request POST:/gists + * @tags repos + * @name ReposAddStatusCheckContexts + * @summary Add status check contexts + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts */ - gistsCreate: ( + reposAddStatusCheckContexts: ( + owner: string, + repo: string, + branch: string, data: { - /** - * Description of the gist - * @example "Example Ruby script" - */ - description?: string; - /** - * Names and content for the files that make up the gist - * @example {"hello.rb":{"content":"puts \"Hello, World!\""}} - */ - files: Record< - string, - { - /** Content of the file */ - content: string; - } - >; - /** Flag indicating whether the gist is public */ - public?: boolean | "true" | "false"; + /** contexts parameter */ + contexts: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/gists`, + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks/contexts\`, method: "POST", body: data, type: ContentType.Json, @@ -10701,210 +24709,186 @@ export class Api extends HttpClient - this.request({ - path: `/gists/public`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks/contexts\`, + method: "PUT", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description List the authenticated user's starred gists: + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. * - * @tags gists - * @name GistsListStarred - * @summary List starred gists - * @request GET:/gists/starred + * @tags repos + * @name ReposRemoveStatusCheckContexts + * @summary Remove status check contexts + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts */ - gistsListStarred: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - since?: string; + reposRemoveStatusCheckContexts: ( + owner: string, + repo: string, + branch: string, + data: { + /** contexts parameter */ + contexts: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/gists/starred`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/required_status_checks/contexts\`, + method: "DELETE", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * No description + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists who has access to this protected branch. **Note**: Users, apps, and teams \`restrictions\` are only available for organization-owned repositories. * - * @tags gists - * @name GistsGet - * @summary Get a gist - * @request GET:/gists/{gist_id} + * @tags repos + * @name ReposGetAccessRestrictions + * @summary Get access restrictions + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions */ - gistsGet: (gistId: string, params: RequestParams = {}) => - this.request< - GistSimple, - | { - block?: { - created_at?: string; - html_url?: string | null; - reason?: string; - }; - documentation_url?: string; - message?: string; - } - | BasicError - >({ - path: `/gists/${gistId}`, + reposGetAccessRestrictions: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions\`, method: "GET", format: "json", ...params, }), /** - * @description Allows you to update or delete a gist file and rename gist files. Files from the previous version of the gist that aren't explicitly changed during an edit are unchanged. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Disables the ability to restrict who can push to this branch. * - * @tags gists - * @name GistsUpdate - * @summary Update a gist - * @request PATCH:/gists/{gist_id} + * @tags repos + * @name ReposDeleteAccessRestrictions + * @summary Delete access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions */ - gistsUpdate: ( - gistId: string, - data: null & { - /** - * Description of the gist - * @example "Example Ruby script" - */ - description?: string; - /** - * Names of files to be updated - * @example {"hello.rb":{"content":"blah","filename":"goodbye.rb"}} - */ - files?: Record< - string, - (object | null) & { - /** The new content of the file */ - content?: string; - /** The new filename for the file */ - filename?: string | null; - } - >; - }, + reposDeleteAccessRestrictions: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions\`, + method: "DELETE", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists the GitHub Apps that have push access to this branch. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. + * + * @tags repos + * @name ReposGetAppsWithAccessToProtectedBranch + * @summary Get apps with access to the protected branch + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + */ + reposGetAppsWithAccessToProtectedBranch: ( + owner: string, + repo: string, + branch: string, params: RequestParams = {}, ) => - this.request({ - path: `/gists/${gistId}`, - method: "PATCH", - body: data, - type: ContentType.Json, + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/apps\`, + method: "GET", format: "json", ...params, }), /** - * No description + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified apps push access for this branch. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | The GitHub Apps that have push access to this branch. Use the app's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | * - * @tags gists - * @name GistsDelete - * @summary Delete a gist - * @request DELETE:/gists/{gist_id} + * @tags repos + * @name ReposAddAppAccessRestrictions + * @summary Add app access restrictions + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps */ - gistsDelete: (gistId: string, params: RequestParams = {}) => - this.request({ - path: `/gists/${gistId}`, - method: "DELETE", + reposAddAppAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: { + /** apps parameter */ + apps: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/apps\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * No description + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Replaces the list of apps that have push access to this branch. This removes all apps that previously had push access and grants push access to the new list of apps. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | The GitHub Apps that have push access to this branch. Use the app's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | * - * @tags gists - * @name GistsListComments - * @summary List gist comments - * @request GET:/gists/{gist_id}/comments + * @tags repos + * @name ReposSetAppAccessRestrictions + * @summary Set app access restrictions + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps */ - gistsListComments: ( - gistId: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + reposSetAppAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: { + /** apps parameter */ + apps: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/gists/${gistId}/comments`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/apps\`, + method: "PUT", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * No description + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of an app to push to this branch. Only installed GitHub Apps with \`write\` access to the \`contents\` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | The GitHub Apps that have push access to this branch. Use the app's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | * - * @tags gists - * @name GistsCreateComment - * @summary Create a gist comment - * @request POST:/gists/{gist_id}/comments + * @tags repos + * @name ReposRemoveAppAccessRestrictions + * @summary Remove app access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps */ - gistsCreateComment: ( - gistId: string, + reposRemoveAppAccessRestrictions: ( + owner: string, + repo: string, + branch: string, data: { - /** - * The comment text. - * @maxLength 65535 - * @example "Body of the attachment" - */ - body: string; + /** apps parameter */ + apps: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/gists/${gistId}/comments`, - method: "POST", + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/apps\`, + method: "DELETE", body: data, type: ContentType.Json, format: "json", @@ -10912,57 +24896,47 @@ export class Api extends HttpClient - this.request< - GistComment, - | { - block?: { - created_at?: string; - html_url?: string | null; - reason?: string; - }; - documentation_url?: string; - message?: string; - } - | BasicError - >({ - path: `/gists/${gistId}/comments/${commentId}`, + reposGetTeamsWithAccessToProtectedBranch: ( + owner: string, + repo: string, + branch: string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/teams\`, method: "GET", format: "json", ...params, }), /** - * No description + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified teams push access for this branch. You can also give push access to child teams. | Type | Description | | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | \`array\` | The teams that can have push access. Use the team's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | * - * @tags gists - * @name GistsUpdateComment - * @summary Update a gist comment - * @request PATCH:/gists/{gist_id}/comments/{comment_id} + * @tags repos + * @name ReposAddTeamAccessRestrictions + * @summary Add team access restrictions + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams */ - gistsUpdateComment: ( - gistId: string, - commentId: number, + reposAddTeamAccessRestrictions: ( + owner: string, + repo: string, + branch: string, data: { - /** - * The comment text. - * @maxLength 65535 - * @example "Body of the attachment" - */ - body: string; + /** teams parameter */ + teams: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/gists/${gistId}/comments/${commentId}`, - method: "PATCH", + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/teams\`, + method: "POST", body: data, type: ContentType.Json, format: "json", @@ -10970,280 +24944,461 @@ export class Api extends HttpClient - this.request({ - path: `/gists/${gistId}/comments/${commentId}`, - method: "DELETE", + reposSetTeamAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: { + /** teams parameter */ + teams: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/teams\`, + method: "PUT", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * No description + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of a team to push to this branch. You can also remove push access for child teams. | Type | Description | | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Teams that should no longer have push access. Use the team's \`slug\`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | * - * @tags gists - * @name GistsListCommits - * @summary List gist commits - * @request GET:/gists/{gist_id}/commits + * @tags repos + * @name ReposRemoveTeamAccessRestrictions + * @summary Remove team access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams */ - gistsListCommits: ( - gistId: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + reposRemoveTeamAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: { + /** teams parameter */ + teams: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/gists/${gistId}/commits`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/teams\`, + method: "DELETE", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * No description + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists the people who have push access to this branch. * - * @tags gists - * @name GistsListForks - * @summary List gist forks - * @request GET:/gists/{gist_id}/forks + * @tags repos + * @name ReposGetUsersWithAccessToProtectedBranch + * @summary Get users with access to the protected branch + * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users */ - gistsListForks: ( - gistId: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, + reposGetUsersWithAccessToProtectedBranch: ( + owner: string, + repo: string, + branch: string, params: RequestParams = {}, ) => - this.request({ - path: `/gists/${gistId}/forks`, + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/users\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description **Note**: This was previously `/gists/:gist_id/fork`. + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified people push access for this branch. | Type | Description | | ------- | ----------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Usernames for people who can have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | * - * @tags gists - * @name GistsFork - * @summary Fork a gist - * @request POST:/gists/{gist_id}/forks + * @tags repos + * @name ReposAddUserAccessRestrictions + * @summary Add user access restrictions + * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users */ - gistsFork: (gistId: string, params: RequestParams = {}) => - this.request({ - path: `/gists/${gistId}/forks`, + reposAddUserAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: { + /** users parameter */ + users: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/users\`, method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * No description - * - * @tags gists - * @name GistsCheckIsStarred - * @summary Check if a gist is starred - * @request GET:/gists/{gist_id}/star - */ - gistsCheckIsStarred: (gistId: string, params: RequestParams = {}) => - this.request({ - path: `/gists/${gistId}/star`, - method: "GET", - ...params, - }), - - /** - * @description Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Replaces the list of people that have push access to this branch. This removes all people that previously had push access and grants push access to the new list of people. | Type | Description | | ------- | ----------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Usernames for people who can have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | * - * @tags gists - * @name GistsStar - * @summary Star a gist - * @request PUT:/gists/{gist_id}/star + * @tags repos + * @name ReposSetUserAccessRestrictions + * @summary Set user access restrictions + * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users */ - gistsStar: (gistId: string, params: RequestParams = {}) => - this.request({ - path: `/gists/${gistId}/star`, + reposSetUserAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: { + /** users parameter */ + users: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/users\`, method: "PUT", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * No description + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of a user to push to this branch. | Type | Description | | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | \`array\` | Usernames of the people who should no longer have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | * - * @tags gists - * @name GistsUnstar - * @summary Unstar a gist - * @request DELETE:/gists/{gist_id}/star + * @tags repos + * @name ReposRemoveUserAccessRestrictions + * @summary Remove user access restrictions + * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users */ - gistsUnstar: (gistId: string, params: RequestParams = {}) => - this.request({ - path: `/gists/${gistId}/star`, + reposRemoveUserAccessRestrictions: ( + owner: string, + repo: string, + branch: string, + data: { + /** users parameter */ + users: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/protection/restrictions/users\`, method: "DELETE", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * No description + * @description Renames a branch in a repository. **Note:** Although the API responds immediately, the branch rename process might take some extra time to complete in the background. You won't be able to push to the old branch name while the rename process is in progress. For more information, see "[Renaming a branch](https://docs.github.com/github/administering-a-repository/renaming-a-branch)". The permissions required to use this endpoint depends on whether you are renaming the default branch. To rename a non-default branch: * Users must have push access. * GitHub Apps must have the \`contents:write\` repository permission. To rename the default branch: * Users must have admin or owner permissions. * GitHub Apps must have the \`administration:write\` repository permission. * - * @tags gists - * @name GistsGetRevision - * @summary Get a gist revision - * @request GET:/gists/{gist_id}/{sha} + * @tags repos + * @name ReposRenameBranch + * @summary Rename a branch + * @request POST:/repos/{owner}/{repo}/branches/{branch}/rename */ - gistsGetRevision: (gistId: string, sha: string, params: RequestParams = {}) => - this.request({ - path: `/gists/${gistId}/${sha}`, - method: "GET", + reposRenameBranch: ( + owner: string, + repo: string, + branch: string, + data: { + /** The new name of the branch. */ + new_name: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/branches/\${branch}/rename\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), - }; - gitignore = { + /** - * @description List all templates available to pass as an option when [creating a repository](https://docs.github.com/rest/reference/repos#create-a-repository-for-the-authenticated-user). + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Creates a new check run for a specific commit in a repository. Your GitHub App must have the \`checks:write\` permission to create check runs. In a check suite, GitHub limits the number of check runs with the same name to 1000. Once these check runs exceed 1000, GitHub will start to automatically delete older check runs. * - * @tags gitignore - * @name GitignoreGetAllTemplates - * @summary Get all gitignore templates - * @request GET:/gitignore/templates + * @tags checks + * @name ChecksCreate + * @summary Create a check run + * @request POST:/repos/{owner}/{repo}/check-runs */ - gitignoreGetAllTemplates: (params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates`, - method: "GET", + checksCreate: ( + owner: string, + repo: string, + data: ( + | { + status?: "completed"; + [key: string]: any; + } + | { + status?: "queued" | "in_progress"; + [key: string]: any; + } + ) & { + /** + * Displays a button on GitHub that can be clicked to alert your app to do additional tasks. For example, a code linting app can display a button that automatically fixes detected errors. The button created in this object is displayed after the check run completes. When a user clicks the button, GitHub sends the [\`check_run.requested_action\` webhook](https://docs.github.com/webhooks/event-payloads/#check_run) to your app. Each action includes a \`label\`, \`identifier\` and \`description\`. A maximum of three actions are accepted. See the [\`actions\` object](https://docs.github.com/rest/reference/checks#actions-object) description. To learn more about check runs and requested actions, see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)." To learn more about check runs and requested actions, see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)." + * @maxItems 3 + */ + actions?: { + /** + * A short explanation of what this action would do. The maximum size is 40 characters. + * @maxLength 40 + */ + description: string; + /** + * A reference for the action on the integrator's system. The maximum size is 20 characters. + * @maxLength 20 + */ + identifier: string; + /** + * The text to be displayed on a button in the web UI. The maximum size is 20 characters. + * @maxLength 20 + */ + label: string; + }[]; + /** The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + completed_at?: string; + /** + * **Required if you provide \`completed_at\` or a \`status\` of \`completed\`**. The final conclusion of the check. Can be one of \`success\`, \`failure\`, \`neutral\`, \`cancelled\`, \`skipped\`, \`timed_out\`, or \`action_required\`. When the conclusion is \`action_required\`, additional details should be provided on the site specified by \`details_url\`. + * **Note:** Providing \`conclusion\` will automatically set the \`status\` parameter to \`completed\`. Only GitHub can change a check run conclusion to \`stale\`. + */ + conclusion?: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required"; + /** The URL of the integrator's site that has the full details of the check. If the integrator does not provide this, then the homepage of the GitHub app is used. */ + details_url?: string; + /** A reference for the run on the integrator's system. */ + external_id?: string; + /** The SHA of the commit. */ + head_sha: string; + /** The name of the check. For example, "code-coverage". */ + name: string; + /** Check runs can accept a variety of data in the \`output\` object, including a \`title\` and \`summary\` and can optionally provide descriptive details about the run. See the [\`output\` object](https://docs.github.com/rest/reference/checks#output-object) description. */ + output?: { + /** + * Adds information from your analysis to specific lines of code. Annotations are visible on GitHub in the **Checks** and **Files changed** tab of the pull request. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the [Update a check run](https://docs.github.com/rest/reference/checks#update-a-check-run) endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. For details about how you can view annotations on GitHub, see "[About status checks](https://help.github.com/articles/about-status-checks#checks)". See the [\`annotations\` object](https://docs.github.com/rest/reference/checks#annotations-object) description for details about how to use this parameter. + * @maxItems 50 + */ + annotations?: { + /** The level of the annotation. Can be one of \`notice\`, \`warning\`, or \`failure\`. */ + annotation_level: "notice" | "warning" | "failure"; + /** The end column of the annotation. Annotations only support \`start_column\` and \`end_column\` on the same line. Omit this parameter if \`start_line\` and \`end_line\` have different values. */ + end_column?: number; + /** The end line of the annotation. */ + end_line: number; + /** A short description of the feedback for these lines of code. The maximum size is 64 KB. */ + message: string; + /** The path of the file to add an annotation to. For example, \`assets/css/main.css\`. */ + path: string; + /** Details about this annotation. The maximum size is 64 KB. */ + raw_details?: string; + /** The start column of the annotation. Annotations only support \`start_column\` and \`end_column\` on the same line. Omit this parameter if \`start_line\` and \`end_line\` have different values. */ + start_column?: number; + /** The start line of the annotation. */ + start_line: number; + /** The title that represents the annotation. The maximum size is 255 characters. */ + title?: string; + }[]; + /** Adds images to the output displayed in the GitHub pull request UI. See the [\`images\` object](https://docs.github.com/rest/reference/checks#images-object) description for details. */ + images?: { + /** The alternative text for the image. */ + alt: string; + /** A short image description. */ + caption?: string; + /** The full URL of the image. */ + image_url: string; + }[]; + /** + * The summary of the check run. This parameter supports Markdown. + * @maxLength 65535 + */ + summary: string; + /** + * The details of the check run. This parameter supports Markdown. + * @maxLength 65535 + */ + text?: string; + /** The title of the check run. */ + title: string; + }; + /** The time that the check run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + started_at?: string; + /** + * The current status. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. + * @default "queued" + */ + status?: "queued" | "in_progress" | "completed"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-runs\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description The API also allows fetching the source of a single template. Use the raw [media type](https://docs.github.com/rest/overview/media-types/) to get the raw contents. + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Gets a single check run using its \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the \`repo\` scope to get check runs in a private repository. * - * @tags gitignore - * @name GitignoreGetTemplate - * @summary Get a gitignore template - * @request GET:/gitignore/templates/{name} + * @tags checks + * @name ChecksGet + * @summary Get a check run + * @request GET:/repos/{owner}/{repo}/check-runs/{check_run_id} */ - gitignoreGetTemplate: (name: string, params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates/${name}`, + checksGet: (owner: string, repo: string, checkRunId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-runs/\${checkRunId}\`, method: "GET", format: "json", ...params, }), - }; - installation = { + /** - * @description List repositories that an app installation can access. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Updates a check run for a specific commit in a repository. Your GitHub App must have the \`checks:write\` permission to edit check runs. * - * @tags apps - * @name AppsListReposAccessibleToInstallation - * @summary List repositories accessible to the app installation - * @request GET:/installation/repositories + * @tags checks + * @name ChecksUpdate + * @summary Update a check run + * @request PATCH:/repos/{owner}/{repo}/check-runs/{check_run_id} */ - appsListReposAccessibleToInstallation: ( - query?: { + checksUpdate: ( + owner: string, + repo: string, + checkRunId: number, + data: ( + | { + status?: "completed"; + [key: string]: any; + } + | { + status?: "queued" | "in_progress"; + [key: string]: any; + } + ) & { /** - * Page number of the results to fetch. - * @default 1 + * Possible further actions the integrator can perform, which a user may trigger. Each action includes a \`label\`, \`identifier\` and \`description\`. A maximum of three actions are accepted. See the [\`actions\` object](https://docs.github.com/rest/reference/checks#actions-object) description. To learn more about check runs and requested actions, see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)." + * @maxItems 3 */ - page?: number; + actions?: { + /** + * A short explanation of what this action would do. The maximum size is 40 characters. + * @maxLength 40 + */ + description: string; + /** + * A reference for the action on the integrator's system. The maximum size is 20 characters. + * @maxLength 20 + */ + identifier: string; + /** + * The text to be displayed on a button in the web UI. The maximum size is 20 characters. + * @maxLength 20 + */ + label: string; + }[]; + /** The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + completed_at?: string; /** - * Results per page (max 100) - * @default 30 + * **Required if you provide \`completed_at\` or a \`status\` of \`completed\`**. The final conclusion of the check. Can be one of \`success\`, \`failure\`, \`neutral\`, \`cancelled\`, \`skipped\`, \`timed_out\`, or \`action_required\`. + * **Note:** Providing \`conclusion\` will automatically set the \`status\` parameter to \`completed\`. Only GitHub can change a check run conclusion to \`stale\`. */ - per_page?: number; + conclusion?: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required"; + /** The URL of the integrator's site that has the full details of the check. */ + details_url?: string; + /** A reference for the run on the integrator's system. */ + external_id?: string; + /** The name of the check. For example, "code-coverage". */ + name?: string; + /** Check runs can accept a variety of data in the \`output\` object, including a \`title\` and \`summary\` and can optionally provide descriptive details about the run. See the [\`output\` object](https://docs.github.com/rest/reference/checks#output-object-1) description. */ + output?: { + /** + * Adds information from your analysis to specific lines of code. Annotations are visible in GitHub's pull request UI. Annotations are visible in GitHub's pull request UI. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the [Update a check run](https://docs.github.com/rest/reference/checks#update-a-check-run) endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. For details about annotations in the UI, see "[About status checks](https://help.github.com/articles/about-status-checks#checks)". See the [\`annotations\` object](https://docs.github.com/rest/reference/checks#annotations-object-1) description for details. + * @maxItems 50 + */ + annotations?: { + /** The level of the annotation. Can be one of \`notice\`, \`warning\`, or \`failure\`. */ + annotation_level: "notice" | "warning" | "failure"; + /** The end column of the annotation. Annotations only support \`start_column\` and \`end_column\` on the same line. Omit this parameter if \`start_line\` and \`end_line\` have different values. */ + end_column?: number; + /** The end line of the annotation. */ + end_line: number; + /** A short description of the feedback for these lines of code. The maximum size is 64 KB. */ + message: string; + /** The path of the file to add an annotation to. For example, \`assets/css/main.css\`. */ + path: string; + /** Details about this annotation. The maximum size is 64 KB. */ + raw_details?: string; + /** The start column of the annotation. Annotations only support \`start_column\` and \`end_column\` on the same line. Omit this parameter if \`start_line\` and \`end_line\` have different values. */ + start_column?: number; + /** The start line of the annotation. */ + start_line: number; + /** The title that represents the annotation. The maximum size is 255 characters. */ + title?: string; + }[]; + /** Adds images to the output displayed in the GitHub pull request UI. See the [\`images\` object](https://docs.github.com/rest/reference/checks#annotations-object-1) description for details. */ + images?: { + /** The alternative text for the image. */ + alt: string; + /** A short image description. */ + caption?: string; + /** The full URL of the image. */ + image_url: string; + }[]; + /** + * Can contain Markdown. + * @maxLength 65535 + */ + summary: string; + /** + * Can contain Markdown. + * @maxLength 65535 + */ + text?: string; + /** **Required**. */ + title?: string; + }; + /** This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + started_at?: string; + /** The current status. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ + status?: "queued" | "in_progress" | "completed"; }, params: RequestParams = {}, ) => - this.request< - { - repositories: Repository[]; - /** @example "selected" */ - repository_selection?: string; - total_count: number; - }, - BasicError - >({ - path: `/installation/repositories`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/check-runs/\${checkRunId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Revokes the installation token you're using to authenticate as an installation and access this endpoint. Once an installation token is revoked, the token is invalidated and cannot be used. Other endpoints that require the revoked installation token must have a new installation token to work. You can create a new token using the "[Create an installation access token for an app](https://docs.github.com/rest/reference/apps#create-an-installation-access-token-for-an-app)" endpoint. You must use an [installation access token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-an-installation) to access this endpoint. - * - * @tags apps - * @name AppsRevokeInstallationAccessToken - * @summary Revoke an installation access token - * @request DELETE:/installation/token - */ - appsRevokeInstallationAccessToken: (params: RequestParams = {}) => - this.request({ - path: `/installation/token`, - method: "DELETE", - ...params, - }), - }; - issues = { - /** - * @description List issues assigned to the authenticated user across all visible repositories including owned repositories, member repositories, and organization repositories. You can use the `filter` query parameter to fetch issues that are not necessarily assigned to you. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * @description Lists annotations for a check run using the annotation \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get annotations for a check run. OAuth Apps and authenticated users must have the \`repo\` scope to get annotations for a check run in a private repository. * - * @tags issues - * @name IssuesList - * @summary List issues assigned to the authenticated user - * @request GET:/issues + * @tags checks + * @name ChecksListAnnotations + * @summary List check run annotations + * @request GET:/repos/{owner}/{repo}/check-runs/{check_run_id}/annotations */ - issuesList: ( + checksListAnnotations: ( + owner: string, + repo: string, + checkRunId: number, query?: { - collab?: boolean; - /** - * One of `asc` (ascending) or `desc` (descending). - * @default "desc" - */ - direction?: "asc" | "desc"; - /** - * Indicates which sorts of issues to return. Can be one of: - * \* `assigned`: Issues assigned to you - * \* `created`: Issues created by you - * \* `mentioned`: Issues mentioning you - * \* `subscribed`: Issues you're subscribed to updates for - * \* `all`: All issues the authenticated user can see, regardless of participation or creation - * @default "assigned" - */ - filter?: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** A list of comma separated label names. Example: `bug,ui,@high` */ - labels?: string; - orgs?: boolean; - owned?: boolean; /** * Page number of the results to fetch. * @default 1 @@ -11254,150 +25409,113 @@ export class Api extends HttpClient - this.request({ - path: `/issues`, + this.request({ + path: \`/repos/\${owner}/\${repo}/check-runs/\${checkRunId}/annotations\`, method: "GET", query: query, format: "json", ...params, }), - }; - licenses = { + /** - * No description + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array and a \`null\` value for \`head_branch\`. By default, check suites are automatically created when you create a [check run](https://docs.github.com/rest/reference/checks#check-runs). You only need to use this endpoint for manually creating check suites when you've disabled automatic creation using "[Update repository preferences for check suites](https://docs.github.com/rest/reference/checks#update-repository-preferences-for-check-suites)". Your GitHub App must have the \`checks:write\` permission to create check suites. * - * @tags licenses - * @name LicensesGetAllCommonlyUsed - * @summary Get all commonly used licenses - * @request GET:/licenses + * @tags checks + * @name ChecksCreateSuite + * @summary Create a check suite + * @request POST:/repos/{owner}/{repo}/check-suites */ - licensesGetAllCommonlyUsed: ( - query?: { - featured?: boolean; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + checksCreateSuite: ( + owner: string, + repo: string, + data: { + /** The sha of the head commit. */ + head_sha: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/licenses`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/check-suites\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * No description - * - * @tags licenses - * @name LicensesGet - * @summary Get a license - * @request GET:/licenses/{license} - */ - licensesGet: (license: string, params: RequestParams = {}) => - this.request({ - path: `/licenses/${license}`, - method: "GET", - format: "json", - ...params, - }), - }; - markdown = { - /** - * No description + * @description Changes the default automatic flow when creating check suites. By default, a check suite is automatically created each time code is pushed to a repository. When you disable the automatic creation of check suites, you can manually [Create a check suite](https://docs.github.com/rest/reference/checks#create-a-check-suite). You must have admin permissions in the repository to set preferences for check suites. * - * @tags markdown - * @name MarkdownRender - * @summary Render a Markdown document - * @request POST:/markdown + * @tags checks + * @name ChecksSetSuitesPreferences + * @summary Update repository preferences for check suites + * @request PATCH:/repos/{owner}/{repo}/check-suites/preferences */ - markdownRender: ( + checksSetSuitesPreferences: ( + owner: string, + repo: string, data: { - /** The repository context to use when creating references in `gfm` mode. */ - context?: string; - /** - * The rendering mode. - * @default "markdown" - * @example "markdown" - */ - mode?: "markdown" | "gfm"; - /** The Markdown text to render in HTML. */ - text: string; + /** Enables or disables automatic creation of CheckSuite events upon pushes to the repository. Enabled by default. See the [\`auto_trigger_checks\` object](https://docs.github.com/rest/reference/checks#auto_trigger_checks-object) description for details. */ + auto_trigger_checks?: { + /** The \`id\` of the GitHub App. */ + app_id: number; + /** + * Set to \`true\` to enable automatic creation of CheckSuite events upon pushes to the repository, or \`false\` to disable them. + * @default true + */ + setting: boolean; + }[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/markdown`, - method: "POST", + this.request({ + path: \`/repos/\${owner}/\${repo}/check-suites/preferences\`, + method: "PATCH", body: data, type: ContentType.Json, + format: "json", ...params, }), /** - * @description You must send Markdown as plain text (using a `Content-Type` header of `text/plain` or `text/x-markdown`) to this endpoint, rather than using JSON format. In raw mode, [GitHub Flavored Markdown](https://github.github.com/gfm/) is not supported and Markdown will be rendered in plain format like a README.md file. Markdown content must be 400 KB or less. - * - * @tags markdown - * @name MarkdownRenderRaw - * @summary Render a Markdown document in raw mode - * @request POST:/markdown/raw - */ - markdownRenderRaw: (data: WebhookConfigUrl, params: RequestParams = {}) => - this.request({ - path: `/markdown/raw`, - method: "POST", - body: data, - type: ContentType.Text, - ...params, - }), - }; - marketplaceListing = { - /** - * @description Shows whether the user or organization account actively subscribes to a plan listed by the authenticated GitHub App. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array and a \`null\` value for \`head_branch\`. Gets a single check suite using its \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check suites. OAuth Apps and authenticated users must have the \`repo\` scope to get check suites in a private repository. * - * @tags apps - * @name AppsGetSubscriptionPlanForAccount - * @summary Get a subscription plan for an account - * @request GET:/marketplace_listing/accounts/{account_id} + * @tags checks + * @name ChecksGetSuite + * @summary Get a check suite + * @request GET:/repos/{owner}/{repo}/check-suites/{check_suite_id} */ - appsGetSubscriptionPlanForAccount: (accountId: number, params: RequestParams = {}) => - this.request({ - path: `/marketplace_listing/accounts/${accountId}`, + checksGetSuite: (owner: string, repo: string, checkSuiteId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/check-suites/\${checkSuiteId}\`, method: "GET", format: "json", ...params, }), /** - * @description Lists all plans that are part of your GitHub Marketplace listing. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Lists check runs for a check suite using its \`id\`. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the \`repo\` scope to get check runs in a private repository. * - * @tags apps - * @name AppsListPlans - * @summary List plans - * @request GET:/marketplace_listing/plans + * @tags checks + * @name ChecksListForSuite + * @summary List check runs in a check suite + * @request GET:/repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs */ - appsListPlans: ( + checksListForSuite: ( + owner: string, + repo: string, + checkSuiteId: number, query?: { + /** Returns check runs with the specified \`name\`. */ + check_name?: string; + /** + * Filters check runs by their \`completed_at\` timestamp. Can be one of \`latest\` (returning the most recent check runs) or \`all\`. + * @default "latest" + */ + filter?: "latest" | "all"; /** * Page number of the results to fetch. * @default 1 @@ -11408,11 +25526,19 @@ export class Api extends HttpClient - this.request({ - path: `/marketplace_listing/plans`, + this.request< + { + check_runs: CheckRun[]; + total_count: number; + }, + any + >({ + path: \`/repos/\${owner}/\${repo}/check-suites/\${checkSuiteId}/check-runs\`, method: "GET", query: query, format: "json", @@ -11420,38 +25546,48 @@ export class Api extends HttpClient + this.request({ + path: \`/repos/\${owner}/\${repo}/check-suites/\${checkSuiteId}/rerequest\`, + method: "POST", + ...params, + }), + + /** + * @description Lists all open code scanning alerts for the default branch (usually \`main\` or \`master\`). You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` read permission to use this endpoint. + * + * @tags code-scanning + * @name CodeScanningListAlertsForRepo + * @summary List code scanning alerts for a repository + * @request GET:/repos/{owner}/{repo}/code-scanning/alerts + */ + codeScanningListAlertsForRepo: ( + owner: string, + repo: string, query?: { - /** To return the oldest accounts first, set to `asc`. Can be one of `asc` or `desc`. Ignored without the `sort` parameter. */ - direction?: "asc" | "desc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** - * One of `created` (when the repository was starred) or `updated` (when it was last pushed to). - * @default "created" - */ - sort?: "created" | "updated"; + /** Set a full Git reference to list alerts for a specific branch. The \`ref\` must be formatted as \`refs/heads/\`. */ + ref?: CodeScanningAlertRef; + /** Set to \`open\`, \`fixed\`, or \`dismissed\` to list code scanning alerts in a specific state. */ + state?: CodeScanningAlertState; }, params: RequestParams = {}, ) => - this.request({ - path: `/marketplace_listing/plans/${planId}/accounts`, + this.request< + CodeScanningAlertCodeScanningAlertItems[], + void | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/code-scanning/alerts\`, method: "GET", query: query, format: "json", @@ -11459,182 +25595,164 @@ export class Api extends HttpClient - this.request({ - path: `/marketplace_listing/stubbed/accounts/${accountId}`, + codeScanningGetAlert: (owner: string, repo: string, alertNumber: number, params: RequestParams = {}) => + this.request< + CodeScanningAlertCodeScanningAlert, + | void + | BasicError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/code-scanning/alerts/\${alertNumber}\`, method: "GET", format: "json", ...params, }), /** - * @description Lists all plans that are part of your GitHub Marketplace listing. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * @description Updates the status of a single code scanning alert. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` write permission to use this endpoint. * - * @tags apps - * @name AppsListPlansStubbed - * @summary List plans (stubbed) - * @request GET:/marketplace_listing/stubbed/plans + * @tags code-scanning + * @name CodeScanningUpdateAlert + * @summary Update a code scanning alert + * @request PATCH:/repos/{owner}/{repo}/code-scanning/alerts/{alert_number} */ - appsListPlansStubbed: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + codeScanningUpdateAlert: ( + owner: string, + repo: string, + alertNumber: AlertNumber, + data: { + /** **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\`. */ + dismissed_reason?: CodeScanningAlertDismissedReason; + /** Sets the state of the code scanning alert. Can be one of \`open\` or \`dismissed\`. You must provide \`dismissed_reason\` when you set the state to \`dismissed\`. */ + state: CodeScanningAlertSetState; }, params: RequestParams = {}, ) => - this.request({ - path: `/marketplace_listing/stubbed/plans`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/code-scanning/alerts/\${alertNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Returns repository and organization accounts associated with the specified plan, including free plans. For per-seat pricing, you see the list of accounts that have purchased the plan, including the number of seats purchased. When someone submits a plan change that won't be processed until the end of their billing cycle, you will also see the upcoming pending change. GitHub Apps must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. OAuth Apps must use [basic authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication) with their client ID and client secret to access this endpoint. + * @description List the details of recent code scanning analyses for a repository. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` read permission to use this endpoint. * - * @tags apps - * @name AppsListAccountsForPlanStubbed - * @summary List accounts for a plan (stubbed) - * @request GET:/marketplace_listing/stubbed/plans/{plan_id}/accounts + * @tags code-scanning + * @name CodeScanningListRecentAnalyses + * @summary List recent code scanning analyses for a repository + * @request GET:/repos/{owner}/{repo}/code-scanning/analyses */ - appsListAccountsForPlanStubbed: ( - planId: number, + codeScanningListRecentAnalyses: ( + owner: string, + repo: string, query?: { - /** To return the oldest accounts first, set to `asc`. Can be one of `asc` or `desc`. Ignored without the `sort` parameter. */ - direction?: "asc" | "desc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** - * One of `created` (when the repository was starred) or `updated` (when it was last pushed to). - * @default "created" - */ - sort?: "created" | "updated"; + /** Set a full Git reference to list alerts for a specific branch. The \`ref\` must be formatted as \`refs/heads/\`. */ + ref?: CodeScanningAnalysisRef; + /** Set a single code scanning tool name to filter alerts by tool. */ + tool_name?: CodeScanningAnalysisToolName; }, params: RequestParams = {}, ) => - this.request({ - path: `/marketplace_listing/stubbed/plans/${planId}/accounts`, + this.request({ + path: \`/repos/\${owner}/\${repo}/code-scanning/analyses\`, method: "GET", query: query, format: "json", ...params, }), - }; - meta = { - /** - * @description Returns meta information about GitHub, including a list of GitHub's IP addresses. For more information, see "[About GitHub's IP addresses](https://help.github.com/articles/about-github-s-ip-addresses/)." **Note:** The IP addresses shown in the documentation's response are only example values. You must always query the API directly to get the latest list of IP addresses. - * - * @tags meta - * @name MetaGet - * @summary Get GitHub meta information - * @request GET:/meta - */ - metaGet: (params: RequestParams = {}) => - this.request({ - path: `/meta`, - method: "GET", - format: "json", - ...params, - }), - }; - networks = { + /** - * No description + * @description Upload a SARIF file containing the results of a code scanning analysis to make the results available in a repository. You must use an access token with the \`security_events\` scope to use this endpoint. GitHub Apps must have the \`security_events\` write permission to use this endpoint. * - * @tags activity - * @name ActivityListPublicEventsForRepoNetwork - * @summary List public events for a network of repositories - * @request GET:/networks/{owner}/{repo}/events + * @tags code-scanning + * @name CodeScanningUploadSarif + * @summary Upload a SARIF file + * @request POST:/repos/{owner}/{repo}/code-scanning/sarifs */ - activityListPublicEventsForRepoNetwork: ( + codeScanningUploadSarif: ( owner: string, repo: string, - query?: { + data: { /** - * Page number of the results to fetch. - * @default 1 + * 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. + * @format uri + * @example "file:///github/workspace/" */ - page?: number; + checkout_uri?: string; + /** The commit SHA of the code scanning analysis file. */ + commit_sha: CodeScanningAnalysisCommitSha; + /** The full Git reference of the code scanning analysis file, formatted as \`refs/heads/\`. */ + 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; /** - * Results per page (max 100) - * @default 30 + * 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 */ - per_page?: number; + started_at?: string; + /** The name of the tool used to generate the code scanning analysis alert. */ + tool_name: CodeScanningAnalysisToolName; }, params: RequestParams = {}, ) => - this.request({ - path: `/networks/${owner}/${repo}/events`, - method: "GET", - query: query, - format: "json", + this.request({ + path: \`/repos/\${owner}/\${repo}/code-scanning/sarifs\`, + method: "POST", + body: data, + type: ContentType.Json, ...params, }), - }; - notifications = { + /** - * @description List all notifications for the current user, sorted by most recently updated. + * @description For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. Team members will include the members of child teams. * - * @tags activity - * @name ActivityListNotificationsForAuthenticatedUser - * @summary List notifications for the authenticated user - * @request GET:/notifications + * @tags repos + * @name ReposListCollaborators + * @summary List repository collaborators + * @request GET:/repos/{owner}/{repo}/collaborators */ - activityListNotificationsForAuthenticatedUser: ( + reposListCollaborators: ( + owner: string, + repo: string, query?: { /** - * If `true`, show notifications marked as read. - * @default false + * Filter collaborators returned by their affiliation. Can be one of: + * \\* \`outside\`: All outside collaborators of an organization-owned repository. + * \\* \`direct\`: All collaborators with permissions to an organization-owned repository, regardless of organization membership status. + * \\* \`all\`: All collaborators the authenticated user can see. + * @default "all" */ - all?: boolean; - /** Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - before?: string; + affiliation?: "outside" | "direct" | "all"; /** * Page number of the results to fetch. * @default 1 */ page?: number; - /** - * If `true`, only shows notifications in which the user is directly participating or mentioned. - * @default false - */ - participating?: boolean; /** * Results per page (max 100) * @default 30 */ per_page?: number; - /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - since?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/notifications`, + this.request({ + path: \`/repos/\${owner}/\${repo}/collaborators\`, method: "GET", query: query, format: "json", @@ -11642,107 +25760,50 @@ export class Api extends HttpClient - this.request< - { - message?: string; - }, - BasicError - >({ - path: `/notifications`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags activity - * @name ActivityGetThread - * @summary Get a thread - * @request GET:/notifications/threads/{thread_id} - */ - activityGetThread: (threadId: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${threadId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @tags activity - * @name ActivityMarkThreadAsRead - * @summary Mark a thread as read - * @request PATCH:/notifications/threads/{thread_id} - */ - activityMarkThreadAsRead: (threadId: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${threadId}`, - method: "PATCH", - ...params, - }), - - /** - * @description This checks to see if the current user is subscribed to a thread. You can also [get a repository subscription](https://docs.github.com/rest/reference/activity#get-a-repository-subscription). Note that subscriptions are only generated if a user is participating in a conversation--for example, they've replied to the thread, were **@mentioned**, or manually subscribe to a thread. + * @description For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. Team members will include the members of child teams. * - * @tags activity - * @name ActivityGetThreadSubscriptionForAuthenticatedUser - * @summary Get a thread subscription for the authenticated user - * @request GET:/notifications/threads/{thread_id}/subscription + * @tags repos + * @name ReposCheckCollaborator + * @summary Check if a user is a repository collaborator + * @request GET:/repos/{owner}/{repo}/collaborators/{username} */ - activityGetThreadSubscriptionForAuthenticatedUser: (threadId: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${threadId}/subscription`, + reposCheckCollaborator: (owner: string, repo: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/collaborators/\${username}\`, method: "GET", - format: "json", ...params, }), /** - * @description If you are watching a repository, you receive notifications for all threads by default. Use this endpoint to ignore future notifications for threads until you comment on the thread or get an **@mention**. You can also use this endpoint to subscribe to threads that you are currently not receiving notifications for or to subscribed to threads that you have previously ignored. Unsubscribing from a conversation in a repository that you are not watching is functionally equivalent to the [Delete a thread subscription](https://docs.github.com/rest/reference/activity#delete-a-thread-subscription) endpoint. + * @description This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. For more information the permission levels, see "[Repository permission levels for an organization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)". Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." The invitee will receive a notification that they have been invited to the repository, which they must accept or decline. They may do this via the notifications page, the email they receive, or by using the [repository invitations API endpoints](https://docs.github.com/rest/reference/repos#invitations). **Rate limits** To prevent abuse, you are limited to sending 50 invitations to a repository per 24 hour period. Note there is no limit if you are inviting organization members to an organization repository. * - * @tags activity - * @name ActivitySetThreadSubscription - * @summary Set a thread subscription - * @request PUT:/notifications/threads/{thread_id}/subscription + * @tags repos + * @name ReposAddCollaborator + * @summary Add a repository collaborator + * @request PUT:/repos/{owner}/{repo}/collaborators/{username} */ - activitySetThreadSubscription: ( - threadId: number, + reposAddCollaborator: ( + owner: string, + repo: string, + username: string, data: { /** - * Whether to block all notifications from a thread. - * @default false + * The permission to grant the collaborator. **Only valid on organization-owned repositories.** Can be one of: + * \\* \`pull\` - can pull, but not push to or administer this repository. + * \\* \`push\` - can pull and push, but not administer this repository. + * \\* \`admin\` - can pull, push and administer this repository. + * \\* \`maintain\` - Recommended for project managers who need to manage the repository without access to sensitive or destructive actions. + * \\* \`triage\` - Recommended for contributors who need to proactively manage issues and pull requests without write access. + * @default "push" */ - ignored?: boolean; + permission?: "pull" | "push" | "admin" | "maintain" | "triage"; + /** @example ""push"" */ + permissions?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/notifications/threads/${threadId}/subscription`, + this.request({ + path: \`/repos/\${owner}/\${repo}/collaborators/\${username}\`, method: "PUT", body: data, type: ContentType.Json, @@ -11751,394 +25812,483 @@ export class Api extends HttpClient - this.request({ - path: `/notifications/threads/${threadId}/subscription`, + reposRemoveCollaborator: (owner: string, repo: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/collaborators/\${username}\`, method: "DELETE", ...params, }), - }; - octocat = { + /** - * @description Get the octocat as ASCII art + * @description Checks the repository permission of a collaborator. The possible repository permissions are \`admin\`, \`write\`, \`read\`, and \`none\`. * - * @tags meta - * @name MetaGetOctocat - * @summary Get Octocat - * @request GET:/octocat + * @tags repos + * @name ReposGetCollaboratorPermissionLevel + * @summary Get repository permissions for a user + * @request GET:/repos/{owner}/{repo}/collaborators/{username}/permission */ - metaGetOctocat: ( - query?: { - /** The words to show in Octocat's speech bubble */ - s?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/octocat`, + reposGetCollaboratorPermissionLevel: (owner: string, repo: string, username: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/collaborators/\${username}/permission\`, method: "GET", - query: query, + format: "json", ...params, }), - }; - organizations = { + /** - * @description Lists all organizations, in the order that they were created on GitHub. **Note:** Pagination is powered exclusively by the `since` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of organizations. + * @description Commit Comments use [these custom media types](https://docs.github.com/rest/reference/repos#custom-media-types). You can read more about the use of media types in the API [here](https://docs.github.com/rest/overview/media-types/). Comments are ordered by ascending ID. * - * @tags orgs - * @name OrgsList - * @summary List organizations - * @request GET:/organizations + * @tags repos + * @name ReposListCommitCommentsForRepo + * @summary List commit comments for a repository + * @request GET:/repos/{owner}/{repo}/comments */ - orgsList: ( + reposListCommitCommentsForRepo: ( + owner: string, + repo: string, query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; /** * Results per page (max 100) * @default 30 */ per_page?: number; - /** An organization ID. Only return organizations with an ID greater than this ID. */ - since?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/organizations`, + this.request({ + path: \`/repos/\${owner}/\${repo}/comments\`, method: "GET", query: query, format: "json", ...params, }), - }; - orgs = { + /** - * @description To see many of the organization response values, you need to be an authenticated organization owner with the `admin:org` scope. When the value of `two_factor_requirement_enabled` is `true`, the organization requires all members, billing managers, and outside collaborators to enable [two-factor authentication](https://help.github.com/articles/securing-your-account-with-two-factor-authentication-2fa/). GitHub Apps with the `Organization plan` permission can use this endpoint to retrieve information about an organization's GitHub plan. See "[Authenticating with GitHub Apps](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/)" for details. For an example response, see 'Response with GitHub plan information' below." + * No description * - * @tags orgs - * @name OrgsGet - * @summary Get an organization - * @request GET:/orgs/{org} + * @tags repos + * @name ReposGetCommitComment + * @summary Get a commit comment + * @request GET:/repos/{owner}/{repo}/comments/{comment_id} */ - orgsGet: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}`, + reposGetCommitComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "GET", format: "json", ...params, }), /** - * @description **Parameter Deprecation Notice:** GitHub will replace and discontinue `members_allowed_repository_creation_type` in favor of more granular permissions. The new input parameters are `members_can_create_public_repositories`, `members_can_create_private_repositories` for all organizations and `members_can_create_internal_repositories` for organizations associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. For more information, see the [blog post](https://developer.github.com/changes/2019-12-03-internal-visibility-changes). Enables an authenticated organization owner with the `admin:org` scope to update the organization's profile and member privileges. + * No description * - * @tags orgs - * @name OrgsUpdate - * @summary Update an organization - * @request PATCH:/orgs/{org} + * @tags repos + * @name ReposUpdateCommitComment + * @summary Update a commit comment + * @request PATCH:/repos/{owner}/{repo}/comments/{comment_id} */ - orgsUpdate: ( - org: string, + reposUpdateCommitComment: ( + owner: string, + repo: string, + commentId: number, data: { - /** Billing email address. This address is not publicized. */ - billing_email?: string; - /** @example ""http://github.blog"" */ - blog?: string; - /** The company name. */ - company?: string; - /** - * Default permission level members have for organization repositories: - * \* `read` - can pull, but not push to or administer this repository. - * \* `write` - can pull and push, but not administer this repository. - * \* `admin` - can pull, push, and administer this repository. - * \* `none` - no permissions granted by default. - * @default "read" - */ - default_repository_permission?: "read" | "write" | "admin" | "none"; - /** The description of the company. */ - description?: string; - /** The publicly visible email address. */ - email?: string; - /** Toggles whether an organization can use organization projects. */ - has_organization_projects?: boolean; - /** Toggles whether repositories that belong to the organization can use repository projects. */ - has_repository_projects?: boolean; - /** The location. */ - location?: string; - /** - * Specifies which types of repositories non-admin organization members can create. Can be one of: - * \* `all` - all organization members can create public and private repositories. - * \* `private` - members can create private repositories. This option is only available to repositories that are part of an organization on GitHub Enterprise Cloud. - * \* `none` - only admin members can create repositories. - * **Note:** This parameter is deprecated and will be removed in the future. Its return value ignores internal repositories. Using this parameter overrides values set in `members_can_create_repositories`. See the parameter deprecation notice in the operation description for details. - */ - members_allowed_repository_creation_type?: "all" | "private" | "none"; - /** - * Toggles whether organization members can create internal repositories, which are visible to all enterprise members. You can only allow members to create internal repositories if your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+. Can be one of: - * \* `true` - all organization members can create internal repositories. - * \* `false` - only organization owners can create internal repositories. - * Default: `true`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation. - */ - members_can_create_internal_repositories?: boolean; - /** - * Toggles whether organization members can create GitHub Pages sites. Can be one of: - * \* `true` - all organization members can create GitHub Pages sites. - * \* `false` - no organization members can create GitHub Pages sites. Existing published sites will not be impacted. - * @default true - */ - members_can_create_pages?: boolean; - /** - * Toggles whether organization members can create private GitHub Pages sites. Can be one of: - * \* `true` - all organization members can create private GitHub Pages sites. - * \* `false` - no organization members can create private GitHub Pages sites. Existing published sites will not be impacted. - * @default true - */ - members_can_create_private_pages?: boolean; - /** - * Toggles whether organization members can create private repositories, which are visible to organization members with permission. Can be one of: - * \* `true` - all organization members can create private repositories. - * \* `false` - only organization owners can create private repositories. - * Default: `true`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation. - */ - members_can_create_private_repositories?: boolean; - /** - * Toggles whether organization members can create public GitHub Pages sites. Can be one of: - * \* `true` - all organization members can create public GitHub Pages sites. - * \* `false` - no organization members can create public GitHub Pages sites. Existing published sites will not be impacted. - * @default true - */ - members_can_create_public_pages?: boolean; + /** The contents of the comment */ + body: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposDeleteCommitComment + * @summary Delete a commit comment + * @request DELETE:/repos/{owner}/{repo}/comments/{comment_id} + */ + reposDeleteCommitComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, + method: "DELETE", + ...params, + }), + + /** + * @description List the reactions to a [commit comment](https://docs.github.com/rest/reference/repos#comments). + * + * @tags reactions + * @name ReactionsListForCommitComment + * @summary List reactions for a commit comment + * @request GET:/repos/{owner}/{repo}/comments/{comment_id}/reactions + */ + reactionsListForCommitComment: ( + owner: string, + repo: string, + commentId: number, + query?: { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a commit comment. */ + content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; /** - * Toggles whether organization members can create public repositories, which are visible to anyone. Can be one of: - * \* `true` - all organization members can create public repositories. - * \* `false` - only organization owners can create public repositories. - * Default: `true`. For more information, see "[Restricting repository creation in your organization](https://help.github.com/github/setting-up-and-managing-organizations-and-teams/restricting-repository-creation-in-your-organization)" in the GitHub Help documentation. + * Page number of the results to fetch. + * @default 1 */ - members_can_create_public_repositories?: boolean; + page?: number; /** - * Toggles the ability of non-admin organization members to create repositories. Can be one of: - * \* `true` - all organization members can create repositories. - * \* `false` - only organization owners can create repositories. - * Default: `true` - * **Note:** A parameter can override this parameter. See `members_allowed_repository_creation_type` in this table for details. **Note:** A parameter can override this parameter. See `members_allowed_repository_creation_type` in this table for details. - * @default true + * Results per page (max 100) + * @default 30 */ - members_can_create_repositories?: boolean; - /** The shorthand name of the company. */ - name?: string; - /** The Twitter username of the company. */ - twitter_username?: string; + per_page?: number; }, params: RequestParams = {}, ) => this.request< - OrganizationFull, + Reaction[], | BasicError | { documentation_url: string; message: string; } - | (ValidationError | ValidationErrorSimple) >({ - path: `/orgs/${org}`, - method: "PATCH", - body: data, - type: ContentType.Json, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}/reactions\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description Gets the GitHub Actions permissions policy for repositories and allowed actions in an organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API. + * @description Create a reaction to a [commit comment](https://docs.github.com/rest/reference/repos#comments). A response with a \`Status: 200 OK\` means that you already added the reaction type to this commit comment. * - * @tags actions - * @name ActionsGetGithubActionsPermissionsOrganization - * @summary Get GitHub Actions permissions for an organization - * @request GET:/orgs/{org}/actions/permissions + * @tags reactions + * @name ReactionsCreateForCommitComment + * @summary Create reaction for a commit comment + * @request POST:/repos/{owner}/{repo}/comments/{comment_id}/reactions */ - actionsGetGithubActionsPermissionsOrganization: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/permissions`, - method: "GET", + reactionsCreateForCommitComment: ( + owner: string, + repo: string, + commentId: number, + data: { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the commit comment. */ + content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + }, + params: RequestParams = {}, + ) => + this.request< + Reaction, + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Sets the GitHub Actions permissions policy for repositories and allowed actions in an organization. If the organization belongs to an enterprise that has set restrictive permissions at the enterprise level, such as `allowed_actions` to `selected` actions, then you cannot override them for the organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API. + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE /repositories/:repository_id/comments/:comment_id/reactions/:reaction_id\`. Delete a reaction to a [commit comment](https://docs.github.com/rest/reference/repos#comments). * - * @tags actions - * @name ActionsSetGithubActionsPermissionsOrganization - * @summary Set GitHub Actions permissions for an organization - * @request PUT:/orgs/{org}/actions/permissions + * @tags reactions + * @name ReactionsDeleteForCommitComment + * @summary Delete a commit comment reaction + * @request DELETE:/repos/{owner}/{repo}/comments/{comment_id}/reactions/{reaction_id} */ - actionsSetGithubActionsPermissionsOrganization: ( - org: string, - data: { - /** The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. */ - allowed_actions?: AllowedActions; - /** The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`. */ - enabled_repositories: EnabledRepositories; - }, + reactionsDeleteForCommitComment: ( + owner: string, + repo: string, + commentId: number, + reactionId: number, params: RequestParams = {}, ) => this.request({ - path: `/orgs/${org}/actions/permissions`, - method: "PUT", - body: data, - type: ContentType.Json, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}/reactions/\${reactionId}\`, + method: "DELETE", ...params, }), /** - * @description Lists the selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API. + * @description **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | * - * @tags actions - * @name ActionsListSelectedRepositoriesEnabledGithubActionsOrganization - * @summary List selected repositories enabled for GitHub Actions in an organization - * @request GET:/orgs/{org}/actions/permissions/repositories + * @tags repos + * @name ReposListCommits + * @summary List commits + * @request GET:/repos/{owner}/{repo}/commits */ - actionsListSelectedRepositoriesEnabledGithubActionsOrganization: ( - org: string, + reposListCommits: ( + owner: string, + repo: string, query?: { + /** GitHub login or email address by which to filter by commit author. */ + author?: string; /** * Page number of the results to fetch. * @default 1 */ page?: number; + /** Only commits containing this file path will be returned. */ + path?: string; /** * Results per page (max 100) * @default 30 */ per_page?: number; + /** SHA or branch to start listing commits from. Default: the repository’s default branch (usually \`master\`). */ + sha?: string; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** Only commits before this date will be returned. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + until?: string; }, params: RequestParams = {}, ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/commits\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Returns all branches where the given commit SHA is the HEAD, or latest commit for the branch. + * + * @tags repos + * @name ReposListBranchesForHeadCommit + * @summary List branches for HEAD commit + * @request GET:/repos/{owner}/{repo}/commits/{commit_sha}/branches-where-head + */ + reposListBranchesForHeadCommit: (owner: string, repo: string, commitSha: string, params: RequestParams = {}) => this.request< - { - repositories: Repository[]; - total_count: number; - }, - any + BranchShort[], + | { + documentation_url: string; + message: string; + } + | ValidationError >({ - path: `/orgs/${org}/actions/permissions/repositories`, + path: \`/repos/\${owner}/\${repo}/commits/\${commitSha}/branches-where-head\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description Replaces the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API. + * @description Use the \`:commit_sha\` to specify the commit that will have its comments listed. * - * @tags actions - * @name ActionsSetSelectedRepositoriesEnabledGithubActionsOrganization - * @summary Set selected repositories enabled for GitHub Actions in an organization - * @request PUT:/orgs/{org}/actions/permissions/repositories + * @tags repos + * @name ReposListCommentsForCommit + * @summary List commit comments + * @request GET:/repos/{owner}/{repo}/commits/{commit_sha}/comments */ - actionsSetSelectedRepositoriesEnabledGithubActionsOrganization: ( - org: string, - data: { - /** List of repository IDs to enable for GitHub Actions. */ - selected_repository_ids: number[]; + reposListCommentsForCommit: ( + owner: string, + repo: string, + commitSha: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/actions/permissions/repositories`, - method: "PUT", - body: data, - type: ContentType.Json, + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${commitSha}/comments\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description Adds a repository to the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API. + * @description Create a comment for a commit using its \`:commit_sha\`. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. * - * @tags actions - * @name ActionsEnableSelectedRepositoryGithubActionsOrganization - * @summary Enable a selected repository for GitHub Actions in an organization - * @request PUT:/orgs/{org}/actions/permissions/repositories/{repository_id} + * @tags repos + * @name ReposCreateCommitComment + * @summary Create a commit comment + * @request POST:/repos/{owner}/{repo}/commits/{commit_sha}/comments */ - actionsEnableSelectedRepositoryGithubActionsOrganization: ( - org: string, - repositoryId: number, + reposCreateCommitComment: ( + owner: string, + repo: string, + commitSha: string, + data: { + /** The contents of the comment. */ + body: string; + /** **Deprecated**. Use **position** parameter instead. Line number in the file to comment on. */ + line?: number; + /** Relative path of the file to comment on. */ + path?: string; + /** Line index in the diff to comment on. */ + position?: number; + }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/actions/permissions/repositories/${repositoryId}`, - method: "PUT", + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${commitSha}/comments\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description Removes a repository from the list of selected repositories that are enabled for GitHub Actions in an organization. To use this endpoint, the organization permission policy for `enabled_repositories` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API. + * @description Lists all pull requests containing the provided commit SHA, which can be from any point in the commit history. The results will include open and closed pull requests. Additional preview headers may be required to see certain details for associated pull requests, such as whether a pull request is in a draft state. For more information about previews that might affect this endpoint, see the [List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests) endpoint. * - * @tags actions - * @name ActionsDisableSelectedRepositoryGithubActionsOrganization - * @summary Disable a selected repository for GitHub Actions in an organization - * @request DELETE:/orgs/{org}/actions/permissions/repositories/{repository_id} + * @tags repos + * @name ReposListPullRequestsAssociatedWithCommit + * @summary List pull requests associated with a commit + * @request GET:/repos/{owner}/{repo}/commits/{commit_sha}/pulls */ - actionsDisableSelectedRepositoryGithubActionsOrganization: ( - org: string, - repositoryId: number, + reposListPullRequestsAssociatedWithCommit: ( + owner: string, + repo: string, + commitSha: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/actions/permissions/repositories/${repositoryId}`, - method: "DELETE", + this.request< + PullRequestSimple[], + { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/commits/\${commitSha}/pulls\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description Gets the selected actions that are allowed in an organization. To use this endpoint, the organization permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)."" You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API. + * @description Returns the contents of a single commit reference. You must have \`read\` access for the repository to use this endpoint. **Note:** If there are more than 300 files in the commit diff, the response will include pagination link headers for the remaining files, up to a limit of 3000 files. Each page contains the static commit information, and the only changes are to the file listing. You can pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch \`diff\` and \`patch\` formats. Diffs with binary data will have no \`patch\` property. To return only the SHA-1 hash of the commit reference, you can provide the \`sha\` custom [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) in the \`Accept\` header. You can use this endpoint to check if a remote reference's SHA-1 hash is the same as your local reference's SHA-1 hash by providing the local SHA-1 reference as the ETag. **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | * - * @tags actions - * @name ActionsGetAllowedActionsOrganization - * @summary Get allowed actions for an organization - * @request GET:/orgs/{org}/actions/permissions/selected-actions + * @tags repos + * @name ReposGetCommit + * @summary Get a commit + * @request GET:/repos/{owner}/{repo}/commits/{ref} */ - actionsGetAllowedActionsOrganization: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/permissions/selected-actions`, + reposGetCommit: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${ref}\`, method: "GET", format: "json", ...params, }), /** - * @description Sets the actions that are allowed in an organization. To use this endpoint, the organization permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for an organization](#set-github-actions-permissions-for-an-organization)." If the organization belongs to an enterprise that has `selected` actions set at the enterprise level, then you cannot override any of the enterprise's allowed actions settings. To use the `patterns_allowed` setting for private repositories, the organization must belong to an enterprise. If the organization does not belong to an enterprise, then the `patterns_allowed` setting only applies to public repositories in the organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `administration` organization permission to use this API. + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array. Lists check runs for a commit ref. The \`ref\` can be a SHA, branch name, or a tag name. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the \`repo\` scope to get check runs in a private repository. * - * @tags actions - * @name ActionsSetAllowedActionsOrganization - * @summary Set allowed actions for an organization - * @request PUT:/orgs/{org}/actions/permissions/selected-actions + * @tags checks + * @name ChecksListForRef + * @summary List check runs for a Git reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/check-runs */ - actionsSetAllowedActionsOrganization: (org: string, data: SelectedActions, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/permissions/selected-actions`, - method: "PUT", - body: data, - type: ContentType.Json, + checksListForRef: ( + owner: string, + repo: string, + ref: string, + query?: { + /** Returns check runs with the specified \`name\`. */ + check_name?: string; + /** + * Filters check runs by their \`completed_at\` timestamp. Can be one of \`latest\` (returning the most recent check runs) or \`all\`. + * @default "latest" + */ + filter?: "latest" | "all"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Returns check runs with the specified \`status\`. Can be one of \`queued\`, \`in_progress\`, or \`completed\`. */ + status?: "queued" | "in_progress" | "completed"; + }, + params: RequestParams = {}, + ) => + this.request< + { + check_runs: CheckRun[]; + total_count: number; + }, + any + >({ + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/check-runs\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists all self-hosted runner groups configured in an organization and inherited from an enterprise. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty \`pull_requests\` array and a \`null\` value for \`head_branch\`. Lists check suites for a commit \`ref\`. The \`ref\` can be a SHA, branch name, or a tag name. GitHub Apps must have the \`checks:read\` permission on a private repository or pull access to a public repository to list check suites. OAuth Apps and authenticated users must have the \`repo\` scope to get check suites in a private repository. * - * @tags actions - * @name ActionsListSelfHostedRunnerGroupsForOrg - * @summary List self-hosted runner groups for an organization - * @request GET:/orgs/{org}/actions/runner-groups + * @tags checks + * @name ChecksListSuitesForRef + * @summary List check suites for a Git reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/check-suites */ - actionsListSelfHostedRunnerGroupsForOrg: ( - org: string, + checksListSuitesForRef: ( + owner: string, + repo: string, + ref: string, query?: { + /** + * Filters check suites by GitHub App \`id\`. + * @example 1 + */ + app_id?: number; + /** Returns check runs with the specified \`name\`. */ + check_name?: string; /** * Page number of the results to fetch. * @default 1 @@ -12154,12 +26304,12 @@ export class Api extends HttpClient this.request< { - runner_groups: RunnerGroupsOrg[]; + check_suites: CheckSuite[]; total_count: number; }, any >({ - path: `/orgs/${org}/actions/runner-groups`, + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/check-suites\`, method: "GET", query: query, format: "json", @@ -12167,201 +26317,286 @@ export class Api extends HttpClient + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/status\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Users with pull access in a repository can view commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name. Statuses are returned in reverse chronological order. The first status in the list will be the latest one. This resource is also available via a legacy route: \`GET /repos/:owner/:repo/statuses/:ref\`. + * + * @tags repos + * @name ReposListCommitStatusesForRef + * @summary List commit statuses for a reference + * @request GET:/repos/{owner}/{repo}/commits/{ref}/statuses + */ + reposListCommitStatusesForRef: ( + owner: string, + repo: string, + ref: string, + query?: { /** - * Visibility of a runner group. You can select all repositories, select individual repositories, or limit access to private repositories. Can be one of: `all`, `selected`, or `private`. - * @default "all" + * Page number of the results to fetch. + * @default 1 */ - visibility?: "selected" | "all" | "private"; + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/actions/runner-groups`, - method: "POST", - body: data, - type: ContentType.Json, + this.request({ + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/statuses\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Gets a specific self-hosted runner group for an organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description Returns the contents of the repository's code of conduct file, if one is detected. A code of conduct is detected if there is a file named \`CODE_OF_CONDUCT\` in the root directory of the repository. GitHub detects which code of conduct it is using fuzzy matching. * - * @tags actions - * @name ActionsGetSelfHostedRunnerGroupForOrg - * @summary Get a self-hosted runner group for an organization - * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id} + * @tags codes-of-conduct + * @name CodesOfConductGetForRepo + * @summary Get the code of conduct for a repository + * @request GET:/repos/{owner}/{repo}/community/code_of_conduct */ - actionsGetSelfHostedRunnerGroupForOrg: (org: string, runnerGroupId: number, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}`, + codesOfConductGetForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/community/code_of_conduct\`, method: "GET", format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Updates the `name` and `visibility` of a self-hosted runner group in an organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description This endpoint will return all community profile metrics, including an overall health score, repository description, the presence of documentation, detected code of conduct, detected license, and the presence of ISSUE\\_TEMPLATE, PULL\\_REQUEST\\_TEMPLATE, README, and CONTRIBUTING files. The \`health_percentage\` score is defined as a percentage of how many of these four documents are present: README, CONTRIBUTING, LICENSE, and CODE_OF_CONDUCT. For example, if all four documents are present, then the \`health_percentage\` is \`100\`. If only one is present, then the \`health_percentage\` is \`25\`. \`content_reports_enabled\` is only returned for organization-owned repositories. * - * @tags actions - * @name ActionsUpdateSelfHostedRunnerGroupForOrg - * @summary Update a self-hosted runner group for an organization - * @request PATCH:/orgs/{org}/actions/runner-groups/{runner_group_id} + * @tags repos + * @name ReposGetCommunityProfileMetrics + * @summary Get community profile metrics + * @request GET:/repos/{owner}/{repo}/community/profile */ - actionsUpdateSelfHostedRunnerGroupForOrg: ( - org: string, - runnerGroupId: number, - data: { - /** Name of the runner group. */ - name?: string; - /** Visibility of a runner group. You can select all repositories, select individual repositories, or all private repositories. Can be one of: `all`, `selected`, or `private`. */ - visibility?: "selected" | "all" | "private"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}`, - method: "PATCH", - body: data, - type: ContentType.Json, + reposGetCommunityProfileMetrics: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/community/profile\`, + method: "GET", format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Deletes a self-hosted runner group for an organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description Both \`:base\` and \`:head\` must be branch names in \`:repo\`. To compare branches across other repositories in the same network as \`:repo\`, use the format \`:branch\`. The response from the API is equivalent to running the \`git log base..head\` command; however, commits are returned in chronological order. Pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats. The response also includes details on the files that were changed between the two commits. This includes the status of the change (for example, if a file was added, removed, modified, or renamed), and details of the change itself. For example, files with a \`renamed\` status have a \`previous_filename\` field showing the previous filename of the file, and files with a \`modified\` status have a \`patch\` field showing the changes made to the file. **Working with large comparisons** The response will include a comparison of up to 250 commits. If you are working with a larger commit range, you can use the [List commits](https://docs.github.com/rest/reference/repos#list-commits) to enumerate all commits in the range. For comparisons with extremely large diffs, you may receive an error response indicating that the diff took too long to generate. You can typically resolve this error by using a smaller commit range. **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | * - * @tags actions - * @name ActionsDeleteSelfHostedRunnerGroupFromOrg - * @summary Delete a self-hosted runner group from an organization - * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id} + * @tags repos + * @name ReposCompareCommits + * @summary Compare two commits + * @request GET:/repos/{owner}/{repo}/compare/{base}...{head} */ - actionsDeleteSelfHostedRunnerGroupFromOrg: (org: string, runnerGroupId: number, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}`, - method: "DELETE", + reposCompareCommits: (owner: string, repo: string, base: string, head: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/compare/\${base}...\${head}\`, + method: "GET", + format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud and GitHub Enterprise Server. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists the repositories with access to a self-hosted runner group configured in an organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description Gets the contents of a file or directory in a repository. Specify the file path or directory in \`:path\`. If you omit \`:path\`, you will receive the contents of the repository's root directory. See the description below regarding what the API response includes for directories. Files and symlinks support [a custom media type](https://docs.github.com/rest/reference/repos#custom-media-types) for retrieving the raw content or rendered HTML (when supported). All content types support [a custom media type](https://docs.github.com/rest/reference/repos#custom-media-types) to ensure the content is returned in a consistent object format. **Note**: * To get a repository's contents recursively, you can [recursively get the tree](https://docs.github.com/rest/reference/git#trees). * This API has an upper limit of 1,000 files for a directory. If you need to retrieve more files, use the [Git Trees API](https://docs.github.com/rest/reference/git#get-a-tree). * This API supports files up to 1 megabyte in size. #### If the content is a directory The response will be an array of objects, one object for each item in the directory. When listing the contents of a directory, submodules have their "type" specified as "file". Logically, the value _should_ be "submodule". This behavior exists in API v3 [for backwards compatibility purposes](https://git.io/v1YCW). In the next major version of the API, the type will be returned as "submodule". #### If the content is a symlink If the requested \`:path\` points to a symlink, and the symlink's target is a normal file in the repository, then the API responds with the content of the file (in the format shown in the example. Otherwise, the API responds with an object describing the symlink itself. #### If the content is a submodule The \`submodule_git_url\` identifies the location of the submodule repository, and the \`sha\` identifies a specific commit within the submodule repository. Git uses the given URL when cloning the submodule repository, and checks out the submodule at that specific commit. If the submodule repository is not hosted on github.com, the Git URLs (\`git_url\` and \`_links["git"]\`) and the github.com URLs (\`html_url\` and \`_links["html"]\`) will have null values. * - * @tags actions - * @name ActionsListRepoAccessToSelfHostedRunnerGroupInOrg - * @summary List repository access to a self-hosted runner group in an organization - * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories + * @tags repos + * @name ReposGetContent + * @summary Get repository content + * @request GET:/repos/{owner}/{repo}/contents/{path} */ - actionsListRepoAccessToSelfHostedRunnerGroupInOrg: ( - org: string, - runnerGroupId: number, + reposGetContent: ( + owner: string, + repo: string, + path: string, + query?: { + /** The name of the commit/branch/tag. Default: the repository’s default branch (usually \`master\`) */ + ref?: string; + }, params: RequestParams = {}, ) => - this.request< - { - repositories: Repository[]; - total_count: number; - }, - any - >({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}/repositories`, + this.request({ + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Replaces the list of repositories that have access to a self-hosted runner group configured in an organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description Creates a new file or replaces an existing file in a repository. * - * @tags actions - * @name ActionsSetRepoAccessToSelfHostedRunnerGroupInOrg - * @summary Set repository access for a self-hosted runner group in an organization - * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories + * @tags repos + * @name ReposCreateOrUpdateFileContents + * @summary Create or update file contents + * @request PUT:/repos/{owner}/{repo}/contents/{path} */ - actionsSetRepoAccessToSelfHostedRunnerGroupInOrg: ( - org: string, - runnerGroupId: number, + reposCreateOrUpdateFileContents: ( + owner: string, + repo: string, + path: string, data: { - /** List of repository IDs that can access the runner group. */ - selected_repository_ids: number[]; + /** The author of the file. Default: The \`committer\` or the authenticated user if you omit \`committer\`. */ + author?: { + /** @example ""2013-01-15T17:13:22+05:00"" */ + date?: string; + /** The email of the author or committer of the commit. You'll receive a \`422\` status code if \`email\` is omitted. */ + email: string; + /** The name of the author or committer of the commit. You'll receive a \`422\` status code if \`name\` is omitted. */ + name: string; + }; + /** The branch name. Default: the repository’s default branch (usually \`master\`) */ + branch?: string; + /** The person that committed the file. Default: the authenticated user. */ + committer?: { + /** @example ""2013-01-05T13:13:22+05:00"" */ + date?: string; + /** The email of the author or committer of the commit. You'll receive a \`422\` status code if \`email\` is omitted. */ + email: string; + /** The name of the author or committer of the commit. You'll receive a \`422\` status code if \`name\` is omitted. */ + name: string; + }; + /** The new file content, using Base64 encoding. */ + content: string; + /** The commit message. */ + message: string; + /** **Required if you are updating a file**. The blob SHA of the file being replaced. */ + sha?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}/repositories`, + this.request({ + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "PUT", body: data, type: ContentType.Json, + format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Adds a repository to the list of selected repositories that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)." You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description Deletes a file in a repository. You can provide an additional \`committer\` parameter, which is an object containing information about the committer. Or, you can provide an \`author\` parameter, which is an object containing information about the author. The \`author\` section is optional and is filled in with the \`committer\` information if omitted. If the \`committer\` information is omitted, the authenticated user's information is used. You must provide values for both \`name\` and \`email\`, whether you choose to use \`author\` or \`committer\`. Otherwise, you'll receive a \`422\` status code. * - * @tags actions - * @name ActionsAddRepoAccessToSelfHostedRunnerGroupInOrg - * @summary Add repository access to a self-hosted runner group in an organization - * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} + * @tags repos + * @name ReposDeleteFile + * @summary Delete a file + * @request DELETE:/repos/{owner}/{repo}/contents/{path} */ - actionsAddRepoAccessToSelfHostedRunnerGroupInOrg: ( - org: string, - runnerGroupId: number, - repositoryId: number, + reposDeleteFile: ( + owner: string, + repo: string, + path: string, + data: { + /** object containing information about the author. */ + author?: { + /** The email of the author (or committer) of the commit */ + email?: string; + /** The name of the author (or committer) of the commit */ + name?: string; + }; + /** The branch name. Default: the repository’s default branch (usually \`master\`) */ + branch?: string; + /** object containing information about the committer. */ + committer?: { + /** The email of the author (or committer) of the commit */ + email?: string; + /** The name of the author (or committer) of the commit */ + name?: string; + }; + /** The commit message. */ + message: string; + /** The blob SHA of the file being replaced. */ + sha: string; + }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}/repositories/${repositoryId}`, - method: "PUT", + this.request< + FileCommit, + | BasicError + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, + method: "DELETE", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Removes a repository from the list of selected repositories that can access a self-hosted runner group. The runner group must have `visibility` set to `selected`. For more information, see "[Create a self-hosted runner group for an organization](#create-a-self-hosted-runner-group-for-an-organization)." You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description Lists contributors to the specified repository and sorts them by the number of commits per contributor in descending order. This endpoint may return information that is a few hours old because the GitHub REST API v3 caches contributor data to improve performance. GitHub identifies contributors by author email address. This endpoint groups contribution counts by GitHub user, which includes all associated email addresses. To improve performance, only the first 500 author email addresses in the repository link to GitHub users. The rest will appear as anonymous contributors without associated GitHub user information. * - * @tags actions - * @name ActionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg - * @summary Remove repository access to a self-hosted runner group in an organization - * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id}/repositories/{repository_id} + * @tags repos + * @name ReposListContributors + * @summary List repository contributors + * @request GET:/repos/{owner}/{repo}/contributors */ - actionsRemoveRepoAccessToSelfHostedRunnerGroupInOrg: ( - org: string, - runnerGroupId: number, - repositoryId: number, + reposListContributors: ( + owner: string, + repo: string, + query?: { + /** Set to \`1\` or \`true\` to include anonymous contributors in results. */ + anon?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}/repositories/${repositoryId}`, - method: "DELETE", + this.request({ + path: \`/repos/\${owner}/\${repo}/contributors\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Lists self-hosted runners that are in a specific organization group. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description Simple filtering of deployments is available via query parameters: * - * @tags actions - * @name ActionsListSelfHostedRunnersInGroupForOrg - * @summary List self-hosted runners in a group for an organization - * @request GET:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners + * @tags repos + * @name ReposListDeployments + * @summary List deployments + * @request GET:/repos/{owner}/{repo}/deployments */ - actionsListSelfHostedRunnersInGroupForOrg: ( - org: string, - runnerGroupId: number, + reposListDeployments: ( + owner: string, + repo: string, query?: { + /** + * The name of the environment that was deployed to (e.g., \`staging\` or \`production\`). + * @default "none" + */ + environment?: string; /** * Page number of the results to fetch. * @default 1 @@ -12372,17 +26607,26 @@ export class Api extends HttpClient - this.request< - { - runners: Runner[]; - total_count: number; - }, - any - >({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}/runners`, + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "GET", query: query, format: "json", @@ -12390,80 +26634,119 @@ export class Api extends HttpClient | string; + /** + * 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; + /** 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; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}/runners`, - method: "PUT", + this.request< + Deployment, + | { + /** @example ""https://docs.github.com/rest/reference/repos#create-a-deployment"" */ + documentation_url?: string; + message?: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/deployments\`, + method: "POST", body: data, type: ContentType.Json, + format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Adds a self-hosted runner to a runner group configured in an organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * No description * - * @tags actions - * @name ActionsAddSelfHostedRunnerToGroupForOrg - * @summary Add a self-hosted runner to a group for an organization - * @request PUT:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + * @tags repos + * @name ReposGetDeployment + * @summary Get a deployment + * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id} */ - actionsAddSelfHostedRunnerToGroupForOrg: ( - org: string, - runnerGroupId: number, - runnerId: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}/runners/${runnerId}`, - method: "PUT", + reposGetDeployment: (owner: string, repo: string, deploymentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments/\${deploymentId}\`, + method: "GET", + format: "json", ...params, }), /** - * @description The self-hosted runner groups REST API is available with GitHub Enterprise Cloud. For more information, see "[GitHub's products](https://docs.github.com/github/getting-started-with-github/githubs-products)." Removes a self-hosted runner from a group configured in an organization. The runner is then returned to the default group. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description To ensure there can always be an active deployment, you can only delete an _inactive_ deployment. Anyone with \`repo\` or \`repo_deployment\` scopes can delete an inactive deployment. To set a deployment as inactive, you must: * Create a new deployment that is active so that the system has a record of the current state, then delete the previously active deployment. * Mark the active deployment as inactive by adding any non-successful deployment status. For more information, see "[Create a deployment](https://docs.github.com/rest/reference/repos/#create-a-deployment)" and "[Create a deployment status](https://docs.github.com/rest/reference/repos#create-a-deployment-status)." * - * @tags actions - * @name ActionsRemoveSelfHostedRunnerFromGroupForOrg - * @summary Remove a self-hosted runner from a group for an organization - * @request DELETE:/orgs/{org}/actions/runner-groups/{runner_group_id}/runners/{runner_id} + * @tags repos + * @name ReposDeleteDeployment + * @summary Delete a deployment + * @request DELETE:/repos/{owner}/{repo}/deployments/{deployment_id} */ - actionsRemoveSelfHostedRunnerFromGroupForOrg: ( - org: string, - runnerGroupId: number, - runnerId: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/actions/runner-groups/${runnerGroupId}/runners/${runnerId}`, + reposDeleteDeployment: (owner: string, repo: string, deploymentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments/\${deploymentId}\`, method: "DELETE", ...params, }), /** - * @description Lists all self-hosted runners configured in an organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description Users with pull access can view deployment statuses for a deployment: * - * @tags actions - * @name ActionsListSelfHostedRunnersForOrg - * @summary List self-hosted runners for an organization - * @request GET:/orgs/{org}/actions/runners + * @tags repos + * @name ReposListDeploymentStatuses + * @summary List deployment statuses + * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses */ - actionsListSelfHostedRunnersForOrg: ( - org: string, + reposListDeploymentStatuses: ( + owner: string, + repo: string, + deploymentId: number, query?: { /** * Page number of the results to fetch. @@ -12478,14 +26761,8 @@ export class Api extends HttpClient - this.request< - { - runners: Runner[]; - total_count: number; - }, - any - >({ - path: `/orgs/${org}/actions/runners`, + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments/\${deploymentId}/statuses\`, method: "GET", query: query, format: "json", @@ -12493,94 +26770,129 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/actions/runners/downloads`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Returns a token that you can pass to the `config` script. The token expires after one hour. You must authenticate using an access token with the `admin:org` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint. ``` ./config.sh --url https://github.com/octo-org --token TOKEN ``` - * - * @tags actions - * @name ActionsCreateRegistrationTokenForOrg - * @summary Create a registration token for an organization - * @request POST:/orgs/{org}/actions/runners/registration-token - */ - actionsCreateRegistrationTokenForOrg: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/runners/registration-token`, - method: "POST", - format: "json", - ...params, - }), - - /** - * @description Returns a token that you can pass to the `config` script to remove a self-hosted runner from an organization. The token expires after one hour. You must authenticate using an access token with the `admin:org` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from an organization, replace `TOKEN` with the remove token provided by this endpoint. ``` ./config.sh remove --token TOKEN ``` + * @description Users with \`push\` access can create deployment statuses for a given deployment. GitHub Apps require \`read & write\` access to "Deployments" and \`read-only\` access to "Repo contents" (for private repos). OAuth Apps require the \`repo_deployment\` scope. * - * @tags actions - * @name ActionsCreateRemoveTokenForOrg - * @summary Create a remove token for an organization - * @request POST:/orgs/{org}/actions/runners/remove-token + * @tags repos + * @name ReposCreateDeploymentStatus + * @summary Create a deployment status + * @request POST:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses */ - actionsCreateRemoveTokenForOrg: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/runners/remove-token`, + reposCreateDeploymentStatus: ( + owner: string, + repo: string, + deploymentId: number, + data: { + /** + * Adds a new \`inactive\` status to all prior non-transient, non-production environment deployments with the same repository and \`environment\` name as the created status's deployment. An \`inactive\` status is only added to deployments that had a \`success\` state. Default: \`true\` + * **Note:** To add an \`inactive\` status to \`production\` environments, you must use the [\`application/vnd.github.flash-preview+json\`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) 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. + */ + auto_inactive?: boolean; + /** + * A short description of the status. The maximum description length is 140 characters. + * @default "" + */ + description?: string; + /** Name for the target deployment environment, which can be changed when setting a deploy status. For example, \`production\`, \`staging\`, or \`qa\`. **Note:** This parameter requires you to use the [\`application/vnd.github.flash-preview+json\`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) custom media type. */ + environment?: "production" | "staging" | "qa"; + /** + * Sets the URL for accessing your environment. Default: \`""\` + * **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 "" + */ + environment_url?: string; + /** + * The full URL of the deployment's output. This parameter replaces \`target_url\`. We will continue to accept \`target_url\` to support legacy uses, but we recommend replacing \`target_url\` with \`log_url\`. Setting \`log_url\` will automatically set \`target_url\` to the same value. Default: \`""\` + * **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 "" + */ + log_url?: string; + /** The state of the status. Can be one of \`error\`, \`failure\`, \`inactive\`, \`in_progress\`, \`queued\` \`pending\`, or \`success\`. **Note:** To use the \`inactive\` state, you must provide the [\`application/vnd.github.ant-man-preview+json\`](https://docs.github.com/rest/overview/api-previews#enhanced-deployments) custom media type. To use the \`in_progress\` and \`queued\` states, you must provide the [\`application/vnd.github.flash-preview+json\`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) custom media type. When you set a transient deployment to \`inactive\`, the deployment will be shown as \`destroyed\` in GitHub. */ + state: "error" | "failure" | "inactive" | "in_progress" | "queued" | "pending" | "success"; + /** + * The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. **Note:** It's recommended to use the \`log_url\` parameter, which replaces \`target_url\`. + * @default "" + */ + target_url?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/deployments/\${deploymentId}/statuses\`, method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Gets a specific self-hosted runner configured in an organization. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description Users with pull access can view a deployment status for a deployment: * - * @tags actions - * @name ActionsGetSelfHostedRunnerForOrg - * @summary Get a self-hosted runner for an organization - * @request GET:/orgs/{org}/actions/runners/{runner_id} - */ - actionsGetSelfHostedRunnerForOrg: (org: string, runnerId: number, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/runners/${runnerId}`, + * @tags repos + * @name ReposGetDeploymentStatus + * @summary Get a deployment status + * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses/{status_id} + */ + reposGetDeploymentStatus: ( + owner: string, + repo: string, + deploymentId: number, + statusId: number, + params: RequestParams = {}, + ) => + this.request< + DeploymentStatus, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/deployments/\${deploymentId}/statuses/\${statusId}\`, method: "GET", format: "json", ...params, }), /** - * @description Forces the removal of a self-hosted runner from an organization. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the `admin:org` scope to use this endpoint. + * @description You can use this endpoint to trigger a webhook event called \`repository_dispatch\` when you want activity that happens outside of GitHub to trigger a GitHub Actions workflow or GitHub App webhook. You must configure your GitHub Actions workflow or GitHub App to run when the \`repository_dispatch\` event occurs. For an example \`repository_dispatch\` webhook payload, see "[RepositoryDispatchEvent](https://docs.github.com/webhooks/event-payloads/#repository_dispatch)." The \`client_payload\` parameter is available for any extra information that your workflow might need. This parameter is a JSON payload that will be passed on when the webhook event is dispatched. For example, the \`client_payload\` can include a message that a user would like to send using a GitHub Actions workflow. Or the \`client_payload\` can be used as a test to debug your workflow. This endpoint requires write access to the repository by providing either: - Personal access tokens with \`repo\` scope. For more information, see "[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line)" in the GitHub Help documentation. - GitHub Apps with both \`metadata:read\` and \`contents:read&write\` permissions. This input example shows how you can use the \`client_payload\` as a test to debug your workflow. * - * @tags actions - * @name ActionsDeleteSelfHostedRunnerFromOrg - * @summary Delete a self-hosted runner from an organization - * @request DELETE:/orgs/{org}/actions/runners/{runner_id} + * @tags repos + * @name ReposCreateDispatchEvent + * @summary Create a repository dispatch event + * @request POST:/repos/{owner}/{repo}/dispatches */ - actionsDeleteSelfHostedRunnerFromOrg: (org: string, runnerId: number, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/runners/${runnerId}`, - method: "DELETE", + reposCreateDispatchEvent: ( + owner: string, + repo: string, + data: { + /** JSON payload with extra information about the webhook event that your action or worklow may use. */ + client_payload?: Record; + /** A custom webhook event name. */ + event_type: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/dispatches\`, + method: "POST", + body: data, + type: ContentType.Json, ...params, }), /** - * @description Lists all secrets available in an organization without revealing their encrypted values. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint. + * No description * - * @tags actions - * @name ActionsListOrgSecrets - * @summary List organization secrets - * @request GET:/orgs/{org}/actions/secrets + * @tags activity + * @name ActivityListRepoEvents + * @summary List repository events + * @request GET:/repos/{owner}/{repo}/events */ - actionsListOrgSecrets: ( - org: string, + activityListRepoEvents: ( + owner: string, + repo: string, query?: { /** * Page number of the results to fetch. @@ -12595,14 +26907,8 @@ export class Api extends HttpClient - this.request< - { - secrets: OrganizationActionsSecret[]; - total_count: number; - }, - any - >({ - path: `/orgs/${org}/actions/secrets`, + this.request({ + path: \`/repos/\${owner}/\${repo}/events\`, method: "GET", query: query, format: "json", @@ -12610,218 +26916,210 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/actions/secrets/public-key`, + reposListForks: ( + owner: string, + repo: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * The sort order. Can be either \`newest\`, \`oldest\`, or \`stargazers\`. + * @default "newest" + */ + sort?: "newest" | "oldest" | "stargazers"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/forks\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description Gets a single organization secret without revealing its encrypted value. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint. + * @description Create a fork for the authenticated user. **Note**: Forking a Repository happens asynchronously. You may have to wait a short period of time before you can access the git objects. If this takes longer than 5 minutes, be sure to contact [GitHub Support](https://support.github.com/contact) or [GitHub Premium Support](https://premium.githubsupport.com). * - * @tags actions - * @name ActionsGetOrgSecret - * @summary Get an organization secret - * @request GET:/orgs/{org}/actions/secrets/{secret_name} + * @tags repos + * @name ReposCreateFork + * @summary Create a fork + * @request POST:/repos/{owner}/{repo}/forks */ - actionsGetOrgSecret: (org: string, secretName: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/secrets/${secretName}`, - method: "GET", + reposCreateFork: ( + owner: string, + repo: string, + data: { + /** Optional parameter to specify the organization name if forking into an organization. */ + organization?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/forks\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Creates or updates an organization secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint. #### Example encrypting a secret using Node.js Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library. ``` const sodium = require('tweetsodium'); const key = "base64-encoded-public-key"; const value = "plain-text-secret"; // Convert the message and key to Uint8Array's (Buffer implements that interface) const messageBytes = Buffer.from(value); const keyBytes = Buffer.from(key, 'base64'); // Encrypt using LibSodium. const encryptedBytes = sodium.seal(messageBytes, keyBytes); // Base64 the encrypted secret const encrypted = Buffer.from(encryptedBytes).toString('base64'); console.log(encrypted); ``` #### Example encrypting a secret using Python Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3. ``` from base64 import b64encode from nacl import encoding, public def encrypt(public_key: str, secret_value: str) -> str: """Encrypt a Unicode string using the public key.""" public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder()) sealed_box = public.SealedBox(public_key) encrypted = sealed_box.encrypt(secret_value.encode("utf-8")) return b64encode(encrypted).decode("utf-8") ``` #### Example encrypting a secret using C# Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package. ``` var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret"); var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU="); var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey); Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox)); ``` #### Example encrypting a secret using Ruby Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem. ```ruby require "rbnacl" require "base64" key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=") public_key = RbNaCl::PublicKey.new(key) box = RbNaCl::Boxes::Sealed.from_public_key(public_key) encrypted_secret = box.encrypt("my_secret") # Print the base64 encoded secret puts Base64.strict_encode64(encrypted_secret) ``` + * No description * - * @tags actions - * @name ActionsCreateOrUpdateOrgSecret - * @summary Create or update an organization secret - * @request PUT:/orgs/{org}/actions/secrets/{secret_name} + * @tags git + * @name GitCreateBlob + * @summary Create a blob + * @request POST:/repos/{owner}/{repo}/git/blobs */ - actionsCreateOrUpdateOrgSecret: ( - org: string, - secretName: string, + gitCreateBlob: ( + owner: string, + repo: string, data: { - /** Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get an organization public key](https://docs.github.com/rest/reference/actions#get-an-organization-public-key) endpoint. */ - encrypted_value?: string; - /** ID of the key you used to encrypt the secret. */ - key_id?: string; - /** An array of repository ids that can access the organization secret. You can only provide a list of repository ids when the `visibility` is set to `selected`. You can manage the list of selected repositories using the [List selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#list-selected-repositories-for-an-organization-secret), [Set selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#set-selected-repositories-for-an-organization-secret), and [Remove selected repository from an organization secret](https://docs.github.com/rest/reference/actions#remove-selected-repository-from-an-organization-secret) endpoints. */ - selected_repository_ids?: string[]; + /** The new blob's content. */ + content: string; /** - * Configures the access that repositories have to the organization secret. Can be one of: - * \- `all` - All repositories in an organization can access the secret. - * \- `private` - Private repositories in an organization can access the secret. - * \- `selected` - Only specific repositories can access the secret. + * The encoding used for \`content\`. Currently, \`"utf-8"\` and \`"base64"\` are supported. + * @default "utf-8" */ - visibility?: "all" | "private" | "selected"; + encoding?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/actions/secrets/${secretName}`, - method: "PUT", + this.request({ + path: \`/repos/\${owner}/\${repo}/git/blobs\`, + method: "POST", body: data, type: ContentType.Json, + format: "json", ...params, }), /** - * @description Deletes a secret in an organization using the secret name. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint. - * - * @tags actions - * @name ActionsDeleteOrgSecret - * @summary Delete an organization secret - * @request DELETE:/orgs/{org}/actions/secrets/{secret_name} - */ - actionsDeleteOrgSecret: (org: string, secretName: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/actions/secrets/${secretName}`, - method: "DELETE", - ...params, - }), - - /** - * @description Lists all repositories that have been selected when the `visibility` for repository access to a secret is set to `selected`. You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint. + * @description The \`content\` in the response will always be Base64 encoded. _Note_: This API supports blobs up to 100 megabytes in size. * - * @tags actions - * @name ActionsListSelectedReposForOrgSecret - * @summary List selected repositories for an organization secret - * @request GET:/orgs/{org}/actions/secrets/{secret_name}/repositories + * @tags git + * @name GitGetBlob + * @summary Get a blob + * @request GET:/repos/{owner}/{repo}/git/blobs/{file_sha} */ - actionsListSelectedReposForOrgSecret: (org: string, secretName: string, params: RequestParams = {}) => - this.request< - { - repositories: MinimalRepository[]; - total_count: number; - }, - any - >({ - path: `/orgs/${org}/actions/secrets/${secretName}/repositories`, + gitGetBlob: (owner: string, repo: string, fileSha: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/blobs/\${fileSha}\`, method: "GET", format: "json", ...params, }), /** - * @description Replaces all repositories for an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint. + * @description Creates a new Git [commit object](https://git-scm.com/book/en/v1/Git-Internals-Git-Objects#Commit-Objects). **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | * - * @tags actions - * @name ActionsSetSelectedReposForOrgSecret - * @summary Set selected repositories for an organization secret - * @request PUT:/orgs/{org}/actions/secrets/{secret_name}/repositories + * @tags git + * @name GitCreateCommit + * @summary Create a commit + * @request POST:/repos/{owner}/{repo}/git/commits */ - actionsSetSelectedReposForOrgSecret: ( - org: string, - secretName: string, + gitCreateCommit: ( + owner: string, + repo: string, data: { - /** An array of repository ids that can access the organization secret. You can only provide a list of repository ids when the `visibility` is set to `selected`. You can add and remove individual repositories using the [Set selected repositories for an organization secret](https://docs.github.com/rest/reference/actions#set-selected-repositories-for-an-organization-secret) and [Remove selected repository from an organization secret](https://docs.github.com/rest/reference/actions#remove-selected-repository-from-an-organization-secret) endpoints. */ - selected_repository_ids?: number[]; + /** Information about the author of the commit. By default, the \`author\` will be the authenticated user and the current date. See the \`author\` and \`committer\` object below for details. */ + author?: { + /** Indicates when this commit was authored (or committed). This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + date?: string; + /** The email of the author (or committer) of the commit */ + email?: string; + /** The name of the author (or committer) of the commit */ + name?: string; + }; + /** Information about the person who is making the commit. By default, \`committer\` will use the information set in \`author\`. See the \`author\` and \`committer\` object below for details. */ + committer?: { + /** Indicates when this commit was authored (or committed). This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + date?: string; + /** The email of the author (or committer) of the commit */ + email?: string; + /** The name of the author (or committer) of the commit */ + name?: string; + }; + /** The commit message */ + message: string; + /** The SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided. */ + parents?: string[]; + /** The [PGP signature](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) of the commit. GitHub adds the signature to the \`gpgsig\` header of the created commit. For a commit signature to be verifiable by Git or GitHub, it must be an ASCII-armored detached PGP signature over the string commit as it would be written to the object database. To pass a \`signature\` parameter, you need to first manually create a valid PGP signature, which can be complicated. You may find it easier to [use the command line](https://git-scm.com/book/id/v2/Git-Tools-Signing-Your-Work) to create signed commits. */ + signature?: string; + /** The SHA of the tree object this commit points to */ + tree: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/actions/secrets/${secretName}/repositories`, - method: "PUT", + this.request({ + path: \`/repos/\${owner}/\${repo}/git/commits\`, + method: "POST", body: data, type: ContentType.Json, + format: "json", ...params, }), /** - * @description Adds a repository to an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint. - * - * @tags actions - * @name ActionsAddSelectedRepoToOrgSecret - * @summary Add selected repository to an organization secret - * @request PUT:/orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} - */ - actionsAddSelectedRepoToOrgSecret: ( - org: string, - secretName: string, - repositoryId: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/actions/secrets/${secretName}/repositories/${repositoryId}`, - method: "PUT", - ...params, - }), - - /** - * @description Removes a repository from an organization secret when the `visibility` for repository access is set to `selected`. The visibility is set when you [Create or update an organization secret](https://docs.github.com/rest/reference/actions#create-or-update-an-organization-secret). You must authenticate using an access token with the `admin:org` scope to use this endpoint. GitHub Apps must have the `secrets` organization permission to use this endpoint. + * @description Gets a Git [commit object](https://git-scm.com/book/en/v1/Git-Internals-Git-Objects#Commit-Objects). **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | * - * @tags actions - * @name ActionsRemoveSelectedRepoFromOrgSecret - * @summary Remove selected repository from an organization secret - * @request DELETE:/orgs/{org}/actions/secrets/{secret_name}/repositories/{repository_id} + * @tags git + * @name GitGetCommit + * @summary Get a commit + * @request GET:/repos/{owner}/{repo}/git/commits/{commit_sha} */ - actionsRemoveSelectedRepoFromOrgSecret: ( - org: string, - secretName: string, - repositoryId: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/actions/secrets/${secretName}/repositories/${repositoryId}`, - method: "DELETE", + gitGetCommit: (owner: string, repo: string, commitSha: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/commits/\${commitSha}\`, + method: "GET", + format: "json", ...params, }), /** - * @description **Note:** The audit log REST API is currently in beta and is subject to change. Gets the audit log for an organization. For more information, see "[Reviewing the audit log for your organization](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization)." To use this endpoint, you must be an organization owner, and you must use an access token with the `admin:org` scope. GitHub Apps must have the `organization_administration` read permission to use this endpoint. + * @description Returns an array of references from your Git database that match the supplied name. The \`:ref\` in the URL must be formatted as \`heads/\` for branches and \`tags/\` for tags. If the \`:ref\` doesn't exist in the repository, but existing refs start with \`:ref\`, they will be returned as an array. When you use this endpoint without providing a \`:ref\`, it will return an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just \`heads\` and \`tags\`. **Note:** You need to explicitly [request a pull request](https://docs.github.com/rest/reference/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". If you request matching references for a branch named \`feature\` but the branch \`feature\` doesn't exist, the response can still include other matching head refs that start with the word \`feature\`, such as \`featureA\` and \`featureB\`. * - * @tags orgs - * @name OrgsGetAuditLog - * @summary Get the audit log for an organization - * @request GET:/orgs/{org}/audit-log + * @tags git + * @name GitListMatchingRefs + * @summary List matching references + * @request GET:/repos/{owner}/{repo}/git/matching-refs/{ref} */ - orgsGetAuditLog: ( - org: string, + gitListMatchingRefs: ( + owner: string, + repo: string, + ref: string, query?: { - /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events after this cursor. */ - after?: string; - /** A cursor, as given in the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header). If specified, the query only searches for events before this cursor. */ - before?: string; - /** - * The event types to include: - * - * - `web` - returns web (non-Git) events - * - `git` - returns Git events - * - `all` - returns both web and Git events - * - * The default is `web`. - */ - include?: "web" | "git" | "all"; /** - * The order of audit log events. To list newest events first, specify `desc`. To list oldest events first, specify `asc`. - * - * The default is `desc`. + * Page number of the results to fetch. + * @default 1 */ - order?: "desc" | "asc"; + page?: number; /** * Results per page (max 100) * @default 30 */ per_page?: number; - /** A search phrase. For more information, see [Searching the audit log](https://docs.github.com/github/setting-up-and-managing-organizations-and-teams/reviewing-the-audit-log-for-your-organization#searching-the-audit-log). */ - phrase?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/audit-log`, + this.request({ + path: \`/repos/\${owner}/\${repo}/git/matching-refs/\${ref}\`, method: "GET", query: query, format: "json", @@ -12829,161 +27127,225 @@ export class Api extends HttpClient\` for branches and \`tags/\` for tags. If the \`:ref\` doesn't match an existing ref, a \`404\` is returned. **Note:** You need to explicitly [request a pull request](https://docs.github.com/rest/reference/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". * - * @tags orgs - * @name OrgsListBlockedUsers - * @summary List users blocked by an organization - * @request GET:/orgs/{org}/blocks + * @tags git + * @name GitGetRef + * @summary Get a reference + * @request GET:/repos/{owner}/{repo}/git/ref/{ref} */ - orgsListBlockedUsers: (org: string, params: RequestParams = {}) => - this.request< - SimpleUser[], - { - documentation_url: string; - message: string; - } - >({ - path: `/orgs/${org}/blocks`, + gitGetRef: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/ref/\${ref}\`, method: "GET", format: "json", ...params, }), /** - * No description + * @description Creates a reference for your repository. You are unable to create new references for empty repositories, even if the commit SHA-1 hash used exists. Empty repositories are repositories without branches. * - * @tags orgs - * @name OrgsCheckBlockedUser - * @summary Check if a user is blocked by an organization - * @request GET:/orgs/{org}/blocks/{username} + * @tags git + * @name GitCreateRef + * @summary Create a reference + * @request POST:/repos/{owner}/{repo}/git/refs */ - orgsCheckBlockedUser: (org: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/blocks/${username}`, - method: "GET", + gitCreateRef: ( + owner: string, + repo: string, + data: { + /** @example ""refs/heads/newbranch"" */ + key?: string; + /** The name of the fully qualified reference (ie: \`refs/heads/master\`). If it doesn't start with 'refs' and have at least two slashes, it will be rejected. */ + ref: string; + /** The SHA1 value for this reference. */ + sha: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/refs\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** * No description * - * @tags orgs - * @name OrgsBlockUser - * @summary Block a user from an organization - * @request PUT:/orgs/{org}/blocks/{username} + * @tags git + * @name GitUpdateRef + * @summary Update a reference + * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} */ - orgsBlockUser: (org: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/blocks/${username}`, - method: "PUT", + gitUpdateRef: ( + owner: string, + repo: string, + ref: string, + data: { + /** + * Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to \`false\` will make sure you're not overwriting work. + * @default false + */ + force?: boolean; + /** The SHA1 value to set this reference to */ + sha: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** * No description * - * @tags orgs - * @name OrgsUnblockUser - * @summary Unblock a user from an organization - * @request DELETE:/orgs/{org}/blocks/{username} + * @tags git + * @name GitDeleteRef + * @summary Delete a reference + * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} */ - orgsUnblockUser: (org: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/blocks/${username}`, + gitDeleteRef: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "DELETE", ...params, }), /** - * @description Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products). An authenticated organization owner with the `read:org` scope can list all credential authorizations for an organization that uses SAML single sign-on (SSO). The credentials are either personal access tokens or SSH keys that organization members have authorized for the organization. For more information, see [About authentication with SAML single sign-on](https://help.github.com/en/articles/about-authentication-with-saml-single-sign-on). + * @description Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then [create](https://docs.github.com/rest/reference/git#create-a-reference) the \`refs/tags/[tag]\` reference. If you want to create a lightweight tag, you only have to [create](https://docs.github.com/rest/reference/git#create-a-reference) the tag reference - this call would be unnecessary. **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | * - * @tags orgs - * @name OrgsListSamlSsoAuthorizations - * @summary List SAML SSO authorizations for an organization - * @request GET:/orgs/{org}/credential-authorizations + * @tags git + * @name GitCreateTag + * @summary Create a tag object + * @request POST:/repos/{owner}/{repo}/git/tags */ - orgsListSamlSsoAuthorizations: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/credential-authorizations`, - method: "GET", + gitCreateTag: ( + owner: string, + repo: string, + data: { + /** The tag message. */ + message: string; + /** The SHA of the git object this is tagging. */ + object: string; + /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ + tag: string; + /** An object with information about the individual creating the tag. */ + tagger?: { + /** When this object was tagged. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + date?: string; + /** The email of the author of the tag */ + email?: string; + /** The name of the author of the tag */ + name?: string; + }; + /** 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"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/tags\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Listing and deleting credential authorizations is available to organizations with GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products). An authenticated organization owner with the `admin:org` scope can remove a credential authorization for an organization that uses SAML SSO. Once you remove someone's credential authorization, they will need to create a new personal access token or SSH key and authorize it for the organization they want to access. + * @description **Signature verification object** The response will include a \`verification\` object that describes the result of verifying the commit's signature. The following fields are included in the \`verification\` object: | Name | Type | Description | | ---- | ---- | ----------- | | \`verified\` | \`boolean\` | Indicates whether GitHub considers the signature in this commit to be verified. | | \`reason\` | \`string\` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | \`signature\` | \`string\` | The signature that was extracted from the commit. | | \`payload\` | \`string\` | The value that was signed. | These are the possible values for \`reason\` in the \`verification\` object: | Value | Description | | ----- | ----------- | | \`expired_key\` | The key that made the signature is expired. | | \`not_signing_key\` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | \`gpgverify_error\` | There was an error communicating with the signature verification service. | | \`gpgverify_unavailable\` | The signature verification service is currently unavailable. | | \`unsigned\` | The object does not include a signature. | | \`unknown_signature_type\` | A non-PGP signature was found in the commit. | | \`no_user\` | No user was associated with the \`committer\` email address in the commit. | | \`unverified_email\` | The \`committer\` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | \`bad_email\` | The \`committer\` email address in the commit is not included in the identities of the PGP key that made the signature. | | \`unknown_key\` | The key that made the signature has not been registered with any user's account. | | \`malformed_signature\` | There was an error parsing the signature. | | \`invalid\` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | \`valid\` | None of the above errors applied, so the signature is considered to be verified. | * - * @tags orgs - * @name OrgsRemoveSamlSsoAuthorization - * @summary Remove a SAML SSO authorization for an organization - * @request DELETE:/orgs/{org}/credential-authorizations/{credential_id} + * @tags git + * @name GitGetTag + * @summary Get a tag + * @request GET:/repos/{owner}/{repo}/git/tags/{tag_sha} */ - orgsRemoveSamlSsoAuthorization: (org: string, credentialId: number, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/credential-authorizations/${credentialId}`, - method: "DELETE", + gitGetTag: (owner: string, repo: string, tagSha: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/git/tags/\${tagSha}\`, + method: "GET", + format: "json", ...params, }), /** - * No description + * @description The tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure. If you use this endpoint to add, delete, or modify the file contents in a tree, you will need to commit the tree and then update a branch to point to the commit. For more information see "[Create a commit](https://docs.github.com/rest/reference/git#create-a-commit)" and "[Update a reference](https://docs.github.com/rest/reference/git#update-a-reference)." * - * @tags activity - * @name ActivityListPublicOrgEvents - * @summary List public organization events - * @request GET:/orgs/{org}/events + * @tags git + * @name GitCreateTree + * @summary Create a tree + * @request POST:/repos/{owner}/{repo}/git/trees */ - activityListPublicOrgEvents: ( - org: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; + gitCreateTree: ( + owner: string, + repo: string, + data: { /** - * Results per page (max 100) - * @default 30 + * The SHA1 of an existing Git tree object which will be used as the base for the new tree. If provided, a new Git tree object will be created from entries in the Git tree object pointed to by \`base_tree\` and entries defined in the \`tree\` parameter. Entries defined in the \`tree\` parameter will overwrite items from \`base_tree\` with the same \`path\`. If you're creating new changes on a branch, then normally you'd set \`base_tree\` to the SHA1 of the Git tree object of the current latest commit on the branch you're working on. + * If not provided, GitHub will create a new Git tree object from only the entries defined in the \`tree\` parameter. If you create a new commit pointing to such a tree, then all files which were a part of the parent commit's tree and were not defined in the \`tree\` parameter will be listed as deleted by the new commit. */ - per_page?: number; + base_tree?: string; + /** Objects (of \`path\`, \`mode\`, \`type\`, and \`sha\`) specifying a tree structure. */ + tree: { + /** + * The content you want this file to have. GitHub will write this blob out and use that SHA for this entry. Use either this, or \`tree.sha\`. + * + * **Note:** Use either \`tree.sha\` or \`content\` to specify the contents of the entry. Using both \`tree.sha\` and \`content\` will return an error. + */ + content?: string; + /** The file mode; one of \`100644\` for file (blob), \`100755\` for executable (blob), \`040000\` for subdirectory (tree), \`160000\` for submodule (commit), or \`120000\` for a blob that specifies the path of a symlink. */ + mode?: "100644" | "100755" | "040000" | "160000" | "120000"; + /** The file referenced in the tree. */ + path?: string; + /** + * The SHA1 checksum ID of the object in the tree. Also called \`tree.sha\`. If the value is \`null\` then the file will be deleted. + * + * **Note:** Use either \`tree.sha\` or \`content\` to specify the contents of the entry. Using both \`tree.sha\` and \`content\` will return an error. + */ + sha?: string | null; + /** Either \`blob\`, \`tree\`, or \`commit\`. */ + type?: "blob" | "tree" | "commit"; + }[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/events`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/git/trees\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description The return hash contains `failed_at` and `failed_reason` fields which represent the time at which the invitation failed and the reason for the failure. + * @description Returns a single tree using the SHA1 value for that tree. If \`truncated\` is \`true\` in the response then the number of items in the \`tree\` array exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time. * - * @tags orgs - * @name OrgsListFailedInvitations - * @summary List failed organization invitations - * @request GET:/orgs/{org}/failed_invitations + * @tags git + * @name GitGetTree + * @summary Get a tree + * @request GET:/repos/{owner}/{repo}/git/trees/{tree_sha} */ - orgsListFailedInvitations: ( - org: string, + gitGetTree: ( + owner: string, + repo: string, + treeSha: string, query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + /** Setting this parameter to any value returns the objects or subtrees referenced by the tree specified in \`:tree_sha\`. For example, setting \`recursive\` to any of the following will enable returning objects or subtrees: \`0\`, \`1\`, \`"true"\`, and \`"false"\`. Omit this parameter to prevent recursively returning objects or subtrees. */ + recursive?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/failed_invitations`, + this.request({ + path: \`/repos/\${owner}/\${repo}/git/trees/\${treeSha}\`, method: "GET", query: query, format: "json", @@ -12993,13 +27355,14 @@ export class Api extends HttpClient extends HttpClient - this.request({ - path: `/orgs/${org}/hooks`, + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "GET", query: query, format: "json", @@ -13023,48 +27386,49 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/hooks`, + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "POST", body: data, type: ContentType.Json, @@ -13073,61 +27437,68 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/hooks/${hookId}`, + reposGetWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "GET", format: "json", ...params, }), /** - * @description Updates a webhook configured in an organization. When you update a webhook, the `secret` will be overwritten. If you previously had a `secret` set, you must provide the same `secret` or set a new `secret` or the secret will be removed. If you are only updating individual webhook `config` properties, use "[Update a webhook configuration for an organization](/rest/reference/orgs#update-a-webhook-configuration-for-an-organization)." + * @description Updates a webhook configured in a repository. If you previously had a \`secret\` set, you must provide the same \`secret\` or set a new \`secret\` or the secret will be removed. If you are only updating individual webhook \`config\` properties, use "[Update a webhook configuration for a repository](/rest/reference/repos#update-a-webhook-configuration-for-a-repository)." * - * @tags orgs - * @name OrgsUpdateWebhook - * @summary Update an organization webhook - * @request PATCH:/orgs/{org}/hooks/{hook_id} + * @tags repos + * @name ReposUpdateWebhook + * @summary Update a repository webhook + * @request PATCH:/repos/{owner}/{repo}/hooks/{hook_id} */ - orgsUpdateWebhook: ( - org: string, + reposUpdateWebhook: ( + owner: string, + repo: string, hookId: number, data: { /** - * Determines if notifications are sent when the webhook is triggered. Set to `true` to send notifications. + * Determines if notifications are sent when the webhook is triggered. Set to \`true\` to send notifications. * @default true */ active?: boolean; - /** Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/orgs#update-hook-config-params). */ + /** Determines a list of events to be added to the list of events that the Hook triggers for. */ + add_events?: string[]; + /** Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/repos#create-hook-config-params). */ config?: { - /** The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. */ + /** @example ""bar@example.com"" */ + address?: string; + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ content_type?: WebhookConfigContentType; - /** 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.** */ + /** 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; - /** 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). */ + /** @example ""The Serious Room"" */ + room?: 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; /** The URL to which the payloads will be delivered. */ url: WebhookConfigUrl; }; /** - * Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. + * Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. This replaces the entire array of events. * @default ["push"] */ events?: string[]; - /** @example ""web"" */ - name?: string; + /** Determines a list of events to be removed from the list of events that the Hook triggers for. */ + remove_events?: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/hooks/${hookId}`, + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "PATCH", body: data, type: ContentType.Json, @@ -13138,51 +27509,52 @@ export class Api extends HttpClient + reposDeleteWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => this.request({ - path: `/orgs/${org}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "DELETE", ...params, }), /** - * @description Returns the webhook configuration for an organization. To get more information about the webhook, including the `active` state and `events`, use "[Get an organization webhook ](/rest/reference/orgs#get-an-organization-webhook)." Access tokens must have the `admin:org_hook` scope, and GitHub Apps must have the `organization_hooks:read` permission. + * @description Returns the webhook configuration for a repository. To get more information about the webhook, including the \`active\` state and \`events\`, use "[Get a repository webhook](/rest/reference/orgs#get-a-repository-webhook)." Access tokens must have the \`read:repo_hook\` or \`repo\` scope, and GitHub Apps must have the \`repository_hooks:read\` permission. * - * @tags orgs - * @name OrgsGetWebhookConfigForOrg - * @summary Get a webhook configuration for an organization - * @request GET:/orgs/{org}/hooks/{hook_id}/config + * @tags repos + * @name ReposGetWebhookConfigForRepo + * @summary Get a webhook configuration for a repository + * @request GET:/repos/{owner}/{repo}/hooks/{hook_id}/config */ - orgsGetWebhookConfigForOrg: (org: string, hookId: number, params: RequestParams = {}) => + reposGetWebhookConfigForRepo: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => this.request({ - path: `/orgs/${org}/hooks/${hookId}/config`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/config\`, method: "GET", format: "json", ...params, }), /** - * @description Updates the webhook configuration for an organization. To update more information about the webhook, including the `active` state and `events`, use "[Update an organization webhook ](/rest/reference/orgs#update-an-organization-webhook)." Access tokens must have the `admin:org_hook` scope, and GitHub Apps must have the `organization_hooks:write` permission. + * @description Updates the webhook configuration for a repository. To update more information about the webhook, including the \`active\` state and \`events\`, use "[Update a repository webhook](/rest/reference/orgs#update-a-repository-webhook)." Access tokens must have the \`write:repo_hook\` or \`repo\` scope, and GitHub Apps must have the \`repository_hooks:write\` permission. * - * @tags orgs - * @name OrgsUpdateWebhookConfigForOrg - * @summary Update a webhook configuration for an organization - * @request PATCH:/orgs/{org}/hooks/{hook_id}/config + * @tags repos + * @name ReposUpdateWebhookConfigForRepo + * @summary Update a webhook configuration for a repository + * @request PATCH:/repos/{owner}/{repo}/hooks/{hook_id}/config */ - orgsUpdateWebhookConfigForOrg: ( - org: string, + reposUpdateWebhookConfigForRepo: ( + owner: string, + repo: string, hookId: number, data: { - /** The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. */ + /** The media type used to serialize the payloads. Supported values include \`json\` and \`form\`. The default is \`form\`. */ content_type?: WebhookConfigContentType; - /** 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.** */ + /** 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; - /** 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). */ + /** 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; /** The URL to which the payloads will be delivered. */ url?: WebhookConfigUrl; @@ -13190,7 +27562,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/hooks/${hookId}/config`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/config\`, method: "PATCH", body: data, type: ContentType.Json, @@ -13201,184 +27573,77 @@ export class Api extends HttpClient + reposPingWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => this.request({ - path: `/orgs/${org}/hooks/${hookId}/pings`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/pings\`, method: "POST", ...params, }), /** - * @description Enables an authenticated GitHub App to find the organization's installation information. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. - * - * @tags apps - * @name AppsGetOrgInstallation - * @summary Get an organization installation for the authenticated app - * @request GET:/orgs/{org}/installation - */ - appsGetOrgInstallation: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/installation`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Lists all GitHub Apps in an organization. The installation count includes all GitHub Apps installed on repositories in the organization. You must be an organization owner with `admin:read` scope to use this endpoint. - * - * @tags orgs - * @name OrgsListAppInstallations - * @summary List app installations for an organization - * @request GET:/orgs/{org}/installations - */ - orgsListAppInstallations: ( - org: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request< - { - installations: Installation[]; - total_count: number; - }, - any - >({ - path: `/orgs/${org}/installations`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Shows which type of GitHub user can interact with this organization and when the restriction expires. If there is no restrictions, you will see an empty response. - * - * @tags interactions - * @name InteractionsGetRestrictionsForOrg - * @summary Get interaction restrictions for an organization - * @request GET:/orgs/{org}/interaction-limits - */ - interactionsGetRestrictionsForOrg: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/interaction-limits`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Temporarily restricts interactions to a certain type of GitHub user in any public repository in the given organization. You must be an organization owner to set these restrictions. Setting the interaction limit at the organization level will overwrite any interaction limits that are set for individual repositories owned by the organization. - * - * @tags interactions - * @name InteractionsSetRestrictionsForOrg - * @summary Set interaction restrictions for an organization - * @request PUT:/orgs/{org}/interaction-limits - */ - interactionsSetRestrictionsForOrg: (org: string, data: InteractionLimit, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/interaction-limits`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Removes all interaction restrictions from public repositories in the given organization. You must be an organization owner to remove restrictions. + * @description This will trigger the hook with the latest push to the current repository if the hook is subscribed to \`push\` events. If the hook is not subscribed to \`push\` events, the server will respond with 204 but no test POST will be generated. **Note**: Previously \`/repos/:owner/:repo/hooks/:hook_id/test\` * - * @tags interactions - * @name InteractionsRemoveRestrictionsForOrg - * @summary Remove interaction restrictions for an organization - * @request DELETE:/orgs/{org}/interaction-limits + * @tags repos + * @name ReposTestPushWebhook + * @summary Test the push repository webhook + * @request POST:/repos/{owner}/{repo}/hooks/{hook_id}/tests */ - interactionsRemoveRestrictionsForOrg: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/interaction-limits`, - method: "DELETE", + reposTestPushWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/tests\`, + method: "POST", ...params, }), /** - * @description The return hash contains a `role` field which refers to the Organization Invitation role and will be one of the following values: `direct_member`, `admin`, `billing_manager`, `hiring_manager`, or `reinstate`. If the invitee is not a GitHub member, the `login` field in the return hash will be `null`. + * @description View the progress of an import. **Import status** This section includes details about the possible values of the \`status\` field of the Import Progress response. An import that does not have errors will progress through these steps: * \`detecting\` - the "detection" step of the import is in progress because the request did not include a \`vcs\` parameter. The import is identifying the type of source control present at the URL. * \`importing\` - the "raw" step of the import is in progress. This is where commit data is fetched from the original repository. The import progress response will include \`commit_count\` (the total number of raw commits that will be imported) and \`percent\` (0 - 100, the current progress through the import). * \`mapping\` - the "rewrite" step of the import is in progress. This is where SVN branches are converted to Git branches, and where author updates are applied. The import progress response does not include progress information. * \`pushing\` - the "push" step of the import is in progress. This is where the importer updates the repository on GitHub. The import progress response will include \`push_percent\`, which is the percent value reported by \`git push\` when it is "Writing objects". * \`complete\` - the import is complete, and the repository is ready on GitHub. If there are problems, you will see one of these in the \`status\` field: * \`auth_failed\` - the import requires authentication in order to connect to the original repository. To update authentication for the import, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. * \`error\` - the import encountered an error. The import progress response will include the \`failed_step\` and an error message. Contact [GitHub Support](https://support.github.com/contact) or [GitHub Premium Support](https://premium.githubsupport.com) for more information. * \`detection_needs_auth\` - the importer requires authentication for the originating repository to continue detection. To update authentication for the import, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. * \`detection_found_nothing\` - the importer didn't recognize any source control at the URL. To resolve, [Cancel the import](https://docs.github.com/rest/reference/migrations#cancel-an-import) and [retry](https://docs.github.com/rest/reference/migrations#start-an-import) with the correct URL. * \`detection_found_multiple\` - the importer found several projects or repositories at the provided URL. When this is the case, the Import Progress response will also include a \`project_choices\` field with the possible project choices as values. To update project choice, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. **The project_choices field** When multiple projects are found at the provided URL, the response hash will include a \`project_choices\` field, the value of which is an array of hashes each representing a project choice. The exact key/value pairs of the project hashes will differ depending on the version control type. **Git LFS related fields** This section includes details about Git LFS related fields that may be present in the Import Progress response. * \`use_lfs\` - describes whether the import has been opted in or out of using Git LFS. The value can be \`opt_in\`, \`opt_out\`, or \`undecided\` if no action has been taken. * \`has_large_files\` - the boolean value describing whether files larger than 100MB were found during the \`importing\` step. * \`large_files_size\` - the total size in gigabytes of files larger than 100MB found in the originating repository. * \`large_files_count\` - the total number of files larger than 100MB found in the originating repository. To see a list of these files, make a "Get Large Files" request. * - * @tags orgs - * @name OrgsListPendingInvitations - * @summary List pending organization invitations - * @request GET:/orgs/{org}/invitations + * @tags migrations + * @name MigrationsGetImportStatus + * @summary Get an import status + * @request GET:/repos/{owner}/{repo}/import */ - orgsListPendingInvitations: ( - org: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/invitations`, + migrationsGetImportStatus: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description Invite people to an organization by using their GitHub user ID or their email address. In order to create invitations in an organization, the authenticated user must be an organization owner. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @description Start a source import to a GitHub repository using GitHub Importer. * - * @tags orgs - * @name OrgsCreateInvitation - * @summary Create an organization invitation - * @request POST:/orgs/{org}/invitations + * @tags migrations + * @name MigrationsStartImport + * @summary Start an import + * @request PUT:/repos/{owner}/{repo}/import */ - orgsCreateInvitation: ( - org: string, + migrationsStartImport: ( + owner: string, + repo: string, data: { - /** **Required unless you provide `invitee_id`**. Email address of the person you are inviting, which can be an existing GitHub user. */ - email?: string; - /** **Required unless you provide `email`**. GitHub user ID for the person you are inviting. */ - invitee_id?: number; - /** - * Specify role for new member. Can be one of: - * \* `admin` - Organization owners with full administrative rights to the organization and complete access to all repositories and teams. - * \* `direct_member` - Non-owner organization members with ability to see other members and join teams by invitation. - * \* `billing_manager` - Non-owner organization members with ability to manage the billing settings of your organization. - * @default "direct_member" - */ - role?: "admin" | "direct_member" | "billing_manager"; - /** Specify IDs for the teams you want to invite new members to. */ - team_ids?: number[]; + /** For a tfvc import, the name of the project that is being imported. */ + tfvc_project?: string; + /** The originating VCS type. Can be one of \`subversion\`, \`git\`, \`mercurial\`, or \`tfvc\`. Please be aware that without this parameter, the import job will take additional time to detect the VCS type before beginning the import. This detection step will be reflected in the response. */ + vcs?: "subversion" | "git" | "mercurial" | "tfvc"; + /** If authentication is required, the password to provide to \`vcs_url\`. */ + vcs_password?: string; + /** The URL of the originating repository. */ + vcs_url: string; + /** If authentication is required, the username to provide to \`vcs_url\`. */ + vcs_username?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/invitations`, - method: "POST", + this.request({ + path: \`/repos/\${owner}/\${repo}/import\`, + method: "PUT", body: data, type: ContentType.Json, format: "json", @@ -13386,232 +27651,31 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/invitations/${invitationId}`, - method: "DELETE", - ...params, - }), - - /** - * @description List all teams associated with an invitation. In order to see invitations in an organization, the authenticated user must be an organization owner. - * - * @tags orgs - * @name OrgsListInvitationTeams - * @summary List organization invitation teams - * @request GET:/orgs/{org}/invitations/{invitation_id}/teams - */ - orgsListInvitationTeams: ( - org: string, - invitationId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/invitations/${invitationId}/teams`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List issues in an organization assigned to the authenticated user. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. - * - * @tags issues - * @name IssuesListForOrg - * @summary List organization issues assigned to the authenticated user - * @request GET:/orgs/{org}/issues - */ - issuesListForOrg: ( - org: string, - query?: { - /** - * One of `asc` (ascending) or `desc` (descending). - * @default "desc" - */ - direction?: "asc" | "desc"; - /** - * Indicates which sorts of issues to return. Can be one of: - * \* `assigned`: Issues assigned to you - * \* `created`: Issues created by you - * \* `mentioned`: Issues mentioning you - * \* `subscribed`: Issues you're subscribed to updates for - * \* `all`: All issues the authenticated user can see, regardless of participation or creation - * @default "assigned" - */ - filter?: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** A list of comma separated label names. Example: `bug,ui,@high` */ - labels?: string; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - since?: string; - /** - * What to sort results by. Can be either `created`, `updated`, `comments`. - * @default "created" - */ - sort?: "created" | "updated" | "comments"; - /** - * Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`. - * @default "open" - */ - state?: "open" | "closed" | "all"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List all users who are members of an organization. If the authenticated user is also a member of this organization then both concealed and public members will be returned. - * - * @tags orgs - * @name OrgsListMembers - * @summary List organization members - * @request GET:/orgs/{org}/members - */ - orgsListMembers: ( - org: string, - query?: { - /** - * Filter members returned in the list. Can be one of: - * \* `2fa_disabled` - Members without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. Available for organization owners. - * \* `all` - All members the authenticated user can see. - * @default "all" - */ - filter?: "2fa_disabled" | "all"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** - * Filter members returned by their role. Can be one of: - * \* `all` - All members of the organization, regardless of role. - * \* `admin` - Organization owners. - * \* `member` - Non-owner organization members. - * @default "all" - */ - role?: "all" | "admin" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/members`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Check if a user is, publicly or privately, a member of the organization. - * - * @tags orgs - * @name OrgsCheckMembershipForUser - * @summary Check organization membership for a user - * @request GET:/orgs/{org}/members/{username} - */ - orgsCheckMembershipForUser: (org: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/members/${username}`, - method: "GET", - ...params, - }), - - /** - * @description Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. - * - * @tags orgs - * @name OrgsRemoveMember - * @summary Remove an organization member - * @request DELETE:/orgs/{org}/members/{username} - */ - orgsRemoveMember: (org: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/members/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description In order to get a user's membership with an organization, the authenticated user must be an organization member. - * - * @tags orgs - * @name OrgsGetMembershipForUser - * @summary Get organization membership for a user - * @request GET:/orgs/{org}/memberships/{username} - */ - orgsGetMembershipForUser: (org: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/memberships/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Only authenticated organization owners can add a member to the organization or update the member's role. * If the authenticated user is _adding_ a member to the organization, the invited user will receive an email inviting them to the organization. The user's [membership status](https://docs.github.com/rest/reference/orgs#get-organization-membership-for-a-user) will be `pending` until they accept the invitation. * Authenticated users can _update_ a user's membership by passing the `role` parameter. If the authenticated user changes a member's role to `admin`, the affected user will receive an email notifying them that they've been made an organization owner. If the authenticated user changes an owner's role to `member`, no email will be sent. **Rate limits** To prevent abuse, the authenticated user is limited to 50 organization invitations per 24 hour period. If the organization is more than one month old or on a paid plan, the limit is 500 invitations per 24 hour period. + * @description An import can be updated with credentials or a project choice by passing in the appropriate parameters in this API request. If no parameters are provided, the import will be restarted. * - * @tags orgs - * @name OrgsSetMembershipForUser - * @summary Set organization membership for a user - * @request PUT:/orgs/{org}/memberships/{username} + * @tags migrations + * @name MigrationsUpdateImport + * @summary Update an import + * @request PATCH:/repos/{owner}/{repo}/import */ - orgsSetMembershipForUser: ( - org: string, - username: string, + migrationsUpdateImport: ( + owner: string, + repo: string, data: { - /** - * The role to give the user in the organization. Can be one of: - * \* `admin` - The user will become an owner of the organization. - * \* `member` - The user will become a non-owner member of the organization. - * @default "member" - */ - role?: "admin" | "member"; + /** @example ""project1"" */ + tfvc_project?: string; + /** @example ""git"" */ + vcs?: string; + /** The password to provide to the originating repository. */ + vcs_password?: string; + /** The username to provide to the originating repository. */ + vcs_username?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/memberships/${username}`, - method: "PUT", + this.request({ + path: \`/repos/\${owner}/\${repo}/import\`, + method: "PATCH", body: data, type: ContentType.Json, format: "json", @@ -13619,46 +27683,39 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/memberships/${username}`, + migrationsCancelImport: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import\`, method: "DELETE", ...params, }), /** - * @description Lists the most recent migrations. + * @description Each type of source control system represents authors in a different way. For example, a Git commit author has a display name and an email address, but a Subversion commit author just has a username. The GitHub Importer will make the author information valid, but the author might not be correct. For example, it will change the bare Subversion username \`hubot\` into something like \`hubot \`. This endpoint and the [Map a commit author](https://docs.github.com/rest/reference/migrations#map-a-commit-author) endpoint allow you to provide correct Git author information. * * @tags migrations - * @name MigrationsListForOrg - * @summary List organization migrations - * @request GET:/orgs/{org}/migrations + * @name MigrationsGetCommitAuthors + * @summary Get commit authors + * @request GET:/repos/{owner}/{repo}/import/authors */ - migrationsListForOrg: ( - org: string, + migrationsGetCommitAuthors: ( + owner: string, + repo: string, query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + /** A user ID. Only return users with an ID greater than this ID. */ + since?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/migrations`, + this.request({ + path: \`/repos/\${owner}/\${repo}/import/authors\`, method: "GET", query: query, format: "json", @@ -13666,35 +27723,30 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/migrations`, - method: "POST", + this.request({ + path: \`/repos/\${owner}/\${repo}/import/authors/\${authorId}\`, + method: "PATCH", body: data, type: ContentType.Json, format: "json", @@ -13702,117 +27754,129 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/migrations/${migrationId}`, + migrationsGetLargeFiles: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import/large_files\`, method: "GET", format: "json", ...params, }), /** - * @description Fetches the URL to a migration archive. + * @description You can import repositories from Subversion, Mercurial, and TFS that include files larger than 100MB. This ability is powered by [Git LFS](https://git-lfs.github.com). You can learn more about our LFS feature and working with large files [on our help site](https://help.github.com/articles/versioning-large-files/). * * @tags migrations - * @name MigrationsDownloadArchiveForOrg - * @summary Download an organization migration archive - * @request GET:/orgs/{org}/migrations/{migration_id}/archive + * @name MigrationsSetLfsPreference + * @summary Update Git LFS preference + * @request PATCH:/repos/{owner}/{repo}/import/lfs */ - migrationsDownloadArchiveForOrg: (org: string, migrationId: number, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/migrations/${migrationId}/archive`, - method: "GET", + migrationsSetLfsPreference: ( + owner: string, + repo: string, + data: { + /** Can be one of \`opt_in\` (large files will be stored using Git LFS) or \`opt_out\` (large files will be removed during the import). */ + use_lfs: "opt_in" | "opt_out"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/import/lfs\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description Deletes a previous migration archive. Migration archives are automatically deleted after seven days. + * @description Enables an authenticated GitHub App to find the repository's installation information. The installation's account type will be either an organization or a user account, depending which account the repository belongs to. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. * - * @tags migrations - * @name MigrationsDeleteArchiveForOrg - * @summary Delete an organization migration archive - * @request DELETE:/orgs/{org}/migrations/{migration_id}/archive + * @tags apps + * @name AppsGetRepoInstallation + * @summary Get a repository installation for the authenticated app + * @request GET:/repos/{owner}/{repo}/installation */ - migrationsDeleteArchiveForOrg: (org: string, migrationId: number, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/migrations/${migrationId}/archive`, - method: "DELETE", + appsGetRepoInstallation: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/installation\`, + method: "GET", + format: "json", ...params, }), /** - * @description Unlocks a repository that was locked for migration. You should unlock each migrated repository and [delete them](https://docs.github.com/rest/reference/repos#delete-a-repository) when the migration is complete and you no longer need the source data. + * @description Shows which type of GitHub user can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response. * - * @tags migrations - * @name MigrationsUnlockRepoForOrg - * @summary Unlock an organization repository - * @request DELETE:/orgs/{org}/migrations/{migration_id}/repos/{repo_name}/lock + * @tags interactions + * @name InteractionsGetRestrictionsForRepo + * @summary Get interaction restrictions for a repository + * @request GET:/repos/{owner}/{repo}/interaction-limits */ - migrationsUnlockRepoForOrg: (org: string, migrationId: number, repoName: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/migrations/${migrationId}/repos/${repoName}/lock`, - method: "DELETE", + interactionsGetRestrictionsForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/interaction-limits\`, + method: "GET", + format: "json", ...params, }), /** - * @description List all the repositories for this organization migration. + * @description Temporarily restricts interactions to a certain type of GitHub user within the given repository. You must have owner or admin access to set these restrictions. If an interaction limit is set for the user or organization that owns this repository, you will receive a \`409 Conflict\` response and will not be able to use this endpoint to change the interaction limit for a single repository. * - * @tags migrations - * @name MigrationsListReposForOrg - * @summary List repositories in an organization migration - * @request GET:/orgs/{org}/migrations/{migration_id}/repositories + * @tags interactions + * @name InteractionsSetRestrictionsForRepo + * @summary Set interaction restrictions for a repository + * @request PUT:/repos/{owner}/{repo}/interaction-limits */ - migrationsListReposForOrg: ( - org: string, - migrationId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, + interactionsSetRestrictionsForRepo: ( + owner: string, + repo: string, + data: InteractionLimit, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/migrations/${migrationId}/repositories`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/interaction-limits\`, + method: "PUT", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description List all users who are outside collaborators of an organization. + * @description Removes all interaction restrictions from the given repository. You must have owner or admin access to remove restrictions. If the interaction limit is set for the user or organization that owns this repository, you will receive a \`409 Conflict\` response and will not be able to use this endpoint to change the interaction limit for a single repository. * - * @tags orgs - * @name OrgsListOutsideCollaborators - * @summary List outside collaborators for an organization - * @request GET:/orgs/{org}/outside_collaborators + * @tags interactions + * @name InteractionsRemoveRestrictionsForRepo + * @summary Remove interaction restrictions for a repository + * @request DELETE:/repos/{owner}/{repo}/interaction-limits */ - orgsListOutsideCollaborators: ( - org: string, + interactionsRemoveRestrictionsForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/interaction-limits\`, + method: "DELETE", + ...params, + }), + + /** + * @description When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations. + * + * @tags repos + * @name ReposListInvitations + * @summary List repository invitations + * @request GET:/repos/{owner}/{repo}/invitations + */ + reposListInvitations: ( + owner: string, + repo: string, query?: { - /** - * Filter the list of outside collaborators. Can be one of: - * \* `2fa_disabled`: Outside collaborators without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. - * \* `all`: All outside collaborators. - * @default "all" - */ - filter?: "2fa_disabled" | "all"; /** * Page number of the results to fetch. * @default 1 @@ -13826,8 +27890,8 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/outside_collaborators`, + this.request({ + path: \`/repos/\${owner}/\${repo}/invitations\`, method: "GET", query: query, format: "json", @@ -13835,59 +27899,74 @@ export class Api extends HttpClient - this.request< - void, - | { - documentation_url?: string; - message?: string; - } - | BasicError - >({ - path: `/orgs/${org}/outside_collaborators/${username}`, - method: "PUT", + reposUpdateInvitation: ( + owner: string, + repo: string, + invitationId: number, + data: { + /** The permissions that the associated user will have on the repository. Valid values are \`read\`, \`write\`, \`maintain\`, \`triage\`, and \`admin\`. */ + permissions?: "read" | "write" | "maintain" | "triage" | "admin"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/invitations/\${invitationId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description Removing a user from this list will remove them from all the organization's repositories. + * No description * - * @tags orgs - * @name OrgsRemoveOutsideCollaborator - * @summary Remove outside collaborator from an organization - * @request DELETE:/orgs/{org}/outside_collaborators/{username} + * @tags repos + * @name ReposDeleteInvitation + * @summary Delete a repository invitation + * @request DELETE:/repos/{owner}/{repo}/invitations/{invitation_id} */ - orgsRemoveOutsideCollaborator: (org: string, username: string, params: RequestParams = {}) => - this.request< - void, - { - documentation_url?: string; - message?: string; - } - >({ - path: `/orgs/${org}/outside_collaborators/${username}`, + reposDeleteInvitation: (owner: string, repo: string, invitationId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/invitations/\${invitationId}\`, method: "DELETE", ...params, }), /** - * @description Lists the projects in an organization. Returns a `404 Not Found` status if projects are disabled in the organization. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned. + * @description List issues in a repository. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. * - * @tags projects - * @name ProjectsListForOrg - * @summary List organization projects - * @request GET:/orgs/{org}/projects + * @tags issues + * @name IssuesListForRepo + * @summary List repository issues + * @request GET:/repos/{owner}/{repo}/issues */ - projectsListForOrg: ( - org: string, + issuesListForRepo: ( + owner: string, + repo: string, query?: { + /** Can be the name of a user. Pass in \`none\` for issues with no assigned user, and \`*\` for issues assigned to any user. */ + assignee?: string; + /** The user that created the issue. */ + creator?: string; + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: "asc" | "desc"; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + /** A user that's mentioned in the issue. */ + mentioned?: string; + /** If an \`integer\` is passed, it should refer to a milestone by its \`number\` field. If the string \`*\` is passed, issues with any milestone are accepted. If the string \`none\` is passed, issues without milestones are returned. */ + milestone?: string; /** * Page number of the results to fetch. * @default 1 @@ -13898,16 +27977,23 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/projects`, + this.request({ + path: \`/repos/\${owner}/\${repo}/issues\`, method: "GET", query: query, format: "json", @@ -13915,25 +28001,51 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/projects`, + this.request< + Issue, + | BasicError + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/issues\`, method: "POST", body: data, type: ContentType.Json, @@ -13942,94 +28054,18 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/public_members`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags orgs - * @name OrgsCheckPublicMembershipForUser - * @summary Check public organization membership for a user - * @request GET:/orgs/{org}/public_members/{username} - */ - orgsCheckPublicMembershipForUser: (org: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/public_members/${username}`, - method: "GET", - ...params, - }), - - /** - * @description The user can publicize their own membership. (A user cannot publicize the membership for another user.) Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." - * - * @tags orgs - * @name OrgsSetPublicMembershipForAuthenticatedUser - * @summary Set public organization membership for the authenticated user - * @request PUT:/orgs/{org}/public_members/{username} - */ - orgsSetPublicMembershipForAuthenticatedUser: (org: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/public_members/${username}`, - method: "PUT", - ...params, - }), - - /** - * No description - * - * @tags orgs - * @name OrgsRemovePublicMembershipForAuthenticatedUser - * @summary Remove public organization membership for the authenticated user - * @request DELETE:/orgs/{org}/public_members/{username} - */ - orgsRemovePublicMembershipForAuthenticatedUser: (org: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/public_members/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description Lists repositories for the specified organization. + * @description By default, Issue Comments are ordered by ascending ID. * - * @tags repos - * @name ReposListForOrg - * @summary List organization repositories - * @request GET:/orgs/{org}/repos + * @tags issues + * @name IssuesListCommentsForRepo + * @summary List issue comments for a repository + * @request GET:/repos/{owner}/{repo}/issues/comments */ - reposListForOrg: ( - org: string, + issuesListCommentsForRepo: ( + owner: string, + repo: string, query?: { - /** Can be one of `asc` or `desc`. Default: when using `full_name`: `asc`, otherwise `desc` */ + /** Either \`asc\` or \`desc\`. Ignored without the \`sort\` parameter. */ direction?: "asc" | "desc"; /** * Page number of the results to fetch. @@ -14041,18 +28077,18 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/repos`, + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/comments\`, method: "GET", query: query, format: "json", @@ -14060,154 +28096,78 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/repos`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Access tokens must have the `repo` or `admin:org` scope. + * No description * - * @tags billing - * @name BillingGetGithubActionsBillingOrg - * @summary Get GitHub Actions billing for an organization - * @request GET:/orgs/{org}/settings/billing/actions + * @tags issues + * @name IssuesGetComment + * @summary Get an issue comment + * @request GET:/repos/{owner}/{repo}/issues/comments/{comment_id} */ - billingGetGithubActionsBillingOrg: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/settings/billing/actions`, + issuesGetComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "GET", format: "json", ...params, }), /** - * @description Gets the free and paid storage usued for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the `repo` or `admin:org` scope. + * No description * - * @tags billing - * @name BillingGetGithubPackagesBillingOrg - * @summary Get GitHub Packages billing for an organization - * @request GET:/orgs/{org}/settings/billing/packages + * @tags issues + * @name IssuesUpdateComment + * @summary Update an issue comment + * @request PATCH:/repos/{owner}/{repo}/issues/comments/{comment_id} */ - billingGetGithubPackagesBillingOrg: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/settings/billing/packages`, - method: "GET", + issuesUpdateComment: ( + owner: string, + repo: string, + commentId: number, + data: { + /** The contents of the comment. */ + body: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, + method: "PATCH", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the `repo` or `admin:org` scope. + * No description * - * @tags billing - * @name BillingGetSharedStorageBillingOrg - * @summary Get shared storage billing for an organization - * @request GET:/orgs/{org}/settings/billing/shared-storage + * @tags issues + * @name IssuesDeleteComment + * @summary Delete an issue comment + * @request DELETE:/repos/{owner}/{repo}/issues/comments/{comment_id} */ - billingGetSharedStorageBillingOrg: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/settings/billing/shared-storage`, - method: "GET", - format: "json", + issuesDeleteComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, + method: "DELETE", ...params, }), /** - * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups available in an organization. You can limit your page results using the `per_page` parameter. GitHub generates a url-encoded `page` token using a cursor value for where the next page begins. For more information on cursor pagination, see "[Offset and Cursor Pagination explained](https://dev.to/jackmarchant/offset-and-cursor-pagination-explained-b89)." The `per_page` parameter provides pagination for a list of IdP groups the authenticated user can access in an organization. For example, if the user `octocat` wants to see two groups per page in `octo-org` via cURL, it would look like this: + * @description List the reactions to an [issue comment](https://docs.github.com/rest/reference/issues#comments). * - * @tags teams - * @name TeamsListIdpGroupsForOrg - * @summary List IdP groups for an organization - * @request GET:/orgs/{org}/team-sync/groups + * @tags reactions + * @name ReactionsListForIssueComment + * @summary List reactions for an issue comment + * @request GET:/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions */ - teamsListIdpGroupsForOrg: ( - org: string, + reactionsListForIssueComment: ( + owner: string, + repo: string, + commentId: number, query?: { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue comment. */ + content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; /** * Page number of the results to fetch. * @default 1 @@ -14221,8 +28181,15 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/team-sync/groups`, + this.request< + Reaction[], + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}/reactions\`, method: "GET", query: query, format: "json", @@ -14230,15 +28197,71 @@ export class Api extends HttpClient + this.request< + Reaction, + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE delete /repositories/:repository_id/issues/comments/:comment_id/reactions/:reaction_id\`. Delete a reaction to an [issue comment](https://docs.github.com/rest/reference/issues#comments). + * + * @tags reactions + * @name ReactionsDeleteForIssueComment + * @summary Delete an issue comment reaction + * @request DELETE:/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions/{reaction_id} + */ + reactionsDeleteForIssueComment: ( + owner: string, + repo: string, + commentId: number, + reactionId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}/reactions/\${reactionId}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesListEventsForRepo + * @summary List issue events for a repository + * @request GET:/repos/{owner}/{repo}/issues/events + */ + issuesListEventsForRepo: ( + owner: string, + repo: string, query?: { /** * Page number of the results to fetch. @@ -14253,8 +28276,8 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams`, + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/events\`, method: "GET", query: query, format: "json", @@ -14262,113 +28285,86 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams`, - method: "POST", - body: data, - type: ContentType.Json, + issuesGetEvent: (owner: string, repo: string, eventId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/events/\${eventId}\`, + method: "GET", format: "json", ...params, }), /** - * @description Gets a team using the team's `slug`. GitHub generates the `slug` from the team `name`. **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}`. + * @description The API returns a [\`301 Moved Permanently\` status](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-redirects-redirects) if the issue was [transferred](https://help.github.com/articles/transferring-an-issue-to-another-repository/) to another repository. If the issue was transferred to or deleted from a repository where the authenticated user lacks read access, the API returns a \`404 Not Found\` status. If the issue was deleted from a repository where the authenticated user has read access, the API returns a \`410 Gone\` status. To receive webhook events for transferred and deleted issues, subscribe to the [\`issues\`](https://docs.github.com/webhooks/event-payloads/#issues) webhook. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. * - * @tags teams - * @name TeamsGetByName - * @summary Get a team by name - * @request GET:/orgs/{org}/teams/{team_slug} + * @tags issues + * @name IssuesGet + * @summary Get an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number} */ - teamsGetByName: (org: string, teamSlug: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}`, + issuesGet: (owner: string, repo: string, issueNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}\`, method: "GET", format: "json", ...params, }), /** - * @description To edit a team, the authenticated user must either be an organization owner or a team maintainer. **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}`. + * @description Issue owners and users with push access can edit an issue. * - * @tags teams - * @name TeamsUpdateInOrg - * @summary Update a team - * @request PATCH:/orgs/{org}/teams/{team_slug} + * @tags issues + * @name IssuesUpdate + * @summary Update an issue + * @request PATCH:/repos/{owner}/{repo}/issues/{issue_number} */ - teamsUpdateInOrg: ( - org: string, - teamSlug: string, + issuesUpdate: ( + owner: string, + repo: string, + issueNumber: number, data: { - /** The description of the team. */ - description?: string; - /** The name of the team. */ - name: string; - /** The ID of a team to set as the parent team. */ - parent_team_id?: number; - /** - * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: - * \* `pull` - team members can pull, but not push to or administer newly-added repositories. - * \* `push` - team members can pull and push, but not administer newly-added repositories. - * \* `admin` - team members can pull, push and administer newly-added repositories. - * @default "pull" - */ - permission?: "pull" | "push" | "admin"; - /** - * The level of privacy this team should have. Editing teams without specifying this parameter leaves `privacy` intact. When a team is nested, the `privacy` for parent teams cannot be `secret`. The options are: - * **For a non-nested team:** - * \* `secret` - only visible to organization owners and members of this team. - * \* `closed` - visible to all members of this organization. - * **For a parent or child team:** - * \* `closed` - visible to all members of this organization. - */ - privacy?: "secret" | "closed"; + /** Login for the user that this issue should be assigned to. **This field is deprecated.** */ + assignee?: string | null; + /** Logins for Users to assign to this issue. Pass one or more user logins to _replace_ the set of assignees on this Issue. Send an empty array (\`[]\`) to clear all assignees from the Issue. _NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise._ */ + assignees?: string[]; + /** The contents of the issue. */ + body?: string; + /** Labels to associate with this issue. Pass one or more Labels to _replace_ the set of Labels on this Issue. Send an empty array (\`[]\`) to clear all Labels from the Issue. _NOTE: Only users with push access can set labels for issues. Labels are silently dropped otherwise._ */ + labels?: ( + | string + | { + color?: string | null; + description?: string | null; + id?: number; + name?: string; + } + )[]; + /** The \`number\` of the milestone to associate this issue with or \`null\` to remove current. _NOTE: Only users with push access can set the milestone for issues. The milestone is silently dropped otherwise._ */ + milestone?: string | number | null; + /** State of the issue. Either \`open\` or \`closed\`. */ + state?: "open" | "closed"; + /** The title of the issue. */ + title?: string | number; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}`, + this.request< + Issue, + | BasicError + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}\`, method: "PATCH", body: data, type: ContentType.Json, @@ -14377,37 +28373,72 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}`, + issuesAddAssignees: ( + owner: string, + repo: string, + issueNumber: number, + data: { + /** Usernames of people to assign this issue to. _NOTE: Only users with push access can add assignees to an issue. Assignees are silently ignored otherwise._ */ + assignees?: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/assignees\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * @description Removes one or more assignees from an issue. + * + * @tags issues + * @name IssuesRemoveAssignees + * @summary Remove assignees from an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/assignees + */ + issuesRemoveAssignees: ( + owner: string, + repo: string, + issueNumber: number, + data: { + /** Usernames of assignees to remove from an issue. _NOTE: Only users with push access can remove assignees from an issue. Assignees are silently ignored otherwise._ */ + assignees?: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/assignees\`, method: "DELETE", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description List all discussions on a team's page. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions`. + * @description Issue Comments are ordered by ascending ID. * - * @tags teams - * @name TeamsListDiscussionsInOrg - * @summary List discussions - * @request GET:/orgs/{org}/teams/{team_slug}/discussions + * @tags issues + * @name IssuesListComments + * @summary List issue comments + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/comments */ - teamsListDiscussionsInOrg: ( - org: string, - teamSlug: string, + issuesListComments: ( + owner: string, + repo: string, + issueNumber: number, query?: { - /** - * One of `asc` (ascending) or `desc` (descending). - * @default "desc" - */ - direction?: "asc" | "desc"; /** * Page number of the results to fetch. * @default 1 @@ -14418,11 +28449,13 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions`, + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/comments\`, method: "GET", query: query, format: "json", @@ -14430,31 +28463,25 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions`, + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/comments\`, method: "POST", body: data, type: ContentType.Json, @@ -14463,83 +28490,52 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`. + * No description * - * @tags teams - * @name TeamsUpdateDiscussionInOrg - * @summary Update a discussion - * @request PATCH:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} + * @tags issues + * @name IssuesListEvents + * @summary List issue events + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/events */ - teamsUpdateDiscussionInOrg: ( - org: string, - teamSlug: string, - discussionNumber: number, - data: { - /** The discussion post's body text. */ - body?: string; - /** The discussion post's title. */ - title?: string; + issuesListEvents: ( + owner: string, + repo: string, + issueNumber: number, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}`, - method: "PATCH", - body: data, - type: ContentType.Json, + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/events\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description Delete a discussion from a team's page. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}`. - * - * @tags teams - * @name TeamsDeleteDiscussionInOrg - * @summary Delete a discussion - * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number} - */ - teamsDeleteDiscussionInOrg: (org: string, teamSlug: string, discussionNumber: number, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}`, - method: "DELETE", - ...params, - }), - - /** - * @description List all comments on a team discussion. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments`. + * No description * - * @tags teams - * @name TeamsListDiscussionCommentsInOrg - * @summary List discussion comments - * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments + * @tags issues + * @name IssuesListLabelsOnIssue + * @summary List labels for an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/labels */ - teamsListDiscussionCommentsInOrg: ( - org: string, - teamSlug: string, - discussionNumber: number, + issuesListLabelsOnIssue: ( + owner: string, + repo: string, + issueNumber: number, query?: { - /** - * One of `asc` (ascending) or `desc` (descending). - * @default "desc" - */ - direction?: "asc" | "desc"; /** * Page number of the results to fetch. * @default 1 @@ -14553,8 +28549,8 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/comments`, + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/labels\`, method: "GET", query: query, format: "json", @@ -14562,25 +28558,25 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/comments`, + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/labels\`, method: "POST", body: data, type: ContentType.Json, @@ -14589,49 +28585,26 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/comments/${commentNumber}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edits the body text of a discussion comment. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/discussions/{discussion_number}/comments/{comment_number}`. + * @description Removes any previous labels and sets the new labels for an issue. * - * @tags teams - * @name TeamsUpdateDiscussionCommentInOrg - * @summary Update a discussion comment - * @request PATCH:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number} + * @tags issues + * @name IssuesSetLabels + * @summary Set labels for an issue + * @request PUT:/repos/{owner}/{repo}/issues/{issue_number}/labels */ - teamsUpdateDiscussionCommentInOrg: ( - org: string, - teamSlug: string, - discussionNumber: number, - commentNumber: number, + issuesSetLabels: ( + owner: string, + repo: string, + issueNumber: number, data: { - /** The discussion comment's body text. */ - body: string; + /** The names of the labels to add to the issue. You can pass an empty array to remove all labels. **Note:** Alternatively, you can pass a single label as a \`string\` or an \`array\` of labels directly, but GitHub recommends passing an object with the \`labels\` key. */ + labels?: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/comments/${commentNumber}`, - method: "PATCH", + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/labels\`, + method: "PUT", body: data, type: ContentType.Json, format: "json", @@ -14639,127 +28612,97 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/comments/${commentNumber}`, + issuesRemoveAllLabels: (owner: string, repo: string, issueNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/labels\`, method: "DELETE", ...params, }), /** - * @description List the reactions to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments/). OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions`. + * @description Removes the specified label from the issue, and returns the remaining labels on the issue. This endpoint returns a \`404 Not Found\` status if the label does not exist. * - * @tags reactions - * @name ReactionsListForTeamDiscussionCommentInOrg - * @summary List reactions for a team discussion comment - * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions + * @tags issues + * @name IssuesRemoveLabel + * @summary Remove a label from an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/labels/{name} */ - reactionsListForTeamDiscussionCommentInOrg: ( - org: string, - teamSlug: string, - discussionNumber: number, - commentNumber: number, - query?: { - /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ - content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/comments/${commentNumber}/reactions`, - method: "GET", - query: query, + issuesRemoveLabel: (owner: string, repo: string, issueNumber: number, name: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/labels/\${name}\`, + method: "DELETE", format: "json", ...params, }), /** - * @description Create a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a `Status: 200 OK` means that you already added the reaction type to this team discussion comment. **Note:** You can also specify a team by `org_id` and `team_id` using the route `POST /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions`. + * @description Users with push access can lock an issue or pull request's conversation. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." * - * @tags reactions - * @name ReactionsCreateForTeamDiscussionCommentInOrg - * @summary Create reaction for a team discussion comment - * @request POST:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions + * @tags issues + * @name IssuesLock + * @summary Lock an issue + * @request PUT:/repos/{owner}/{repo}/issues/{issue_number}/lock */ - reactionsCreateForTeamDiscussionCommentInOrg: ( - org: string, - teamSlug: string, - discussionNumber: number, - commentNumber: number, + issuesLock: ( + owner: string, + repo: string, + issueNumber: number, data: { - /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion comment. */ - content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; - }, + /** + * The reason for locking the issue or pull request conversation. Lock will fail if you don't use one of these reasons: + * \\* \`off-topic\` + * \\* \`too heated\` + * \\* \`resolved\` + * \\* \`spam\` + */ + lock_reason?: "off-topic" | "too heated" | "resolved" | "spam"; + } | null, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/comments/${commentNumber}/reactions`, - method: "POST", + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/lock\`, + method: "PUT", body: data, type: ContentType.Json, - format: "json", ...params, }), /** - * @description **Note:** You can also specify a team or organization with `team_id` and `org_id` using the route `DELETE /organizations/:org_id/team/:team_id/discussions/:discussion_number/comments/:comment_number/reactions/:reaction_id`. Delete a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @description Users with push access can unlock an issue's conversation. * - * @tags reactions - * @name ReactionsDeleteForTeamDiscussionComment - * @summary Delete team discussion comment reaction - * @request DELETE:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/comments/{comment_number}/reactions/{reaction_id} + * @tags issues + * @name IssuesUnlock + * @summary Unlock an issue + * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/lock */ - reactionsDeleteForTeamDiscussionComment: ( - org: string, - teamSlug: string, - discussionNumber: number, - commentNumber: number, - reactionId: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/comments/${commentNumber}/reactions/${reactionId}`, + issuesUnlock: (owner: string, repo: string, issueNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/lock\`, method: "DELETE", ...params, }), /** - * @description List the reactions to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/:org_id/team/:team_id/discussions/:discussion_number/reactions`. + * @description List the reactions to an [issue](https://docs.github.com/rest/reference/issues). * * @tags reactions - * @name ReactionsListForTeamDiscussionInOrg - * @summary List reactions for a team discussion - * @request GET:/orgs/{org}/teams/{team_slug}/discussions/{discussion_number}/reactions + * @name ReactionsListForIssue + * @summary List reactions for an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/reactions */ - reactionsListForTeamDiscussionInOrg: ( - org: string, - teamSlug: string, - discussionNumber: number, + reactionsListForIssue: ( + owner: string, + repo: string, + issueNumber: number, query?: { - /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue. */ content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; /** * Page number of the results to fetch. @@ -14774,8 +28717,15 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/reactions`, + this.request< + Reaction[], + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/reactions\`, method: "GET", query: query, format: "json", @@ -14783,25 +28733,32 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/reactions`, + this.request< + Reaction, + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/reactions\`, method: "POST", body: data, type: ContentType.Json, @@ -14810,37 +28767,38 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams/${teamSlug}/discussions/${discussionNumber}/reactions/${reactionId}`, + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/reactions/\${reactionId}\`, method: "DELETE", ...params, }), /** - * @description The return hash contains a `role` field which refers to the Organization Invitation role and will be one of the following values: `direct_member`, `admin`, `billing_manager`, `hiring_manager`, or `reinstate`. If the invitee is not a GitHub member, the `login` field in the return hash will be `null`. **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/invitations`. + * No description * - * @tags teams - * @name TeamsListPendingInvitationsInOrg - * @summary List pending team invitations - * @request GET:/orgs/{org}/teams/{team_slug}/invitations + * @tags issues + * @name IssuesListEventsForTimeline + * @summary List timeline events for an issue + * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/timeline */ - teamsListPendingInvitationsInOrg: ( - org: string, - teamSlug: string, + issuesListEventsForTimeline: ( + owner: string, + repo: string, + issueNumber: number, query?: { /** * Page number of the results to fetch. @@ -14855,8 +28813,15 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/invitations`, + this.request< + IssueEventForIssue[], + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/issues/\${issueNumber}/timeline\`, method: "GET", query: query, format: "json", @@ -14864,16 +28829,16 @@ export class Api extends HttpClient extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/members`, + this.request({ + path: \`/repos/\${owner}/\${repo}/keys\`, method: "GET", query: query, format: "json", @@ -14905,57 +28862,33 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/memberships/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Adds an organization member to a team. An authenticated organization owner or team maintainer can add organization members to a team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." An organization owner can add someone who is not part of the team's organization to a team. When an organization owner adds someone to a team who is not an organization member, this endpoint will send an invitation to the person via email. This newly-created membership will be in the "pending" state until the person accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer. **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/memberships/{username}`. + * @description You can create a read-only deploy key. * - * @tags teams - * @name TeamsAddOrUpdateMembershipForUserInOrg - * @summary Add or update team membership for a user - * @request PUT:/orgs/{org}/teams/{team_slug}/memberships/{username} + * @tags repos + * @name ReposCreateDeployKey + * @summary Create a deploy key + * @request POST:/repos/{owner}/{repo}/keys */ - teamsAddOrUpdateMembershipForUserInOrg: ( - org: string, - teamSlug: string, - username: string, + reposCreateDeployKey: ( + owner: string, + repo: string, data: { + /** The contents of the key. */ + key: string; /** - * The role that this user should have in the team. Can be one of: - * \* `member` - a normal member of the team. - * \* `maintainer` - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description. - * @default "member" + * If \`true\`, the key will only be able to read repository contents. Otherwise, the key will be able to read and write. + * + * Deploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see "[Repository permission levels for an organization](https://help.github.com/articles/repository-permission-levels-for-an-organization/)" and "[Permission levels for a user account repository](https://help.github.com/articles/permission-levels-for-a-user-account-repository/)." */ - role?: "member" | "maintainer"; + read_only?: boolean; + /** A name for the key. */ + title?: string; }, params: RequestParams = {}, ) => - this.request< - TeamMembership, - void | { - errors?: { - code?: string; - field?: string; - resource?: string; - }[]; - message?: string; - } - >({ - path: `/orgs/${org}/teams/${teamSlug}/memberships/${username}`, - method: "PUT", + this.request({ + path: \`/repos/\${owner}/\${repo}/keys\`, + method: "POST", body: data, type: ContentType.Json, format: "json", @@ -14963,31 +28896,47 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/memberships/${username}`, + reposGetDeployKey: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead. + * + * @tags repos + * @name ReposDeleteDeployKey + * @summary Delete a deploy key + * @request DELETE:/repos/{owner}/{repo}/keys/{key_id} + */ + reposDeleteDeployKey: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "DELETE", ...params, }), /** - * @description Lists the organization projects for a team. **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/projects`. + * No description * - * @tags teams - * @name TeamsListProjectsInOrg - * @summary List team projects - * @request GET:/orgs/{org}/teams/{team_slug}/projects + * @tags issues + * @name IssuesListLabelsForRepo + * @summary List labels for a repository + * @request GET:/repos/{owner}/{repo}/labels */ - teamsListProjectsInOrg: ( - org: string, - teamSlug: string, + issuesListLabelsForRepo: ( + owner: string, + repo: string, query?: { /** * Page number of the results to fetch. @@ -15002,8 +28951,8 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/projects`, + this.request({ + path: \`/repos/\${owner}/\${repo}/labels\`, method: "GET", query: query, format: "json", @@ -15011,227 +28960,296 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/projects/${projectId}`, + this.request({ + path: \`/repos/\${owner}/\${repo}/labels\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesGetLabel + * @summary Get a label + * @request GET:/repos/{owner}/{repo}/labels/{name} + */ + issuesGetLabel: (owner: string, repo: string, name: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "GET", format: "json", ...params, }), /** - * @description Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have `admin` permissions for the project. The project and team must be part of the same organization. **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/projects/{project_id}`. + * No description * - * @tags teams - * @name TeamsAddOrUpdateProjectPermissionsInOrg - * @summary Add or update team project permissions - * @request PUT:/orgs/{org}/teams/{team_slug}/projects/{project_id} + * @tags issues + * @name IssuesUpdateLabel + * @summary Update a label + * @request PATCH:/repos/{owner}/{repo}/labels/{name} */ - teamsAddOrUpdateProjectPermissionsInOrg: ( - org: string, - teamSlug: string, - projectId: number, + issuesUpdateLabel: ( + owner: string, + repo: string, + name: string, data: { - /** - * The permission to grant to the team for this project. Can be one of: - * \* `read` - team members can read, but not write to or administer this project. - * \* `write` - team members can read and write, but not administer this project. - * \* `admin` - team members can read, write and administer this project. - * Default: the team's `permission` attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." - */ - permission?: "read" | "write" | "admin"; + /** The [hexadecimal color code](http://www.color-hex.com/) for the label, without the leading \`#\`. */ + color?: string; + /** A short description of the label. */ + description?: string; + /** The new name of the label. Emoji can be added to label names, using either native emoji or colon-style markup. For example, typing \`:strawberry:\` will render the emoji ![:strawberry:](https://assets-git.f3mw1.com/images/icons/emoji/unicode/1f353.png ":strawberry:"). For a full list of available emoji and codes, see [emoji-cheat-sheet.com](http://emoji-cheat-sheet.com/). */ + new_name?: string; }, params: RequestParams = {}, ) => - this.request< - void, - { - documentation_url?: string; - message?: string; - } - >({ - path: `/orgs/${org}/teams/${teamSlug}/projects/${projectId}`, - method: "PUT", + this.request({ + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, + method: "PATCH", body: data, type: ContentType.Json, + format: "json", ...params, }), /** - * @description Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have `read` access to both the team and project, or `admin` access to the team or project. This endpoint removes the project from the team, but does not delete the project. **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/projects/{project_id}`. + * No description * - * @tags teams - * @name TeamsRemoveProjectInOrg - * @summary Remove a project from a team - * @request DELETE:/orgs/{org}/teams/{team_slug}/projects/{project_id} + * @tags issues + * @name IssuesDeleteLabel + * @summary Delete a label + * @request DELETE:/repos/{owner}/{repo}/labels/{name} */ - teamsRemoveProjectInOrg: (org: string, teamSlug: string, projectId: number, params: RequestParams = {}) => + issuesDeleteLabel: (owner: string, repo: string, name: string, params: RequestParams = {}) => this.request({ - path: `/orgs/${org}/teams/${teamSlug}/projects/${projectId}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "DELETE", ...params, }), /** - * @description Lists a team's repositories visible to the authenticated user. **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos`. + * @description Lists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language. * - * @tags teams - * @name TeamsListReposInOrg - * @summary List team repositories - * @request GET:/orgs/{org}/teams/{team_slug}/repos + * @tags repos + * @name ReposListLanguages + * @summary List repository languages + * @request GET:/repos/{owner}/{repo}/languages */ - teamsListReposInOrg: ( - org: string, - teamSlug: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + reposListLanguages: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/languages\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description This method returns the contents of the repository's license file, if one is detected. Similar to [Get repository content](https://docs.github.com/rest/reference/repos#get-repository-content), this method also supports [custom media types](https://docs.github.com/rest/overview/media-types) for retrieving the raw license content or rendered license HTML. + * + * @tags licenses + * @name LicensesGetForRepo + * @summary Get the license for a repository + * @request GET:/repos/{owner}/{repo}/license + */ + licensesGetForRepo: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/license\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * No description + * + * @tags repos + * @name ReposMerge + * @summary Merge a branch + * @request POST:/repos/{owner}/{repo}/merges + */ + reposMerge: ( + owner: string, + repo: string, + data: { + /** The name of the base branch that the head will be merged into. */ + base: string; + /** Commit message to use for the merge commit. If omitted, a default message will be used. */ + commit_message?: string; + /** The head to merge. This can be a branch name or a commit SHA1. */ + head: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/repos`, - method: "GET", - query: query, + this.request< + Commit, + | BasicError + | { + /** @example ""https://docs.github.com/rest/reference/repos#perform-a-merge"" */ + documentation_url?: string; + message?: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/merges\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Checks whether a team has `admin`, `push`, `maintain`, `triage`, or `pull` permission for a repository. Repositories inherited through a parent team will also be checked. You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the `application/vnd.github.v3.repository+json` accept header. If a team doesn't have permission for the repository, you will receive a `404 Not Found` response status. **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`. + * No description * - * @tags teams - * @name TeamsCheckPermissionsForRepoInOrg - * @summary Check team permissions for a repository - * @request GET:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + * @tags issues + * @name IssuesListMilestones + * @summary List milestones + * @request GET:/repos/{owner}/{repo}/milestones */ - teamsCheckPermissionsForRepoInOrg: ( - org: string, - teamSlug: string, + issuesListMilestones: ( owner: string, repo: string, + query?: { + /** + * The direction of the sort. Either \`asc\` or \`desc\`. + * @default "asc" + */ + direction?: "asc" | "desc"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * What to sort results by. Either \`due_on\` or \`completeness\`. + * @default "due_on" + */ + sort?: "due_on" | "completeness"; + /** + * The state of the milestone. Either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: "open" | "closed" | "all"; + }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/repos/${owner}/${repo}`, + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a `422 Unprocessable Entity` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." **Note:** You can also specify a team by `org_id` and `team_id` using the route `PUT /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`. For more information about the permission levels, see "[Repository permission levels for an organization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)". + * No description * - * @tags teams - * @name TeamsAddOrUpdateRepoPermissionsInOrg - * @summary Add or update team repository permissions - * @request PUT:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} + * @tags issues + * @name IssuesCreateMilestone + * @summary Create a milestone + * @request POST:/repos/{owner}/{repo}/milestones */ - teamsAddOrUpdateRepoPermissionsInOrg: ( - org: string, - teamSlug: string, + issuesCreateMilestone: ( owner: string, repo: string, data: { + /** A description of the milestone. */ + description?: string; + /** The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + due_on?: string; /** - * The permission to grant the team on this repository. Can be one of: - * \* `pull` - team members can pull, but not push to or administer this repository. - * \* `push` - team members can pull and push, but not administer this repository. - * \* `admin` - team members can pull, push and administer this repository. - * \* `maintain` - team members can manage the repository without access to sensitive or destructive actions. Recommended for project managers. Only applies to repositories owned by organizations. - * \* `triage` - team members can proactively manage issues and pull requests without write access. Recommended for contributors who triage a repository. Only applies to repositories owned by organizations. - * - * If no permission is specified, the team's `permission` attribute will be used to determine what permission to grant the team on this repository. + * The state of the milestone. Either \`open\` or \`closed\`. + * @default "open" */ - permission?: "pull" | "push" | "admin" | "maintain" | "triage"; + state?: "open" | "closed"; + /** The title of the milestone. */ + title: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/repos/${owner}/${repo}`, - method: "PUT", + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones\`, + method: "POST", body: data, type: ContentType.Json, + format: "json", ...params, }), /** - * @description If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. This does not delete the repository, it just removes it from the team. **Note:** You can also specify a team by `org_id` and `team_id` using the route `DELETE /organizations/{org_id}/team/{team_id}/repos/{owner}/{repo}`. - * - * @tags teams - * @name TeamsRemoveRepoInOrg - * @summary Remove a repository from a team - * @request DELETE:/orgs/{org}/teams/{team_slug}/repos/{owner}/{repo} - */ - teamsRemoveRepoInOrg: (org: string, teamSlug: string, owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/repos/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /** - * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups connected to a team on GitHub. **Note:** You can also specify a team by `org_id` and `team_id` using the route `GET /organizations/{org_id}/team/{team_id}/team-sync/group-mappings`. + * No description * - * @tags teams - * @name TeamsListIdpGroupsInOrg - * @summary List IdP groups for a team - * @request GET:/orgs/{org}/teams/{team_slug}/team-sync/group-mappings + * @tags issues + * @name IssuesGetMilestone + * @summary Get a milestone + * @request GET:/repos/{owner}/{repo}/milestones/{milestone_number} */ - teamsListIdpGroupsInOrg: (org: string, teamSlug: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/team-sync/group-mappings`, + issuesGetMilestone: (owner: string, repo: string, milestoneNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones/\${milestoneNumber}\`, method: "GET", format: "json", ...params, }), /** - * @description Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty `groups` array will remove all connections for a team. **Note:** You can also specify a team by `org_id` and `team_id` using the route `PATCH /organizations/{org_id}/team/{team_id}/team-sync/group-mappings`. + * No description * - * @tags teams - * @name TeamsCreateOrUpdateIdpGroupConnectionsInOrg - * @summary Create or update IdP group connections - * @request PATCH:/orgs/{org}/teams/{team_slug}/team-sync/group-mappings + * @tags issues + * @name IssuesUpdateMilestone + * @summary Update a milestone + * @request PATCH:/repos/{owner}/{repo}/milestones/{milestone_number} */ - teamsCreateOrUpdateIdpGroupConnectionsInOrg: ( - org: string, - teamSlug: string, + issuesUpdateMilestone: ( + owner: string, + repo: string, + milestoneNumber: number, data: { - /** The IdP groups you want to connect to a GitHub team. When updating, the new `groups` object will replace the original one. You must include any existing groups that you don't want to remove. */ - groups: { - /** Description of the IdP group. */ - group_description: string; - /** ID of the IdP group. */ - group_id: string; - /** Name of the IdP group. */ - group_name: string; - }[]; + /** A description of the milestone. */ + description?: string; + /** The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + due_on?: string; + /** + * The state of the milestone. Either \`open\` or \`closed\`. + * @default "open" + */ + state?: "open" | "closed"; + /** The title of the milestone. */ + title?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/team-sync/group-mappings`, + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones/\${milestoneNumber}\`, method: "PATCH", body: data, type: ContentType.Json, @@ -15240,16 +29258,32 @@ export class Api extends HttpClient + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones/\${milestoneNumber}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags issues + * @name IssuesListLabelsForMilestone + * @summary List labels for issues in a milestone + * @request GET:/repos/{owner}/{repo}/milestones/{milestone_number}/labels + */ + issuesListLabelsForMilestone: ( + owner: string, + repo: string, + milestoneNumber: number, query?: { /** * Page number of the results to fetch. @@ -15264,137 +29298,137 @@ export class Api extends HttpClient - this.request({ - path: `/orgs/${org}/teams/${teamSlug}/teams`, + this.request({ + path: \`/repos/\${owner}/\${repo}/milestones/\${milestoneNumber}/labels\`, method: "GET", query: query, format: "json", ...params, }), - }; - projects = { + /** - * No description + * @description List all notifications for the current user. * - * @tags projects - * @name ProjectsGetCard - * @summary Get a project card - * @request GET:/projects/columns/cards/{card_id} + * @tags activity + * @name ActivityListRepoNotificationsForAuthenticatedUser + * @summary List repository notifications for the authenticated user + * @request GET:/repos/{owner}/{repo}/notifications */ - projectsGetCard: (cardId: number, params: RequestParams = {}) => - this.request({ - path: `/projects/columns/cards/${cardId}`, + activityListRepoNotificationsForAuthenticatedUser: ( + owner: string, + repo: string, + query?: { + /** + * If \`true\`, show notifications marked as read. + * @default false + */ + all?: boolean; + /** Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + before?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * If \`true\`, only shows notifications in which the user is directly participating or mentioned. + * @default false + */ + participating?: boolean; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "GET", + query: query, format: "json", ...params, }), /** - * No description + * @description Marks all notifications in a repository as "read" removes them from the [default view on GitHub](https://github.com/notifications). If the number of notifications is too large to complete in one request, you will receive a \`202 Accepted\` status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the [List repository notifications for the authenticated user](https://docs.github.com/rest/reference/activity#list-repository-notifications-for-the-authenticated-user) endpoint and pass the query parameter \`all=false\`. * - * @tags projects - * @name ProjectsUpdateCard - * @summary Update an existing project card - * @request PATCH:/projects/columns/cards/{card_id} + * @tags activity + * @name ActivityMarkRepoNotificationsAsRead + * @summary Mark repository notifications as read + * @request PUT:/repos/{owner}/{repo}/notifications */ - projectsUpdateCard: ( - cardId: number, + activityMarkRepoNotificationsAsRead: ( + owner: string, + repo: string, data: { - /** - * Whether or not the card is archived - * @example false - */ - archived?: boolean; - /** - * The project card's note - * @example "Update all gems" - */ - note?: string | null; + /** Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. Default: The current timestamp. */ + last_read_at?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/projects/columns/cards/${cardId}`, - method: "PATCH", + this.request({ + path: \`/repos/\${owner}/\${repo}/notifications\`, + method: "PUT", body: data, type: ContentType.Json, - format: "json", ...params, }), /** * No description * - * @tags projects - * @name ProjectsDeleteCard - * @summary Delete a project card - * @request DELETE:/projects/columns/cards/{card_id} + * @tags repos + * @name ReposGetPages + * @summary Get a GitHub Pages site + * @request GET:/repos/{owner}/{repo}/pages */ - projectsDeleteCard: (cardId: number, params: RequestParams = {}) => - this.request< - void, - | BasicError - | { - documentation_url?: string; - errors?: string[]; - message?: string; - } - >({ - path: `/projects/columns/cards/${cardId}`, - method: "DELETE", + reposGetPages: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pages\`, + method: "GET", + format: "json", ...params, }), /** - * No description + * @description Configures a GitHub Pages site. For more information, see "[About GitHub Pages](/github/working-with-github-pages/about-github-pages)." * - * @tags projects - * @name ProjectsMoveCard - * @summary Move a project card - * @request POST:/projects/columns/cards/{card_id}/moves + * @tags repos + * @name ReposCreatePagesSite + * @summary Create a GitHub Pages site + * @request POST:/repos/{owner}/{repo}/pages */ - projectsMoveCard: ( - cardId: number, + reposCreatePagesSite: ( + owner: string, + repo: string, data: { - /** - * The unique identifier of the column the card should be moved to - * @example 42 - */ - column_id?: number; - /** - * The position of the card in a column - * @pattern ^(?:top|bottom|after:\d+)$ - * @example "bottom" - */ - position: string; + /** The source branch and directory used to publish your Pages site. */ + source: { + /** The repository branch used to publish your site's source files. */ + branch: string; + /** + * The repository directory that includes the source files for the Pages site. Allowed paths are \`/\` or \`/docs\`. Default: \`/\` + * @default "/" + */ + path?: "/" | "/docs"; + }; }, params: RequestParams = {}, ) => this.request< - object, + Page, | BasicError | { - documentation_url?: string; - errors?: { - code?: string; - field?: string; - message?: string; - resource?: string; - }[]; - message?: string; + documentation_url: string; + message: string; } | ValidationError - | { - code?: string; - documentation_url?: string; - errors?: { - code?: string; - message?: string; - }[]; - message?: string; - } >({ - path: `/projects/columns/cards/${cardId}/moves`, + path: \`/repos/\${owner}/\${repo}/pages\`, method: "POST", body: data, type: ContentType.Json, @@ -15403,60 +29437,62 @@ export class Api extends HttpClient - this.request({ - path: `/projects/columns/${columnId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description + * @description Updates information for a GitHub Pages site. For more information, see "[About GitHub Pages](/github/working-with-github-pages/about-github-pages). * - * @tags projects - * @name ProjectsUpdateColumn - * @summary Update an existing project column - * @request PATCH:/projects/columns/{column_id} + * @tags repos + * @name ReposUpdateInformationAboutPagesSite + * @summary Update information about a GitHub Pages site + * @request PUT:/repos/{owner}/{repo}/pages */ - projectsUpdateColumn: ( - columnId: number, + reposUpdateInformationAboutPagesSite: ( + owner: string, + repo: string, data: { - /** - * Name of the project column - * @example "Remaining tasks" - */ - name: string; + /** Specify a custom domain for the repository. Sending a \`null\` value will remove the custom domain. For more about custom domains, see "[Using a custom domain with GitHub Pages](https://help.github.com/articles/using-a-custom-domain-with-github-pages/)." */ + cname?: string | null; + /** Configures access controls for the GitHub Pages site. If public is set to \`true\`, the site is accessible to anyone on the internet. If set to \`false\`, the site will only be accessible to users who have at least \`read\` access to the repository that published the site. This includes anyone in your Enterprise if the repository is set to \`internal\` visibility. This feature is only available to repositories in an organization on an Enterprise plan. */ + public?: boolean; + /** Update the source for the repository. Must include the branch name, and may optionally specify the subdirectory \`/docs\`. Possible values are \`"gh-pages"\`, \`"master"\`, and \`"master /docs"\`. */ + source: + | "gh-pages" + | "master" + | "master /docs" + | { + /** The repository branch used to publish your site's source files. */ + branch: string; + /** The repository directory that includes the source files for the Pages site. Allowed paths are \`/\` or \`/docs\`. */ + path: "/" | "/docs"; + }; }, params: RequestParams = {}, ) => - this.request({ - path: `/projects/columns/${columnId}`, - method: "PATCH", + this.request({ + path: \`/repos/\${owner}/\${repo}/pages\`, + method: "PUT", body: data, type: ContentType.Json, - format: "json", ...params, }), /** * No description * - * @tags projects - * @name ProjectsDeleteColumn - * @summary Delete a project column - * @request DELETE:/projects/columns/{column_id} + * @tags repos + * @name ReposDeletePagesSite + * @summary Delete a GitHub Pages site + * @request DELETE:/repos/{owner}/{repo}/pages */ - projectsDeleteColumn: (columnId: number, params: RequestParams = {}) => - this.request({ - path: `/projects/columns/${columnId}`, + reposDeletePagesSite: (owner: string, repo: string, params: RequestParams = {}) => + this.request< + void, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/pages\`, method: "DELETE", ...params, }), @@ -15464,19 +29500,15 @@ export class Api extends HttpClient extends HttpClient - this.request({ - path: `/projects/columns/${columnId}/cards`, + this.request({ + path: \`/repos/\${owner}/\${repo}/pages/builds\`, method: "GET", query: query, format: "json", @@ -15499,55 +29531,17 @@ export class Api extends HttpClient - this.request< - ProjectCard, - | BasicError - | (ValidationError | ValidationErrorSimple) - | { - code?: string; - documentation_url?: string; - errors?: { - code?: string; - message?: string; - }[]; - message?: string; - } - >({ - path: `/projects/columns/${columnId}/cards`, + reposRequestPagesBuild: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pages/builds\`, method: "POST", - body: data, - type: ContentType.Json, format: "json", ...params, }), @@ -15555,142 +29549,47 @@ export class Api extends HttpClient - this.request({ - path: `/projects/columns/${columnId}/moves`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Gets a project by its `id`. Returns a `404 Not Found` status if projects are disabled. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned. - * - * @tags projects - * @name ProjectsGet - * @summary Get a project - * @request GET:/projects/{project_id} - */ - projectsGet: (projectId: number, params: RequestParams = {}) => - this.request({ - path: `/projects/${projectId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Updates a project board's information. Returns a `404 Not Found` status if projects are disabled. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned. - * - * @tags projects - * @name ProjectsUpdate - * @summary Update a project - * @request PATCH:/projects/{project_id} - */ - projectsUpdate: ( - projectId: number, - data: { - /** - * Body of the project - * @example "This project represents the sprint of the first week in January" - */ - body?: string | null; - /** - * Name of the project - * @example "Week One Sprint" - */ - name?: string; - /** The baseline permission that all organization members have on this project */ - organization_permission?: "read" | "write" | "admin" | "none"; - /** Whether or not this project can be seen by everyone. */ - private?: boolean; - /** - * State of the project; either 'open' or 'closed' - * @example "open" - */ - state?: string; - }, - params: RequestParams = {}, - ) => - this.request< - Project, - | BasicError - | { - documentation_url?: string; - errors?: string[]; - message?: string; - } - | void - | ValidationErrorSimple - >({ - path: `/projects/${projectId}`, - method: "PATCH", - body: data, - type: ContentType.Json, + * @tags repos + * @name ReposGetLatestPagesBuild + * @summary Get latest Pages build + * @request GET:/repos/{owner}/{repo}/pages/builds/latest + */ + reposGetLatestPagesBuild: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pages/builds/latest\`, + method: "GET", format: "json", ...params, }), /** - * @description Deletes a project board. Returns a `404 Not Found` status if projects are disabled. + * No description * - * @tags projects - * @name ProjectsDelete - * @summary Delete a project - * @request DELETE:/projects/{project_id} + * @tags repos + * @name ReposGetPagesBuild + * @summary Get GitHub Pages build + * @request GET:/repos/{owner}/{repo}/pages/builds/{build_id} */ - projectsDelete: (projectId: number, params: RequestParams = {}) => - this.request< - void, - | BasicError - | { - documentation_url?: string; - errors?: string[]; - message?: string; - } - >({ - path: `/projects/${projectId}`, - method: "DELETE", + reposGetPagesBuild: (owner: string, repo: string, buildId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pages/builds/\${buildId}\`, + method: "GET", + format: "json", ...params, }), /** - * @description Lists the collaborators for an organization project. For a project, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. You must be an organization owner or a project `admin` to list collaborators. + * @description Lists the projects in a repository. Returns a \`404 Not Found\` status if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a \`401 Unauthorized\` or \`410 Gone\` status is returned. * * @tags projects - * @name ProjectsListCollaborators - * @summary List project collaborators - * @request GET:/projects/{project_id}/collaborators + * @name ProjectsListForRepo + * @summary List repository projects + * @request GET:/repos/{owner}/{repo}/projects */ - projectsListCollaborators: ( - projectId: number, + projectsListForRepo: ( + owner: string, + repo: string, query?: { - /** - * Filters the collaborators by their affiliation. Can be one of: - * \* `outside`: Outside collaborators of a project that are not a member of the project's organization. - * \* `direct`: Collaborators with permissions to a project, regardless of organization membership status. - * \* `all`: All collaborators the authenticated user can see. - * @default "all" - */ - affiliation?: "outside" | "direct" | "all"; /** * Page number of the results to fetch. * @default 1 @@ -15701,19 +29600,16 @@ export class Api extends HttpClient - this.request< - SimpleUser[], - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/projects/${projectId}/collaborators`, + this.request({ + path: \`/repos/\${owner}/\${repo}/projects\`, method: "GET", query: query, format: "json", @@ -15721,100 +29617,51 @@ export class Api extends HttpClient - this.request< - void, - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/projects/${projectId}/collaborators/${username}`, - method: "PUT", + this.request({ + path: \`/repos/\${owner}/\${repo}/projects\`, + method: "POST", body: data, type: ContentType.Json, - ...params, - }), - - /** - * @description Removes a collaborator from an organization project. You must be an organization owner or a project `admin` to remove a collaborator. - * - * @tags projects - * @name ProjectsRemoveCollaborator - * @summary Remove user as a collaborator - * @request DELETE:/projects/{project_id}/collaborators/{username} - */ - projectsRemoveCollaborator: (projectId: number, username: string, params: RequestParams = {}) => - this.request< - void, - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/projects/${projectId}/collaborators/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description Returns the collaborator's permission level for an organization project. Possible values for the `permission` key: `admin`, `write`, `read`, `none`. You must be an organization owner or a project `admin` to review a user's permission level. - * - * @tags projects - * @name ProjectsGetPermissionForUser - * @summary Get project permission for a user - * @request GET:/projects/{project_id}/collaborators/{username}/permission - */ - projectsGetPermissionForUser: (projectId: number, username: string, params: RequestParams = {}) => - this.request< - RepositoryCollaboratorPermission, - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/projects/${projectId}/collaborators/${username}/permission`, - method: "GET", format: "json", ...params, }), /** - * No description + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. * - * @tags projects - * @name ProjectsListColumns - * @summary List project columns - * @request GET:/projects/{project_id}/columns + * @tags pulls + * @name PullsList + * @summary List pull requests + * @request GET:/repos/{owner}/{repo}/pulls */ - projectsListColumns: ( - projectId: number, + pullsList: ( + owner: string, + repo: string, query?: { + /** Filter pulls by base branch name. Example: \`gh-pages\`. */ + base?: string; + /** The direction of the sort. Can be either \`asc\` or \`desc\`. Default: \`desc\` when sort is \`created\` or sort is not specified, otherwise \`asc\`. */ + direction?: "asc" | "desc"; + /** Filter pulls by head user or head organization and branch name in the format of \`user:ref-name\` or \`organization:ref-name\`. For example: \`github:new-script-format\` or \`octocat:test-branch\`. */ + head?: string; /** * Page number of the results to fetch. * @default 1 @@ -15825,11 +29672,21 @@ export class Api extends HttpClient - this.request({ - path: `/projects/${projectId}/columns`, + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "GET", query: query, format: "json", @@ -15837,169 +29694,121 @@ export class Api extends HttpClient - this.request({ - path: `/projects/${projectId}/columns`, + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "POST", body: data, type: ContentType.Json, format: "json", ...params, }), - }; - rateLimit = { + /** - * @description **Note:** Accessing this endpoint does not count against your REST API rate limit. **Note:** The `rate` object is deprecated. If you're writing new API client code or updating existing code, you should use the `core` object instead of the `rate` object. The `core` object contains the same information that is present in the `rate` object. + * @description Lists review comments for all pull requests in a repository. By default, review comments are in ascending order by ID. * - * @tags rate-limit - * @name RateLimitGet - * @summary Get rate limit status for the authenticated user - * @request GET:/rate_limit + * @tags pulls + * @name PullsListReviewCommentsForRepo + * @summary List review comments in a repository + * @request GET:/repos/{owner}/{repo}/pulls/comments */ - rateLimitGet: (params: RequestParams = {}) => - this.request({ - path: `/rate_limit`, + pullsListReviewCommentsForRepo: ( + owner: string, + repo: string, + query?: { + /** Can be either \`asc\` or \`desc\`. Ignored without \`sort\` parameter. */ + direction?: "asc" | "desc"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/comments\`, method: "GET", + query: query, format: "json", ...params, }), - }; - reactions = { - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Reactions API. We recommend migrating your existing code to use the new delete reactions endpoints. For more information, see this [blog post](https://developer.github.com/changes/2020-02-26-new-delete-reactions-endpoints/). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), when deleting a [team discussion](https://docs.github.com/rest/reference/teams#discussions) or [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). - * - * @tags reactions - * @name ReactionsDeleteLegacy - * @summary Delete a reaction (Legacy) - * @request DELETE:/reactions/{reaction_id} - * @deprecated - */ - reactionsDeleteLegacy: (reactionId: number, params: RequestParams = {}) => - this.request< - void, - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/reactions/${reactionId}`, - method: "DELETE", - ...params, - }), - }; - repos = { + /** - * @description When you pass the `scarlet-witch-preview` media type, requests to get a repository will also return the repository's code of conduct if it can be detected from the repository's code of conduct file. The `parent` and `source` objects are present when the repository is a fork. `parent` is the repository this repository was forked from, `source` is the ultimate source for the network. + * @description Provides details for a review comment. * - * @tags repos - * @name ReposGet - * @summary Get a repository - * @request GET:/repos/{owner}/{repo} + * @tags pulls + * @name PullsGetReviewComment + * @summary Get a review comment for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/comments/{comment_id} */ - reposGet: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}`, + pullsGetReviewComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "GET", format: "json", ...params, }), /** - * @description **Note**: To edit a repository's topics, use the [Replace all repository topics](https://docs.github.com/rest/reference/repos#replace-all-repository-topics) endpoint. + * @description Enables you to edit a review comment. * - * @tags repos - * @name ReposUpdate - * @summary Update a repository - * @request PATCH:/repos/{owner}/{repo} + * @tags pulls + * @name PullsUpdateReviewComment + * @summary Update a review comment for a pull request + * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{comment_id} */ - reposUpdate: ( + pullsUpdateReviewComment: ( owner: string, repo: string, + commentId: number, data: { - /** - * Either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits. - * @default true - */ - allow_merge_commit?: boolean; - /** - * Either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging. - * @default true - */ - allow_rebase_merge?: boolean; - /** - * Either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging. - * @default true - */ - allow_squash_merge?: boolean; - /** - * `true` to archive this repository. **Note**: You cannot unarchive repositories through the API. - * @default false - */ - archived?: boolean; - /** Updates the default branch for this repository. */ - default_branch?: string; - /** - * Either `true` to allow automatically deleting head branches when pull requests are merged, or `false` to prevent automatic deletion. - * @default false - */ - delete_branch_on_merge?: boolean; - /** A short description of the repository. */ - description?: string; - /** - * Either `true` to enable issues for this repository or `false` to disable them. - * @default true - */ - has_issues?: boolean; - /** - * Either `true` to enable projects for this repository or `false` to disable them. **Note:** If you're creating a repository in an organization that has disabled repository projects, the default is `false`, and if you pass `true`, the API returns an error. - * @default true - */ - has_projects?: boolean; - /** - * Either `true` to enable the wiki for this repository or `false` to disable it. - * @default true - */ - has_wiki?: boolean; - /** A URL with more information about the repository. */ - homepage?: string; - /** - * Either `true` to make this repo available as a template repository or `false` to prevent it. - * @default false - */ - is_template?: boolean; - /** The name of the repository. */ - name?: string; - /** - * Either `true` to make the repository private or `false` to make it public. Default: `false`. - * **Note**: You will get a `422` error if the organization restricts [changing repository visibility](https://help.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of private. **Note**: You will get a `422` error if the organization restricts [changing repository visibility](https://help.github.com/articles/repository-permission-levels-for-an-organization#changing-the-visibility-of-repositories) to organization owners and a non-owner tries to change the value of private. - * @default false - */ - private?: boolean; - /** Can be `public` or `private`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, `visibility` can also be `internal`. The `visibility` parameter overrides the `private` parameter when you use both along with the `nebula-preview` preview header. */ - visibility?: "public" | "private" | "visibility" | "internal"; + /** The text of the reply to the review comment. */ + body: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}`, + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "PATCH", body: data, type: ContentType.Json, @@ -16008,39 +29817,35 @@ export class Api extends HttpClient - this.request< - void, - | { - documentation_url?: string; - message?: string; - } - | BasicError - >({ - path: `/repos/${owner}/${repo}`, + pullsDeleteReviewComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "DELETE", ...params, }), /** - * @description Lists all artifacts for a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint. + * @description List the reactions to a [pull request review comment](https://docs.github.com/rest/reference/pulls#review-comments). * - * @tags actions - * @name ActionsListArtifactsForRepo - * @summary List artifacts for a repository - * @request GET:/repos/{owner}/{repo}/actions/artifacts + * @tags reactions + * @name ReactionsListForPullRequestReviewComment + * @summary List reactions for a pull request review comment + * @request GET:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions */ - actionsListArtifactsForRepo: ( + reactionsListForPullRequestReviewComment: ( owner: string, repo: string, + commentId: number, query?: { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a pull request review comment. */ + content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; /** * Page number of the results to fetch. * @default 1 @@ -16055,13 +29860,14 @@ export class Api extends HttpClient this.request< - { - artifacts: Artifact[]; - total_count: number; - }, - any + Reaction[], + | BasicError + | { + documentation_url: string; + message: string; + } >({ - path: `/repos/${owner}/${repo}/actions/artifacts`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}/reactions\`, method: "GET", query: query, format: "json", @@ -16069,180 +29875,271 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/actions/artifacts/${artifactId}`, - method: "GET", + reactionsCreateForPullRequestReviewComment: ( + owner: string, + repo: string, + commentId: number, + data: { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the pull request review comment. */ + content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + }, + params: RequestParams = {}, + ) => + this.request< + Reaction, + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Deletes an artifact for a workflow run. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. - * - * @tags actions - * @name ActionsDeleteArtifact - * @summary Delete an artifact - * @request DELETE:/repos/{owner}/{repo}/actions/artifacts/{artifact_id} - */ - actionsDeleteArtifact: (owner: string, repo: string, artifactId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/artifacts/${artifactId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for `Location:` in the response header to find the URL for the download. The `:archive_format` must be `zip`. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint. + * @description **Note:** You can also specify a repository by \`repository_id\` using the route \`DELETE /repositories/:repository_id/pulls/comments/:comment_id/reactions/:reaction_id.\` Delete a reaction to a [pull request review comment](https://docs.github.com/rest/reference/pulls#review-comments). * - * @tags actions - * @name ActionsDownloadArtifact - * @summary Download an artifact - * @request GET:/repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format} + * @tags reactions + * @name ReactionsDeleteForPullRequestComment + * @summary Delete a pull request comment reaction + * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} */ - actionsDownloadArtifact: ( + reactionsDeleteForPullRequestComment: ( owner: string, repo: string, - artifactId: number, - archiveFormat: string, + commentId: number, + reactionId: number, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/actions/artifacts/${artifactId}/${archiveFormat}`, - method: "GET", + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}/reactions/\${reactionId}\`, + method: "DELETE", ...params, }), /** - * @description Gets a specific job in a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint. + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists details of a pull request by providing its number. When you get, [create](https://docs.github.com/rest/reference/pulls/#create-a-pull-request), or [edit](https://docs.github.com/rest/reference/pulls#update-a-pull-request) a pull request, GitHub creates a merge commit to test whether the pull request can be automatically merged into the base branch. This test commit is not added to the base branch or the head branch. You can review the status of the test commit using the \`mergeable\` key. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". The value of the \`mergeable\` attribute can be \`true\`, \`false\`, or \`null\`. If the value is \`null\`, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-\`null\` value for the \`mergeable\` attribute in the response. If \`mergeable\` is \`true\`, then \`merge_commit_sha\` will be the SHA of the _test_ merge commit. The value of the \`merge_commit_sha\` attribute changes depending on the state of the pull request. Before merging a pull request, the \`merge_commit_sha\` attribute holds the SHA of the _test_ merge commit. After merging a pull request, the \`merge_commit_sha\` attribute changes depending on how you merged the pull request: * If merged as a [merge commit](https://help.github.com/articles/about-merge-methods-on-github/), \`merge_commit_sha\` represents the SHA of the merge commit. * If merged via a [squash](https://help.github.com/articles/about-merge-methods-on-github/#squashing-your-merge-commits), \`merge_commit_sha\` represents the SHA of the squashed commit on the base branch. * If [rebased](https://help.github.com/articles/about-merge-methods-on-github/#rebasing-and-merging-your-commits), \`merge_commit_sha\` represents the commit that the base branch was updated to. Pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats. * - * @tags actions - * @name ActionsGetJobForWorkflowRun - * @summary Get a job for a workflow run - * @request GET:/repos/{owner}/{repo}/actions/jobs/{job_id} + * @tags pulls + * @name PullsGet + * @summary Get a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number} */ - actionsGetJobForWorkflowRun: (owner: string, repo: string, jobId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/jobs/${jobId}`, + pullsGet: (owner: string, repo: string, pullNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}\`, method: "GET", format: "json", ...params, }), /** - * @description Gets a redirect URL to download a plain text file of logs for a workflow job. This link expires after 1 minute. Look for `Location:` in the response header to find the URL for the download. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint. + * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request. * - * @tags actions - * @name ActionsDownloadJobLogsForWorkflowRun - * @summary Download job logs for a workflow run - * @request GET:/repos/{owner}/{repo}/actions/jobs/{job_id}/logs + * @tags pulls + * @name PullsUpdate + * @summary Update a pull request + * @request PATCH:/repos/{owner}/{repo}/pulls/{pull_number} */ - actionsDownloadJobLogsForWorkflowRun: (owner: string, repo: string, jobId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/jobs/${jobId}/logs`, - method: "GET", + pullsUpdate: ( + owner: string, + repo: string, + pullNumber: number, + data: { + /** The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository. */ + base?: string; + /** The contents of the pull request. */ + body?: string; + /** Indicates whether [maintainers can modify](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) the pull request. */ + maintainer_can_modify?: boolean; + /** State of this Pull Request. Either \`open\` or \`closed\`. */ + state?: "open" | "closed"; + /** The title of the pull request. */ + title?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description Gets the GitHub Actions permissions policy for a repository, including whether GitHub Actions is enabled and the actions allowed to run in the repository. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `administration` repository permission to use this API. + * @description Lists all review comments for a pull request. By default, review comments are in ascending order by ID. * - * @tags actions - * @name ActionsGetGithubActionsPermissionsRepository - * @summary Get GitHub Actions permissions for a repository - * @request GET:/repos/{owner}/{repo}/actions/permissions + * @tags pulls + * @name PullsListReviewComments + * @summary List review comments on a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/comments */ - actionsGetGithubActionsPermissionsRepository: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/permissions`, + pullsListReviewComments: ( + owner: string, + repo: string, + pullNumber: number, + query?: { + /** Can be either \`asc\` or \`desc\`. Ignored without \`sort\` parameter. */ + direction?: "asc" | "desc"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * One of \`created\` (when the repository was starred) or \`updated\` (when it was last pushed to). + * @default "created" + */ + sort?: "created" | "updated"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/comments\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description Sets the GitHub Actions permissions policy for enabling GitHub Actions and allowed actions in the repository. If the repository belongs to an organization or enterprise that has set restrictive permissions at the organization or enterprise levels, such as `allowed_actions` to `selected` actions, then you cannot override them for the repository. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `administration` repository permission to use this API. + * @description Creates a review comment in the pull request diff. To add a regular comment to a pull request timeline, see "[Create an issue comment](https://docs.github.com/rest/reference/issues#create-an-issue-comment)." We recommend creating a review comment using \`line\`, \`side\`, and optionally \`start_line\` and \`start_side\` if your comment applies to more than one line in the pull request diff. You can still create a review comment using the \`position\` parameter. When you use \`position\`, the \`line\`, \`side\`, \`start_line\`, and \`start_side\` parameters are not required. For more information, see the [\`comfort-fade\` preview notice](https://docs.github.com/rest/reference/pulls#create-a-review-comment-for-a-pull-request-preview-notices). **Note:** The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. * - * @tags actions - * @name ActionsSetGithubActionsPermissionsRepository - * @summary Set GitHub Actions permissions for a repository - * @request PUT:/repos/{owner}/{repo}/actions/permissions + * @tags pulls + * @name PullsCreateReviewComment + * @summary Create a review comment for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/comments */ - actionsSetGithubActionsPermissionsRepository: ( + pullsCreateReviewComment: ( owner: string, repo: string, + pullNumber: number, data: { - /** The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. */ - allowed_actions?: AllowedActions; - /** Whether GitHub Actions is enabled on the repository. */ - enabled: ActionsEnabled; + /** The text of the review comment. */ + body: string; + /** The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the \`position\`. */ + commit_id?: string; + /** @example 2 */ + in_reply_to?: number; + /** **Required with \`comfort-fade\` preview**. The line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to. */ + line?: number; + /** The relative path to the file that necessitates a comment. */ + path: string; + /** **Required without \`comfort-fade\` preview**. The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note above. */ + position?: number; + /** **Required with \`comfort-fade\` preview**. In a split diff view, the side of the diff that the pull request's changes appear on. Can be \`LEFT\` or \`RIGHT\`. Use \`LEFT\` for deletions that appear in red. Use \`RIGHT\` for additions that appear in green or unchanged lines that appear in white and are shown for context. For a multi-line comment, side represents whether the last line of the comment range is a deletion or addition. For more information, see "[Diff view options](https://help.github.com/en/articles/about-comparing-branches-in-pull-requests#diff-view-options)" in the GitHub Help documentation. */ + side?: "LEFT" | "RIGHT"; + /** **Required when using multi-line comments**. To create multi-line comments, you must use the \`comfort-fade\` preview header. The \`start_line\` is the first line in the pull request diff that your multi-line comment applies to. To learn more about multi-line comments, see "[Commenting on a pull request](https://help.github.com/en/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)" in the GitHub Help documentation. */ + start_line?: number; + /** **Required when using multi-line comments**. To create multi-line comments, you must use the \`comfort-fade\` preview header. The \`start_side\` is the starting side of the diff that the comment applies to. Can be \`LEFT\` or \`RIGHT\`. To learn more about multi-line comments, see "[Commenting on a pull request](https://help.github.com/en/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)" in the GitHub Help documentation. See \`side\` in this table for additional context. */ + start_side?: "LEFT" | "RIGHT" | "side"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/actions/permissions`, - method: "PUT", + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/comments\`, + method: "POST", body: data, type: ContentType.Json, + format: "json", ...params, }), /** - * @description Gets the settings for selected actions that are allowed in a repository. To use this endpoint, the repository policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)." You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `administration` repository permission to use this API. + * @description Creates a reply to a review comment for a pull request. For the \`comment_id\`, provide the ID of the review comment you are replying to. This must be the ID of a _top-level review comment_, not a reply to that comment. Replies to replies are not supported. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. * - * @tags actions - * @name ActionsGetAllowedActionsRepository - * @summary Get allowed actions for a repository - * @request GET:/repos/{owner}/{repo}/actions/permissions/selected-actions + * @tags pulls + * @name PullsCreateReplyForReviewComment + * @summary Create a reply for a review comment + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies */ - actionsGetAllowedActionsRepository: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/permissions/selected-actions`, - method: "GET", + pullsCreateReplyForReviewComment: ( + owner: string, + repo: string, + pullNumber: number, + commentId: number, + data: { + /** The text of the review comment. */ + body: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/comments/\${commentId}/replies\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Sets the actions that are allowed in a repository. To use this endpoint, the repository permission policy for `allowed_actions` must be configured to `selected`. For more information, see "[Set GitHub Actions permissions for a repository](#set-github-actions-permissions-for-a-repository)." If the repository belongs to an organization or enterprise that has `selected` actions set at the organization or enterprise levels, then you cannot override any of the allowed actions settings. To use the `patterns_allowed` setting for private repositories, the repository must belong to an enterprise. If the repository does not belong to an enterprise, then the `patterns_allowed` setting only applies to public repositories. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `administration` repository permission to use this API. + * @description Lists a maximum of 250 commits for a pull request. To receive a complete commit list for pull requests with more than 250 commits, use the [List commits](https://docs.github.com/rest/reference/repos#list-commits) endpoint. * - * @tags actions - * @name ActionsSetAllowedActionsRepository - * @summary Set allowed actions for a repository - * @request PUT:/repos/{owner}/{repo}/actions/permissions/selected-actions + * @tags pulls + * @name PullsListCommits + * @summary List commits on a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/commits */ - actionsSetAllowedActionsRepository: ( + pullsListCommits: ( owner: string, repo: string, - data: SelectedActions, + pullNumber: number, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/actions/permissions/selected-actions`, - method: "PUT", - body: data, - type: ContentType.Json, + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/commits\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description Lists all self-hosted runners configured in a repository. You must authenticate using an access token with the `repo` scope to use this endpoint. + * @description **Note:** Responses include a maximum of 3000 files. The paginated response returns 30 files per page by default. * - * @tags actions - * @name ActionsListSelfHostedRunnersForRepo - * @summary List self-hosted runners for a repository - * @request GET:/repos/{owner}/{repo}/actions/runners + * @tags pulls + * @name PullsListFiles + * @summary List pull requests files + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/files */ - actionsListSelfHostedRunnersForRepo: ( + pullsListFiles: ( owner: string, repo: string, + pullNumber: number, query?: { /** * Page number of the results to fetch. @@ -16257,14 +30154,8 @@ export class Api extends HttpClient - this.request< - { - runners: Runner[]; - total_count: number; - }, - any - >({ - path: `/repos/${owner}/${repo}/actions/runners`, + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/files\`, method: "GET", query: query, format: "json", @@ -16272,107 +30163,165 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/actions/runners/downloads`, + pullsCheckIfMerged: (owner: string, repo: string, pullNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/merge\`, method: "GET", - format: "json", ...params, }), /** - * @description Returns a token that you can pass to the `config` script. The token expires after one hour. You must authenticate using an access token with the `repo` scope to use this endpoint. #### Example using registration token Configure your self-hosted runner, replacing `TOKEN` with the registration token provided by this endpoint. ``` ./config.sh --url https://github.com/octo-org/octo-repo-artifacts --token TOKEN ``` + * @description This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. * - * @tags actions - * @name ActionsCreateRegistrationTokenForRepo - * @summary Create a registration token for a repository - * @request POST:/repos/{owner}/{repo}/actions/runners/registration-token + * @tags pulls + * @name PullsMerge + * @summary Merge a pull request + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/merge */ - actionsCreateRegistrationTokenForRepo: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/runners/registration-token`, - method: "POST", + pullsMerge: ( + owner: string, + repo: string, + pullNumber: number, + data: { + /** Extra detail to append to automatic commit message. */ + commit_message?: string; + /** Title for the automatic commit message. */ + commit_title?: string; + /** Merge method to use. Possible values are \`merge\`, \`squash\` or \`rebase\`. Default is \`merge\`. */ + merge_method?: "merge" | "squash" | "rebase"; + /** SHA that pull request head must match to allow merge. */ + sha?: string; + } | null, + params: RequestParams = {}, + ) => + this.request< + PullRequestMergeResult, + | BasicError + | { + documentation_url?: string; + message?: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/merge\`, + method: "PUT", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Returns a token that you can pass to remove a self-hosted runner from a repository. The token expires after one hour. You must authenticate using an access token with the `repo` scope to use this endpoint. #### Example using remove token To remove your self-hosted runner from a repository, replace TOKEN with the remove token provided by this endpoint. ``` ./config.sh remove --token TOKEN ``` + * No description * - * @tags actions - * @name ActionsCreateRemoveTokenForRepo - * @summary Create a remove token for a repository - * @request POST:/repos/{owner}/{repo}/actions/runners/remove-token + * @tags pulls + * @name PullsListRequestedReviewers + * @summary List requested reviewers for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers */ - actionsCreateRemoveTokenForRepo: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/runners/remove-token`, - method: "POST", + pullsListRequestedReviewers: ( + owner: string, + repo: string, + pullNumber: number, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/requested_reviewers\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description Gets a specific self-hosted runner configured in a repository. You must authenticate using an access token with the `repo` scope to use this endpoint. + * @description This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. * - * @tags actions - * @name ActionsGetSelfHostedRunnerForRepo - * @summary Get a self-hosted runner for a repository - * @request GET:/repos/{owner}/{repo}/actions/runners/{runner_id} + * @tags pulls + * @name PullsRequestReviewers + * @summary Request reviewers for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers */ - actionsGetSelfHostedRunnerForRepo: (owner: string, repo: string, runnerId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/runners/${runnerId}`, - method: "GET", + pullsRequestReviewers: ( + owner: string, + repo: string, + pullNumber: number, + data: { + /** An array of user \`login\`s that will be requested. */ + reviewers?: string[]; + /** An array of team \`slug\`s that will be requested. */ + team_reviewers?: string[]; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/requested_reviewers\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Forces the removal of a self-hosted runner from a repository. You can use this endpoint to completely remove the runner when the machine you were using no longer exists. You must authenticate using an access token with the `repo` scope to use this endpoint. + * No description * - * @tags actions - * @name ActionsDeleteSelfHostedRunnerFromRepo - * @summary Delete a self-hosted runner from a repository - * @request DELETE:/repos/{owner}/{repo}/actions/runners/{runner_id} + * @tags pulls + * @name PullsRemoveRequestedReviewers + * @summary Remove requested reviewers from a pull request + * @request DELETE:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers */ - actionsDeleteSelfHostedRunnerFromRepo: ( + pullsRemoveRequestedReviewers: ( owner: string, repo: string, - runnerId: number, + pullNumber: number, + data: { + /** An array of user \`login\`s that will be removed. */ + reviewers?: string[]; + /** An array of team \`slug\`s that will be removed. */ + team_reviewers?: string[]; + }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/actions/runners/${runnerId}`, + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/requested_reviewers\`, method: "DELETE", + body: data, + type: ContentType.Json, ...params, }), /** - * @description Lists all workflow runs for a repository. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint. + * @description The list of reviews returns in chronological order. * - * @tags actions - * @name ActionsListWorkflowRunsForRepo - * @summary List workflow runs for a repository - * @request GET:/repos/{owner}/{repo}/actions/runs + * @tags pulls + * @name PullsListReviews + * @summary List reviews for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews */ - actionsListWorkflowRunsForRepo: ( + pullsListReviews: ( owner: string, repo: string, + pullNumber: number, query?: { - /** Returns someone's workflow runs. Use the login for the user who created the `push` associated with the check suite or workflow run. */ - actor?: string; - /** Returns workflow runs associated with a branch. Use the name of the branch of the `push`. */ - branch?: string; - /** Returns workflow run triggered by the event you specify. For example, `push`, `pull_request` or `issue`. For more information, see "[Events that trigger workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." */ - event?: string; /** * Page number of the results to fetch. * @default 1 @@ -16383,19 +30332,11 @@ export class Api extends HttpClient - this.request< - { - total_count: number; - workflow_runs: WorkflowRun[]; - }, - any - >({ - path: `/repos/${owner}/${repo}/actions/runs`, + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews\`, method: "GET", query: query, format: "json", @@ -16403,111 +30344,133 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/actions/runs/${runId}`, - method: "GET", + pullsCreateReview: ( + owner: string, + repo: string, + pullNumber: number, + data: { + /** **Required** when using \`REQUEST_CHANGES\` or \`COMMENT\` for the \`event\` parameter. The body text of the pull request review. */ + body?: string; + /** Use the following table to specify the location, destination, and contents of the draft review comment. */ + comments?: { + /** Text of the review comment. */ + body: string; + /** @example 28 */ + line?: number; + /** The relative path to the file that necessitates a review comment. */ + path: string; + /** The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note below. */ + position?: number; + /** @example "RIGHT" */ + side?: string; + /** @example 26 */ + start_line?: number; + /** @example "LEFT" */ + start_side?: string; + }[]; + /** The SHA of the commit that needs a review. Not using the latest commit SHA may render your review comment outdated if a subsequent commit modifies the line you specify as the \`position\`. Defaults to the most recent commit in the pull request when you do not specify a value. */ + commit_id?: string; + /** The review action you want to perform. The review actions include: \`APPROVE\`, \`REQUEST_CHANGES\`, or \`COMMENT\`. By leaving this blank, you set the review action state to \`PENDING\`, which means you will need to [submit the pull request review](https://docs.github.com/rest/reference/pulls#submit-a-review-for-a-pull-request) when you are ready. */ + event?: "APPROVE" | "REQUEST_CHANGES" | "COMMENT"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Delete a specific workflow run. Anyone with write access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:write` permission to use this endpoint. + * No description * - * @tags actions - * @name ActionsDeleteWorkflowRun - * @summary Delete a workflow run - * @request DELETE:/repos/{owner}/{repo}/actions/runs/{run_id} + * @tags pulls + * @name PullsGetReview + * @summary Get a review for a pull request + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} */ - actionsDeleteWorkflowRun: (owner: string, repo: string, runId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/runs/${runId}`, - method: "DELETE", + pullsGetReview: (owner: string, repo: string, pullNumber: number, reviewId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}\`, + method: "GET", + format: "json", ...params, }), /** - * @description Lists artifacts for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint. + * @description Update the review summary comment with new text. * - * @tags actions - * @name ActionsListWorkflowRunArtifacts - * @summary List workflow run artifacts - * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/artifacts + * @tags pulls + * @name PullsUpdateReview + * @summary Update a review for a pull request + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} */ - actionsListWorkflowRunArtifacts: ( + pullsUpdateReview: ( owner: string, repo: string, - runId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + pullNumber: number, + reviewId: number, + data: { + /** The body text of the pull request review. */ + body: string; }, params: RequestParams = {}, ) => - this.request< - { - artifacts: Artifact[]; - total_count: number; - }, - any - >({ - path: `/repos/${owner}/${repo}/actions/runs/${runId}/artifacts`, - method: "GET", - query: query, + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}\`, + method: "PUT", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Cancels a workflow run using its `id`. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. + * No description * - * @tags actions - * @name ActionsCancelWorkflowRun - * @summary Cancel a workflow run - * @request POST:/repos/{owner}/{repo}/actions/runs/{run_id}/cancel + * @tags pulls + * @name PullsDeletePendingReview + * @summary Delete a pending review for a pull request + * @request DELETE:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} */ - actionsCancelWorkflowRun: (owner: string, repo: string, runId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/runs/${runId}/cancel`, - method: "POST", + pullsDeletePendingReview: ( + owner: string, + repo: string, + pullNumber: number, + reviewId: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}\`, + method: "DELETE", + format: "json", ...params, }), /** - * @description Lists jobs for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). + * @description List comments for a specific pull request review. * - * @tags actions - * @name ActionsListJobsForWorkflowRun - * @summary List jobs for a workflow run - * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/jobs + * @tags pulls + * @name PullsListCommentsForReview + * @summary List comments for a pull request review + * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments */ - actionsListJobsForWorkflowRun: ( + pullsListCommentsForReview: ( owner: string, repo: string, - runId: number, + pullNumber: number, + reviewId: number, query?: { - /** - * Filters jobs by their `completed_at` timestamp. Can be one of: - * \* `latest`: Returns jobs from the most recent execution of the workflow run. - * \* `all`: Returns all jobs for a workflow run, including from old executions of the workflow run. - * @default "latest" - */ - filter?: "latest" | "all"; /** * Page number of the results to fetch. * @default 1 @@ -16521,14 +30484,8 @@ export class Api extends HttpClient - this.request< - { - jobs: Job[]; - total_count: number; - }, - any - >({ - path: `/repos/${owner}/${repo}/actions/runs/${runId}/jobs`, + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}/comments\`, method: "GET", query: query, format: "json", @@ -16536,75 +30493,137 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/actions/runs/${runId}/logs`, - method: "GET", + pullsDismissReview: ( + owner: string, + repo: string, + pullNumber: number, + reviewId: number, + data: { + /** @example ""APPROVE"" */ + event?: string; + /** The message for the pull request review dismissal */ + message: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}/dismissals\`, + method: "PUT", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description Deletes all logs for a workflow run. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. + * No description * - * @tags actions - * @name ActionsDeleteWorkflowRunLogs - * @summary Delete workflow run logs - * @request DELETE:/repos/{owner}/{repo}/actions/runs/{run_id}/logs + * @tags pulls + * @name PullsSubmitReview + * @summary Submit a review for a pull request + * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events */ - actionsDeleteWorkflowRunLogs: (owner: string, repo: string, runId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/runs/${runId}/logs`, - method: "DELETE", + pullsSubmitReview: ( + owner: string, + repo: string, + pullNumber: number, + reviewId: number, + data: { + /** The body text of the pull request review */ + body?: string; + /** The review action you want to perform. The review actions include: \`APPROVE\`, \`REQUEST_CHANGES\`, or \`COMMENT\`. When you leave this blank, the API returns _HTTP 422 (Unrecognizable entity)_ and sets the review action state to \`PENDING\`, which means you will need to re-submit the pull request review using a review action. */ + event: "APPROVE" | "REQUEST_CHANGES" | "COMMENT"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/reviews/\${reviewId}/events\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description Re-runs your workflow run using its `id`. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. + * @description Updates the pull request branch with the latest upstream changes by merging HEAD from the base branch into the pull request branch. * - * @tags actions - * @name ActionsReRunWorkflow - * @summary Re-run a workflow - * @request POST:/repos/{owner}/{repo}/actions/runs/{run_id}/rerun + * @tags pulls + * @name PullsUpdateBranch + * @summary Update a pull request branch + * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/update-branch */ - actionsReRunWorkflow: (owner: string, repo: string, runId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/runs/${runId}/rerun`, - method: "POST", + pullsUpdateBranch: ( + owner: string, + repo: string, + pullNumber: number, + data: { + /** The expected SHA of the pull request's HEAD ref. This is the most recent commit on the pull request's branch. If the expected SHA does not match the pull request's HEAD, you will receive a \`422 Unprocessable Entity\` status. You can use the "[List commits](https://docs.github.com/rest/reference/repos#list-commits)" endpoint to find the most recent commit SHA. Default: SHA of the pull request's current HEAD ref. */ + expected_head_sha?: string; + } | null, + params: RequestParams = {}, + ) => + this.request< + { + message?: string; + url?: string; + }, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/repos/\${owner}/\${repo}/pulls/\${pullNumber}/update-branch\`, + method: "PUT", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description Gets the number of billable minutes and total run time for a specific workflow run. Billable minutes only apply to workflows in private repositories that use GitHub-hosted runners. Usage is listed for each GitHub-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint. + * @description Gets the preferred README for a repository. READMEs support [custom media types](https://docs.github.com/rest/reference/repos#custom-media-types) for retrieving the raw content or rendered HTML. * - * @tags actions - * @name ActionsGetWorkflowRunUsage - * @summary Get workflow run usage - * @request GET:/repos/{owner}/{repo}/actions/runs/{run_id}/timing + * @tags repos + * @name ReposGetReadme + * @summary Get a repository README + * @request GET:/repos/{owner}/{repo}/readme */ - actionsGetWorkflowRunUsage: (owner: string, repo: string, runId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/runs/${runId}/timing`, + reposGetReadme: ( + owner: string, + repo: string, + query?: { + /** The name of the commit/branch/tag. Default: the repository’s default branch (usually \`master\`) */ + ref?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/readme\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description Lists all secrets available in a repository without revealing their encrypted values. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `secrets` repository permission to use this endpoint. + * @description This returns a list of releases, which does not include regular Git tags that have not been associated with a release. To get a list of Git tags, use the [Repository Tags API](https://docs.github.com/rest/reference/repos#list-repository-tags). Information about published releases are available to everyone. Only users with push access will receive listings for draft releases. * - * @tags actions - * @name ActionsListRepoSecrets - * @summary List repository secrets - * @request GET:/repos/{owner}/{repo}/actions/secrets + * @tags repos + * @name ReposListReleases + * @summary List releases + * @request GET:/repos/{owner}/{repo}/releases */ - actionsListRepoSecrets: ( + reposListReleases: ( owner: string, repo: string, query?: { @@ -16621,14 +30640,8 @@ export class Api extends HttpClient - this.request< - { - secrets: ActionsSecret[]; - total_count: number; - }, - any - >({ - path: `/repos/${owner}/${repo}/actions/secrets`, + this.request({ + path: \`/repos/\${owner}/\${repo}/releases\`, method: "GET", query: query, format: "json", @@ -16636,212 +30649,229 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/actions/secrets/public-key`, - method: "GET", + reposCreateRelease: ( + owner: string, + repo: string, + data: { + /** Text describing the contents of the tag. */ + body?: string; + /** + * \`true\` to create a draft (unpublished) release, \`false\` to create a published one. + * @default false + */ + draft?: boolean; + /** The name of the release. */ + name?: string; + /** + * \`true\` to identify the release as a prerelease. \`false\` to identify the release as a full release. + * @default false + */ + prerelease?: boolean; + /** The name of the tag. */ + tag_name: string; + /** Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually \`master\`). */ + target_commitish?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Gets a single repository secret without revealing its encrypted value. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `secrets` repository permission to use this endpoint. + * @description To download the asset's binary content, set the \`Accept\` header of the request to [\`application/octet-stream\`](https://docs.github.com/rest/overview/media-types). The API will either redirect the client to the location, or stream it directly if possible. API clients should handle both a \`200\` or \`302\` response. * - * @tags actions - * @name ActionsGetRepoSecret - * @summary Get a repository secret - * @request GET:/repos/{owner}/{repo}/actions/secrets/{secret_name} + * @tags repos + * @name ReposGetReleaseAsset + * @summary Get a release asset + * @request GET:/repos/{owner}/{repo}/releases/assets/{asset_id} */ - actionsGetRepoSecret: (owner: string, repo: string, secretName: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/secrets/${secretName}`, + reposGetReleaseAsset: (owner: string, repo: string, assetId: number, params: RequestParams = {}) => + this.request< + ReleaseAsset, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/releases/assets/\${assetId}\`, method: "GET", format: "json", ...params, }), /** - * @description Creates or updates a repository secret with an encrypted value. Encrypt your secret using [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages). You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `secrets` repository permission to use this endpoint. #### Example encrypting a secret using Node.js Encrypt your secret using the [tweetsodium](https://github.com/github/tweetsodium) library. ``` const sodium = require('tweetsodium'); const key = "base64-encoded-public-key"; const value = "plain-text-secret"; // Convert the message and key to Uint8Array's (Buffer implements that interface) const messageBytes = Buffer.from(value); const keyBytes = Buffer.from(key, 'base64'); // Encrypt using LibSodium. const encryptedBytes = sodium.seal(messageBytes, keyBytes); // Base64 the encrypted secret const encrypted = Buffer.from(encryptedBytes).toString('base64'); console.log(encrypted); ``` #### Example encrypting a secret using Python Encrypt your secret using [pynacl](https://pynacl.readthedocs.io/en/stable/public/#nacl-public-sealedbox) with Python 3. ``` from base64 import b64encode from nacl import encoding, public def encrypt(public_key: str, secret_value: str) -> str: """Encrypt a Unicode string using the public key.""" public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder()) sealed_box = public.SealedBox(public_key) encrypted = sealed_box.encrypt(secret_value.encode("utf-8")) return b64encode(encrypted).decode("utf-8") ``` #### Example encrypting a secret using C# Encrypt your secret using the [Sodium.Core](https://www.nuget.org/packages/Sodium.Core/) package. ``` var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret"); var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU="); var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey); Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox)); ``` #### Example encrypting a secret using Ruby Encrypt your secret using the [rbnacl](https://github.com/RubyCrypto/rbnacl) gem. ```ruby require "rbnacl" require "base64" key = Base64.decode64("+ZYvJDZMHUfBkJdyq5Zm9SKqeuBQ4sj+6sfjlH4CgG0=") public_key = RbNaCl::PublicKey.new(key) box = RbNaCl::Boxes::Sealed.from_public_key(public_key) encrypted_secret = box.encrypt("my_secret") # Print the base64 encoded secret puts Base64.strict_encode64(encrypted_secret) ``` + * @description Users with push access to the repository can edit a release asset. * - * @tags actions - * @name ActionsCreateOrUpdateRepoSecret - * @summary Create or update a repository secret - * @request PUT:/repos/{owner}/{repo}/actions/secrets/{secret_name} + * @tags repos + * @name ReposUpdateReleaseAsset + * @summary Update a release asset + * @request PATCH:/repos/{owner}/{repo}/releases/assets/{asset_id} */ - actionsCreateOrUpdateRepoSecret: ( + reposUpdateReleaseAsset: ( owner: string, repo: string, - secretName: string, + assetId: number, data: { - /** Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get a repository public key](https://docs.github.com/rest/reference/actions#get-a-repository-public-key) endpoint. */ - encrypted_value?: string; - /** ID of the key you used to encrypt the secret. */ - key_id?: string; + /** An alternate short description of the asset. Used in place of the filename. */ + label?: string; + /** The file name of the asset. */ + name?: string; + /** @example ""uploaded"" */ + state?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/actions/secrets/${secretName}`, - method: "PUT", + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/assets/\${assetId}\`, + method: "PATCH", body: data, type: ContentType.Json, + format: "json", ...params, }), /** - * @description Deletes a secret in a repository using the secret name. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `secrets` repository permission to use this endpoint. + * No description * - * @tags actions - * @name ActionsDeleteRepoSecret - * @summary Delete a repository secret - * @request DELETE:/repos/{owner}/{repo}/actions/secrets/{secret_name} + * @tags repos + * @name ReposDeleteReleaseAsset + * @summary Delete a release asset + * @request DELETE:/repos/{owner}/{repo}/releases/assets/{asset_id} */ - actionsDeleteRepoSecret: (owner: string, repo: string, secretName: string, params: RequestParams = {}) => + reposDeleteReleaseAsset: (owner: string, repo: string, assetId: number, params: RequestParams = {}) => this.request({ - path: `/repos/${owner}/${repo}/actions/secrets/${secretName}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${assetId}\`, method: "DELETE", ...params, }), /** - * @description Lists the workflows in a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint. + * @description View the latest published full release for the repository. The latest release is the most recent non-prerelease, non-draft release, sorted by the \`created_at\` attribute. The \`created_at\` attribute is the date of the commit used for the release, and not the date when the release was drafted or published. * - * @tags actions - * @name ActionsListRepoWorkflows - * @summary List repository workflows - * @request GET:/repos/{owner}/{repo}/actions/workflows + * @tags repos + * @name ReposGetLatestRelease + * @summary Get the latest release + * @request GET:/repos/{owner}/{repo}/releases/latest */ - actionsListRepoWorkflows: ( - owner: string, - repo: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request< - { - total_count: number; - workflows: Workflow[]; - }, - any - >({ - path: `/repos/${owner}/${repo}/actions/workflows`, + reposGetLatestRelease: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/latest\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description Gets a specific workflow. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. GitHub Apps must have the `actions:read` permission to use this endpoint. + * @description Get a published release with the specified tag. * - * @tags actions - * @name ActionsGetWorkflow - * @summary Get a workflow - * @request GET:/repos/{owner}/{repo}/actions/workflows/{workflow_id} + * @tags repos + * @name ReposGetReleaseByTag + * @summary Get a release by tag name + * @request GET:/repos/{owner}/{repo}/releases/tags/{tag} */ - actionsGetWorkflow: (owner: string, repo: string, workflowId: number | string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/workflows/${workflowId}`, + reposGetReleaseByTag: (owner: string, repo: string, tag: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/tags/\${tag}\`, method: "GET", format: "json", ...params, }), /** - * @description Disables a workflow and sets the `state` of the workflow to `disabled_manually`. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. + * @description **Note:** This returns an \`upload_url\` key corresponding to the endpoint for uploading release assets. This key is a [hypermedia resource](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia). * - * @tags actions - * @name ActionsDisableWorkflow - * @summary Disable a workflow - * @request PUT:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/disable + * @tags repos + * @name ReposGetRelease + * @summary Get a release + * @request GET:/repos/{owner}/{repo}/releases/{release_id} */ - actionsDisableWorkflow: (owner: string, repo: string, workflowId: number | string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/actions/workflows/${workflowId}/disable`, - method: "PUT", + reposGetRelease: (owner: string, repo: string, releaseId: number, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/\${releaseId}\`, + method: "GET", + format: "json", ...params, }), /** - * @description You can use this endpoint to manually trigger a GitHub Actions workflow run. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. You must configure your GitHub Actions workflow to run when the [`workflow_dispatch` webhook](/developers/webhooks-and-events/webhook-events-and-payloads#workflow_dispatch) event occurs. The `inputs` are configured in the workflow file. For more information about how to configure the `workflow_dispatch` event in the workflow file, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)." You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. For more information, see "[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line)." + * @description Users with push access to the repository can edit a release. * - * @tags actions - * @name ActionsCreateWorkflowDispatch - * @summary Create a workflow dispatch event - * @request POST:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/dispatches + * @tags repos + * @name ReposUpdateRelease + * @summary Update a release + * @request PATCH:/repos/{owner}/{repo}/releases/{release_id} */ - actionsCreateWorkflowDispatch: ( + reposUpdateRelease: ( owner: string, repo: string, - workflowId: number | string, + releaseId: number, data: { - /** Input keys and values configured in the workflow file. The maximum number of properties is 10. Any default properties configured in the workflow file will be used when `inputs` are omitted. */ - inputs?: Record; - /** The git reference for the workflow. The reference can be a branch or tag name. */ - ref: string; + /** Text describing the contents of the tag. */ + body?: string; + /** \`true\` makes the release a draft, and \`false\` publishes the release. */ + draft?: boolean; + /** The name of the release. */ + name?: string; + /** \`true\` to identify the release as a prerelease, \`false\` to identify the release as a full release. */ + prerelease?: boolean; + /** The name of the tag. */ + tag_name?: string; + /** Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually \`master\`). */ + target_commitish?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/actions/workflows/${workflowId}/dispatches`, - method: "POST", + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/\${releaseId}\`, + method: "PATCH", body: data, type: ContentType.Json, + format: "json", ...params, }), /** - * @description Enables a workflow and sets the `state` of the workflow to `active`. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. + * @description Users with push access to the repository can delete a release. * - * @tags actions - * @name ActionsEnableWorkflow - * @summary Enable a workflow - * @request PUT:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/enable + * @tags repos + * @name ReposDeleteRelease + * @summary Delete a release + * @request DELETE:/repos/{owner}/{repo}/releases/{release_id} */ - actionsEnableWorkflow: (owner: string, repo: string, workflowId: number | string, params: RequestParams = {}) => + reposDeleteRelease: (owner: string, repo: string, releaseId: number, params: RequestParams = {}) => this.request({ - path: `/repos/${owner}/${repo}/actions/workflows/${workflowId}/enable`, - method: "PUT", + path: \`/repos/\${owner}/\${repo}/releases/\${releaseId}\`, + method: "DELETE", ...params, }), /** - * @description List all workflow runs for a workflow. You can replace `workflow_id` with the workflow file name. For example, you could use `main.yaml`. You can use parameters to narrow the list of results. For more information about using parameters, see [Parameters](https://docs.github.com/rest/overview/resources-in-the-rest-api#parameters). Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the `repo` scope. + * No description * - * @tags actions - * @name ActionsListWorkflowRuns - * @summary List workflow runs - * @request GET:/repos/{owner}/{repo}/actions/workflows/{workflow_id}/runs + * @tags repos + * @name ReposListReleaseAssets + * @summary List release assets + * @request GET:/repos/{owner}/{repo}/releases/{release_id}/assets */ - actionsListWorkflowRuns: ( + reposListReleaseAssets: ( owner: string, repo: string, - workflowId: number | string, + releaseId: number, query?: { - /** Returns someone's workflow runs. Use the login for the user who created the `push` associated with the check suite or workflow run. */ - actor?: string; - /** Returns workflow runs associated with a branch. Use the name of the branch of the `push`. */ - branch?: string; - /** Returns workflow run triggered by the event you specify. For example, `push`, `pull_request` or `issue`. For more information, see "[Events that trigger workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows)." */ - event?: string; /** * Page number of the results to fetch. * @default 1 @@ -16852,19 +30882,11 @@ export class Api extends HttpClient - this.request< - { - total_count: number; - workflow_runs: WorkflowRun[]; - }, - any - >({ - path: `/repos/${owner}/${repo}/actions/workflows/${workflowId}/runs`, + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/\${releaseId}/assets\`, method: "GET", query: query, format: "json", @@ -16872,30 +30894,42 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/actions/workflows/${workflowId}/timing`, - method: "GET", + reposUploadReleaseAsset: ( + owner: string, + repo: string, + releaseId: number, + data: WebhookConfigUrl, + query?: { + label?: string; + name?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/releases/\${releaseId}/assets\`, + method: "POST", + query: query, + body: data, format: "json", ...params, }), /** - * @description Lists the [available assignees](https://help.github.com/articles/assigning-issues-and-pull-requests-to-other-github-users/) for issues in a repository. + * @description Lists all secret scanning alerts for a private repository, from newest to oldest. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the \`repo\` scope or \`security_events\` scope. GitHub Apps must have the \`secret_scanning_alerts\` read permission to use this endpoint. * - * @tags issues - * @name IssuesListAssignees - * @summary List assignees - * @request GET:/repos/{owner}/{repo}/assignees + * @tags secret-scanning + * @name SecretScanningListAlertsForRepo + * @summary List secret scanning alerts for a repository + * @request GET:/repos/{owner}/{repo}/secret-scanning/alerts */ - issuesListAssignees: ( + secretScanningListAlertsForRepo: ( owner: string, repo: string, query?: { @@ -16909,11 +30943,20 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/assignees`, + this.request< + SecretScanningAlert[], + void | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/secret-scanning/alerts\`, method: "GET", query: query, format: "json", @@ -16921,59 +30964,73 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/assignees/${assignee}`, + secretScanningGetAlert: (owner: string, repo: string, alertNumber: AlertNumber, params: RequestParams = {}) => + this.request< + SecretScanningAlert, + void | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/secret-scanning/alerts/\${alertNumber}\`, method: "GET", + format: "json", ...params, }), /** - * @description Enables automated security fixes for a repository. The authenticated user must have admin access to the repository. For more information, see "[Configuring automated security fixes](https://help.github.com/en/articles/configuring-automated-security-fixes)". - * - * @tags repos - * @name ReposEnableAutomatedSecurityFixes - * @summary Enable automated security fixes - * @request PUT:/repos/{owner}/{repo}/automated-security-fixes - */ - reposEnableAutomatedSecurityFixes: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/automated-security-fixes`, - method: "PUT", - ...params, - }), - - /** - * @description Disables automated security fixes for a repository. The authenticated user must have admin access to the repository. For more information, see "[Configuring automated security fixes](https://help.github.com/en/articles/configuring-automated-security-fixes)". + * @description Updates the status of a secret scanning alert in a private repository. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the \`repo\` scope or \`security_events\` scope. GitHub Apps must have the \`secret_scanning_alerts\` write permission to use this endpoint. * - * @tags repos - * @name ReposDisableAutomatedSecurityFixes - * @summary Disable automated security fixes - * @request DELETE:/repos/{owner}/{repo}/automated-security-fixes + * @tags secret-scanning + * @name SecretScanningUpdateAlert + * @summary Update a secret scanning alert + * @request PATCH:/repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} */ - reposDisableAutomatedSecurityFixes: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/automated-security-fixes`, - method: "DELETE", + secretScanningUpdateAlert: ( + owner: string, + repo: string, + alertNumber: AlertNumber, + data: { + /** **Required when the \`state\` is \`resolved\`.** The reason for resolving the alert. Can be one of \`false_positive\`, \`wont_fix\`, \`revoked\`, or \`used_in_tests\`. */ + resolution?: SecretScanningAlertResolution; + /** Sets the state of the secret scanning alert. Can be either \`open\` or \`resolved\`. You must provide \`resolution\` when you set the state to \`resolved\`. */ + state: SecretScanningAlertState; + }, + params: RequestParams = {}, + ) => + this.request< + SecretScanningAlert, + void | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/secret-scanning/alerts/\${alertNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** - * No description + * @description Lists the people that have starred the repository. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: * - * @tags repos - * @name ReposListBranches - * @summary List branches - * @request GET:/repos/{owner}/{repo}/branches + * @tags activity + * @name ActivityListStargazersForRepo + * @summary List stargazers + * @request GET:/repos/{owner}/{repo}/stargazers */ - reposListBranches: ( + activityListStargazersForRepo: ( owner: string, repo: string, query?: { @@ -16987,13 +31044,11 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/branches`, + this.request({ + path: \`/repos/\${owner}/\${repo}/stargazers\`, method: "GET", query: query, format: "json", @@ -17001,227 +31056,196 @@ export class Api extends HttpClient - this.request< - BranchWithProtection, - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/repos/${owner}/${repo}/branches/${branch}`, + reposGetCodeFrequencyStats: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stats/code_frequency\`, method: "GET", format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @description Returns the last year of commit activity grouped by week. The \`days\` array is a group of commits per day, starting on \`Sunday\`. * * @tags repos - * @name ReposGetBranchProtection - * @summary Get branch protection - * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection + * @name ReposGetCommitActivityStats + * @summary Get the last year of commit activity + * @request GET:/repos/{owner}/{repo}/stats/commit_activity */ - reposGetBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection`, + reposGetCommitActivityStats: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stats/commit_activity\`, method: "GET", format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Protecting a branch requires admin or owner permissions to the repository. **Note**: Passing new arrays of `users` and `teams` replaces their previous values. **Note**: The list of users, apps, and teams in total is limited to 100 items. + * @description Returns the \`total\` number of commits authored by the contributor. In addition, the response includes a Weekly Hash (\`weeks\` array) with the following information: * \`w\` - Start of the week, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). * \`a\` - Number of additions * \`d\` - Number of deletions * \`c\` - Number of commits * * @tags repos - * @name ReposUpdateBranchProtection - * @summary Update branch protection - * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection + * @name ReposGetContributorsStats + * @summary Get all contributor commit activity + * @request GET:/repos/{owner}/{repo}/stats/contributors */ - reposUpdateBranchProtection: ( - owner: string, - repo: string, - branch: string, - data: { - /** Allows deletion of the protected branch by anyone with write access to the repository. Set to `false` to prevent deletion of the protected branch. Default: `false`. For more information, see "[Enabling force pushes to a protected branch](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)" in the GitHub Help documentation. */ - allow_deletions?: boolean; - /** Permits force pushes to the protected branch by anyone with write access to the repository. Set to `true` to allow force pushes. Set to `false` or `null` to block force pushes. Default: `false`. For more information, see "[Enabling force pushes to a protected branch](https://help.github.com/en/github/administering-a-repository/enabling-force-pushes-to-a-protected-branch)" in the GitHub Help documentation." */ - allow_force_pushes?: boolean | null; - /** Enforce all configured restrictions for administrators. Set to `true` to enforce required status checks for repository administrators. Set to `null` to disable. */ - enforce_admins: boolean | null; - /** Enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch. Set to `true` to enforce a linear commit history. Set to `false` to disable a linear commit Git history. Your repository must allow squash merging or rebase merging before you can enable a linear commit history. Default: `false`. For more information, see "[Requiring a linear commit history](https://help.github.com/github/administering-a-repository/requiring-a-linear-commit-history)" in the GitHub Help documentation. */ - required_linear_history?: boolean; - /** Require at least one approving review on a pull request, before merging. Set to `null` to disable. */ - required_pull_request_reviews: { - /** Set to `true` if you want to automatically dismiss approving reviews when someone pushes a new commit. */ - dismiss_stale_reviews?: boolean; - /** Specify which users and teams can dismiss pull request reviews. Pass an empty `dismissal_restrictions` object to disable. User and team `dismissal_restrictions` are only available for organization-owned repositories. Omit this parameter for personal repositories. */ - dismissal_restrictions?: { - /** The list of team `slug`s with dismissal access */ - teams?: string[]; - /** The list of user `login`s with dismissal access */ - users?: string[]; - }; - /** Blocks merging pull requests until [code owners](https://help.github.com/articles/about-code-owners/) review them. */ - require_code_owner_reviews?: boolean; - /** Specify the number of reviewers required to approve pull requests. Use a number between 1 and 6. */ - required_approving_review_count?: number; - } | null; - /** Require status checks to pass before merging. Set to `null` to disable. */ - required_status_checks: { - /** The list of status checks to require in order to merge into this branch */ - contexts: string[]; - /** Require branches to be up to date before merging. */ - strict: boolean; - } | null; - /** Restrict who can push to the protected branch. User, app, and team `restrictions` are only available for organization-owned repositories. Set to `null` to disable. */ - restrictions: { - /** The list of app `slug`s with push access */ - apps?: string[]; - /** The list of team `slug`s with push access */ - teams: string[]; - /** The list of user `login`s with push access */ - users: string[]; - } | null; - }, - params: RequestParams = {}, - ) => - this.request< - ProtectedBranch, - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationErrorSimple - >({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection`, - method: "PUT", - body: data, - type: ContentType.Json, + reposGetContributorsStats: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stats/contributors\`, + method: "GET", format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @description Returns the total commit counts for the \`owner\` and total commit counts in \`all\`. \`all\` is everyone combined, including the \`owner\` in the last 52 weeks. If you'd like to get the commit counts for non-owners, you can subtract \`owner\` from \`all\`. The array order is oldest week (index 0) to most recent week. * * @tags repos - * @name ReposDeleteBranchProtection - * @summary Delete branch protection - * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection - */ - reposDeleteBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection`, - method: "DELETE", + * @name ReposGetParticipationStats + * @summary Get the weekly commit count + * @request GET:/repos/{owner}/{repo}/stats/participation + */ + reposGetParticipationStats: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stats/participation\`, + method: "GET", + format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @description Each array contains the day number, hour number, and number of commits: * \`0-6\`: Sunday - Saturday * \`0-23\`: Hour of day * Number of commits For example, \`[2, 14, 25]\` indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits. * * @tags repos - * @name ReposGetAdminBranchProtection - * @summary Get admin branch protection - * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + * @name ReposGetPunchCardStats + * @summary Get the hourly commit count for each day + * @request GET:/repos/{owner}/{repo}/stats/punch_card */ - reposGetAdminBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/enforce_admins`, + reposGetPunchCardStats: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/stats/punch_card\`, method: "GET", format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Adding admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled. + * @description Users with push access in a repository can create commit statuses for a given SHA. Note: there is a limit of 1000 statuses per \`sha\` and \`context\` within a repository. Attempts to create more than 1000 statuses will result in a validation error. * * @tags repos - * @name ReposSetAdminBranchProtection - * @summary Set admin branch protection - * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + * @name ReposCreateCommitStatus + * @summary Create a commit status + * @request POST:/repos/{owner}/{repo}/statuses/{sha} */ - reposSetAdminBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/enforce_admins`, + reposCreateCommitStatus: ( + owner: string, + repo: string, + sha: string, + data: { + /** + * A string label to differentiate this status from the status of other systems. This field is case-insensitive. + * @default "default" + */ + context?: string; + /** A short description of the status. */ + description?: string; + /** The state of the status. Can be one of \`error\`, \`failure\`, \`pending\`, or \`success\`. */ + state: "error" | "failure" | "pending" | "success"; + /** + * The target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the source of the status. + * For example, if your continuous integration system is posting build status, you would want to provide the deep link for the build output for this specific SHA: + * \`http://ci.example.com/user/repo/build/sha\` + */ + target_url?: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/statuses/\${sha}\`, method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removing admin enforcement requires admin or owner permissions to the repository and branch protection to be enabled. + * @description Lists the people watching the specified repository. * - * @tags repos - * @name ReposDeleteAdminBranchProtection - * @summary Delete admin branch protection - * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/enforce_admins + * @tags activity + * @name ActivityListWatchersForRepo + * @summary List watchers + * @request GET:/repos/{owner}/{repo}/subscribers */ - reposDeleteAdminBranchProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/enforce_admins`, - method: "DELETE", + activityListWatchersForRepo: ( + owner: string, + repo: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/subscribers\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * No description * - * @tags repos - * @name ReposGetPullRequestReviewProtection - * @summary Get pull request review protection - * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + * @tags activity + * @name ActivityGetRepoSubscription + * @summary Get a repository subscription + * @request GET:/repos/{owner}/{repo}/subscription */ - reposGetPullRequestReviewProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_pull_request_reviews`, + activityGetRepoSubscription: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "GET", format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Updating pull request review enforcement requires admin or owner permissions to the repository and branch protection to be enabled. **Note**: Passing new arrays of `users` and `teams` replaces their previous values. + * @description If you would like to watch a repository, set \`subscribed\` to \`true\`. If you would like to ignore notifications made within a repository, set \`ignored\` to \`true\`. If you would like to stop watching a repository, [delete the repository's subscription](https://docs.github.com/rest/reference/activity#delete-a-repository-subscription) completely. * - * @tags repos - * @name ReposUpdatePullRequestReviewProtection - * @summary Update pull request review protection - * @request PATCH:/repos/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews + * @tags activity + * @name ActivitySetRepoSubscription + * @summary Set a repository subscription + * @request PUT:/repos/{owner}/{repo}/subscription */ - reposUpdatePullRequestReviewProtection: ( + activitySetRepoSubscription: ( owner: string, repo: string, - branch: string, data: { - /** Set to `true` if you want to automatically dismiss approving reviews when someone pushes a new commit. */ - dismiss_stale_reviews?: boolean; - /** Specify which users and teams can dismiss pull request reviews. Pass an empty `dismissal_restrictions` object to disable. User and team `dismissal_restrictions` are only available for organization-owned repositories. Omit this parameter for personal repositories. */ - dismissal_restrictions?: { - /** The list of team `slug`s with dismissal access */ - teams?: string[]; - /** The list of user `login`s with dismissal access */ - users?: string[]; - }; - /** Blocks merging pull requests until [code owners](https://help.github.com/articles/about-code-owners/) have reviewed. */ - require_code_owner_reviews?: boolean; - /** Specifies the number of reviewers required to approve pull requests. Use a number between 1 and 6. */ - required_approving_review_count?: number; + /** Determines if all notifications should be blocked from this repository. */ + ignored?: boolean; + /** Determines if notifications should be received from this repository. */ + subscribed?: boolean; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_pull_request_reviews`, - method: "PATCH", + this.request({ + path: \`/repos/\${owner}/\${repo}/subscription\`, + method: "PUT", body: data, type: ContentType.Json, format: "json", @@ -17229,106 +31253,152 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_pull_request_reviews`, + activityDeleteRepoSubscription: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "DELETE", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to check whether a branch requires signed commits. An enabled status of `true` indicates you must sign commits on this branch. For more information, see [Signing commits with GPG](https://help.github.com/articles/signing-commits-with-gpg) in GitHub Help. **Note**: You must enable branch protection to require signed commits. + * No description * * @tags repos - * @name ReposGetCommitSignatureProtection - * @summary Get commit signature protection - * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + * @name ReposListTags + * @summary List repository tags + * @request GET:/repos/{owner}/{repo}/tags */ - reposGetCommitSignatureProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_signatures`, + reposListTags: ( + owner: string, + repo: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/tags\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits. + * @description Gets a redirect URL to download a tar archive for a repository. If you omit \`:ref\`, the repository’s default branch (usually \`master\`) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use the \`Location\` header to make a second \`GET\` request. **Note**: For private repositories, these links are temporary and expire after five minutes. * * @tags repos - * @name ReposCreateCommitSignatureProtection - * @summary Create commit signature protection - * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + * @name ReposDownloadTarballArchive + * @summary Download a repository archive (tar) + * @request GET:/repos/{owner}/{repo}/tarball/{ref} */ - reposCreateCommitSignatureProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_signatures`, - method: "POST", - format: "json", + reposDownloadTarballArchive: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/tarball/\${ref}\`, + method: "GET", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. When authenticated with admin or owner permissions to the repository, you can use this endpoint to disable required signed commits on a branch. You must enable branch protection to require signed commits. + * No description * * @tags repos - * @name ReposDeleteCommitSignatureProtection - * @summary Delete commit signature protection - * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_signatures + * @name ReposListTeams + * @summary List repository teams + * @request GET:/repos/{owner}/{repo}/teams */ - reposDeleteCommitSignatureProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_signatures`, - method: "DELETE", + reposListTeams: ( + owner: string, + repo: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/teams\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * No description * * @tags repos - * @name ReposGetStatusChecksProtection - * @summary Get status checks protection - * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + * @name ReposGetAllTopics + * @summary Get all repository topics + * @request GET:/repos/{owner}/{repo}/topics */ - reposGetStatusChecksProtection: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_status_checks`, + reposGetAllTopics: (owner: string, repo: string, params: RequestParams = {}) => + this.request< + Topic, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/repos/\${owner}/\${repo}/topics\`, method: "GET", format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Updating required status checks requires admin or owner permissions to the repository and branch protection to be enabled. + * No description * * @tags repos - * @name ReposUpdateStatusCheckProtection - * @summary Update status check protection - * @request PATCH:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks + * @name ReposReplaceAllTopics + * @summary Replace all repository topics + * @request PUT:/repos/{owner}/{repo}/topics */ - reposUpdateStatusCheckProtection: ( + reposReplaceAllTopics: ( owner: string, repo: string, - branch: string, data: { - /** The list of status checks to require in order to merge into this branch */ - contexts?: string[]; - /** Require branches to be up to date before merging. */ - strict?: boolean; + /** An array of topics to add to the repository. Pass one or more topics to _replace_ the set of existing topics. Send an empty array (\`[]\`) to clear all topics from the repository. **Note:** Topic \`names\` cannot contain uppercase letters. */ + names: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_status_checks`, - method: "PATCH", + this.request< + Topic, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationErrorSimple + >({ + path: \`/repos/\${owner}/\${repo}/topics\`, + method: "PUT", body: data, type: ContentType.Json, format: "json", @@ -17336,111 +31406,115 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_status_checks`, - method: "DELETE", + reposGetClones: ( + owner: string, + repo: string, + query?: { + /** + * Must be one of: \`day\`, \`week\`. + * @default "day" + */ + per?: "day" | "week"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/repos/\${owner}/\${repo}/traffic/clones\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @description Get the top 10 popular contents over the last 14 days. * * @tags repos - * @name ReposGetAllStatusCheckContexts - * @summary Get all status check contexts - * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + * @name ReposGetTopPaths + * @summary Get top referral paths + * @request GET:/repos/{owner}/{repo}/traffic/popular/paths */ - reposGetAllStatusCheckContexts: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_status_checks/contexts`, + reposGetTopPaths: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/traffic/popular/paths\`, method: "GET", format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @description Get the top 10 referrers over the last 14 days. * * @tags repos - * @name ReposAddStatusCheckContexts - * @summary Add status check contexts - * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + * @name ReposGetTopReferrers + * @summary Get top referral sources + * @request GET:/repos/{owner}/{repo}/traffic/popular/referrers */ - reposAddStatusCheckContexts: ( - owner: string, - repo: string, - branch: string, - data: { - /** contexts parameter */ - contexts: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_status_checks/contexts`, - method: "POST", - body: data, - type: ContentType.Json, + reposGetTopReferrers: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/traffic/popular/referrers\`, + method: "GET", format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @description Get the total number of views and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday. * * @tags repos - * @name ReposSetStatusCheckContexts - * @summary Set status check contexts - * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + * @name ReposGetViews + * @summary Get page views + * @request GET:/repos/{owner}/{repo}/traffic/views */ - reposSetStatusCheckContexts: ( + reposGetViews: ( owner: string, repo: string, - branch: string, - data: { - /** contexts parameter */ - contexts: string[]; + query?: { + /** + * Must be one of: \`day\`, \`week\`. + * @default "day" + */ + per?: "day" | "week"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_status_checks/contexts`, - method: "PUT", - body: data, - type: ContentType.Json, + this.request({ + path: \`/repos/\${owner}/\${repo}/traffic/views\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @description A transfer request will need to be accepted by the new owner when transferring a personal repository to another user. The response will contain the original \`owner\`, and the transfer will continue asynchronously. For more details on the requirements to transfer personal and organization-owned repositories, see [about repository transfers](https://help.github.com/articles/about-repository-transfers/). * * @tags repos - * @name ReposRemoveStatusCheckContexts - * @summary Remove status check contexts - * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks/contexts + * @name ReposTransfer + * @summary Transfer a repository + * @request POST:/repos/{owner}/{repo}/transfer */ - reposRemoveStatusCheckContexts: ( + reposTransfer: ( owner: string, repo: string, - branch: string, data: { - /** contexts parameter */ - contexts: string[]; + /** The username or organization name the repository will be transferred to. */ + new_owner: string; + /** ID of the team or teams to add to the repository. Teams can only be added to organization-owned repositories. */ + team_ids?: number[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/required_status_checks/contexts`, - method: "DELETE", + this.request({ + path: \`/repos/\${owner}/\${repo}/transfer\`, + method: "POST", body: data, type: ContentType.Json, format: "json", @@ -17448,132 +31522,181 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions`, + reposCheckVulnerabilityAlerts: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/vulnerability-alerts\`, method: "GET", - format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Disables the ability to restrict who can push to this branch. + * @description Enables dependency alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "[About security alerts for vulnerable dependencies](https://help.github.com/en/articles/about-security-alerts-for-vulnerable-dependencies)". * * @tags repos - * @name ReposDeleteAccessRestrictions - * @summary Delete access restrictions - * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions + * @name ReposEnableVulnerabilityAlerts + * @summary Enable vulnerability alerts + * @request PUT:/repos/{owner}/{repo}/vulnerability-alerts */ - reposDeleteAccessRestrictions: (owner: string, repo: string, branch: string, params: RequestParams = {}) => + reposEnableVulnerabilityAlerts: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/vulnerability-alerts\`, + method: "PUT", + ...params, + }), + + /** + * @description Disables dependency alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "[About security alerts for vulnerable dependencies](https://help.github.com/en/articles/about-security-alerts-for-vulnerable-dependencies)". + * + * @tags repos + * @name ReposDisableVulnerabilityAlerts + * @summary Disable vulnerability alerts + * @request DELETE:/repos/{owner}/{repo}/vulnerability-alerts + */ + reposDisableVulnerabilityAlerts: (owner: string, repo: string, params: RequestParams = {}) => this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions`, + path: \`/repos/\${owner}/\${repo}/vulnerability-alerts\`, method: "DELETE", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists the GitHub Apps that have push access to this branch. Only installed GitHub Apps with `write` access to the `contents` permission can be added as authorized actors on a protected branch. + * @description Gets a redirect URL to download a zip archive for a repository. If you omit \`:ref\`, the repository’s default branch (usually \`master\`) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use the \`Location\` header to make a second \`GET\` request. **Note**: For private repositories, these links are temporary and expire after five minutes. * * @tags repos - * @name ReposGetAppsWithAccessToProtectedBranch - * @summary Get apps with access to the protected branch - * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + * @name ReposDownloadZipballArchive + * @summary Download a repository archive (zip) + * @request GET:/repos/{owner}/{repo}/zipball/{ref} */ - reposGetAppsWithAccessToProtectedBranch: ( - owner: string, - repo: string, - branch: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/apps`, + reposDownloadZipballArchive: (owner: string, repo: string, ref: string, params: RequestParams = {}) => + this.request({ + path: \`/repos/\${owner}/\${repo}/zipball/\${ref}\`, method: "GET", - format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified apps push access for this branch. Only installed GitHub Apps with `write` access to the `contents` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | `array` | The GitHub Apps that have push access to this branch. Use the app's `slug`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @description Creates a new repository using a repository template. Use the \`template_owner\` and \`template_repo\` route parameters to specify the repository to use as the template. The authenticated user must own or be a member of an organization that owns the repository. To check if a repository is available to use as a template, get the repository's information using the [Get a repository](https://docs.github.com/rest/reference/repos#get-a-repository) endpoint and check that the \`is_template\` key is \`true\`. **OAuth scope requirements** When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include: * \`public_repo\` scope or \`repo\` scope to create a public repository * \`repo\` scope to create a private repository * * @tags repos - * @name ReposAddAppAccessRestrictions - * @summary Add app access restrictions - * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + * @name ReposCreateUsingTemplate + * @summary Create a repository using a template + * @request POST:/repos/{template_owner}/{template_repo}/generate */ - reposAddAppAccessRestrictions: ( - owner: string, - repo: string, - branch: string, + reposCreateUsingTemplate: ( + templateOwner: string, + templateRepo: string, data: { - /** apps parameter */ - apps: string[]; + /** A short description of the new repository. */ + description?: string; + /** + * Set to \`true\` to include the directory structure and files from all branches in the template repository, and not just the default branch. Default: \`false\`. + * @default false + */ + include_all_branches?: boolean; + /** The name of the new repository. */ + name: string; + /** The organization or person who will own the new repository. To create a new repository in an organization, the authenticated user must be a member of the specified organization. */ + owner?: string; + /** + * Either \`true\` to create a new private repository or \`false\` to create a new public one. + * @default false + */ + private?: boolean; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/apps`, + this.request({ + path: \`/repos/\${templateOwner}/\${templateRepo}/generate\`, method: "POST", body: data, type: ContentType.Json, format: "json", ...params, }), - + }; + repositories = { /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Replaces the list of apps that have push access to this branch. This removes all apps that previously had push access and grants push access to the new list of apps. Only installed GitHub Apps with `write` access to the `contents` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | `array` | The GitHub Apps that have push access to this branch. Use the app's `slug`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @description Lists all public repositories in the order that they were created. Note: Pagination is powered exclusively by the \`since\` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of repositories. * * @tags repos - * @name ReposSetAppAccessRestrictions - * @summary Set app access restrictions - * @request PUT:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + * @name ReposListPublic + * @summary List public repositories + * @request GET:/repositories */ - reposSetAppAccessRestrictions: ( - owner: string, - repo: string, - branch: string, - data: { - /** apps parameter */ - apps: string[]; + reposListPublic: ( + query?: { + /** A repository ID. Only return repositories with an ID greater than this ID. */ + since?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/apps`, - method: "PUT", - body: data, - type: ContentType.Json, + this.request({ + path: \`/repositories\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + }; + scim = { + /** + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * + * @tags enterprise-admin + * @name EnterpriseAdminListProvisionedGroupsEnterprise + * @summary List provisioned SCIM groups for an enterprise + * @request GET:/scim/v2/enterprises/{enterprise}/Groups + */ + enterpriseAdminListProvisionedGroupsEnterprise: ( + enterprise: string, + query?: { + /** Used for pagination: the number of results to return. */ + count?: number; + /** Used for pagination: the index of the first result to return. */ + startIndex?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of an app to push to this branch. Only installed GitHub Apps with `write` access to the `contents` permission can be added as authorized actors on a protected branch. | Type | Description | | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | | `array` | The GitHub Apps that have push access to this branch. Use the app's `slug`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Provision an enterprise group, and invite users to the group. This sends invitation emails to the email address of the invited users to join the GitHub organization that the SCIM group corresponds to. * - * @tags repos - * @name ReposRemoveAppAccessRestrictions - * @summary Remove app access restrictions - * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/apps + * @tags enterprise-admin + * @name EnterpriseAdminProvisionAndInviteEnterpriseGroup + * @summary Provision a SCIM enterprise group and invite users + * @request POST:/scim/v2/enterprises/{enterprise}/Groups */ - reposRemoveAppAccessRestrictions: ( - owner: string, - repo: string, - branch: string, + enterpriseAdminProvisionAndInviteEnterpriseGroup: ( + enterprise: string, data: { - /** apps parameter */ - apps: string[]; + /** The name of the SCIM group. This must match the GitHub organization that the group maps to. */ + displayName: string; + members?: { + /** The SCIM user ID for a user. */ + value: string; + }[]; + /** The SCIM schema URIs. */ + schemas: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/apps`, - method: "DELETE", + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups\`, + method: "POST", body: data, type: ContentType.Json, format: "json", @@ -17581,47 +31704,51 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/teams`, + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups/\${scimGroupId}\`, method: "GET", format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified teams push access for this branch. You can also give push access to child teams. | Type | Description | | ------- | ------------------------------------------------------------------------------------------------------------------------------------------ | | `array` | The teams that can have push access. Use the team's `slug`. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Replaces an existing provisioned group’s information. You must provide all the information required for the group as if you were provisioning it for the first time. Any existing group information that you don't provide will be removed, including group membership. If you want to only update a specific attribute, use the [Update an attribute for a SCIM enterprise group](#update-an-attribute-for-a-scim-enterprise-group) endpoint instead. * - * @tags repos - * @name ReposAddTeamAccessRestrictions - * @summary Add team access restrictions - * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/teams + * @tags enterprise-admin + * @name EnterpriseAdminSetInformationForProvisionedEnterpriseGroup + * @summary Set SCIM information for a provisioned enterprise group + * @request PUT:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} */ - reposAddTeamAccessRestrictions: ( - owner: string, - repo: string, - branch: string, + enterpriseAdminSetInformationForProvisionedEnterpriseGroup: ( + enterprise: string, + scimGroupId: string, data: { - /** teams parameter */ - teams: string[]; + /** The name of the SCIM group. This must match the GitHub organization that the group maps to. */ + displayName: string; + members?: { + /** The SCIM user ID for a user. */ + value: string; + }[]; + /** The SCIM schema URIs. */ + schemas: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/teams`, - method: "POST", + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups/\${scimGroupId}\`, + method: "PUT", body: data, type: ContentType.Json, format: "json", @@ -17629,26 +31756,27 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/teams`, - method: "PUT", + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups/\${scimGroupId}\`, + method: "PATCH", body: data, type: ContentType.Json, format: "json", @@ -17656,73 +31784,89 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/teams`, + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Groups/\${scimGroupId}\`, method: "DELETE", - body: data, - type: ContentType.Json, - format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists the people who have push access to this branch. + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Retrieves a paginated list of all provisioned enterprise members, including pending invitations. When a user with a SAML-provisioned external identity leaves (or is removed from) an enterprise, the account's metadata is immediately removed. However, the returned list of user accounts might not always match the organization or enterprise member list you see on GitHub. This can happen in certain cases where an external identity associated with an organization will not match an organization member: - When a user with a SCIM-provisioned external identity is removed from an enterprise, the account's metadata is preserved to allow the user to re-join the organization in the future. - When inviting a user to join an organization, you can expect to see their external identity in the results before they accept the invitation, or if the invitation is cancelled (or never accepted). - When a user is invited over SCIM, an external identity is created that matches with the invitee's email address. However, this identity is only linked to a user account when the user accepts the invitation by going through SAML SSO. The returned list of external identities can include an entry for a \`null\` user. These are unlinked SAML identities that are created when a user goes through the following Single Sign-On (SSO) process but does not sign in to their GitHub account after completing SSO: 1. The user is granted access by the IdP and is not a member of the GitHub enterprise. 1. The user attempts to access the GitHub enterprise and initiates the SAML SSO process, and is not currently signed in to their GitHub account. 1. After successfully authenticating with the SAML SSO IdP, the \`null\` external identity entry is created and the user is prompted to sign in to their GitHub account: - If the user signs in, their GitHub account is linked to this entry. - If the user does not sign in (or does not create a new account when prompted), they are not added to the GitHub enterprise, and the external identity \`null\` entry remains in place. * - * @tags repos - * @name ReposGetUsersWithAccessToProtectedBranch - * @summary Get users with access to the protected branch - * @request GET:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + * @tags enterprise-admin + * @name EnterpriseAdminListProvisionedIdentitiesEnterprise + * @summary List SCIM provisioned identities for an enterprise + * @request GET:/scim/v2/enterprises/{enterprise}/Users */ - reposGetUsersWithAccessToProtectedBranch: ( - owner: string, - repo: string, - branch: string, + enterpriseAdminListProvisionedIdentitiesEnterprise: ( + enterprise: string, + query?: { + /** Used for pagination: the number of results to return. */ + count?: number; + /** Used for pagination: the index of the first result to return. */ + startIndex?: number; + }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/users`, + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Grants the specified people push access for this branch. | Type | Description | | ------- | ----------------------------------------------------------------------------------------------------------------------------- | | `array` | Usernames for people who can have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Provision enterprise membership for a user, and send organization invitation emails to the email address. You can optionally include the groups a user will be invited to join. If you do not provide a list of \`groups\`, the user is provisioned for the enterprise, but no organization invitation emails will be sent. * - * @tags repos - * @name ReposAddUserAccessRestrictions - * @summary Add user access restrictions - * @request POST:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + * @tags enterprise-admin + * @name EnterpriseAdminProvisionAndInviteEnterpriseUser + * @summary Provision and invite a SCIM enterprise user + * @request POST:/scim/v2/enterprises/{enterprise}/Users */ - reposAddUserAccessRestrictions: ( - owner: string, - repo: string, - branch: string, + enterpriseAdminProvisionAndInviteEnterpriseUser: ( + enterprise: string, data: { - /** users parameter */ - users: string[]; + /** List of user emails. */ + emails: { + /** Whether this email address is the primary address. */ + primary: boolean; + /** The type of email address. */ + type: string; + /** The email address. */ + value: string; + }[]; + /** List of SCIM group IDs the user is a member of. */ + groups?: { + value?: string; + }[]; + name: { + /** The last name of the user. */ + familyName: string; + /** The first name of the user. */ + givenName: string; + }; + /** The SCIM schema URIs. */ + schemas: string[]; + /** The username for the user. */ + userName: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/users`, + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users\`, method: "POST", body: data, type: ContentType.Json, @@ -17731,53 +31875,66 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/users`, - method: "PUT", - body: data, - type: ContentType.Json, + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users/\${scimUserId}\`, + method: "GET", format: "json", ...params, }), /** - * @description Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Removes the ability of a user to push to this branch. | Type | Description | | ------- | --------------------------------------------------------------------------------------------------------------------------------------------- | | `array` | Usernames of the people who should no longer have push access. **Note**: The list of users, apps, and teams in total is limited to 100 items. | + * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Replaces an existing provisioned user's information. You must provide all the information required for the user as if you were provisioning them for the first time. Any existing user information that you don't provide will be removed. If you want to only update a specific attribute, use the [Update an attribute for a SCIM user](#update-an-attribute-for-an-enterprise-scim-user) endpoint instead. You must at least provide the required values for the user: \`userName\`, \`name\`, and \`emails\`. **Warning:** Setting \`active: false\` removes the user from the enterprise, deletes the external identity, and deletes the associated \`{scim_user_id}\`. * - * @tags repos - * @name ReposRemoveUserAccessRestrictions - * @summary Remove user access restrictions - * @request DELETE:/repos/{owner}/{repo}/branches/{branch}/protection/restrictions/users + * @tags enterprise-admin + * @name EnterpriseAdminSetInformationForProvisionedEnterpriseUser + * @summary Set SCIM information for a provisioned enterprise user + * @request PUT:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} */ - reposRemoveUserAccessRestrictions: ( - owner: string, - repo: string, - branch: string, + enterpriseAdminSetInformationForProvisionedEnterpriseUser: ( + enterprise: string, + scimUserId: string, data: { - /** users parameter */ - users: string[]; + /** List of user emails. */ + emails: { + /** Whether this email address is the primary address. */ + primary: boolean; + /** The type of email address. */ + type: string; + /** The email address. */ + value: string; + }[]; + /** List of SCIM group IDs the user is a member of. */ + groups?: { + value?: string; + }[]; + name: { + /** The last name of the user. */ + familyName: string; + /** The first name of the user. */ + givenName: string; + }; + /** The SCIM schema URIs. */ + schemas: string[]; + /** The username for the user. */ + userName: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/protection/restrictions/users`, - method: "DELETE", + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users/\${scimUserId}\`, + method: "PUT", body: data, type: ContentType.Json, format: "json", @@ -17785,150 +31942,27 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}/rename`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array. Creates a new check run for a specific commit in a repository. Your GitHub App must have the `checks:write` permission to create check runs. In a check suite, GitHub limits the number of check runs with the same name to 1000. Once these check runs exceed 1000, GitHub will start to automatically delete older check runs. - * - * @tags checks - * @name ChecksCreate - * @summary Create a check run - * @request POST:/repos/{owner}/{repo}/check-runs - */ - checksCreate: ( - owner: string, - repo: string, - data: ( - | { - status?: "completed"; - [key: string]: any; - } - | { - status?: "queued" | "in_progress"; - [key: string]: any; - } - ) & { - /** - * Displays a button on GitHub that can be clicked to alert your app to do additional tasks. For example, a code linting app can display a button that automatically fixes detected errors. The button created in this object is displayed after the check run completes. When a user clicks the button, GitHub sends the [`check_run.requested_action` webhook](https://docs.github.com/webhooks/event-payloads/#check_run) to your app. Each action includes a `label`, `identifier` and `description`. A maximum of three actions are accepted. See the [`actions` object](https://docs.github.com/rest/reference/checks#actions-object) description. To learn more about check runs and requested actions, see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)." To learn more about check runs and requested actions, see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)." - * @maxItems 3 - */ - actions?: { - /** - * A short explanation of what this action would do. The maximum size is 40 characters. - * @maxLength 40 - */ - description: string; - /** - * A reference for the action on the integrator's system. The maximum size is 20 characters. - * @maxLength 20 - */ - identifier: string; - /** - * The text to be displayed on a button in the web UI. The maximum size is 20 characters. - * @maxLength 20 - */ - label: string; - }[]; - /** The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - completed_at?: string; - /** - * **Required if you provide `completed_at` or a `status` of `completed`**. The final conclusion of the check. Can be one of `success`, `failure`, `neutral`, `cancelled`, `skipped`, `timed_out`, or `action_required`. When the conclusion is `action_required`, additional details should be provided on the site specified by `details_url`. - * **Note:** Providing `conclusion` will automatically set the `status` parameter to `completed`. Only GitHub can change a check run conclusion to `stale`. - */ - conclusion?: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required"; - /** The URL of the integrator's site that has the full details of the check. If the integrator does not provide this, then the homepage of the GitHub app is used. */ - details_url?: string; - /** A reference for the run on the integrator's system. */ - external_id?: string; - /** The SHA of the commit. */ - head_sha: string; - /** The name of the check. For example, "code-coverage". */ - name: string; - /** Check runs can accept a variety of data in the `output` object, including a `title` and `summary` and can optionally provide descriptive details about the run. See the [`output` object](https://docs.github.com/rest/reference/checks#output-object) description. */ - output?: { - /** - * Adds information from your analysis to specific lines of code. Annotations are visible on GitHub in the **Checks** and **Files changed** tab of the pull request. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the [Update a check run](https://docs.github.com/rest/reference/checks#update-a-check-run) endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. For details about how you can view annotations on GitHub, see "[About status checks](https://help.github.com/articles/about-status-checks#checks)". See the [`annotations` object](https://docs.github.com/rest/reference/checks#annotations-object) description for details about how to use this parameter. - * @maxItems 50 - */ - annotations?: { - /** The level of the annotation. Can be one of `notice`, `warning`, or `failure`. */ - annotation_level: "notice" | "warning" | "failure"; - /** The end column of the annotation. Annotations only support `start_column` and `end_column` on the same line. Omit this parameter if `start_line` and `end_line` have different values. */ - end_column?: number; - /** The end line of the annotation. */ - end_line: number; - /** A short description of the feedback for these lines of code. The maximum size is 64 KB. */ - message: string; - /** The path of the file to add an annotation to. For example, `assets/css/main.css`. */ - path: string; - /** Details about this annotation. The maximum size is 64 KB. */ - raw_details?: string; - /** The start column of the annotation. Annotations only support `start_column` and `end_column` on the same line. Omit this parameter if `start_line` and `end_line` have different values. */ - start_column?: number; - /** The start line of the annotation. */ - start_line: number; - /** The title that represents the annotation. The maximum size is 255 characters. */ - title?: string; - }[]; - /** Adds images to the output displayed in the GitHub pull request UI. See the [`images` object](https://docs.github.com/rest/reference/checks#images-object) description for details. */ - images?: { - /** The alternative text for the image. */ - alt: string; - /** A short image description. */ - caption?: string; - /** The full URL of the image. */ - image_url: string; - }[]; - /** - * The summary of the check run. This parameter supports Markdown. - * @maxLength 65535 - */ - summary: string; - /** - * The details of the check run. This parameter supports Markdown. - * @maxLength 65535 - */ - text?: string; - /** The title of the check run. */ - title: string; - }; - /** The time that the check run began. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - started_at?: string; - /** - * The current status. Can be one of `queued`, `in_progress`, or `completed`. - * @default "queued" - */ - status?: "queued" | "in_progress" | "completed"; + /** Array of [SCIM operations](https://tools.ietf.org/html/rfc7644#section-3.5.2). */ + Operations: object[]; + /** The SCIM schema URIs. */ + schemas: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/check-runs`, - method: "POST", + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users/\${scimUserId}\`, + method: "PATCH", body: data, type: ContentType.Json, format: "json", @@ -17936,195 +31970,173 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/check-runs/${checkRunId}`, - method: "GET", - format: "json", + enterpriseAdminDeleteUserFromEnterprise: (enterprise: string, scimUserId: string, params: RequestParams = {}) => + this.request({ + path: \`/scim/v2/enterprises/\${enterprise}/Users/\${scimUserId}\`, + method: "DELETE", ...params, }), /** - * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array. Updates a check run for a specific commit in a repository. Your GitHub App must have the `checks:write` permission to edit check runs. + * @description Retrieves a paginated list of all provisioned organization members, including pending invitations. If you provide the \`filter\` parameter, the resources for all matching provisions members are returned. When a user with a SAML-provisioned external identity leaves (or is removed from) an organization, the account's metadata is immediately removed. However, the returned list of user accounts might not always match the organization or enterprise member list you see on GitHub. This can happen in certain cases where an external identity associated with an organization will not match an organization member: - When a user with a SCIM-provisioned external identity is removed from an organization, the account's metadata is preserved to allow the user to re-join the organization in the future. - When inviting a user to join an organization, you can expect to see their external identity in the results before they accept the invitation, or if the invitation is cancelled (or never accepted). - When a user is invited over SCIM, an external identity is created that matches with the invitee's email address. However, this identity is only linked to a user account when the user accepts the invitation by going through SAML SSO. The returned list of external identities can include an entry for a \`null\` user. These are unlinked SAML identities that are created when a user goes through the following Single Sign-On (SSO) process but does not sign in to their GitHub account after completing SSO: 1. The user is granted access by the IdP and is not a member of the GitHub organization. 1. The user attempts to access the GitHub organization and initiates the SAML SSO process, and is not currently signed in to their GitHub account. 1. After successfully authenticating with the SAML SSO IdP, the \`null\` external identity entry is created and the user is prompted to sign in to their GitHub account: - If the user signs in, their GitHub account is linked to this entry. - If the user does not sign in (or does not create a new account when prompted), they are not added to the GitHub organization, and the external identity \`null\` entry remains in place. * - * @tags checks - * @name ChecksUpdate - * @summary Update a check run - * @request PATCH:/repos/{owner}/{repo}/check-runs/{check_run_id} + * @tags scim + * @name ScimListProvisionedIdentities + * @summary List SCIM provisioned identities + * @request GET:/scim/v2/organizations/{org}/Users */ - checksUpdate: ( - owner: string, - repo: string, - checkRunId: number, - data: ( - | { - status?: "completed"; - [key: string]: any; - } - | { - status?: "queued" | "in_progress"; - [key: string]: any; - } - ) & { - /** - * Possible further actions the integrator can perform, which a user may trigger. Each action includes a `label`, `identifier` and `description`. A maximum of three actions are accepted. See the [`actions` object](https://docs.github.com/rest/reference/checks#actions-object) description. To learn more about check runs and requested actions, see "[Check runs and requested actions](https://docs.github.com/rest/reference/checks#check-runs-and-requested-actions)." - * @maxItems 3 - */ - actions?: { - /** - * A short explanation of what this action would do. The maximum size is 40 characters. - * @maxLength 40 - */ - description: string; - /** - * A reference for the action on the integrator's system. The maximum size is 20 characters. - * @maxLength 20 - */ - identifier: string; - /** - * The text to be displayed on a button in the web UI. The maximum size is 20 characters. - * @maxLength 20 - */ - label: string; - }[]; - /** The time the check completed. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - completed_at?: string; + scimListProvisionedIdentities: ( + org: string, + query?: { + /** Used for pagination: the number of results to return. */ + count?: number; /** - * **Required if you provide `completed_at` or a `status` of `completed`**. The final conclusion of the check. Can be one of `success`, `failure`, `neutral`, `cancelled`, `skipped`, `timed_out`, or `action_required`. - * **Note:** Providing `conclusion` will automatically set the `status` parameter to `completed`. Only GitHub can change a check run conclusion to `stale`. + * Filters results using the equals query parameter operator (\`eq\`). You can filter results that are equal to \`id\`, \`userName\`, \`emails\`, and \`external_id\`. For example, to search for an identity with the \`userName\` Octocat, you would use this query: + * + * \`?filter=userName%20eq%20\\"Octocat\\"\`. + * + * To filter results for the identity with the email \`octocat@github.com\`, you would use this query: + * + * \`?filter=emails%20eq%20\\"octocat@github.com\\"\`. */ - conclusion?: "success" | "failure" | "neutral" | "cancelled" | "skipped" | "timed_out" | "action_required"; - /** The URL of the integrator's site that has the full details of the check. */ - details_url?: string; - /** A reference for the run on the integrator's system. */ - external_id?: string; - /** The name of the check. For example, "code-coverage". */ - name?: string; - /** Check runs can accept a variety of data in the `output` object, including a `title` and `summary` and can optionally provide descriptive details about the run. See the [`output` object](https://docs.github.com/rest/reference/checks#output-object-1) description. */ - output?: { - /** - * Adds information from your analysis to specific lines of code. Annotations are visible in GitHub's pull request UI. Annotations are visible in GitHub's pull request UI. The Checks API limits the number of annotations to a maximum of 50 per API request. To create more than 50 annotations, you have to make multiple requests to the [Update a check run](https://docs.github.com/rest/reference/checks#update-a-check-run) endpoint. Each time you update the check run, annotations are appended to the list of annotations that already exist for the check run. For details about annotations in the UI, see "[About status checks](https://help.github.com/articles/about-status-checks#checks)". See the [`annotations` object](https://docs.github.com/rest/reference/checks#annotations-object-1) description for details. - * @maxItems 50 - */ - annotations?: { - /** The level of the annotation. Can be one of `notice`, `warning`, or `failure`. */ - annotation_level: "notice" | "warning" | "failure"; - /** The end column of the annotation. Annotations only support `start_column` and `end_column` on the same line. Omit this parameter if `start_line` and `end_line` have different values. */ - end_column?: number; - /** The end line of the annotation. */ - end_line: number; - /** A short description of the feedback for these lines of code. The maximum size is 64 KB. */ - message: string; - /** The path of the file to add an annotation to. For example, `assets/css/main.css`. */ - path: string; - /** Details about this annotation. The maximum size is 64 KB. */ - raw_details?: string; - /** The start column of the annotation. Annotations only support `start_column` and `end_column` on the same line. Omit this parameter if `start_line` and `end_line` have different values. */ - start_column?: number; - /** The start line of the annotation. */ - start_line: number; - /** The title that represents the annotation. The maximum size is 255 characters. */ - title?: string; - }[]; - /** Adds images to the output displayed in the GitHub pull request UI. See the [`images` object](https://docs.github.com/rest/reference/checks#annotations-object-1) description for details. */ - images?: { - /** The alternative text for the image. */ - alt: string; - /** A short image description. */ - caption?: string; - /** The full URL of the image. */ - image_url: string; - }[]; - /** - * Can contain Markdown. - * @maxLength 65535 - */ - summary: string; - /** - * Can contain Markdown. - * @maxLength 65535 - */ - text?: string; - /** **Required**. */ - title?: string; - }; - /** This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - started_at?: string; - /** The current status. Can be one of `queued`, `in_progress`, or `completed`. */ - status?: "queued" | "in_progress" | "completed"; + filter?: string; + /** Used for pagination: the index of the first result to return. */ + startIndex?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/check-runs/${checkRunId}`, - method: "PATCH", - body: data, - type: ContentType.Json, + this.request({ + path: \`/scim/v2/organizations/\${org}/Users\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description Lists annotations for a check run using the annotation `id`. GitHub Apps must have the `checks:read` permission on a private repository or pull access to a public repository to get annotations for a check run. OAuth Apps and authenticated users must have the `repo` scope to get annotations for a check run in a private repository. + * @description Provision organization membership for a user, and send an activation email to the email address. * - * @tags checks - * @name ChecksListAnnotations - * @summary List check run annotations - * @request GET:/repos/{owner}/{repo}/check-runs/{check_run_id}/annotations + * @tags scim + * @name ScimProvisionAndInviteUser + * @summary Provision and invite a SCIM user + * @request POST:/scim/v2/organizations/{org}/Users */ - checksListAnnotations: ( - owner: string, - repo: string, - checkRunId: number, - query?: { + scimProvisionAndInviteUser: ( + org: string, + data: { + active?: boolean; /** - * Page number of the results to fetch. - * @default 1 + * The name of the user, suitable for display to end-users + * @example "Jon Doe" */ - page?: number; + displayName?: string; /** - * Results per page (max 100) - * @default 30 + * user emails + * @minItems 1 + * @example [{"value":"someone@example.com","primary":true},{"value":"another@example.com","primary":false}] */ - per_page?: number; + emails: { + primary?: boolean; + type?: string; + value: string; + }[]; + externalId?: string; + groups?: string[]; + /** @example {"givenName":"Jane","familyName":"User"} */ + name: { + familyName: string; + formatted?: string; + givenName: string; + }; + schemas?: string[]; + /** + * Configured by the admin. Could be an email, login, or username + * @example "someone@example.com" + */ + userName: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/check-runs/${checkRunId}/annotations`, + this.request({ + path: \`/scim/v2/organizations/\${org}/Users\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags scim + * @name ScimGetProvisioningInformationForUser + * @summary Get SCIM provisioning information for a user + * @request GET:/scim/v2/organizations/{org}/Users/{scim_user_id} + */ + scimGetProvisioningInformationForUser: (org: string, scimUserId: string, params: RequestParams = {}) => + this.request({ + path: \`/scim/v2/organizations/\${org}/Users/\${scimUserId}\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array and a `null` value for `head_branch`. By default, check suites are automatically created when you create a [check run](https://docs.github.com/rest/reference/checks#check-runs). You only need to use this endpoint for manually creating check suites when you've disabled automatic creation using "[Update repository preferences for check suites](https://docs.github.com/rest/reference/checks#update-repository-preferences-for-check-suites)". Your GitHub App must have the `checks:write` permission to create check suites. + * @description Replaces an existing provisioned user's information. You must provide all the information required for the user as if you were provisioning them for the first time. Any existing user information that you don't provide will be removed. If you want to only update a specific attribute, use the [Update an attribute for a SCIM user](https://docs.github.com/rest/reference/scim#update-an-attribute-for-a-scim-user) endpoint instead. You must at least provide the required values for the user: \`userName\`, \`name\`, and \`emails\`. **Warning:** Setting \`active: false\` removes the user from the organization, deletes the external identity, and deletes the associated \`{scim_user_id}\`. * - * @tags checks - * @name ChecksCreateSuite - * @summary Create a check suite - * @request POST:/repos/{owner}/{repo}/check-suites + * @tags scim + * @name ScimSetInformationForProvisionedUser + * @summary Update a provisioned organization membership + * @request PUT:/scim/v2/organizations/{org}/Users/{scim_user_id} */ - checksCreateSuite: ( - owner: string, - repo: string, + scimSetInformationForProvisionedUser: ( + org: string, + scimUserId: string, data: { - /** The sha of the head commit. */ - head_sha: string; + active?: boolean; + /** + * The name of the user, suitable for display to end-users + * @example "Jon Doe" + */ + displayName?: string; + /** + * user emails + * @minItems 1 + * @example [{"value":"someone@example.com","primary":true},{"value":"another@example.com","primary":false}] + */ + emails: { + primary?: boolean; + type?: string; + value: string; + }[]; + externalId?: string; + groups?: string[]; + /** @example {"givenName":"Jane","familyName":"User"} */ + name: { + familyName: string; + formatted?: string; + givenName: string; + }; + schemas?: string[]; + /** + * Configured by the admin. Could be an email, login, or username + * @example "someone@example.com" + */ + userName: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/check-suites`, - method: "POST", + this.request({ + path: \`/scim/v2/organizations/\${org}/Users/\${scimUserId}\`, + method: "PUT", body: data, type: ContentType.Json, format: "json", @@ -18132,32 +32144,45 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/check-suites/preferences`, + this.request({ + path: \`/scim/v2/organizations/\${org}/Users/\${scimUserId}\`, method: "PATCH", body: data, type: ContentType.Json, @@ -18166,41 +32191,36 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/check-suites/${checkSuiteId}`, - method: "GET", - format: "json", + scimDeleteUserFromOrg: (org: string, scimUserId: string, params: RequestParams = {}) => + this.request({ + path: \`/scim/v2/organizations/\${org}/Users/\${scimUserId}\`, + method: "DELETE", ...params, }), - + }; + search = { /** - * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array. Lists check runs for a check suite using its `id`. GitHub Apps must have the `checks:read` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the `repo` scope to get check runs in a private repository. + * @description Searches for query terms inside of a file. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for code, you can get text match metadata for the file **content** and file **path** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find the definition of the \`addClass\` function inside [jQuery](https://github.com/jquery/jquery) repository, your query would look something like this: \`q=addClass+in:file+language:js+repo:jquery/jquery\` This query searches for the keyword \`addClass\` within a file's contents. The query limits the search to files where the language is JavaScript in the \`jquery/jquery\` repository. #### Considerations for code search Due to the complexity of searching code, there are a few restrictions on how searches are performed: * Only the _default branch_ is considered. In most cases, this will be the \`master\` branch. * Only files smaller than 384 KB are searchable. * You must always include at least one search term when searching source code. For example, searching for [\`language:go\`](https://github.com/search?utf8=%E2%9C%93&q=language%3Ago&type=Code) is not valid, while [\`amazing language:go\`](https://github.com/search?utf8=%E2%9C%93&q=amazing+language%3Ago&type=Code) is. * - * @tags checks - * @name ChecksListForSuite - * @summary List check runs in a check suite - * @request GET:/repos/{owner}/{repo}/check-suites/{check_suite_id}/check-runs + * @tags search + * @name SearchCode + * @summary Search code + * @request GET:/search/code */ - checksListForSuite: ( - owner: string, - repo: string, - checkSuiteId: number, - query?: { - /** Returns check runs with the specified `name`. */ - check_name?: string; + searchCode: ( + query: { /** - * Filters check runs by their `completed_at` timestamp. Can be one of `latest` (returning the most recent check runs) or `all`. - * @default "latest" + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" */ - filter?: "latest" | "all"; + order?: "desc" | "asc"; /** * Page number of the results to fetch. * @default 1 @@ -18211,149 +32231,28 @@ export class Api extends HttpClient this.request< { - check_runs: CheckRun[]; + incomplete_results: boolean; + items: CodeSearchResultItem[]; total_count: number; }, - any - >({ - path: `/repos/${owner}/${repo}/check-suites/${checkSuiteId}/check-runs`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Triggers GitHub to rerequest an existing check suite, without pushing new code to a repository. This endpoint will trigger the [`check_suite` webhook](https://docs.github.com/webhooks/event-payloads/#check_suite) event with the action `rerequested`. When a check suite is `rerequested`, its `status` is reset to `queued` and the `conclusion` is cleared. To rerequest a check suite, your GitHub App must have the `checks:read` permission on a private repository or pull access to a public repository. - * - * @tags checks - * @name ChecksRerequestSuite - * @summary Rerequest a check suite - * @request POST:/repos/{owner}/{repo}/check-suites/{check_suite_id}/rerequest - */ - checksRerequestSuite: (owner: string, repo: string, checkSuiteId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/check-suites/${checkSuiteId}/rerequest`, - method: "POST", - ...params, - }), - - /** - * @description Lists all open code scanning alerts for the default branch (usually `main` or `master`). You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint. - * - * @tags code-scanning - * @name CodeScanningListAlertsForRepo - * @summary List code scanning alerts for a repository - * @request GET:/repos/{owner}/{repo}/code-scanning/alerts - */ - codeScanningListAlertsForRepo: ( - owner: string, - repo: string, - query?: { - /** Set a full Git reference to list alerts for a specific branch. The `ref` must be formatted as `refs/heads/`. */ - ref?: CodeScanningAlertRef; - /** Set to `open`, `fixed`, or `dismissed` to list code scanning alerts in a specific state. */ - state?: CodeScanningAlertState; - }, - params: RequestParams = {}, - ) => - this.request< - CodeScanningAlertCodeScanningAlertItems[], - void | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/repos/${owner}/${repo}/code-scanning/alerts`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Gets a single code scanning alert. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint. The security `alert_number` is found at the end of the security alert's URL. For example, the security alert ID for `https://github.com/Octo-org/octo-repo/security/code-scanning/88` is `88`. - * - * @tags code-scanning - * @name CodeScanningGetAlert - * @summary Get a code scanning alert - * @request GET:/repos/{owner}/{repo}/code-scanning/alerts/{alert_number} - */ - codeScanningGetAlert: (owner: string, repo: string, alertNumber: number, params: RequestParams = {}) => - this.request< - CodeScanningAlertCodeScanningAlert, - | void | BasicError + | ValidationError | { code?: string; documentation_url?: string; message?: string; } >({ - path: `/repos/${owner}/${repo}/code-scanning/alerts/${alertNumber}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Updates the status of a single code scanning alert. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` write permission to use this endpoint. - * - * @tags code-scanning - * @name CodeScanningUpdateAlert - * @summary Update a code scanning alert - * @request PATCH:/repos/{owner}/{repo}/code-scanning/alerts/{alert_number} - */ - codeScanningUpdateAlert: ( - owner: string, - repo: string, - alertNumber: AlertNumber, - data: { - /** **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`. */ - dismissed_reason?: CodeScanningAlertDismissedReason; - /** Sets the state of the code scanning alert. Can be one of `open` or `dismissed`. You must provide `dismissed_reason` when you set the state to `dismissed`. */ - state: CodeScanningAlertSetState; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/code-scanning/alerts/${alertNumber}`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List the details of recent code scanning analyses for a repository. You must use an access token with the `security_events` scope to use this endpoint. GitHub Apps must have the `security_events` read permission to use this endpoint. - * - * @tags code-scanning - * @name CodeScanningListRecentAnalyses - * @summary List recent code scanning analyses for a repository - * @request GET:/repos/{owner}/{repo}/code-scanning/analyses - */ - codeScanningListRecentAnalyses: ( - owner: string, - repo: string, - query?: { - /** Set a full Git reference to list alerts for a specific branch. The `ref` must be formatted as `refs/heads/`. */ - ref?: CodeScanningAnalysisRef; - /** Set a single code scanning tool name to filter alerts by tool. */ - tool_name?: CodeScanningAnalysisToolName; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/code-scanning/analyses`, + path: \`/search/code\`, method: "GET", query: query, format: "json", @@ -18361,68 +32260,70 @@ 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; + order?: "desc" | "asc"; /** - * 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 + * Page number of the results to fetch. + * @default 1 */ - started_at?: string; - /** The name of the tool used to generate the code scanning analysis alert. */ - tool_name: CodeScanningAnalysisToolName; + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching commits](https://help.github.com/articles/searching-commits/)" for a detailed list of qualifiers. */ + q: string; + /** Sorts the results of your query by \`author-date\` or \`committer-date\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: "author-date" | "committer-date"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/code-scanning/sarifs`, - method: "POST", - body: data, - type: ContentType.Json, + this.request< + { + incomplete_results: boolean; + items: CommitSearchResultItem[]; + total_count: number; + }, + { + documentation_url: string; + message: string; + } + >({ + path: \`/search/commits\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * @description For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners. Team members will include the members of child teams. + * @description Find issues by state and keyword. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for issues, you can get text match metadata for the issue **title**, issue **body**, and issue **comment body** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find the oldest unresolved Python bugs on Windows. Your query might look something like this. \`q=windows+label:bug+language:python+state:open&sort=created&order=asc\` This query searches for the keyword \`windows\`, within any open issue that is labeled as \`bug\`. The search runs across repositories whose primary language is Python. The results are sorted by creation date in ascending order, which means the oldest issues appear first in the search results. **Note:** For [user-to-server](https://docs.github.com/developers/apps/identifying-and-authorizing-users-for-github-apps#user-to-server-requests) GitHub App requests, you can't retrieve a combination of issues and pull requests in a single query. Requests that don't include the \`is:issue\` or \`is:pull-request\` qualifier will receive an HTTP \`422 Unprocessable Entity\` response. To get results for both issues and pull requests, you must send separate queries for issues and pull requests. For more information about the \`is\` qualifier, see "[Searching only issues or pull requests](https://docs.github.com/github/searching-for-information-on-github/searching-issues-and-pull-requests#search-only-issues-or-pull-requests)." * - * @tags repos - * @name ReposListCollaborators - * @summary List repository collaborators - * @request GET:/repos/{owner}/{repo}/collaborators + * @tags search + * @name SearchIssuesAndPullRequests + * @summary Search issues and pull requests + * @request GET:/search/issues */ - reposListCollaborators: ( - owner: string, - repo: string, - query?: { + searchIssuesAndPullRequests: ( + query: { /** - * Filter collaborators returned by their affiliation. Can be one of: - * \* `outside`: All outside collaborators of an organization-owned repository. - * \* `direct`: All collaborators with permissions to an organization-owned repository, regardless of organization membership status. - * \* `all`: All collaborators the authenticated user can see. - * @default "all" + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" */ - affiliation?: "outside" | "direct" | "all"; + order?: "desc" | "asc"; /** * Page number of the results to fetch. * @default 1 @@ -18433,11 +32334,39 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/collaborators`, + this.request< + { + incomplete_results: boolean; + items: IssueSearchResultItem[]; + total_count: number; + }, + | BasicError + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/search/issues\`, method: "GET", query: query, format: "json", @@ -18445,100 +32374,59 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/collaborators/${username}`, - method: "GET", - ...params, - }), - - /** - * @description This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. For more information the permission levels, see "[Repository permission levels for an organization](https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#permission-levels-for-repositories-owned-by-an-organization)". Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." The invitee will receive a notification that they have been invited to the repository, which they must accept or decline. They may do this via the notifications page, the email they receive, or by using the [repository invitations API endpoints](https://docs.github.com/rest/reference/repos#invitations). **Rate limits** To prevent abuse, you are limited to sending 50 invitations to a repository per 24 hour period. Note there is no limit if you are inviting organization members to an organization repository. + * @description Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for labels, you can get text match metadata for the label **name** and **description** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find labels in the \`linguist\` repository that match \`bug\`, \`defect\`, or \`enhancement\`. Your query might look like this: \`q=bug+defect+enhancement&repository_id=64778136\` The labels that best match the query appear first in the search results. * - * @tags repos - * @name ReposAddCollaborator - * @summary Add a repository collaborator - * @request PUT:/repos/{owner}/{repo}/collaborators/{username} + * @tags search + * @name SearchLabels + * @summary Search labels + * @request GET:/search/labels */ - reposAddCollaborator: ( - owner: string, - repo: string, - username: string, - data: { + searchLabels: ( + query: { /** - * The permission to grant the collaborator. **Only valid on organization-owned repositories.** Can be one of: - * \* `pull` - can pull, but not push to or administer this repository. - * \* `push` - can pull and push, but not administer this repository. - * \* `admin` - can pull, push and administer this repository. - * \* `maintain` - Recommended for project managers who need to manage the repository without access to sensitive or destructive actions. - * \* `triage` - Recommended for contributors who need to proactively manage issues and pull requests without write access. - * @default "push" + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" */ - permission?: "pull" | "push" | "admin" | "maintain" | "triage"; - /** @example ""push"" */ - permissions?: string; + order?: "desc" | "asc"; + /** The search keywords. This endpoint does not accept qualifiers in the query. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). */ + q: string; + /** The id of the repository. */ + repository_id: number; + /** Sorts the results of your query by when the label was \`created\` or \`updated\`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ + sort?: "created" | "updated"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/collaborators/${username}`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags repos - * @name ReposRemoveCollaborator - * @summary Remove a repository collaborator - * @request DELETE:/repos/{owner}/{repo}/collaborators/{username} - */ - reposRemoveCollaborator: (owner: string, repo: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/collaborators/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description Checks the repository permission of a collaborator. The possible repository permissions are `admin`, `write`, `read`, and `none`. - * - * @tags repos - * @name ReposGetCollaboratorPermissionLevel - * @summary Get repository permissions for a user - * @request GET:/repos/{owner}/{repo}/collaborators/{username}/permission - */ - reposGetCollaboratorPermissionLevel: (owner: string, repo: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/collaborators/${username}/permission`, + this.request< + { + incomplete_results: boolean; + items: LabelSearchResultItem[]; + total_count: number; + }, + BasicError | ValidationError + >({ + path: \`/search/labels\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description Commit Comments use [these custom media types](https://docs.github.com/rest/reference/repos#custom-media-types). You can read more about the use of media types in the API [here](https://docs.github.com/rest/overview/media-types/). Comments are ordered by ascending ID. + * @description Find repositories via various criteria. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for repositories, you can get text match metadata for the **name** and **description** fields when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to search for popular Tetris repositories written in assembly code, your query might look like this: \`q=tetris+language:assembly&sort=stars&order=desc\` This query searches for repositories with the word \`tetris\` in the name, the description, or the README. The results are limited to repositories where the primary language is assembly. The results are sorted by stars in descending order, so that the most popular repositories appear first in the search results. When you include the \`mercy\` preview header, you can also search for multiple topics by adding more \`topic:\` instances. For example, your query might look like this: \`q=topic:ruby+topic:rails\` * - * @tags repos - * @name ReposListCommitCommentsForRepo - * @summary List commit comments for a repository - * @request GET:/repos/{owner}/{repo}/comments + * @tags search + * @name SearchRepos + * @summary Search repositories + * @request GET:/search/repositories */ - reposListCommitCommentsForRepo: ( - owner: string, - repo: string, - query?: { + searchRepos: ( + query: { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: "desc" | "asc"; /** * Page number of the results to fetch. * @default 1 @@ -18549,11 +32437,27 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/comments`, + this.request< + { + incomplete_results: boolean; + items: RepoSearchResultItem[]; + total_count: number; + }, + | ValidationError + | { + code?: string; + documentation_url?: string; + message?: string; + } + >({ + path: \`/search/repositories\`, method: "GET", query: query, format: "json", @@ -18561,78 +32465,53 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description + * @description Find topics via various criteria. Results are sorted by best match. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). See "[Searching topics](https://help.github.com/articles/searching-topics/)" for a detailed list of qualifiers. When searching for topics, you can get text match metadata for the topic's **short\\_description**, **description**, **name**, or **display\\_name** field when you pass the \`text-match\` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to search for topics related to Ruby that are featured on https://github.com/topics. Your query might look like this: \`q=ruby+is:featured\` This query searches for topics with the keyword \`ruby\` and limits the results to find only topics that are featured. The topics that are the best match for the query appear first in the search results. * - * @tags repos - * @name ReposUpdateCommitComment - * @summary Update a commit comment - * @request PATCH:/repos/{owner}/{repo}/comments/{comment_id} + * @tags search + * @name SearchTopics + * @summary Search topics + * @request GET:/search/topics */ - reposUpdateCommitComment: ( - owner: string, - repo: string, - commentId: number, - data: { - /** The contents of the comment */ - body: string; + searchTopics: ( + query: { + /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). */ + q: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, - method: "PATCH", - body: data, - type: ContentType.Json, + this.request< + { + incomplete_results: boolean; + items: TopicSearchResultItem[]; + total_count: number; + }, + { + documentation_url: string; + message: string; + } + >({ + path: \`/search/topics\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * No description - * - * @tags repos - * @name ReposDeleteCommitComment - * @summary Delete a commit comment - * @request DELETE:/repos/{owner}/{repo}/comments/{comment_id} - */ - reposDeleteCommitComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, - method: "DELETE", - ...params, - }), - - /** - * @description List the reactions to a [commit comment](https://docs.github.com/rest/reference/repos#comments). + * @description Find users via various criteria. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for users, you can get text match metadata for the issue **login**, **email**, and **name** fields when you pass the \`text-match\` media type. For more details about highlighting search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you're looking for a list of popular users, you might try this query: \`q=tom+repos:%3E42+followers:%3E1000\` This query searches for users with the name \`tom\`. The results are restricted to users with more than 42 repositories and over 1,000 followers. * - * @tags reactions - * @name ReactionsListForCommitComment - * @summary List reactions for a commit comment - * @request GET:/repos/{owner}/{repo}/comments/{comment_id}/reactions + * @tags search + * @name SearchUsers + * @summary Search users + * @request GET:/search/users */ - reactionsListForCommitComment: ( - owner: string, - repo: string, - commentId: number, - query?: { - /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a commit comment. */ - content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + searchUsers: ( + query: { + /** + * Determines whether the first search result returned is the highest number of matches (\`desc\`) or lowest number of matches (\`asc\`). This parameter is ignored unless you provide \`sort\`. + * @default "desc" + */ + order?: "desc" | "asc"; /** * Page number of the results to fetch. * @default 1 @@ -18643,52 +32522,92 @@ export class Api extends HttpClient this.request< - Reaction[], - | BasicError + { + incomplete_results: boolean; + items: UserSearchResultItem[]; + total_count: number; + }, + | ValidationError | { - documentation_url: string; - message: string; + code?: string; + documentation_url?: string; + message?: string; } >({ - path: `/repos/${owner}/${repo}/comments/${commentId}/reactions`, + path: \`/search/users\`, method: "GET", query: query, format: "json", ...params, }), + }; + teams = { + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the [Get a team by name](https://docs.github.com/rest/reference/teams#get-a-team-by-name) endpoint. + * + * @tags teams + * @name TeamsGetLegacy + * @summary Get a team (Legacy) + * @request GET:/teams/{team_id} + * @deprecated + */ + teamsGetLegacy: (teamId: number, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}\`, + method: "GET", + format: "json", + ...params, + }), /** - * @description Create a reaction to a [commit comment](https://docs.github.com/rest/reference/repos#comments). A response with a `Status: 200 OK` means that you already added the reaction type to this commit comment. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a team](https://docs.github.com/rest/reference/teams#update-a-team) endpoint. To edit a team, the authenticated user must either be an organization owner or a team maintainer. **Note:** With nested teams, the \`privacy\` for parent teams cannot be \`secret\`. * - * @tags reactions - * @name ReactionsCreateForCommitComment - * @summary Create reaction for a commit comment - * @request POST:/repos/{owner}/{repo}/comments/{comment_id}/reactions + * @tags teams + * @name TeamsUpdateLegacy + * @summary Update a team (Legacy) + * @request PATCH:/teams/{team_id} + * @deprecated */ - reactionsCreateForCommitComment: ( - owner: string, - repo: string, - commentId: number, + teamsUpdateLegacy: ( + teamId: number, data: { - /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the commit comment. */ - content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + /** The description of the team. */ + description?: string; + /** The name of the team. */ + name: string; + /** The ID of a team to set as the parent team. */ + parent_team_id?: number | null; + /** + * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer newly-added repositories. + * \\* \`push\` - team members can pull and push, but not administer newly-added repositories. + * \\* \`admin\` - team members can pull, push and administer newly-added repositories. + * @default "pull" + */ + permission?: "pull" | "push" | "admin"; + /** + * The level of privacy this team should have. Editing teams without specifying this parameter leaves \`privacy\` intact. The options are: + * **For a non-nested team:** + * \\* \`secret\` - only visible to organization owners and members of this team. + * \\* \`closed\` - visible to all members of this organization. + * **For a parent or child team:** + * \\* \`closed\` - visible to all members of this organization. + */ + privacy?: "secret" | "closed"; }, params: RequestParams = {}, ) => - this.request< - Reaction, - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/repos/${owner}/${repo}/comments/${commentId}/reactions`, - method: "POST", + this.request({ + path: \`/teams/\${teamId}\`, + method: "PATCH", body: data, type: ContentType.Json, format: "json", @@ -18696,63 +32615,53 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}/reactions/${reactionId}`, + teamsDeleteLegacy: (teamId: number, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}\`, method: "DELETE", ...params, }), /** - * @description **Signature verification object** The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object: | Name | Type | Description | | ---- | ---- | ----------- | | `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. | | `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | `signature` | `string` | The signature that was extracted from the commit. | | `payload` | `string` | The value that was signed. | These are the possible values for `reason` in the `verification` object: | Value | Description | | ----- | ----------- | | `expired_key` | The key that made the signature is expired. | | `not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | `gpgverify_error` | There was an error communicating with the signature verification service. | | `gpgverify_unavailable` | The signature verification service is currently unavailable. | | `unsigned` | The object does not include a signature. | | `unknown_signature_type` | A non-PGP signature was found in the commit. | | `no_user` | No user was associated with the `committer` email address in the commit. | | `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. | | `unknown_key` | The key that made the signature has not been registered with any user's account. | | `malformed_signature` | There was an error parsing the signature. | | `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | `valid` | None of the above errors applied, so the signature is considered to be verified. | + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List discussions\`](https://docs.github.com/rest/reference/teams#list-discussions) endpoint. List all discussions on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags repos - * @name ReposListCommits - * @summary List commits - * @request GET:/repos/{owner}/{repo}/commits + * @tags teams + * @name TeamsListDiscussionsLegacy + * @summary List discussions (Legacy) + * @request GET:/teams/{team_id}/discussions + * @deprecated */ - reposListCommits: ( - owner: string, - repo: string, + teamsListDiscussionsLegacy: ( + teamId: number, query?: { - /** GitHub login or email address by which to filter by commit author. */ - author?: string; + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: "asc" | "desc"; /** * Page number of the results to fetch. * @default 1 */ page?: number; - /** Only commits containing this file path will be returned. */ - path?: string; /** * Results per page (max 100) * @default 30 */ per_page?: number; - /** SHA or branch to start listing commits from. Default: the repository’s default branch (usually `master`). */ - sha?: string; - /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - since?: string; - /** Only commits before this date will be returned. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - until?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/commits`, + this.request({ + path: \`/teams/\${teamId}/discussions\`, method: "GET", query: query, format: "json", @@ -18760,89 +32669,78 @@ export class Api extends HttpClient - this.request< - BranchShort[], - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/repos/${owner}/${repo}/commits/${commitSha}/branches-where-head`, - method: "GET", + teamsCreateDiscussionLegacy: ( + teamId: number, + data: { + /** The discussion post's body text. */ + body: string; + /** + * Private posts are only visible to team members, organization owners, and team maintainers. Public posts are visible to all members of the organization. Set to \`true\` to create a private post. + * @default false + */ + private?: boolean; + /** The discussion post's title. */ + title: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Use the `:commit_sha` to specify the commit that will have its comments listed. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get a discussion](https://docs.github.com/rest/reference/teams#get-a-discussion) endpoint. Get a specific discussion on a team's page. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags repos - * @name ReposListCommentsForCommit - * @summary List commit comments - * @request GET:/repos/{owner}/{repo}/commits/{commit_sha}/comments + * @tags teams + * @name TeamsGetDiscussionLegacy + * @summary Get a discussion (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number} + * @deprecated */ - reposListCommentsForCommit: ( - owner: string, - repo: string, - commitSha: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/commits/${commitSha}/comments`, + teamsGetDiscussionLegacy: (teamId: number, discussionNumber: number, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description Create a comment for a commit using its `:commit_sha`. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a discussion](https://docs.github.com/rest/reference/teams#update-a-discussion) endpoint. Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags repos - * @name ReposCreateCommitComment - * @summary Create a commit comment - * @request POST:/repos/{owner}/{repo}/commits/{commit_sha}/comments + * @tags teams + * @name TeamsUpdateDiscussionLegacy + * @summary Update a discussion (Legacy) + * @request PATCH:/teams/{team_id}/discussions/{discussion_number} + * @deprecated */ - reposCreateCommitComment: ( - owner: string, - repo: string, - commitSha: string, + teamsUpdateDiscussionLegacy: ( + teamId: number, + discussionNumber: number, data: { - /** The contents of the comment. */ - body: string; - /** **Deprecated**. Use **position** parameter instead. Line number in the file to comment on. */ - line?: number; - /** Relative path of the file to comment on. */ - path?: string; - /** Line index in the diff to comment on. */ - position?: number; + /** The discussion post's body text. */ + body?: string; + /** The discussion post's title. */ + title?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/commits/${commitSha}/comments`, - method: "POST", + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}\`, + method: "PATCH", body: data, type: ContentType.Json, format: "json", @@ -18850,18 +32748,39 @@ export class Api extends HttpClient + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [List discussion comments](https://docs.github.com/rest/reference/teams#list-discussion-comments) endpoint. List all comments on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags teams + * @name TeamsListDiscussionCommentsLegacy + * @summary List discussion comments (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments + * @deprecated + */ + teamsListDiscussionCommentsLegacy: ( + teamId: number, + discussionNumber: number, query?: { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: "asc" | "desc"; /** * Page number of the results to fetch. * @default 1 @@ -18875,14 +32794,8 @@ export class Api extends HttpClient - this.request< - PullRequestSimple[], - { - documentation_url: string; - message: string; - } - >({ - path: `/repos/${owner}/${repo}/commits/${commitSha}/pulls`, + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments\`, method: "GET", query: query, format: "json", @@ -18890,146 +32803,119 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/commits/${ref}`, - method: "GET", + teamsCreateDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + data: { + /** The discussion comment's body text. */ + body: string; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array. Lists check runs for a commit ref. The `ref` can be a SHA, branch name, or a tag name. GitHub Apps must have the `checks:read` permission on a private repository or pull access to a public repository to get check runs. OAuth Apps and authenticated users must have the `repo` scope to get check runs in a private repository. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get a discussion comment](https://docs.github.com/rest/reference/teams#get-a-discussion-comment) endpoint. Get a specific comment on a team discussion. OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags checks - * @name ChecksListForRef - * @summary List check runs for a Git reference - * @request GET:/repos/{owner}/{repo}/commits/{ref}/check-runs + * @tags teams + * @name TeamsGetDiscussionCommentLegacy + * @summary Get a discussion comment (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + * @deprecated */ - checksListForRef: ( - owner: string, - repo: string, - ref: string, - query?: { - /** Returns check runs with the specified `name`. */ - check_name?: string; - /** - * Filters check runs by their `completed_at` timestamp. Can be one of `latest` (returning the most recent check runs) or `all`. - * @default "latest" - */ - filter?: "latest" | "all"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** Returns check runs with the specified `status`. Can be one of `queued`, `in_progress`, or `completed`. */ - status?: "queued" | "in_progress" | "completed"; - }, + teamsGetDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + commentNumber: number, params: RequestParams = {}, ) => - this.request< - { - check_runs: CheckRun[]; - total_count: number; - }, - any - >({ - path: `/repos/${owner}/${repo}/commits/${ref}/check-runs`, + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description **Note:** The Checks API only looks for pushes in the repository where the check suite or check run were created. Pushes to a branch in a forked repository are not detected and return an empty `pull_requests` array and a `null` value for `head_branch`. Lists check suites for a commit `ref`. The `ref` can be a SHA, branch name, or a tag name. GitHub Apps must have the `checks:read` permission on a private repository or pull access to a public repository to list check suites. OAuth Apps and authenticated users must have the `repo` scope to get check suites in a private repository. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a discussion comment](https://docs.github.com/rest/reference/teams#update-a-discussion-comment) endpoint. Edits the body text of a discussion comment. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags checks - * @name ChecksListSuitesForRef - * @summary List check suites for a Git reference - * @request GET:/repos/{owner}/{repo}/commits/{ref}/check-suites + * @tags teams + * @name TeamsUpdateDiscussionCommentLegacy + * @summary Update a discussion comment (Legacy) + * @request PATCH:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + * @deprecated */ - checksListSuitesForRef: ( - owner: string, - repo: string, - ref: string, - query?: { - /** - * Filters check suites by GitHub App `id`. - * @example 1 - */ - app_id?: number; - /** Returns check runs with the specified `name`. */ - check_name?: string; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + teamsUpdateDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + commentNumber: number, + data: { + /** The discussion comment's body text. */ + body: string; }, - params: RequestParams = {}, - ) => - this.request< - { - check_suites: CheckSuite[]; - total_count: number; - }, - any - >({ - path: `/repos/${owner}/${repo}/commits/${ref}/check-suites`, - method: "GET", - query: query, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "PATCH", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Users with pull access in a repository can access a combined view of commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name. The most recent status for each context is returned, up to 100. This field [paginates](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination) if there are over 100 contexts. Additionally, a combined `state` is returned. The `state` is one of: * **failure** if any of the contexts report as `error` or `failure` * **pending** if there are no statuses or a context is `pending` * **success** if the latest status for all contexts is `success` + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Delete a discussion comment](https://docs.github.com/rest/reference/teams#delete-a-discussion-comment) endpoint. Deletes a comment on a team discussion. OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags repos - * @name ReposGetCombinedStatusForRef - * @summary Get the combined status for a specific reference - * @request GET:/repos/{owner}/{repo}/commits/{ref}/status + * @tags teams + * @name TeamsDeleteDiscussionCommentLegacy + * @summary Delete a discussion comment (Legacy) + * @request DELETE:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} + * @deprecated */ - reposGetCombinedStatusForRef: (owner: string, repo: string, ref: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/status`, - method: "GET", - format: "json", + teamsDeleteDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + commentNumber: number, + params: RequestParams = {}, + ) => + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments/\${commentNumber}\`, + method: "DELETE", ...params, }), /** - * @description Users with pull access in a repository can view commit statuses for a given ref. The ref can be a SHA, a branch name, or a tag name. Statuses are returned in reverse chronological order. The first status in the list will be the latest one. This resource is also available via a legacy route: `GET /repos/:owner/:repo/statuses/:ref`. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List reactions for a team discussion comment\`](https://docs.github.com/rest/reference/reactions#list-reactions-for-a-team-discussion-comment) endpoint. List the reactions to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags repos - * @name ReposListCommitStatusesForRef - * @summary List commit statuses for a reference - * @request GET:/repos/{owner}/{repo}/commits/{ref}/statuses + * @tags reactions + * @name ReactionsListForTeamDiscussionCommentLegacy + * @summary List reactions for a team discussion comment (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions + * @deprecated */ - reposListCommitStatusesForRef: ( - owner: string, - repo: string, - ref: string, + reactionsListForTeamDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + commentNumber: number, query?: { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ + content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; /** * Page number of the results to fetch. * @default 1 @@ -19043,8 +32929,8 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/statuses`, + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments/\${commentNumber}/reactions\`, method: "GET", query: query, format: "json", @@ -19052,178 +32938,90 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/community/code_of_conduct`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description This endpoint will return all community profile metrics, including an overall health score, repository description, the presence of documentation, detected code of conduct, detected license, and the presence of ISSUE\_TEMPLATE, PULL\_REQUEST\_TEMPLATE, README, and CONTRIBUTING files. The `health_percentage` score is defined as a percentage of how many of these four documents are present: README, CONTRIBUTING, LICENSE, and CODE_OF_CONDUCT. For example, if all four documents are present, then the `health_percentage` is `100`. If only one is present, then the `health_percentage` is `25`. `content_reports_enabled` is only returned for organization-owned repositories. - * - * @tags repos - * @name ReposGetCommunityProfileMetrics - * @summary Get community profile metrics - * @request GET:/repos/{owner}/{repo}/community/profile - */ - reposGetCommunityProfileMetrics: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/community/profile`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Both `:base` and `:head` must be branch names in `:repo`. To compare branches across other repositories in the same network as `:repo`, use the format `:branch`. The response from the API is equivalent to running the `git log base..head` command; however, commits are returned in chronological order. Pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats. The response also includes details on the files that were changed between the two commits. This includes the status of the change (for example, if a file was added, removed, modified, or renamed), and details of the change itself. For example, files with a `renamed` status have a `previous_filename` field showing the previous filename of the file, and files with a `modified` status have a `patch` field showing the changes made to the file. **Working with large comparisons** The response will include a comparison of up to 250 commits. If you are working with a larger commit range, you can use the [List commits](https://docs.github.com/rest/reference/repos#list-commits) to enumerate all commits in the range. For comparisons with extremely large diffs, you may receive an error response indicating that the diff took too long to generate. You can typically resolve this error by using a smaller commit range. **Signature verification object** The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object: | Name | Type | Description | | ---- | ---- | ----------- | | `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. | | `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | `signature` | `string` | The signature that was extracted from the commit. | | `payload` | `string` | The value that was signed. | These are the possible values for `reason` in the `verification` object: | Value | Description | | ----- | ----------- | | `expired_key` | The key that made the signature is expired. | | `not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | `gpgverify_error` | There was an error communicating with the signature verification service. | | `gpgverify_unavailable` | The signature verification service is currently unavailable. | | `unsigned` | The object does not include a signature. | | `unknown_signature_type` | A non-PGP signature was found in the commit. | | `no_user` | No user was associated with the `committer` email address in the commit. | | `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. | | `unknown_key` | The key that made the signature has not been registered with any user's account. | | `malformed_signature` | There was an error parsing the signature. | | `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | `valid` | None of the above errors applied, so the signature is considered to be verified. | - * - * @tags repos - * @name ReposCompareCommits - * @summary Compare two commits - * @request GET:/repos/{owner}/{repo}/compare/{base}...{head} - */ - reposCompareCommits: (owner: string, repo: string, base: string, head: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/compare/${base}...${head}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Gets the contents of a file or directory in a repository. Specify the file path or directory in `:path`. If you omit `:path`, you will receive the contents of the repository's root directory. See the description below regarding what the API response includes for directories. Files and symlinks support [a custom media type](https://docs.github.com/rest/reference/repos#custom-media-types) for retrieving the raw content or rendered HTML (when supported). All content types support [a custom media type](https://docs.github.com/rest/reference/repos#custom-media-types) to ensure the content is returned in a consistent object format. **Note**: * To get a repository's contents recursively, you can [recursively get the tree](https://docs.github.com/rest/reference/git#trees). * This API has an upper limit of 1,000 files for a directory. If you need to retrieve more files, use the [Git Trees API](https://docs.github.com/rest/reference/git#get-a-tree). * This API supports files up to 1 megabyte in size. #### If the content is a directory The response will be an array of objects, one object for each item in the directory. When listing the contents of a directory, submodules have their "type" specified as "file". Logically, the value _should_ be "submodule". This behavior exists in API v3 [for backwards compatibility purposes](https://git.io/v1YCW). In the next major version of the API, the type will be returned as "submodule". #### If the content is a symlink If the requested `:path` points to a symlink, and the symlink's target is a normal file in the repository, then the API responds with the content of the file (in the format shown in the example. Otherwise, the API responds with an object describing the symlink itself. #### If the content is a submodule The `submodule_git_url` identifies the location of the submodule repository, and the `sha` identifies a specific commit within the submodule repository. Git uses the given URL when cloning the submodule repository, and checks out the submodule at that specific commit. If the submodule repository is not hosted on github.com, the Git URLs (`git_url` and `_links["git"]`) and the github.com URLs (`html_url` and `_links["html"]`) will have null values. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new "[Create reaction for a team discussion comment](https://docs.github.com/rest/reference/reactions#create-reaction-for-a-team-discussion-comment)" endpoint. Create a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion comment. * - * @tags repos - * @name ReposGetContent - * @summary Get repository content - * @request GET:/repos/{owner}/{repo}/contents/{path} + * @tags reactions + * @name ReactionsCreateForTeamDiscussionCommentLegacy + * @summary Create reaction for a team discussion comment (Legacy) + * @request POST:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions + * @deprecated */ - reposGetContent: ( - owner: string, - repo: string, - path: string, - query?: { - /** The name of the commit/branch/tag. Default: the repository’s default branch (usually `master`) */ - ref?: string; + reactionsCreateForTeamDiscussionCommentLegacy: ( + teamId: number, + discussionNumber: number, + commentNumber: number, + data: { + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion comment. */ + content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, - method: "GET", - query: query, + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/comments/\${commentNumber}/reactions\`, + method: "POST", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Creates a new file or replaces an existing file in a repository. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List reactions for a team discussion\`](https://docs.github.com/rest/reference/reactions#list-reactions-for-a-team-discussion) endpoint. List the reactions to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`read:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags repos - * @name ReposCreateOrUpdateFileContents - * @summary Create or update file contents - * @request PUT:/repos/{owner}/{repo}/contents/{path} + * @tags reactions + * @name ReactionsListForTeamDiscussionLegacy + * @summary List reactions for a team discussion (Legacy) + * @request GET:/teams/{team_id}/discussions/{discussion_number}/reactions + * @deprecated */ - reposCreateOrUpdateFileContents: ( - owner: string, - repo: string, - path: string, - data: { - /** The author of the file. Default: The `committer` or the authenticated user if you omit `committer`. */ - author?: { - /** @example ""2013-01-15T17:13:22+05:00"" */ - date?: string; - /** The email of the author or committer of the commit. You'll receive a `422` status code if `email` is omitted. */ - email: string; - /** The name of the author or committer of the commit. You'll receive a `422` status code if `name` is omitted. */ - name: string; - }; - /** The branch name. Default: the repository’s default branch (usually `master`) */ - branch?: string; - /** The person that committed the file. Default: the authenticated user. */ - committer?: { - /** @example ""2013-01-05T13:13:22+05:00"" */ - date?: string; - /** The email of the author or committer of the commit. You'll receive a `422` status code if `email` is omitted. */ - email: string; - /** The name of the author or committer of the commit. You'll receive a `422` status code if `name` is omitted. */ - name: string; - }; - /** The new file content, using Base64 encoding. */ - content: string; - /** The commit message. */ - message: string; - /** **Required if you are updating a file**. The blob SHA of the file being replaced. */ - sha?: string; + reactionsListForTeamDiscussionLegacy: ( + teamId: number, + discussionNumber: number, + query?: { + /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ + content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, - method: "PUT", - body: data, - type: ContentType.Json, + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/reactions\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description Deletes a file in a repository. You can provide an additional `committer` parameter, which is an object containing information about the committer. Or, you can provide an `author` parameter, which is an object containing information about the author. The `author` section is optional and is filled in with the `committer` information if omitted. If the `committer` information is omitted, the authenticated user's information is used. You must provide values for both `name` and `email`, whether you choose to use `author` or `committer`. Otherwise, you'll receive a `422` status code. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`Create reaction for a team discussion\`](https://docs.github.com/rest/reference/reactions#create-reaction-for-a-team-discussion) endpoint. Create a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the \`write:discussion\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a \`Status: 200 OK\` means that you already added the reaction type to this team discussion. * - * @tags repos - * @name ReposDeleteFile - * @summary Delete a file - * @request DELETE:/repos/{owner}/{repo}/contents/{path} + * @tags reactions + * @name ReactionsCreateForTeamDiscussionLegacy + * @summary Create reaction for a team discussion (Legacy) + * @request POST:/teams/{team_id}/discussions/{discussion_number}/reactions + * @deprecated */ - reposDeleteFile: ( - owner: string, - repo: string, - path: string, + reactionsCreateForTeamDiscussionLegacy: ( + teamId: number, + discussionNumber: number, data: { - /** object containing information about the author. */ - author?: { - /** The email of the author (or committer) of the commit */ - email?: string; - /** The name of the author (or committer) of the commit */ - name?: string; - }; - /** The branch name. Default: the repository’s default branch (usually `master`) */ - branch?: string; - /** object containing information about the committer. */ - committer?: { - /** The email of the author (or committer) of the commit */ - email?: string; - /** The name of the author (or committer) of the commit */ - name?: string; - }; - /** The commit message. */ - message: string; - /** The blob SHA of the file being replaced. */ - sha: string; + /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion. */ + content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; }, params: RequestParams = {}, ) => - this.request< - FileCommit, - | BasicError - | ValidationError - | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/repos/${owner}/${repo}/contents/${path}`, - method: "DELETE", + this.request({ + path: \`/teams/\${teamId}/discussions/\${discussionNumber}/reactions\`, + method: "POST", body: data, type: ContentType.Json, format: "json", @@ -19231,19 +33029,17 @@ export class Api extends HttpClient extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/contributors`, + this.request({ + path: \`/teams/\${teamId}/invitations\`, method: "GET", query: query, format: "json", @@ -19266,22 +33062,17 @@ export class Api extends HttpClient extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/deployments`, + this.request({ + path: \`/teams/\${teamId}/members\`, method: "GET", query: query, format: "json", @@ -19319,192 +33103,124 @@ export class Api extends HttpClient | string; - /** - * 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; - /** 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; - }, - params: RequestParams = {}, - ) => - this.request< - Deployment, - | { - /** @example ""https://docs.github.com/rest/reference/repos#create-a-deployment"" */ - documentation_url?: string; - message?: string; - } - | ValidationError - >({ - path: `/repos/${owner}/${repo}/deployments`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", + teamsGetMemberLegacy: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/members/\${username}\`, + method: "GET", ...params, }), /** - * No description + * @description The "Add team member" endpoint (described below) is deprecated. We recommend using the [Add or update team membership for a user](https://docs.github.com/rest/reference/teams#add-or-update-team-membership-for-a-user) endpoint instead. It allows you to invite new organization members to your teams. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To add someone to a team, the authenticated user must be an organization owner or a team maintainer in the team they're changing. The person being added to the team must be a member of the team's organization. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." * - * @tags repos - * @name ReposGetDeployment - * @summary Get a deployment - * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id} + * @tags teams + * @name TeamsAddMemberLegacy + * @summary Add team member (Legacy) + * @request PUT:/teams/{team_id}/members/{username} + * @deprecated */ - reposGetDeployment: (owner: string, repo: string, deploymentId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/deployments/${deploymentId}`, - method: "GET", - format: "json", + teamsAddMemberLegacy: (teamId: number, username: string, params: RequestParams = {}) => + this.request< + void, + | BasicError + | void + | { + /** @example ""https://docs.github.com/rest"" */ + documentation_url?: string; + errors?: { + code?: string; + field?: string; + resource?: string; + }[]; + message?: string; + } + >({ + path: \`/teams/\${teamId}/members/\${username}\`, + method: "PUT", ...params, }), /** - * @description To ensure there can always be an active deployment, you can only delete an _inactive_ deployment. Anyone with `repo` or `repo_deployment` scopes can delete an inactive deployment. To set a deployment as inactive, you must: * Create a new deployment that is active so that the system has a record of the current state, then delete the previously active deployment. * Mark the active deployment as inactive by adding any non-successful deployment status. For more information, see "[Create a deployment](https://docs.github.com/rest/reference/repos/#create-a-deployment)" and "[Create a deployment status](https://docs.github.com/rest/reference/repos#create-a-deployment-status)." + * @description The "Remove team member" endpoint (described below) is deprecated. We recommend using the [Remove team membership for a user](https://docs.github.com/rest/reference/teams#remove-team-membership-for-a-user) endpoint instead. It allows you to remove both active and pending memberships. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To remove a team member, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. Removing a team member does not delete the user, it just removes them from the team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." * - * @tags repos - * @name ReposDeleteDeployment - * @summary Delete a deployment - * @request DELETE:/repos/{owner}/{repo}/deployments/{deployment_id} + * @tags teams + * @name TeamsRemoveMemberLegacy + * @summary Remove team member (Legacy) + * @request DELETE:/teams/{team_id}/members/{username} + * @deprecated */ - reposDeleteDeployment: (owner: string, repo: string, deploymentId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/deployments/${deploymentId}`, + teamsRemoveMemberLegacy: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/members/\${username}\`, method: "DELETE", ...params, }), /** - * @description Users with pull access can view deployment statuses for a deployment: + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get team membership for a user](https://docs.github.com/rest/reference/teams#get-team-membership-for-a-user) endpoint. Team members will include the members of child teams. To get a user's membership with a team, the team must be visible to the authenticated user. **Note:** The \`role\` for organization owners returns as \`maintainer\`. For more information about \`maintainer\` roles, see [Create a team](https://docs.github.com/rest/reference/teams#create-a-team). * - * @tags repos - * @name ReposListDeploymentStatuses - * @summary List deployment statuses - * @request GET:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses + * @tags teams + * @name TeamsGetMembershipForUserLegacy + * @summary Get team membership for a user (Legacy) + * @request GET:/teams/{team_id}/memberships/{username} + * @deprecated */ - reposListDeploymentStatuses: ( - owner: string, - repo: string, - deploymentId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/deployments/${deploymentId}/statuses`, + teamsGetMembershipForUserLegacy: (teamId: number, username: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description Users with `push` access can create deployment statuses for a given deployment. GitHub Apps require `read & write` access to "Deployments" and `read-only` access to "Repo contents" (for private repos). OAuth Apps require the `repo_deployment` scope. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Add or update team membership for a user](https://docs.github.com/rest/reference/teams#add-or-update-team-membership-for-a-user) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. If the user is already a member of the team's organization, this endpoint will add the user to the team. To add a membership between an organization member and a team, the authenticated user must be an organization owner or a team maintainer. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." If the user is unaffiliated with the team's organization, this endpoint will send an invitation to the user via email. This newly-created membership will be in the "pending" state until the user accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. To add a membership between an unaffiliated user and a team, the authenticated user must be an organization owner. If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer. * - * @tags repos - * @name ReposCreateDeploymentStatus - * @summary Create a deployment status - * @request POST:/repos/{owner}/{repo}/deployments/{deployment_id}/statuses + * @tags teams + * @name TeamsAddOrUpdateMembershipForUserLegacy + * @summary Add or update team membership for a user (Legacy) + * @request PUT:/teams/{team_id}/memberships/{username} + * @deprecated */ - reposCreateDeploymentStatus: ( - owner: string, - repo: string, - deploymentId: number, + teamsAddOrUpdateMembershipForUserLegacy: ( + teamId: number, + username: string, data: { /** - * Adds a new `inactive` status to all prior non-transient, non-production environment deployments with the same repository and `environment` name as the created status's deployment. An `inactive` status is only added to deployments that had a `success` state. Default: `true` - * **Note:** To add an `inactive` status to `production` environments, you must use the [`application/vnd.github.flash-preview+json`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) 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. - */ - auto_inactive?: boolean; - /** - * A short description of the status. The maximum description length is 140 characters. - * @default "" - */ - description?: string; - /** Name for the target deployment environment, which can be changed when setting a deploy status. For example, `production`, `staging`, or `qa`. **Note:** This parameter requires you to use the [`application/vnd.github.flash-preview+json`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) custom media type. */ - environment?: "production" | "staging" | "qa"; - /** - * Sets the URL for accessing your environment. Default: `""` - * **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 "" - */ - environment_url?: string; - /** - * The full URL of the deployment's output. This parameter replaces `target_url`. We will continue to accept `target_url` to support legacy uses, but we recommend replacing `target_url` with `log_url`. Setting `log_url` will automatically set `target_url` to the same value. Default: `""` - * **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 "" - */ - log_url?: string; - /** The state of the status. Can be one of `error`, `failure`, `inactive`, `in_progress`, `queued` `pending`, or `success`. **Note:** To use the `inactive` state, you must provide the [`application/vnd.github.ant-man-preview+json`](https://docs.github.com/rest/overview/api-previews#enhanced-deployments) custom media type. To use the `in_progress` and `queued` states, you must provide the [`application/vnd.github.flash-preview+json`](https://docs.github.com/rest/overview/api-previews#deployment-statuses) custom media type. When you set a transient deployment to `inactive`, the deployment will be shown as `destroyed` in GitHub. */ - state: "error" | "failure" | "inactive" | "in_progress" | "queued" | "pending" | "success"; - /** - * The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. **Note:** It's recommended to use the `log_url` parameter, which replaces `target_url`. - * @default "" + * The role that this user should have in the team. Can be one of: + * \\* \`member\` - a normal member of the team. + * \\* \`maintainer\` - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description. + * @default "member" */ - target_url?: string; + role?: "member" | "maintainer"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/deployments/${deploymentId}/statuses`, - method: "POST", + this.request< + TeamMembership, + | void + | BasicError + | { + /** @example ""https://help.github.com/articles/github-and-trade-controls"" */ + documentation_url?: string; + errors?: { + code?: string; + field?: string; + resource?: string; + }[]; + message?: string; + } + >({ + path: \`/teams/\${teamId}/memberships/\${username}\`, + method: "PUT", body: data, type: ContentType.Json, format: "json", @@ -19512,105 +33228,163 @@ export class Api extends HttpClient + this.request({ + path: \`/teams/\${teamId}/memberships/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List team projects\`](https://docs.github.com/rest/reference/teams#list-team-projects) endpoint. Lists the organization projects for a team. + * + * @tags teams + * @name TeamsListProjectsLegacy + * @summary List team projects (Legacy) + * @request GET:/teams/{team_id}/projects + * @deprecated + */ + teamsListProjectsLegacy: ( + teamId: number, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, params: RequestParams = {}, ) => this.request< - DeploymentStatus, + TeamProject[], | BasicError | { documentation_url: string; message: string; } >({ - path: `/repos/${owner}/${repo}/deployments/${deploymentId}/statuses/${statusId}`, + path: \`/teams/\${teamId}/projects\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description You can use this endpoint to trigger a webhook event called `repository_dispatch` when you want activity that happens outside of GitHub to trigger a GitHub Actions workflow or GitHub App webhook. You must configure your GitHub Actions workflow or GitHub App to run when the `repository_dispatch` event occurs. For an example `repository_dispatch` webhook payload, see "[RepositoryDispatchEvent](https://docs.github.com/webhooks/event-payloads/#repository_dispatch)." The `client_payload` parameter is available for any extra information that your workflow might need. This parameter is a JSON payload that will be passed on when the webhook event is dispatched. For example, the `client_payload` can include a message that a user would like to send using a GitHub Actions workflow. Or the `client_payload` can be used as a test to debug your workflow. This endpoint requires write access to the repository by providing either: - Personal access tokens with `repo` scope. For more information, see "[Creating a personal access token for the command line](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line)" in the GitHub Help documentation. - GitHub Apps with both `metadata:read` and `contents:read&write` permissions. This input example shows how you can use the `client_payload` as a test to debug your workflow. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Check team permissions for a project](https://docs.github.com/rest/reference/teams#check-team-permissions-for-a-project) endpoint. Checks whether a team has \`read\`, \`write\`, or \`admin\` permissions for an organization project. The response includes projects inherited from a parent team. * - * @tags repos - * @name ReposCreateDispatchEvent - * @summary Create a repository dispatch event - * @request POST:/repos/{owner}/{repo}/dispatches + * @tags teams + * @name TeamsCheckPermissionsForProjectLegacy + * @summary Check team permissions for a project (Legacy) + * @request GET:/teams/{team_id}/projects/{project_id} + * @deprecated */ - reposCreateDispatchEvent: ( - owner: string, - repo: string, + teamsCheckPermissionsForProjectLegacy: (teamId: number, projectId: number, params: RequestParams = {}) => + this.request< + TeamProject, + void | { + documentation_url: string; + message: string; + } + >({ + path: \`/teams/\${teamId}/projects/\${projectId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Add or update team project permissions](https://docs.github.com/rest/reference/teams#add-or-update-team-project-permissions) endpoint. Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have \`admin\` permissions for the project. The project and team must be part of the same organization. + * + * @tags teams + * @name TeamsAddOrUpdateProjectPermissionsLegacy + * @summary Add or update team project permissions (Legacy) + * @request PUT:/teams/{team_id}/projects/{project_id} + * @deprecated + */ + teamsAddOrUpdateProjectPermissionsLegacy: ( + teamId: number, + projectId: number, data: { - /** JSON payload with extra information about the webhook event that your action or worklow may use. */ - client_payload?: Record; - /** A custom webhook event name. */ - event_type: string; + /** + * The permission to grant to the team for this project. Can be one of: + * \\* \`read\` - team members can read, but not write to or administer this project. + * \\* \`write\` - team members can read and write, but not administer this project. + * \\* \`admin\` - team members can read, write and administer this project. + * Default: the team's \`permission\` attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + */ + permission?: "read" | "write" | "admin"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/dispatches`, - method: "POST", + this.request< + void, + | { + documentation_url?: string; + message?: string; + } + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/teams/\${teamId}/projects/\${projectId}\`, + method: "PUT", body: data, type: ContentType.Json, ...params, }), /** - * No description + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove a project from a team](https://docs.github.com/rest/reference/teams#remove-a-project-from-a-team) endpoint. Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have \`read\` access to both the team and project, or \`admin\` access to the team or project. **Note:** This endpoint removes the project from the team, but does not delete it. * - * @tags activity - * @name ActivityListRepoEvents - * @summary List repository events - * @request GET:/repos/{owner}/{repo}/events + * @tags teams + * @name TeamsRemoveProjectLegacy + * @summary Remove a project from a team (Legacy) + * @request DELETE:/teams/{team_id}/projects/{project_id} + * @deprecated */ - activityListRepoEvents: ( - owner: string, - repo: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/events`, - method: "GET", - query: query, - format: "json", + teamsRemoveProjectLegacy: (teamId: number, projectId: number, params: RequestParams = {}) => + this.request< + void, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationError + >({ + path: \`/teams/\${teamId}/projects/\${projectId}\`, + method: "DELETE", ...params, }), /** - * No description + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [List team repositories](https://docs.github.com/rest/reference/teams#list-team-repositories) endpoint. * - * @tags repos - * @name ReposListForks - * @summary List forks - * @request GET:/repos/{owner}/{repo}/forks + * @tags teams + * @name TeamsListReposLegacy + * @summary List team repositories (Legacy) + * @request GET:/teams/{team_id}/repos + * @deprecated */ - reposListForks: ( - owner: string, - repo: string, + teamsListReposLegacy: ( + teamId: number, query?: { /** * Page number of the results to fetch. @@ -19622,16 +33396,11 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/teams/\${teamId}/repos\`, method: "GET", query: query, format: "json", @@ -19639,122 +33408,124 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/forks`, - method: "POST", - body: data, - type: ContentType.Json, + teamsCheckPermissionsForRepoLegacy: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, + method: "GET", format: "json", ...params, }), /** - * No description + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new "[Add or update team repository permissions](https://docs.github.com/rest/reference/teams#add-or-update-team-repository-permissions)" endpoint. To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a \`422 Unprocessable Entity\` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." * - * @tags git - * @name GitCreateBlob - * @summary Create a blob - * @request POST:/repos/{owner}/{repo}/git/blobs + * @tags teams + * @name TeamsAddOrUpdateRepoPermissionsLegacy + * @summary Add or update team repository permissions (Legacy) + * @request PUT:/teams/{team_id}/repos/{owner}/{repo} + * @deprecated */ - gitCreateBlob: ( + teamsAddOrUpdateRepoPermissionsLegacy: ( + teamId: number, owner: string, repo: string, data: { - /** The new blob's content. */ - content: string; /** - * The encoding used for `content`. Currently, `"utf-8"` and `"base64"` are supported. - * @default "utf-8" + * The permission to grant the team on this repository. Can be one of: + * \\* \`pull\` - team members can pull, but not push to or administer this repository. + * \\* \`push\` - team members can pull and push, but not administer this repository. + * \\* \`admin\` - team members can pull, push and administer this repository. + * + * If no permission is specified, the team's \`permission\` attribute will be used to determine what permission to grant the team on this repository. */ - encoding?: string; + permission?: "pull" | "push" | "admin"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/git/blobs`, - method: "POST", + this.request({ + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, + method: "PUT", body: data, type: ContentType.Json, - format: "json", ...params, }), /** - * @description The `content` in the response will always be Base64 encoded. _Note_: This API supports blobs up to 100 megabytes in size. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove a repository from a team](https://docs.github.com/rest/reference/teams#remove-a-repository-from-a-team) endpoint. If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. NOTE: This does not delete the repository, it just removes it from the team. * - * @tags git - * @name GitGetBlob - * @summary Get a blob - * @request GET:/repos/{owner}/{repo}/git/blobs/{file_sha} + * @tags teams + * @name TeamsRemoveRepoLegacy + * @summary Remove a repository from a team (Legacy) + * @request DELETE:/teams/{team_id}/repos/{owner}/{repo} + * @deprecated */ - gitGetBlob: (owner: string, repo: string, fileSha: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/git/blobs/${fileSha}`, + teamsRemoveRepoLegacy: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, + method: "DELETE", + ...params, + }), + + /** + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List IdP groups for a team\`](https://docs.github.com/rest/reference/teams#list-idp-groups-for-a-team) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups connected to a team on GitHub. + * + * @tags teams + * @name TeamsListIdpGroupsForLegacy + * @summary List IdP groups for a team (Legacy) + * @request GET:/teams/{team_id}/team-sync/group-mappings + * @deprecated + */ + teamsListIdpGroupsForLegacy: (teamId: number, params: RequestParams = {}) => + this.request({ + path: \`/teams/\${teamId}/team-sync/group-mappings\`, method: "GET", format: "json", ...params, }), /** - * @description Creates a new Git [commit object](https://git-scm.com/book/en/v1/Git-Internals-Git-Objects#Commit-Objects). **Signature verification object** The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object: | Name | Type | Description | | ---- | ---- | ----------- | | `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. | | `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | `signature` | `string` | The signature that was extracted from the commit. | | `payload` | `string` | The value that was signed. | These are the possible values for `reason` in the `verification` object: | Value | Description | | ----- | ----------- | | `expired_key` | The key that made the signature is expired. | | `not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | `gpgverify_error` | There was an error communicating with the signature verification service. | | `gpgverify_unavailable` | The signature verification service is currently unavailable. | | `unsigned` | The object does not include a signature. | | `unknown_signature_type` | A non-PGP signature was found in the commit. | | `no_user` | No user was associated with the `committer` email address in the commit. | | `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. | | `unknown_key` | The key that made the signature has not been registered with any user's account. | | `malformed_signature` | There was an error parsing the signature. | | `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | `valid` | None of the above errors applied, so the signature is considered to be verified. | + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`Create or update IdP group connections\`](https://docs.github.com/rest/reference/teams#create-or-update-idp-group-connections) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty \`groups\` array will remove all connections for a team. * - * @tags git - * @name GitCreateCommit - * @summary Create a commit - * @request POST:/repos/{owner}/{repo}/git/commits + * @tags teams + * @name TeamsCreateOrUpdateIdpGroupConnectionsLegacy + * @summary Create or update IdP group connections (Legacy) + * @request PATCH:/teams/{team_id}/team-sync/group-mappings + * @deprecated */ - gitCreateCommit: ( - owner: string, - repo: string, + teamsCreateOrUpdateIdpGroupConnectionsLegacy: ( + teamId: number, data: { - /** Information about the author of the commit. By default, the `author` will be the authenticated user and the current date. See the `author` and `committer` object below for details. */ - author?: { - /** Indicates when this commit was authored (or committed). This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - date?: string; - /** The email of the author (or committer) of the commit */ - email?: string; - /** The name of the author (or committer) of the commit */ - name?: string; - }; - /** Information about the person who is making the commit. By default, `committer` will use the information set in `author`. See the `author` and `committer` object below for details. */ - committer?: { - /** Indicates when this commit was authored (or committed). This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - date?: string; - /** The email of the author (or committer) of the commit */ - email?: string; - /** The name of the author (or committer) of the commit */ + /** The IdP groups you want to connect to a GitHub team. When updating, the new \`groups\` object will replace the original one. You must include any existing groups that you don't want to remove. */ + groups: { + /** @example ""moar cheese pleese"" */ + description?: string; + /** Description of the IdP group. */ + group_description: string; + /** ID of the IdP group. */ + group_id: string; + /** Name of the IdP group. */ + group_name: string; + /** @example ""caceab43fc9ffa20081c"" */ + id?: string; + /** @example ""external-team-6c13e7288ef7"" */ name?: string; - }; - /** The commit message */ - message: string; - /** The SHAs of the commits that were the parents of this commit. If omitted or empty, the commit will be written as a root commit. For a single parent, an array of one SHA should be provided; for a merge commit, an array of more than one should be provided. */ - parents?: string[]; - /** The [PGP signature](https://en.wikipedia.org/wiki/Pretty_Good_Privacy) of the commit. GitHub adds the signature to the `gpgsig` header of the created commit. For a commit signature to be verifiable by Git or GitHub, it must be an ASCII-armored detached PGP signature over the string commit as it would be written to the object database. To pass a `signature` parameter, you need to first manually create a valid PGP signature, which can be complicated. You may find it easier to [use the command line](https://git-scm.com/book/id/v2/Git-Tools-Signing-Your-Work) to create signed commits. */ - signature?: string; - /** The SHA of the tree object this commit points to */ - tree: string; + }[]; + /** @example ""I am not a timestamp"" */ + synced_at?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/git/commits`, - method: "POST", + this.request({ + path: \`/teams/\${teamId}/team-sync/group-mappings\`, + method: "PATCH", body: data, type: ContentType.Json, format: "json", @@ -19762,33 +33533,16 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/git/commits/${commitSha}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Returns an array of references from your Git database that match the supplied name. The `:ref` in the URL must be formatted as `heads/` for branches and `tags/` for tags. If the `:ref` doesn't exist in the repository, but existing refs start with `:ref`, they will be returned as an array. When you use this endpoint without providing a `:ref`, it will return an array of all the references from your Git database, including notes and stashes if they exist on the server. Anything in the namespace is returned, not just `heads` and `tags`. **Note:** You need to explicitly [request a pull request](https://docs.github.com/rest/reference/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". If you request matching references for a branch named `feature` but the branch `feature` doesn't exist, the response can still include other matching head refs that start with the word `feature`, such as `featureA` and `featureB`. + * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [\`List child teams\`](https://docs.github.com/rest/reference/teams#list-child-teams) endpoint. * - * @tags git - * @name GitListMatchingRefs - * @summary List matching references - * @request GET:/repos/{owner}/{repo}/git/matching-refs/{ref} + * @tags teams + * @name TeamsListChildLegacy + * @summary List child teams (Legacy) + * @request GET:/teams/{team_id}/teams + * @deprecated */ - gitListMatchingRefs: ( - owner: string, - repo: string, - ref: string, + teamsListChildLegacy: ( + teamId: number, query?: { /** * Page number of the results to fetch. @@ -19803,85 +33557,80 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/git/matching-refs/${ref}`, + this.request({ + path: \`/teams/\${teamId}/teams\`, method: "GET", query: query, format: "json", ...params, }), - + }; + user = { /** - * @description Returns a single reference from your Git database. The `:ref` in the URL must be formatted as `heads/` for branches and `tags/` for tags. If the `:ref` doesn't match an existing ref, a `404` is returned. **Note:** You need to explicitly [request a pull request](https://docs.github.com/rest/reference/pulls#get-a-pull-request) to trigger a test merge commit, which checks the mergeability of pull requests. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". + * @description If the authenticated user is authenticated through basic authentication or OAuth with the \`user\` scope, then the response lists public and private profile information. If the authenticated user is authenticated through OAuth without the \`user\` scope, then the response lists only public profile information. * - * @tags git - * @name GitGetRef - * @summary Get a reference - * @request GET:/repos/{owner}/{repo}/git/ref/{ref} + * @tags users + * @name UsersGetAuthenticated + * @summary Get the authenticated user + * @request GET:/user */ - gitGetRef: (owner: string, repo: string, ref: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/git/ref/${ref}`, + usersGetAuthenticated: (params: RequestParams = {}) => + this.request({ + path: \`/user\`, method: "GET", format: "json", ...params, }), /** - * @description Creates a reference for your repository. You are unable to create new references for empty repositories, even if the commit SHA-1 hash used exists. Empty repositories are repositories without branches. - * - * @tags git - * @name GitCreateRef - * @summary Create a reference - * @request POST:/repos/{owner}/{repo}/git/refs - */ - gitCreateRef: ( - owner: string, - repo: string, - data: { - /** @example ""refs/heads/newbranch"" */ - key?: string; - /** The name of the fully qualified reference (ie: `refs/heads/master`). If it doesn't start with 'refs' and have at least two slashes, it will be rejected. */ - ref: string; - /** The SHA1 value for this reference. */ - sha: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/git/refs`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description + * @description **Note:** If your email is set to private and you send an \`email\` parameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API. * - * @tags git - * @name GitUpdateRef - * @summary Update a reference - * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} + * @tags users + * @name UsersUpdateAuthenticated + * @summary Update the authenticated user + * @request PATCH:/user */ - gitUpdateRef: ( - owner: string, - repo: string, - ref: string, + usersUpdateAuthenticated: ( data: { + /** The new short biography of the user. */ + bio?: string; /** - * Indicates whether to force the update or to make sure the update is a fast-forward update. Leaving this out or setting it to `false` will make sure you're not overwriting work. - * @default false + * The new blog URL of the user. + * @example "blog.example.com" */ - force?: boolean; - /** The SHA1 value to set this reference to */ - sha: string; + blog?: string; + /** + * The new company of the user. + * @example "Acme corporation" + */ + company?: string; + /** + * The publicly visible email address of the user. + * @example "omar@example.com" + */ + email?: string; + /** The new hiring availability of the user. */ + hireable?: boolean; + /** + * The new location of the user. + * @example "Berlin, Germany" + */ + location?: string; + /** + * The new name of the user. + * @example "Omar Jahandar" + */ + name?: string; + /** + * The new Twitter username of the user. + * @example "therealomarj" + */ + twitter_username?: string | null; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + this.request({ + path: \`/user\`, method: "PATCH", body: data, type: ContentType.Json, @@ -19890,164 +33639,111 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, - method: "DELETE", - ...params, - }), - - /** - * @description Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then [create](https://docs.github.com/rest/reference/git#create-a-reference) the `refs/tags/[tag]` reference. If you want to create a lightweight tag, you only have to [create](https://docs.github.com/rest/reference/git#create-a-reference) the tag reference - this call would be unnecessary. **Signature verification object** The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object: | Name | Type | Description | | ---- | ---- | ----------- | | `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. | | `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | `signature` | `string` | The signature that was extracted from the commit. | | `payload` | `string` | The value that was signed. | These are the possible values for `reason` in the `verification` object: | Value | Description | | ----- | ----------- | | `expired_key` | The key that made the signature is expired. | | `not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | `gpgverify_error` | There was an error communicating with the signature verification service. | | `gpgverify_unavailable` | The signature verification service is currently unavailable. | | `unsigned` | The object does not include a signature. | | `unknown_signature_type` | A non-PGP signature was found in the commit. | | `no_user` | No user was associated with the `committer` email address in the commit. | | `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. | | `unknown_key` | The key that made the signature has not been registered with any user's account. | | `malformed_signature` | There was an error parsing the signature. | | `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | `valid` | None of the above errors applied, so the signature is considered to be verified. | + * @description List the users you've blocked on your personal account. * - * @tags git - * @name GitCreateTag - * @summary Create a tag object - * @request POST:/repos/{owner}/{repo}/git/tags + * @tags users + * @name UsersListBlockedByAuthenticated + * @summary List users blocked by the authenticated user + * @request GET:/user/blocks */ - gitCreateTag: ( - owner: string, - repo: string, - data: { - /** The tag message. */ - message: string; - /** The SHA of the git object this is tagging. */ - object: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag: string; - /** An object with information about the individual creating the tag. */ - tagger?: { - /** When this object was tagged. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - date?: string; - /** The email of the author of the tag */ - email?: string; - /** The name of the author of the tag */ - name?: string; - }; - /** 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"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/git/tags`, - method: "POST", - body: data, - type: ContentType.Json, + usersListBlockedByAuthenticated: (params: RequestParams = {}) => + this.request< + SimpleUser[], + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/user/blocks\`, + method: "GET", format: "json", ...params, }), /** - * @description **Signature verification object** The response will include a `verification` object that describes the result of verifying the commit's signature. The following fields are included in the `verification` object: | Name | Type | Description | | ---- | ---- | ----------- | | `verified` | `boolean` | Indicates whether GitHub considers the signature in this commit to be verified. | | `reason` | `string` | The reason for verified value. Possible values and their meanings are enumerated in table below. | | `signature` | `string` | The signature that was extracted from the commit. | | `payload` | `string` | The value that was signed. | These are the possible values for `reason` in the `verification` object: | Value | Description | | ----- | ----------- | | `expired_key` | The key that made the signature is expired. | | `not_signing_key` | The "signing" flag is not among the usage flags in the GPG key that made the signature. | | `gpgverify_error` | There was an error communicating with the signature verification service. | | `gpgverify_unavailable` | The signature verification service is currently unavailable. | | `unsigned` | The object does not include a signature. | | `unknown_signature_type` | A non-PGP signature was found in the commit. | | `no_user` | No user was associated with the `committer` email address in the commit. | | `unverified_email` | The `committer` email address in the commit was associated with a user, but the email address is not verified on her/his account. | | `bad_email` | The `committer` email address in the commit is not included in the identities of the PGP key that made the signature. | | `unknown_key` | The key that made the signature has not been registered with any user's account. | | `malformed_signature` | There was an error parsing the signature. | | `invalid` | The signature could not be cryptographically verified using the key whose key-id was found in the signature. | | `valid` | None of the above errors applied, so the signature is considered to be verified. | + * No description * - * @tags git - * @name GitGetTag - * @summary Get a tag - * @request GET:/repos/{owner}/{repo}/git/tags/{tag_sha} + * @tags users + * @name UsersCheckBlocked + * @summary Check if a user is blocked by the authenticated user + * @request GET:/user/blocks/{username} */ - gitGetTag: (owner: string, repo: string, tagSha: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/git/tags/${tagSha}`, + usersCheckBlocked: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/blocks/\${username}\`, method: "GET", - format: "json", ...params, }), /** - * @description The tree creation API accepts nested entries. If you specify both a tree and a nested path modifying that tree, this endpoint will overwrite the contents of the tree with the new path contents, and create a new tree structure. If you use this endpoint to add, delete, or modify the file contents in a tree, you will need to commit the tree and then update a branch to point to the commit. For more information see "[Create a commit](https://docs.github.com/rest/reference/git#create-a-commit)" and "[Update a reference](https://docs.github.com/rest/reference/git#update-a-reference)." + * No description * - * @tags git - * @name GitCreateTree - * @summary Create a tree - * @request POST:/repos/{owner}/{repo}/git/trees + * @tags users + * @name UsersBlock + * @summary Block a user + * @request PUT:/user/blocks/{username} */ - gitCreateTree: ( - owner: string, - repo: string, - data: { - /** - * The SHA1 of an existing Git tree object which will be used as the base for the new tree. If provided, a new Git tree object will be created from entries in the Git tree object pointed to by `base_tree` and entries defined in the `tree` parameter. Entries defined in the `tree` parameter will overwrite items from `base_tree` with the same `path`. If you're creating new changes on a branch, then normally you'd set `base_tree` to the SHA1 of the Git tree object of the current latest commit on the branch you're working on. - * If not provided, GitHub will create a new Git tree object from only the entries defined in the `tree` parameter. If you create a new commit pointing to such a tree, then all files which were a part of the parent commit's tree and were not defined in the `tree` parameter will be listed as deleted by the new commit. - */ - base_tree?: string; - /** Objects (of `path`, `mode`, `type`, and `sha`) specifying a tree structure. */ - tree: { - /** - * The content you want this file to have. GitHub will write this blob out and use that SHA for this entry. Use either this, or `tree.sha`. - * - * **Note:** Use either `tree.sha` or `content` to specify the contents of the entry. Using both `tree.sha` and `content` will return an error. - */ - content?: string; - /** The file mode; one of `100644` for file (blob), `100755` for executable (blob), `040000` for subdirectory (tree), `160000` for submodule (commit), or `120000` for a blob that specifies the path of a symlink. */ - mode?: "100644" | "100755" | "040000" | "160000" | "120000"; - /** The file referenced in the tree. */ - path?: string; - /** - * The SHA1 checksum ID of the object in the tree. Also called `tree.sha`. If the value is `null` then the file will be deleted. - * - * **Note:** Use either `tree.sha` or `content` to specify the contents of the entry. Using both `tree.sha` and `content` will return an error. - */ - sha?: string | null; - /** Either `blob`, `tree`, or `commit`. */ - type?: "blob" | "tree" | "commit"; - }[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/git/trees`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", + usersBlock: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/blocks/\${username}\`, + method: "PUT", ...params, }), /** - * @description Returns a single tree using the SHA1 value for that tree. If `truncated` is `true` in the response then the number of items in the `tree` array exceeded our maximum limit. If you need to fetch more items, use the non-recursive method of fetching trees, and fetch one sub-tree at a time. + * No description * - * @tags git - * @name GitGetTree - * @summary Get a tree - * @request GET:/repos/{owner}/{repo}/git/trees/{tree_sha} + * @tags users + * @name UsersUnblock + * @summary Unblock a user + * @request DELETE:/user/blocks/{username} */ - gitGetTree: ( - owner: string, - repo: string, - treeSha: string, - query?: { - /** Setting this parameter to any value returns the objects or subtrees referenced by the tree specified in `:tree_sha`. For example, setting `recursive` to any of the following will enable returning objects or subtrees: `0`, `1`, `"true"`, and `"false"`. Omit this parameter to prevent recursively returning objects or subtrees. */ - recursive?: string; + usersUnblock: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/blocks/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Sets the visibility for your primary email addresses. + * + * @tags users + * @name UsersSetPrimaryEmailVisibilityForAuthenticated + * @summary Set primary email visibility for the authenticated user + * @request PATCH:/user/email/visibility + */ + usersSetPrimaryEmailVisibilityForAuthenticated: ( + data: { + /** + * An email address associated with the GitHub user account to manage. + * @example "org@example.com" + */ + email: string; + /** Denotes whether an email is publically visible. */ + visibility: "public" | "private"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/git/trees/${treeSha}`, - method: "GET", - query: query, + this.request({ + path: \`/user/email/visibility\`, + method: "PATCH", + body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * No description + * @description Lists all of your email addresses, and specifies which one is visible to the public. This endpoint is accessible with the \`user:email\` scope. * - * @tags repos - * @name ReposListWebhooks - * @summary List repository webhooks - * @request GET:/repos/{owner}/{repo}/hooks + * @tags users + * @name UsersListEmailsForAuthenticated + * @summary List email addresses for the authenticated user + * @request GET:/user/emails */ - reposListWebhooks: ( - owner: string, - repo: string, + usersListEmailsForAuthenticated: ( query?: { /** * Page number of the results to fetch. @@ -20062,8 +33758,8 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/hooks`, + this.request({ + path: \`/user/emails\`, method: "GET", query: query, format: "json", @@ -20071,49 +33767,28 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/hooks`, + this.request({ + path: \`/user/emails\`, method: "POST", body: data, type: ContentType.Json, @@ -20122,213 +33797,187 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, - method: "GET", - format: "json", + usersDeleteEmailForAuthenticated: ( + data: + | { + /** Email addresses associated with the GitHub user account. */ + emails: string[]; + } + | string[] + | string, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/emails\`, + method: "DELETE", + body: data, + type: ContentType.Json, ...params, }), /** - * @description Updates a webhook configured in a repository. If you previously had a `secret` set, you must provide the same `secret` or set a new `secret` or the secret will be removed. If you are only updating individual webhook `config` properties, use "[Update a webhook configuration for a repository](/rest/reference/repos#update-a-webhook-configuration-for-a-repository)." + * @description Lists the people following the authenticated user. * - * @tags repos - * @name ReposUpdateWebhook - * @summary Update a repository webhook - * @request PATCH:/repos/{owner}/{repo}/hooks/{hook_id} + * @tags users + * @name UsersListFollowersForAuthenticatedUser + * @summary List followers of the authenticated user + * @request GET:/user/followers */ - reposUpdateWebhook: ( - owner: string, - repo: string, - hookId: number, - data: { + usersListFollowersForAuthenticatedUser: ( + query?: { /** - * Determines if notifications are sent when the webhook is triggered. Set to `true` to send notifications. - * @default true + * Page number of the results to fetch. + * @default 1 */ - active?: boolean; - /** Determines a list of events to be added to the list of events that the Hook triggers for. */ - add_events?: string[]; - /** Key/value pairs to provide settings for this webhook. [These are defined below](https://docs.github.com/rest/reference/repos#create-hook-config-params). */ - config?: { - /** @example ""bar@example.com"" */ - address?: string; - /** The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. */ - content_type?: WebhookConfigContentType; - /** 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 ""The Serious Room"" */ - room?: 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; - /** The URL to which the payloads will be delivered. */ - url: WebhookConfigUrl; - }; + page?: number; /** - * Determines what [events](https://docs.github.com/webhooks/event-payloads) the hook is triggered for. This replaces the entire array of events. - * @default ["push"] + * Results per page (max 100) + * @default 30 */ - events?: string[]; - /** Determines a list of events to be removed from the list of events that the Hook triggers for. */ - remove_events?: string[]; + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, - method: "PATCH", - body: data, - type: ContentType.Json, + this.request({ + path: \`/user/followers\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * No description - * - * @tags repos - * @name ReposDeleteWebhook - * @summary Delete a repository webhook - * @request DELETE:/repos/{owner}/{repo}/hooks/{hook_id} - */ - reposDeleteWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Returns the webhook configuration for a repository. To get more information about the webhook, including the `active` state and `events`, use "[Get a repository webhook](/rest/reference/orgs#get-a-repository-webhook)." Access tokens must have the `read:repo_hook` or `repo` scope, and GitHub Apps must have the `repository_hooks:read` permission. + * @description Lists the people who the authenticated user follows. * - * @tags repos - * @name ReposGetWebhookConfigForRepo - * @summary Get a webhook configuration for a repository - * @request GET:/repos/{owner}/{repo}/hooks/{hook_id}/config + * @tags users + * @name UsersListFollowedByAuthenticated + * @summary List the people the authenticated user follows + * @request GET:/user/following */ - reposGetWebhookConfigForRepo: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/config`, + usersListFollowedByAuthenticated: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/following\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description Updates the webhook configuration for a repository. To update more information about the webhook, including the `active` state and `events`, use "[Update a repository webhook](/rest/reference/orgs#update-a-repository-webhook)." Access tokens must have the `write:repo_hook` or `repo` scope, and GitHub Apps must have the `repository_hooks:write` permission. + * No description * - * @tags repos - * @name ReposUpdateWebhookConfigForRepo - * @summary Update a webhook configuration for a repository - * @request PATCH:/repos/{owner}/{repo}/hooks/{hook_id}/config + * @tags users + * @name UsersCheckPersonIsFollowedByAuthenticated + * @summary Check if a person is followed by the authenticated user + * @request GET:/user/following/{username} */ - reposUpdateWebhookConfigForRepo: ( - owner: string, - repo: string, - hookId: number, - data: { - /** The media type used to serialize the payloads. Supported values include `json` and `form`. The default is `form`. */ - content_type?: WebhookConfigContentType; - /** 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; - /** 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; - /** The URL to which the payloads will be delivered. */ - url?: WebhookConfigUrl; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/config`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", + usersCheckPersonIsFollowedByAuthenticated: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/following/\${username}\`, + method: "GET", ...params, }), /** - * @description This will trigger a [ping event](https://docs.github.com/webhooks/#ping-event) to be sent to the hook. + * @description Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the \`user:follow\` scope. * - * @tags repos - * @name ReposPingWebhook - * @summary Ping a repository webhook - * @request POST:/repos/{owner}/{repo}/hooks/{hook_id}/pings + * @tags users + * @name UsersFollow + * @summary Follow a user + * @request PUT:/user/following/{username} */ - reposPingWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + usersFollow: (username: string, params: RequestParams = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/pings`, - method: "POST", + path: \`/user/following/\${username}\`, + method: "PUT", ...params, }), /** - * @description This will trigger the hook with the latest push to the current repository if the hook is subscribed to `push` events. If the hook is not subscribed to `push` events, the server will respond with 204 but no test POST will be generated. **Note**: Previously `/repos/:owner/:repo/hooks/:hook_id/test` + * @description Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the \`user:follow\` scope. * - * @tags repos - * @name ReposTestPushWebhook - * @summary Test the push repository webhook - * @request POST:/repos/{owner}/{repo}/hooks/{hook_id}/tests + * @tags users + * @name UsersUnfollow + * @summary Unfollow a user + * @request DELETE:/user/following/{username} */ - reposTestPushWebhook: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => + usersUnfollow: (username: string, params: RequestParams = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, - method: "POST", + path: \`/user/following/\${username}\`, + method: "DELETE", ...params, }), /** - * @description View the progress of an import. **Import status** This section includes details about the possible values of the `status` field of the Import Progress response. An import that does not have errors will progress through these steps: * `detecting` - the "detection" step of the import is in progress because the request did not include a `vcs` parameter. The import is identifying the type of source control present at the URL. * `importing` - the "raw" step of the import is in progress. This is where commit data is fetched from the original repository. The import progress response will include `commit_count` (the total number of raw commits that will be imported) and `percent` (0 - 100, the current progress through the import). * `mapping` - the "rewrite" step of the import is in progress. This is where SVN branches are converted to Git branches, and where author updates are applied. The import progress response does not include progress information. * `pushing` - the "push" step of the import is in progress. This is where the importer updates the repository on GitHub. The import progress response will include `push_percent`, which is the percent value reported by `git push` when it is "Writing objects". * `complete` - the import is complete, and the repository is ready on GitHub. If there are problems, you will see one of these in the `status` field: * `auth_failed` - the import requires authentication in order to connect to the original repository. To update authentication for the import, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. * `error` - the import encountered an error. The import progress response will include the `failed_step` and an error message. Contact [GitHub Support](https://support.github.com/contact) or [GitHub Premium Support](https://premium.githubsupport.com) for more information. * `detection_needs_auth` - the importer requires authentication for the originating repository to continue detection. To update authentication for the import, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. * `detection_found_nothing` - the importer didn't recognize any source control at the URL. To resolve, [Cancel the import](https://docs.github.com/rest/reference/migrations#cancel-an-import) and [retry](https://docs.github.com/rest/reference/migrations#start-an-import) with the correct URL. * `detection_found_multiple` - the importer found several projects or repositories at the provided URL. When this is the case, the Import Progress response will also include a `project_choices` field with the possible project choices as values. To update project choice, please see the [Update an import](https://docs.github.com/rest/reference/migrations#update-an-import) section. **The project_choices field** When multiple projects are found at the provided URL, the response hash will include a `project_choices` field, the value of which is an array of hashes each representing a project choice. The exact key/value pairs of the project hashes will differ depending on the version control type. **Git LFS related fields** This section includes details about Git LFS related fields that may be present in the Import Progress response. * `use_lfs` - describes whether the import has been opted in or out of using Git LFS. The value can be `opt_in`, `opt_out`, or `undecided` if no action has been taken. * `has_large_files` - the boolean value describing whether files larger than 100MB were found during the `importing` step. * `large_files_size` - the total size in gigabytes of files larger than 100MB found in the originating repository. * `large_files_count` - the total number of files larger than 100MB found in the originating repository. To see a list of these files, make a "Get Large Files" request. + * @description Lists the current user's GPG keys. Requires that you are authenticated via Basic Auth or via OAuth with at least \`read:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags migrations - * @name MigrationsGetImportStatus - * @summary Get an import status - * @request GET:/repos/{owner}/{repo}/import + * @tags users + * @name UsersListGpgKeysForAuthenticated + * @summary List GPG keys for the authenticated user + * @request GET:/user/gpg_keys */ - migrationsGetImportStatus: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/import`, + usersListGpgKeysForAuthenticated: ( + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/gpg_keys\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description Start a source import to a GitHub repository using GitHub Importer. + * @description Adds a GPG key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least \`write:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags migrations - * @name MigrationsStartImport - * @summary Start an import - * @request PUT:/repos/{owner}/{repo}/import + * @tags users + * @name UsersCreateGpgKeyForAuthenticated + * @summary Create a GPG key for the authenticated user + * @request POST:/user/gpg_keys */ - migrationsStartImport: ( - owner: string, - repo: string, + usersCreateGpgKeyForAuthenticated: ( data: { - /** For a tfvc import, the name of the project that is being imported. */ - tfvc_project?: string; - /** The originating VCS type. Can be one of `subversion`, `git`, `mercurial`, or `tfvc`. Please be aware that without this parameter, the import job will take additional time to detect the VCS type before beginning the import. This detection step will be reflected in the response. */ - vcs?: "subversion" | "git" | "mercurial" | "tfvc"; - /** If authentication is required, the password to provide to `vcs_url`. */ - vcs_password?: string; - /** The URL of the originating repository. */ - vcs_url: string; - /** If authentication is required, the username to provide to `vcs_url`. */ - vcs_username?: string; + /** A GPG key in ASCII-armored format. */ + armored_public_key: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/import`, - method: "PUT", + this.request({ + path: \`/user/gpg_keys\`, + method: "POST", body: data, type: ContentType.Json, format: "json", @@ -20336,71 +33985,71 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/import`, - method: "PATCH", - body: data, - type: ContentType.Json, + usersGetGpgKeyForAuthenticated: (gpgKeyId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/gpg_keys/\${gpgKeyId}\`, + method: "GET", format: "json", ...params, }), /** - * @description Stop an import for a repository. + * @description Removes a GPG key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least \`admin:gpg_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). * - * @tags migrations - * @name MigrationsCancelImport - * @summary Cancel an import - * @request DELETE:/repos/{owner}/{repo}/import + * @tags users + * @name UsersDeleteGpgKeyForAuthenticated + * @summary Delete a GPG key for the authenticated user + * @request DELETE:/user/gpg_keys/{gpg_key_id} */ - migrationsCancelImport: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/import`, + usersDeleteGpgKeyForAuthenticated: (gpgKeyId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/gpg_keys/\${gpgKeyId}\`, method: "DELETE", ...params, }), /** - * @description Each type of source control system represents authors in a different way. For example, a Git commit author has a display name and an email address, but a Subversion commit author just has a username. The GitHub Importer will make the author information valid, but the author might not be correct. For example, it will change the bare Subversion username `hubot` into something like `hubot `. This endpoint and the [Map a commit author](https://docs.github.com/rest/reference/migrations#map-a-commit-author) endpoint allow you to provide correct Git author information. + * @description Lists installations of your GitHub App that the authenticated user has explicit permission (\`:read\`, \`:write\`, or \`:admin\`) to access. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. You can find the permissions for the installation under the \`permissions\` key. * - * @tags migrations - * @name MigrationsGetCommitAuthors - * @summary Get commit authors - * @request GET:/repos/{owner}/{repo}/import/authors + * @tags apps + * @name AppsListInstallationsForAuthenticatedUser + * @summary List app installations accessible to the user access token + * @request GET:/user/installations */ - migrationsGetCommitAuthors: ( - owner: string, - repo: string, + appsListInstallationsForAuthenticatedUser: ( query?: { - /** A user ID. Only return users with an ID greater than this ID. */ - since?: number; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/import/authors`, + this.request< + { + installations: Installation[]; + total_count: number; + }, + | BasicError + | { + documentation_url: string; + message: string; + } + >({ + path: \`/user/installations\`, method: "GET", query: query, format: "json", @@ -20408,126 +34057,101 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/import/authors/${authorId}`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List files larger than 100MB found during the import - * - * @tags migrations - * @name MigrationsGetLargeFiles - * @summary Get large files - * @request GET:/repos/{owner}/{repo}/import/large_files - */ - migrationsGetLargeFiles: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/import/large_files`, + this.request< + { + repositories: Repository[]; + repository_selection?: string; + total_count: number; + }, + BasicError + >({ + path: \`/user/installations/\${installationId}/repositories\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description You can import repositories from Subversion, Mercurial, and TFS that include files larger than 100MB. This ability is powered by [Git LFS](https://git-lfs.github.com). You can learn more about our LFS feature and working with large files [on our help site](https://help.github.com/articles/versioning-large-files/). + * @description Add a single repository to an installation. The authenticated user must have admin access to the repository. You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint. * - * @tags migrations - * @name MigrationsSetLfsPreference - * @summary Update Git LFS preference - * @request PATCH:/repos/{owner}/{repo}/import/lfs + * @tags apps + * @name AppsAddRepoToInstallation + * @summary Add a repository to an app installation + * @request PUT:/user/installations/{installation_id}/repositories/{repository_id} */ - migrationsSetLfsPreference: ( - owner: string, - repo: string, - data: { - /** Can be one of `opt_in` (large files will be stored using Git LFS) or `opt_out` (large files will be removed during the import). */ - use_lfs: "opt_in" | "opt_out"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/import/lfs`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", + appsAddRepoToInstallation: (installationId: number, repositoryId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/installations/\${installationId}/repositories/\${repositoryId}\`, + method: "PUT", ...params, }), /** - * @description Enables an authenticated GitHub App to find the repository's installation information. The installation's account type will be either an organization or a user account, depending which account the repository belongs to. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + * @description Remove a single repository from an installation. The authenticated user must have admin access to the repository. You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint. * * @tags apps - * @name AppsGetRepoInstallation - * @summary Get a repository installation for the authenticated app - * @request GET:/repos/{owner}/{repo}/installation - */ - appsGetRepoInstallation: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/installation`, - method: "GET", - format: "json", + * @name AppsRemoveRepoFromInstallation + * @summary Remove a repository from an app installation + * @request DELETE:/user/installations/{installation_id}/repositories/{repository_id} + */ + appsRemoveRepoFromInstallation: (installationId: number, repositoryId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/installations/\${installationId}/repositories/\${repositoryId}\`, + method: "DELETE", ...params, }), /** - * @description Shows which type of GitHub user can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response. + * @description Shows which type of GitHub user can interact with your public repositories and when the restriction expires. If there are no restrictions, you will see an empty response. * * @tags interactions - * @name InteractionsGetRestrictionsForRepo - * @summary Get interaction restrictions for a repository - * @request GET:/repos/{owner}/{repo}/interaction-limits + * @name InteractionsGetRestrictionsForAuthenticatedUser + * @summary Get interaction restrictions for your public repositories + * @request GET:/user/interaction-limits */ - interactionsGetRestrictionsForRepo: (owner: string, repo: string, params: RequestParams = {}) => + interactionsGetRestrictionsForAuthenticatedUser: (params: RequestParams = {}) => this.request({ - path: `/repos/${owner}/${repo}/interaction-limits`, + path: \`/user/interaction-limits\`, method: "GET", format: "json", ...params, }), /** - * @description Temporarily restricts interactions to a certain type of GitHub user within the given repository. You must have owner or admin access to set these restrictions. If an interaction limit is set for the user or organization that owns this repository, you will receive a `409 Conflict` response and will not be able to use this endpoint to change the interaction limit for a single repository. + * @description Temporarily restricts which type of GitHub user can interact with your public repositories. Setting the interaction limit at the user level will overwrite any interaction limits that are set for individual repositories owned by the user. * * @tags interactions - * @name InteractionsSetRestrictionsForRepo - * @summary Set interaction restrictions for a repository - * @request PUT:/repos/{owner}/{repo}/interaction-limits + * @name InteractionsSetRestrictionsForAuthenticatedUser + * @summary Set interaction restrictions for your public repositories + * @request PUT:/user/interaction-limits */ - interactionsSetRestrictionsForRepo: ( - owner: string, - repo: string, - data: InteractionLimit, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/interaction-limits`, + interactionsSetRestrictionsForAuthenticatedUser: (data: InteractionLimit, params: RequestParams = {}) => + this.request({ + path: \`/user/interaction-limits\`, method: "PUT", body: data, type: ContentType.Json, @@ -20536,31 +34160,89 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/interaction-limits`, + interactionsRemoveRestrictionsForAuthenticatedUser: (params: RequestParams = {}) => + this.request({ + path: \`/user/interaction-limits\`, method: "DELETE", ...params, }), /** - * @description When authenticating as a user with admin rights to a repository, this endpoint will list all currently open repository invitations. + * @description List issues across owned and member repositories assigned to the authenticated user. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the \`pull_request\` key. Be aware that the \`id\` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. * - * @tags repos - * @name ReposListInvitations - * @summary List repository invitations - * @request GET:/repos/{owner}/{repo}/invitations + * @tags issues + * @name IssuesListForAuthenticatedUser + * @summary List user account issues assigned to the authenticated user + * @request GET:/user/issues */ - reposListInvitations: ( - owner: string, - repo: string, + issuesListForAuthenticatedUser: ( + query?: { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: "asc" | "desc"; + /** + * Indicates which sorts of issues to return. Can be one of: + * \\* \`assigned\`: Issues assigned to you + * \\* \`created\`: Issues created by you + * \\* \`mentioned\`: Issues mentioning you + * \\* \`subscribed\`: Issues you're subscribed to updates for + * \\* \`all\`: All issues the authenticated user can see, regardless of participation or creation + * @default "assigned" + */ + filter?: "assigned" | "created" | "mentioned" | "subscribed" | "all"; + /** A list of comma separated label names. Example: \`bug,ui,@high\` */ + labels?: string; + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: \`YYYY-MM-DDTHH:MM:SSZ\`. */ + since?: string; + /** + * What to sort results by. Can be either \`created\`, \`updated\`, \`comments\`. + * @default "created" + */ + sort?: "created" | "updated" | "comments"; + /** + * Indicates the state of the issues to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: "open" | "closed" | "all"; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/user/issues\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * @description Lists the public SSH keys for the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least \`read:public_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags users + * @name UsersListPublicSshKeysForAuthenticated + * @summary List public SSH keys for the authenticated user + * @request GET:/user/keys + */ + usersListPublicSshKeysForAuthenticated: ( query?: { /** * Page number of the results to fetch. @@ -20575,8 +34257,8 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/invitations`, + this.request({ + path: \`/user/keys\`, method: "GET", query: query, format: "json", @@ -20584,26 +34266,31 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/invitations/${invitationId}`, - method: "PATCH", + this.request({ + path: \`/user/keys\`, + method: "POST", body: data, type: ContentType.Json, format: "json", @@ -20611,47 +34298,46 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/invitations/${invitationId}`, + usersGetPublicSshKeyForAuthenticated: (keyId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/keys/\${keyId}\`, + method: "GET", + format: "json", + ...params, + }), + + /** + * @description Removes a public SSH key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least \`admin:public_key\` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * + * @tags users + * @name UsersDeletePublicSshKeyForAuthenticated + * @summary Delete a public SSH key for the authenticated user + * @request DELETE:/user/keys/{key_id} + */ + usersDeletePublicSshKeyForAuthenticated: (keyId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/keys/\${keyId}\`, method: "DELETE", ...params, }), /** - * @description List issues in a repository. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * @description Lists the active subscriptions for the authenticated user. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an [OAuth token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/). * - * @tags issues - * @name IssuesListForRepo - * @summary List repository issues - * @request GET:/repos/{owner}/{repo}/issues + * @tags apps + * @name AppsListSubscriptionsForAuthenticatedUser + * @summary List subscriptions for the authenticated user + * @request GET:/user/marketplace_purchases */ - issuesListForRepo: ( - owner: string, - repo: string, + appsListSubscriptionsForAuthenticatedUser: ( query?: { - /** Can be the name of a user. Pass in `none` for issues with no assigned user, and `*` for issues assigned to any user. */ - assignee?: string; - /** The user that created the issue. */ - creator?: string; - /** - * One of `asc` (ascending) or `desc` (descending). - * @default "desc" - */ - direction?: "asc" | "desc"; - /** A list of comma separated label names. Example: `bug,ui,@high` */ - labels?: string; - /** A user that's mentioned in the issue. */ - mentioned?: string; - /** If an `integer` is passed, it should refer to a milestone by its `number` field. If the string `*` is passed, issues with any milestone are accepted. If the string `none` is passed, issues without milestones are returned. */ - milestone?: string; /** * Page number of the results to fetch. * @default 1 @@ -20662,23 +34348,11 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues`, + this.request({ + path: \`/user/marketplace_purchases\`, method: "GET", query: query, format: "json", @@ -20686,72 +34360,46 @@ export class Api extends HttpClient - this.request< - Issue, - | BasicError - | ValidationError - | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/repos/${owner}/${repo}/issues`, - method: "POST", - body: data, - type: ContentType.Json, + this.request({ + path: \`/user/marketplace_purchases/stubbed\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description By default, Issue Comments are ordered by ascending ID. + * No description * - * @tags issues - * @name IssuesListCommentsForRepo - * @summary List issue comments for a repository - * @request GET:/repos/{owner}/{repo}/issues/comments + * @tags orgs + * @name OrgsListMembershipsForAuthenticatedUser + * @summary List organization memberships for the authenticated user + * @request GET:/user/memberships/orgs */ - issuesListCommentsForRepo: ( - owner: string, - repo: string, + orgsListMembershipsForAuthenticatedUser: ( query?: { - /** Either `asc` or `desc`. Ignored without the `sort` parameter. */ - direction?: "asc" | "desc"; /** * Page number of the results to fetch. * @default 1 @@ -20762,18 +34410,13 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, + this.request({ + path: \`/user/memberships/orgs\`, method: "GET", query: query, format: "json", @@ -20783,14 +34426,14 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + orgsGetMembershipForAuthenticatedUser: (org: string, params: RequestParams = {}) => + this.request({ + path: \`/user/memberships/orgs/\${org}\`, method: "GET", format: "json", ...params, @@ -20799,23 +34442,21 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + this.request({ + path: \`/user/memberships/orgs/\${org}\`, method: "PATCH", body: data, type: ContentType.Json, @@ -20824,35 +34465,15 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, - method: "DELETE", - ...params, - }), - - /** - * @description List the reactions to an [issue comment](https://docs.github.com/rest/reference/issues#comments). + * @description Lists all migrations a user has started. * - * @tags reactions - * @name ReactionsListForIssueComment - * @summary List reactions for an issue comment - * @request GET:/repos/{owner}/{repo}/issues/comments/{comment_id}/reactions + * @tags migrations + * @name MigrationsListForAuthenticatedUser + * @summary List user migrations + * @request GET:/user/migrations */ - reactionsListForIssueComment: ( - owner: string, - repo: string, - commentId: number, + migrationsListForAuthenticatedUser: ( query?: { - /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue comment. */ - content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; /** * Page number of the results to fetch. * @default 1 @@ -20866,15 +34487,8 @@ export class Api extends HttpClient - this.request< - Reaction[], - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}/reactions`, + this.request({ + path: \`/user/migrations\`, method: "GET", query: query, format: "json", @@ -20882,32 +34496,36 @@ export class Api extends HttpClient - this.request< - Reaction, - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}/reactions`, + this.request({ + path: \`/user/migrations\`, method: "POST", body: data, type: ContentType.Json, @@ -20916,53 +34534,22 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}/reactions/${reactionId}`, - method: "DELETE", - ...params, - }), - - /** - * No description + * @description Fetches a single user migration. The response includes the \`state\` of the migration, which can be one of the following values: * \`pending\` - the migration hasn't started yet. * \`exporting\` - the migration is in progress. * \`exported\` - the migration finished successfully. * \`failed\` - the migration failed. Once the migration has been \`exported\` you can [download the migration archive](https://docs.github.com/rest/reference/migrations#download-a-user-migration-archive). * - * @tags issues - * @name IssuesListEventsForRepo - * @summary List issue events for a repository - * @request GET:/repos/{owner}/{repo}/issues/events + * @tags migrations + * @name MigrationsGetStatusForAuthenticatedUser + * @summary Get a user migration status + * @request GET:/user/migrations/{migration_id} */ - issuesListEventsForRepo: ( - owner: string, - repo: string, + migrationsGetStatusForAuthenticatedUser: ( + migrationId: number, query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + exclude?: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/issues/events`, + this.request({ + path: \`/user/migrations/\${migrationId}\`, method: "GET", query: query, format: "json", @@ -20970,159 +34557,91 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/events/${eventId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description The API returns a [`301 Moved Permanently` status](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-redirects-redirects) if the issue was [transferred](https://help.github.com/articles/transferring-an-issue-to-another-repository/) to another repository. If the issue was transferred to or deleted from a repository where the authenticated user lacks read access, the API returns a `404 Not Found` status. If the issue was deleted from a repository where the authenticated user has read access, the API returns a `410 Gone` status. To receive webhook events for transferred and deleted issues, subscribe to the [`issues`](https://docs.github.com/webhooks/event-payloads/#issues) webhook. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * @description Fetches the URL to download the migration archive as a \`tar.gz\` file. Depending on the resources your repository uses, the migration archive can contain JSON files with data for these objects: * attachments * bases * commit\\_comments * issue\\_comments * issue\\_events * issues * milestones * organizations * projects * protected\\_branches * pull\\_request\\_reviews * pull\\_requests * releases * repositories * review\\_comments * schema * users The archive will also contain an \`attachments\` directory that includes all attachment files uploaded to GitHub.com and a \`repositories\` directory that contains the repository's Git data. * - * @tags issues - * @name IssuesGet - * @summary Get an issue - * @request GET:/repos/{owner}/{repo}/issues/{issue_number} + * @tags migrations + * @name MigrationsGetArchiveForAuthenticatedUser + * @summary Download a user migration archive + * @request GET:/user/migrations/{migration_id}/archive */ - issuesGet: (owner: string, repo: string, issueNumber: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}`, + migrationsGetArchiveForAuthenticatedUser: (migrationId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/migrations/\${migrationId}/archive\`, method: "GET", - format: "json", ...params, }), /** - * @description Issue owners and users with push access can edit an issue. - * - * @tags issues - * @name IssuesUpdate - * @summary Update an issue - * @request PATCH:/repos/{owner}/{repo}/issues/{issue_number} - */ - issuesUpdate: ( - owner: string, - repo: string, - issueNumber: number, - data: { - /** Login for the user that this issue should be assigned to. **This field is deprecated.** */ - assignee?: string | null; - /** Logins for Users to assign to this issue. Pass one or more user logins to _replace_ the set of assignees on this Issue. Send an empty array (`[]`) to clear all assignees from the Issue. _NOTE: Only users with push access can set assignees for new issues. Assignees are silently dropped otherwise._ */ - assignees?: string[]; - /** The contents of the issue. */ - body?: string; - /** Labels to associate with this issue. Pass one or more Labels to _replace_ the set of Labels on this Issue. Send an empty array (`[]`) to clear all Labels from the Issue. _NOTE: Only users with push access can set labels for issues. Labels are silently dropped otherwise._ */ - labels?: ( - | string - | { - color?: string | null; - description?: string | null; - id?: number; - name?: string; - } - )[]; - /** The `number` of the milestone to associate this issue with or `null` to remove current. _NOTE: Only users with push access can set the milestone for issues. The milestone is silently dropped otherwise._ */ - milestone?: string | number | null; - /** State of the issue. Either `open` or `closed`. */ - state?: "open" | "closed"; - /** The title of the issue. */ - title?: string | number; - }, - params: RequestParams = {}, - ) => - this.request< - Issue, - | BasicError - | ValidationError - | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", + * @description Deletes a previous migration archive. Downloadable migration archives are automatically deleted after seven days. Migration metadata, which is returned in the [List user migrations](https://docs.github.com/rest/reference/migrations#list-user-migrations) and [Get a user migration status](https://docs.github.com/rest/reference/migrations#get-a-user-migration-status) endpoints, will continue to be available even after an archive is deleted. + * + * @tags migrations + * @name MigrationsDeleteArchiveForAuthenticatedUser + * @summary Delete a user migration archive + * @request DELETE:/user/migrations/{migration_id}/archive + */ + migrationsDeleteArchiveForAuthenticatedUser: (migrationId: number, params: RequestParams = {}) => + this.request({ + path: \`/user/migrations/\${migrationId}/archive\`, + method: "DELETE", ...params, }), /** - * @description Adds up to 10 assignees to an issue. Users already assigned to an issue are not replaced. + * @description Unlocks a repository. You can lock repositories when you [start a user migration](https://docs.github.com/rest/reference/migrations#start-a-user-migration). Once the migration is complete you can unlock each repository to begin using it again or [delete the repository](https://docs.github.com/rest/reference/repos#delete-a-repository) if you no longer need the source data. Returns a status of \`404 Not Found\` if the repository is not locked. * - * @tags issues - * @name IssuesAddAssignees - * @summary Add assignees to an issue - * @request POST:/repos/{owner}/{repo}/issues/{issue_number}/assignees + * @tags migrations + * @name MigrationsUnlockRepoForAuthenticatedUser + * @summary Unlock a user repository + * @request DELETE:/user/migrations/{migration_id}/repos/{repo_name}/lock */ - issuesAddAssignees: ( - owner: string, - repo: string, - issueNumber: number, - data: { - /** Usernames of people to assign this issue to. _NOTE: Only users with push access can add assignees to an issue. Assignees are silently ignored otherwise._ */ - assignees?: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/assignees`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", + migrationsUnlockRepoForAuthenticatedUser: (migrationId: number, repoName: string, params: RequestParams = {}) => + this.request({ + path: \`/user/migrations/\${migrationId}/repos/\${repoName}/lock\`, + method: "DELETE", ...params, }), /** - * @description Removes one or more assignees from an issue. + * @description Lists all the repositories for this user migration. * - * @tags issues - * @name IssuesRemoveAssignees - * @summary Remove assignees from an issue - * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/assignees + * @tags migrations + * @name MigrationsListReposForUser + * @summary List repositories for a user migration + * @request GET:/user/migrations/{migration_id}/repositories */ - issuesRemoveAssignees: ( - owner: string, - repo: string, - issueNumber: number, - data: { - /** Usernames of assignees to remove from an issue. _NOTE: Only users with push access can remove assignees from an issue. Assignees are silently ignored otherwise._ */ - assignees?: string[]; + migrationsListReposForUser: ( + migrationId: number, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/assignees`, - method: "DELETE", - body: data, - type: ContentType.Json, + this.request({ + path: \`/user/migrations/\${migrationId}/repositories\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description Issue Comments are ordered by ascending ID. + * @description List organizations for the authenticated user. **OAuth scope requirements** This only lists organizations that your authorization allows you to operate on in some way (e.g., you can list teams with \`read:org\` scope, you can publicize your organization membership with \`user\` scope, etc.). Therefore, this API requires at least \`user\` or \`read:org\` scope. OAuth requests with insufficient scope receive a \`403 Forbidden\` response. * - * @tags issues - * @name IssuesListComments - * @summary List issue comments - * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/comments + * @tags orgs + * @name OrgsListForAuthenticatedUser + * @summary List organizations for the authenticated user + * @request GET:/user/orgs */ - issuesListComments: ( - owner: string, - repo: string, - issueNumber: number, + orgsListForAuthenticatedUser: ( query?: { /** * Page number of the results to fetch. @@ -21134,13 +34653,11 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/comments`, + this.request({ + path: \`/user/orgs\`, method: "GET", query: query, format: "json", @@ -21148,25 +34665,38 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/comments`, + this.request< + Project, + | BasicError + | { + documentation_url: string; + message: string; + } + | ValidationErrorSimple + >({ + path: \`/user/projects\`, method: "POST", body: data, type: ContentType.Json, @@ -21175,17 +34705,14 @@ export class Api extends HttpClient extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/events`, + this.request({ + path: \`/user/public_emails\`, method: "GET", query: query, format: "json", @@ -21209,18 +34736,27 @@ export class Api extends HttpClient extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/labels`, + this.request({ + path: \`/user/repos\`, method: "GET", query: query, format: "json", @@ -21243,25 +34798,105 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/labels`, + this.request({ + path: \`/user/repos\`, method: "POST", body: data, type: ContentType.Json, @@ -21270,28 +34905,32 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/labels`, - method: "PUT", - body: data, - type: ContentType.Json, + this.request({ + path: \`/user/repository_invitations\`, + method: "GET", + query: query, format: "json", ...params, }), @@ -21299,96 +34938,48 @@ export class Api extends HttpClient + reposAcceptInvitation: (invitationId: number, params: RequestParams = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/labels`, - method: "DELETE", - ...params, - }), - - /** - * @description Removes the specified label from the issue, and returns the remaining labels on the issue. This endpoint returns a `404 Not Found` status if the label does not exist. - * - * @tags issues - * @name IssuesRemoveLabel - * @summary Remove a label from an issue - * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/labels/{name} - */ - issuesRemoveLabel: (owner: string, repo: string, issueNumber: number, name: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/labels/${name}`, - method: "DELETE", - format: "json", - ...params, - }), - - /** - * @description Users with push access can lock an issue or pull request's conversation. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." - * - * @tags issues - * @name IssuesLock - * @summary Lock an issue - * @request PUT:/repos/{owner}/{repo}/issues/{issue_number}/lock - */ - issuesLock: ( - owner: string, - repo: string, - issueNumber: number, - data: { - /** - * The reason for locking the issue or pull request conversation. Lock will fail if you don't use one of these reasons: - * \* `off-topic` - * \* `too heated` - * \* `resolved` - * \* `spam` - */ - lock_reason?: "off-topic" | "too heated" | "resolved" | "spam"; - } | null, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/lock`, - method: "PUT", - body: data, - type: ContentType.Json, + path: \`/user/repository_invitations/\${invitationId}\`, + method: "PATCH", ...params, }), /** - * @description Users with push access can unlock an issue's conversation. + * No description * - * @tags issues - * @name IssuesUnlock - * @summary Unlock an issue - * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/lock + * @tags repos + * @name ReposDeclineInvitation + * @summary Decline a repository invitation + * @request DELETE:/user/repository_invitations/{invitation_id} */ - issuesUnlock: (owner: string, repo: string, issueNumber: number, params: RequestParams = {}) => + reposDeclineInvitation: (invitationId: number, params: RequestParams = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/lock`, + path: \`/user/repository_invitations/\${invitationId}\`, method: "DELETE", ...params, }), /** - * @description List the reactions to an [issue](https://docs.github.com/rest/reference/issues). + * @description Lists repositories the authenticated user has starred. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: * - * @tags reactions - * @name ReactionsListForIssue - * @summary List reactions for an issue - * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/reactions + * @tags activity + * @name ActivityListReposStarredByAuthenticatedUser + * @summary List repositories starred by the authenticated user + * @request GET:/user/starred */ - reactionsListForIssue: ( - owner: string, - repo: string, - issueNumber: number, + activityListReposStarredByAuthenticatedUser: ( query?: { - /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue. */ - content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: "asc" | "desc"; /** * Page number of the results to fetch. * @default 1 @@ -21399,18 +34990,16 @@ export class Api extends HttpClient - this.request< - Reaction[], - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/reactions`, + this.request({ + path: \`/user/starred\`, method: "GET", query: query, format: "json", @@ -21418,72 +35007,59 @@ export class Api extends HttpClient - this.request< - Reaction, - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/reactions`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", + activityCheckRepoIsStarredByAuthenticatedUser: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/user/starred/\${owner}/\${repo}\`, + method: "GET", ...params, }), /** - * @description **Note:** You can also specify a repository by `repository_id` using the route `DELETE /repositories/:repository_id/issues/:issue_number/reactions/:reaction_id`. Delete a reaction to an [issue](https://docs.github.com/rest/reference/issues/). + * @description Note that you'll need to set \`Content-Length\` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." * - * @tags reactions - * @name ReactionsDeleteForIssue - * @summary Delete an issue reaction - * @request DELETE:/repos/{owner}/{repo}/issues/{issue_number}/reactions/{reaction_id} + * @tags activity + * @name ActivityStarRepoForAuthenticatedUser + * @summary Star a repository for the authenticated user + * @request PUT:/user/starred/{owner}/{repo} */ - reactionsDeleteForIssue: ( - owner: string, - repo: string, - issueNumber: number, - reactionId: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/reactions/${reactionId}`, - method: "DELETE", + activityStarRepoForAuthenticatedUser: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/user/starred/\${owner}/\${repo}\`, + method: "PUT", ...params, }), /** * No description * - * @tags issues - * @name IssuesListEventsForTimeline - * @summary List timeline events for an issue - * @request GET:/repos/{owner}/{repo}/issues/{issue_number}/timeline + * @tags activity + * @name ActivityUnstarRepoForAuthenticatedUser + * @summary Unstar a repository for the authenticated user + * @request DELETE:/user/starred/{owner}/{repo} */ - issuesListEventsForTimeline: ( - owner: string, - repo: string, - issueNumber: number, + activityUnstarRepoForAuthenticatedUser: (owner: string, repo: string, params: RequestParams = {}) => + this.request({ + path: \`/user/starred/\${owner}/\${repo}\`, + method: "DELETE", + ...params, + }), + + /** + * @description Lists repositories the authenticated user is watching. + * + * @tags activity + * @name ActivityListWatchedReposForAuthenticatedUser + * @summary List repositories watched by the authenticated user + * @request GET:/user/subscriptions + */ + activityListWatchedReposForAuthenticatedUser: ( query?: { /** * Page number of the results to fetch. @@ -21498,15 +35074,8 @@ export class Api extends HttpClient - this.request< - IssueEventForIssue[], - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/repos/${owner}/${repo}/issues/${issueNumber}/timeline`, + this.request({ + path: \`/user/subscriptions\`, method: "GET", query: query, format: "json", @@ -21514,16 +35083,14 @@ export class Api extends HttpClient extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/keys`, + this.request({ + path: \`/user/teams\`, method: "GET", query: query, format: "json", ...params, }), - + }; + users = { /** - * @description You can create a read-only deploy key. + * @description Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts. Note: Pagination is powered exclusively by the \`since\` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of users. * - * @tags repos - * @name ReposCreateDeployKey - * @summary Create a deploy key - * @request POST:/repos/{owner}/{repo}/keys + * @tags users + * @name UsersList + * @summary List users + * @request GET:/users */ - reposCreateDeployKey: ( - owner: string, - repo: string, - data: { - /** The contents of the key. */ - key: string; + usersList: ( + query?: { /** - * If `true`, the key will only be able to read repository contents. Otherwise, the key will be able to read and write. - * - * Deploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see "[Repository permission levels for an organization](https://help.github.com/articles/repository-permission-levels-for-an-organization/)" and "[Permission levels for a user account repository](https://help.github.com/articles/permission-levels-for-a-user-account-repository/)." + * Results per page (max 100) + * @default 30 */ - read_only?: boolean; - /** A name for the key. */ - title?: string; + per_page?: number; + /** A user ID. Only return users with an ID greater than this ID. */ + since?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/keys`, - method: "POST", - body: data, - type: ContentType.Json, + this.request({ + path: \`/users\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * No description + * @description Provides publicly available information about someone with a GitHub account. GitHub Apps with the \`Plan\` user permission can use this endpoint to retrieve information about a user's GitHub plan. The GitHub App must be authenticated as a user. See "[Identifying and authorizing users for GitHub Apps](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/)" for details about authentication. For an example response, see 'Response with GitHub plan information' below" The \`email\` key in the following response is the publicly visible email address from your GitHub [profile page](https://github.com/settings/profile). When setting up your profile, you can select a primary email address to be “public” which provides an email entry for this endpoint. If you do not set a public email address for \`email\`, then it will have a value of \`null\`. You only see publicly visible email addresses when authenticated with GitHub. For more information, see [Authentication](https://docs.github.com/rest/overview/resources-in-the-rest-api#authentication). The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see "[Emails API](https://docs.github.com/rest/reference/users#emails)". * - * @tags repos - * @name ReposGetDeployKey - * @summary Get a deploy key - * @request GET:/repos/{owner}/{repo}/keys/{key_id} + * @tags users + * @name UsersGetByUsername + * @summary Get a user + * @request GET:/users/{username} */ - reposGetDeployKey: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + usersGetByUsername: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}\`, method: "GET", format: "json", ...params, }), /** - * @description Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead. - * - * @tags repos - * @name ReposDeleteDeployKey - * @summary Delete a deploy key - * @request DELETE:/repos/{owner}/{repo}/keys/{key_id} - */ - reposDeleteDeployKey: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, - method: "DELETE", - ...params, - }), - - /** - * No description + * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. * - * @tags issues - * @name IssuesListLabelsForRepo - * @summary List labels for a repository - * @request GET:/repos/{owner}/{repo}/labels + * @tags activity + * @name ActivityListEventsForAuthenticatedUser + * @summary List events for the authenticated user + * @request GET:/users/{username}/events */ - issuesListLabelsForRepo: ( - owner: string, - repo: string, + activityListEventsForAuthenticatedUser: ( + username: string, query?: { /** * Page number of the results to fetch. @@ -21636,8 +35182,8 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/labels`, + this.request({ + path: \`/users/\${username}/events\`, method: "GET", query: query, format: "json", @@ -21645,47 +35191,34 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/labels`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags issues - * @name IssuesGetLabel - * @summary Get a label - * @request GET:/repos/{owner}/{repo}/labels/{name} - */ - issuesGetLabel: (owner: string, repo: string, name: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + this.request({ + path: \`/users/\${username}/events/orgs/\${org}\`, method: "GET", + query: query, format: "json", ...params, }), @@ -21693,77 +35226,95 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, - method: "PATCH", - body: data, - type: ContentType.Json, + this.request({ + path: \`/users/\${username}/events/public\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * No description - * - * @tags issues - * @name IssuesDeleteLabel - * @summary Delete a label - * @request DELETE:/repos/{owner}/{repo}/labels/{name} - */ - issuesDeleteLabel: (owner: string, repo: string, name: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, - method: "DELETE", - ...params, - }), - - /** - * @description Lists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language. + * @description Lists the people following the specified user. * - * @tags repos - * @name ReposListLanguages - * @summary List repository languages - * @request GET:/repos/{owner}/{repo}/languages + * @tags users + * @name UsersListFollowersForUser + * @summary List followers of a user + * @request GET:/users/{username}/followers */ - reposListLanguages: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/languages`, + usersListFollowersForUser: ( + username: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/followers\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description This method returns the contents of the repository's license file, if one is detected. Similar to [Get repository content](https://docs.github.com/rest/reference/repos#get-repository-content), this method also supports [custom media types](https://docs.github.com/rest/overview/media-types) for retrieving the raw license content or rendered license HTML. + * @description Lists the people who the specified user follows. * - * @tags licenses - * @name LicensesGetForRepo - * @summary Get the license for a repository - * @request GET:/repos/{owner}/{repo}/license + * @tags users + * @name UsersListFollowingForUser + * @summary List the people a user follows + * @request GET:/users/{username}/following */ - licensesGetForRepo: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/license`, + usersListFollowingForUser: ( + username: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/following\`, method: "GET", + query: query, format: "json", ...params, }), @@ -21771,59 +35322,29 @@ export class Api extends HttpClient - this.request< - Commit, - | BasicError - | { - /** @example ""https://docs.github.com/rest/reference/repos#perform-a-merge"" */ - documentation_url?: string; - message?: string; - } - | ValidationError - >({ - path: `/repos/${owner}/${repo}/merges`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", + usersCheckFollowingForUser: (username: string, targetUser: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/following/\${targetUser}\`, + method: "GET", ...params, }), /** - * No description + * @description Lists public gists for the specified user: * - * @tags issues - * @name IssuesListMilestones - * @summary List milestones - * @request GET:/repos/{owner}/{repo}/milestones + * @tags gists + * @name GistsListForUser + * @summary List gists for a user + * @request GET:/users/{username}/gists */ - issuesListMilestones: ( - owner: string, - repo: string, + gistsListForUser: ( + username: string, query?: { - /** - * The direction of the sort. Either `asc` or `desc`. - * @default "asc" - */ - direction?: "asc" | "desc"; /** * Page number of the results to fetch. * @default 1 @@ -21834,21 +35355,13 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/milestones`, + this.request({ + path: \`/users/\${username}/gists\`, method: "GET", query: query, format: "json", @@ -21856,119 +35369,89 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/milestones`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags issues - * @name IssuesGetMilestone - * @summary Get a milestone - * @request GET:/repos/{owner}/{repo}/milestones/{milestone_number} - */ - issuesGetMilestone: (owner: string, repo: string, milestoneNumber: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/milestones/${milestoneNumber}`, + this.request({ + path: \`/users/\${username}/gpg_keys\`, method: "GET", + query: query, format: "json", ...params, }), /** - * No description + * @description Provides hovercard information when authenticated through basic auth or OAuth with the \`repo\` scope. You can find out more about someone in relation to their pull requests, issues, repositories, and organizations. The \`subject_type\` and \`subject_id\` parameters provide context for the person's hovercard, which returns more information than without the parameters. For example, if you wanted to find out more about \`octocat\` who owns the \`Spoon-Knife\` repository via cURL, it would look like this: \`\`\`shell curl -u username:token https://api.github.com/users/octocat/hovercard?subject_type=repository&subject_id=1300192 \`\`\` * - * @tags issues - * @name IssuesUpdateMilestone - * @summary Update a milestone - * @request PATCH:/repos/{owner}/{repo}/milestones/{milestone_number} + * @tags users + * @name UsersGetContextForUser + * @summary Get contextual information for a user + * @request GET:/users/{username}/hovercard */ - issuesUpdateMilestone: ( - owner: string, - repo: string, - milestoneNumber: number, - data: { - /** A description of the milestone. */ - description?: string; - /** The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - due_on?: string; - /** - * The state of the milestone. Either `open` or `closed`. - * @default "open" - */ - state?: "open" | "closed"; - /** The title of the milestone. */ - title?: string; + usersGetContextForUser: ( + username: string, + query?: { + /** Uses the ID for the \`subject_type\` you specified. **Required** when using \`subject_type\`. */ + subject_id?: string; + /** Identifies which additional information you'd like to receive about the person's hovercard. Can be \`organization\`, \`repository\`, \`issue\`, \`pull_request\`. **Required** when using \`subject_id\`. */ + subject_type?: "organization" | "repository" | "issue" | "pull_request"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/milestones/${milestoneNumber}`, - method: "PATCH", - body: data, - type: ContentType.Json, + this.request({ + path: \`/users/\${username}/hovercard\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * No description + * @description Enables an authenticated GitHub App to find the user’s installation information. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. * - * @tags issues - * @name IssuesDeleteMilestone - * @summary Delete a milestone - * @request DELETE:/repos/{owner}/{repo}/milestones/{milestone_number} + * @tags apps + * @name AppsGetUserInstallation + * @summary Get a user installation for the authenticated app + * @request GET:/users/{username}/installation */ - issuesDeleteMilestone: (owner: string, repo: string, milestoneNumber: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/milestones/${milestoneNumber}`, - method: "DELETE", + appsGetUserInstallation: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/installation\`, + method: "GET", + format: "json", ...params, }), /** - * No description + * @description Lists the _verified_ public SSH keys for a user. This is accessible by anyone. * - * @tags issues - * @name IssuesListLabelsForMilestone - * @summary List labels for issues in a milestone - * @request GET:/repos/{owner}/{repo}/milestones/{milestone_number}/labels + * @tags users + * @name UsersListPublicKeysForUser + * @summary List public keys for a user + * @request GET:/users/{username}/keys */ - issuesListLabelsForMilestone: ( - owner: string, - repo: string, - milestoneNumber: number, + usersListPublicKeysForUser: ( + username: string, query?: { /** * Page number of the results to fetch. @@ -21983,8 +35466,8 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/milestones/${milestoneNumber}/labels`, + this.request({ + path: \`/users/\${username}/keys\`, method: "GET", query: query, format: "json", @@ -21992,208 +35475,158 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/notifications`, + this.request({ + path: \`/users/\${username}/orgs\`, method: "GET", query: query, format: "json", ...params, }), - /** - * @description Marks all notifications in a repository as "read" removes them from the [default view on GitHub](https://github.com/notifications). If the number of notifications is too large to complete in one request, you will receive a `202 Accepted` status and GitHub will run an asynchronous process to mark notifications as "read." To check whether any "unread" notifications remain, you can use the [List repository notifications for the authenticated user](https://docs.github.com/rest/reference/activity#list-repository-notifications-for-the-authenticated-user) endpoint and pass the query parameter `all=false`. - * - * @tags activity - * @name ActivityMarkRepoNotificationsAsRead - * @summary Mark repository notifications as read - * @request PUT:/repos/{owner}/{repo}/notifications - */ - activityMarkRepoNotificationsAsRead: ( - owner: string, - repo: string, - data: { - /** Describes the last point that notifications were checked. Anything updated since this time will not be marked as read. If you omit this parameter, all notifications are marked as read. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. Default: The current timestamp. */ - last_read_at?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/notifications`, - method: "PUT", - body: data, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags repos - * @name ReposGetPages - * @summary Get a GitHub Pages site - * @request GET:/repos/{owner}/{repo}/pages - */ - reposGetPages: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/pages`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Configures a GitHub Pages site. For more information, see "[About GitHub Pages](/github/working-with-github-pages/about-github-pages)." - * - * @tags repos - * @name ReposCreatePagesSite - * @summary Create a GitHub Pages site - * @request POST:/repos/{owner}/{repo}/pages + /** + * No description + * + * @tags projects + * @name ProjectsListForUser + * @summary List user projects + * @request GET:/users/{username}/projects */ - reposCreatePagesSite: ( - owner: string, - repo: string, - data: { - /** The source branch and directory used to publish your Pages site. */ - source: { - /** The repository branch used to publish your site's source files. */ - branch: string; - /** - * The repository directory that includes the source files for the Pages site. Allowed paths are `/` or `/docs`. Default: `/` - * @default "/" - */ - path?: "/" | "/docs"; - }; + projectsListForUser: ( + username: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + /** + * Indicates the state of the projects to return. Can be either \`open\`, \`closed\`, or \`all\`. + * @default "open" + */ + state?: "open" | "closed" | "all"; }, params: RequestParams = {}, ) => this.request< - Page, - | BasicError + Project[], | { documentation_url: string; message: string; } | ValidationError >({ - path: `/repos/${owner}/${repo}/pages`, - method: "POST", - body: data, - type: ContentType.Json, + path: \`/users/\${username}/projects\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description Updates information for a GitHub Pages site. For more information, see "[About GitHub Pages](/github/working-with-github-pages/about-github-pages). + * @description These are events that you've received by watching repos and following users. If you are authenticated as the given user, you will see private events. Otherwise, you'll only see public events. * - * @tags repos - * @name ReposUpdateInformationAboutPagesSite - * @summary Update information about a GitHub Pages site - * @request PUT:/repos/{owner}/{repo}/pages + * @tags activity + * @name ActivityListReceivedEventsForUser + * @summary List events received by the authenticated user + * @request GET:/users/{username}/received_events */ - reposUpdateInformationAboutPagesSite: ( - owner: string, - repo: string, - data: { - /** Specify a custom domain for the repository. Sending a `null` value will remove the custom domain. For more about custom domains, see "[Using a custom domain with GitHub Pages](https://help.github.com/articles/using-a-custom-domain-with-github-pages/)." */ - cname?: string | null; - /** Configures access controls for the GitHub Pages site. If public is set to `true`, the site is accessible to anyone on the internet. If set to `false`, the site will only be accessible to users who have at least `read` access to the repository that published the site. This includes anyone in your Enterprise if the repository is set to `internal` visibility. This feature is only available to repositories in an organization on an Enterprise plan. */ - public?: boolean; - /** Update the source for the repository. Must include the branch name, and may optionally specify the subdirectory `/docs`. Possible values are `"gh-pages"`, `"master"`, and `"master /docs"`. */ - source: - | "gh-pages" - | "master" - | "master /docs" - | { - /** The repository branch used to publish your site's source files. */ - branch: string; - /** The repository directory that includes the source files for the Pages site. Allowed paths are `/` or `/docs`. */ - path: "/" | "/docs"; - }; + activityListReceivedEventsForUser: ( + username: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/pages`, - method: "PUT", - body: data, - type: ContentType.Json, + this.request({ + path: \`/users/\${username}/received_events\`, + method: "GET", + query: query, + format: "json", ...params, }), /** * No description * - * @tags repos - * @name ReposDeletePagesSite - * @summary Delete a GitHub Pages site - * @request DELETE:/repos/{owner}/{repo}/pages + * @tags activity + * @name ActivityListReceivedPublicEventsForUser + * @summary List public events received by a user + * @request GET:/users/{username}/received_events/public */ - reposDeletePagesSite: (owner: string, repo: string, params: RequestParams = {}) => - this.request< - void, - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/repos/${owner}/${repo}/pages`, - method: "DELETE", + activityListReceivedPublicEventsForUser: ( + username: string, + query?: { + /** + * Page number of the results to fetch. + * @default 1 + */ + page?: number; + /** + * Results per page (max 100) + * @default 30 + */ + per_page?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/users/\${username}/received_events/public\`, + method: "GET", + query: query, + format: "json", ...params, }), /** - * No description + * @description Lists public repositories for the specified user. * * @tags repos - * @name ReposListPagesBuilds - * @summary List GitHub Pages builds - * @request GET:/repos/{owner}/{repo}/pages/builds + * @name ReposListForUser + * @summary List repositories for a user + * @request GET:/users/{username}/repos */ - reposListPagesBuilds: ( - owner: string, - repo: string, + reposListForUser: ( + username: string, query?: { + /** Can be one of \`asc\` or \`desc\`. Default: \`asc\` when using \`full_name\`, otherwise \`desc\` */ + direction?: "asc" | "desc"; /** * Page number of the results to fetch. * @default 1 @@ -22204,11 +35637,21 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/pages/builds`, + this.request({ + path: \`/users/\${username}/repos\`, method: "GET", query: query, format: "json", @@ -22216,65 +35659,69 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/pages/builds`, - method: "POST", + billingGetGithubActionsBillingUser: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/settings/billing/actions\`, + method: "GET", format: "json", ...params, }), /** - * No description + * @description Gets the free and paid storage used for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`user\` scope. * - * @tags repos - * @name ReposGetLatestPagesBuild - * @summary Get latest Pages build - * @request GET:/repos/{owner}/{repo}/pages/builds/latest + * @tags billing + * @name BillingGetGithubPackagesBillingUser + * @summary Get GitHub Packages billing for a user + * @request GET:/users/{username}/settings/billing/packages */ - reposGetLatestPagesBuild: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/pages/builds/latest`, + billingGetGithubPackagesBillingUser: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/settings/billing/packages\`, method: "GET", format: "json", ...params, }), /** - * No description + * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the \`user\` scope. * - * @tags repos - * @name ReposGetPagesBuild - * @summary Get GitHub Pages build - * @request GET:/repos/{owner}/{repo}/pages/builds/{build_id} + * @tags billing + * @name BillingGetSharedStorageBillingUser + * @summary Get shared storage billing for a user + * @request GET:/users/{username}/settings/billing/shared-storage */ - reposGetPagesBuild: (owner: string, repo: string, buildId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/pages/builds/${buildId}`, + billingGetSharedStorageBillingUser: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${username}/settings/billing/shared-storage\`, method: "GET", format: "json", ...params, }), /** - * @description Lists the projects in a repository. Returns a `404 Not Found` status if projects are disabled in the repository. If you do not have sufficient privileges to perform this action, a `401 Unauthorized` or `410 Gone` status is returned. + * @description Lists repositories a user has starred. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the \`Accept\` header: * - * @tags projects - * @name ProjectsListForRepo - * @summary List repository projects - * @request GET:/repos/{owner}/{repo}/projects + * @tags activity + * @name ActivityListReposStarredByUser + * @summary List repositories starred by a user + * @request GET:/users/{username}/starred */ - projectsListForRepo: ( - owner: string, - repo: string, + activityListReposStarredByUser: ( + username: string, query?: { + /** + * One of \`asc\` (ascending) or \`desc\` (descending). + * @default "desc" + */ + direction?: "asc" | "desc"; /** * Page number of the results to fetch. * @default 1 @@ -22286,15 +35733,15 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/projects`, + this.request({ + path: \`/users/\${username}/starred\`, method: "GET", query: query, format: "json", @@ -22302,51 +35749,16 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/projects`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + * @description Lists repositories a user is watching. * - * @tags pulls - * @name PullsList - * @summary List pull requests - * @request GET:/repos/{owner}/{repo}/pulls + * @tags activity + * @name ActivityListReposWatchedByUser + * @summary List repositories watched by a user + * @request GET:/users/{username}/subscriptions */ - pullsList: ( - owner: string, - repo: string, + activityListReposWatchedByUser: ( + username: string, query?: { - /** Filter pulls by base branch name. Example: `gh-pages`. */ - base?: string; - /** The direction of the sort. Can be either `asc` or `desc`. Default: `desc` when sort is `created` or sort is not specified, otherwise `asc`. */ - direction?: "asc" | "desc"; - /** Filter pulls by head user or head organization and branch name in the format of `user:ref-name` or `organization:ref-name`. For example: `github:new-script-format` or `octocat:test-branch`. */ - head?: string; /** * Page number of the results to fetch. * @default 1 @@ -22357,611 +35769,1529 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/pulls`, + this.request({ + path: \`/users/\${username}/subscriptions\`, method: "GET", query: query, format: "json", ...params, }), - + }; + zen = { /** - * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request. You can create a new pull request. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @description Get a random sentence from the Zen of GitHub * - * @tags pulls - * @name PullsCreate - * @summary Create a pull request - * @request POST:/repos/{owner}/{repo}/pulls + * @tags meta + * @name MetaGetZen + * @summary Get the Zen of GitHub + * @request GET:/zen */ - pullsCreate: ( - owner: string, - repo: string, - data: { - /** The name of the branch you want the changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository. */ - base: string; - /** The contents of the pull request. */ - body?: string; - /** Indicates whether the pull request is a draft. See "[Draft Pull Requests](https://help.github.com/en/articles/about-pull-requests#draft-pull-requests)" in the GitHub Help documentation to learn more. */ - draft?: boolean; - /** The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace `head` with a user like this: `username:branch`. */ - head: string; - /** @example 1 */ - issue?: number; - /** Indicates whether [maintainers can modify](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) the pull request. */ - maintainer_can_modify?: boolean; - /** The title of the new pull request. */ - title?: string; + metaGetZen: (params: RequestParams = {}) => + this.request({ + path: \`/zen\`, + method: "GET", + ...params, + }), + }; +} +" +`; + +exports[`simple > 'furkot-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Step { + /** address of the stop */ + address?: string; + /** + * arrival at the stop in its local timezone as YYYY-MM-DDThh:mm + * @format date-time + */ + arrival?: string; + /** geographical coordinates of the stop */ + coordinates?: { + /** + * latitude + * @format float + */ + lat?: number; + /** + * longitude + * @format float + */ + lon?: number; + }; + /** + * departure from the stop in its local timezone as YYYY-MM-DDThh:mm + * @format date-time + */ + departure?: string; + /** name of the stop */ + name?: string; + /** + * number of nights + * @format int64 + */ + nights?: number; + /** route leading to the stop */ + route?: { + /** + * route distance in meters + * @format int64 + */ + distance?: number; + /** + * route duration in seconds + * @format int64 + */ + duration?: number; + /** travel mode */ + mode?: "car" | "motorcycle" | "bicycle" | "walk" | "other"; + /** route path compatible with Google polyline encoding algorithm */ + polyline?: string; + }; + /** url of the page with more information about the stop */ + url?: string; +} + +export interface Trip { + /** + * begin of the trip in its local timezone as YYYY-MM-DDThh:mm + * @format date-time + */ + begin?: string; + /** description of the trip (truncated to 200 characters) */ + description?: string; + /** + * end of the trip in its local timezone as YYYY-MM-DDThh:mm + * @format date-time + */ + end?: string; + /** Unique ID of the trip */ + id?: string; + /** name of the trip */ + name?: string; +} + +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://trips.furkot.com/pub/api"; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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 Furkot Trips + * @version 1.0.0 + * @baseUrl https://trips.furkot.com/pub/api + * @externalDocs https://help.furkot.com/widgets/furkot-api.html + * @contact + * + * Furkot provides Rest API to access user trip data. + * Using Furkot API an application can list user trips and display stops for a specific trip. + * Furkot API uses OAuth2 protocol to authorize applications to access data on behalf of users. + */ +export class Api extends HttpClient { + trip = { /** - * @description Lists review comments for all pull requests in a repository. By default, review comments are in ascending order by ID. + * @description list user's trips * - * @tags pulls - * @name PullsListReviewCommentsForRepo - * @summary List review comments in a repository - * @request GET:/repos/{owner}/{repo}/pulls/comments + * @name TripList + * @request GET:/trip + * @secure */ - pullsListReviewCommentsForRepo: ( - owner: string, - repo: string, - query?: { - /** Can be either `asc` or `desc`. Ignored without `sort` parameter. */ - direction?: "asc" | "desc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - since?: string; - /** - * One of `created` (when the repository was starred) or `updated` (when it was last pushed to). - * @default "created" - */ - sort?: "created" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, + tripList: (params: RequestParams = {}) => + this.request({ + path: \`/trip\`, method: "GET", - query: query, + secure: true, format: "json", ...params, }), /** - * @description Provides details for a review comment. + * @description list stops for a trip identified by {trip_id} * - * @tags pulls - * @name PullsGetReviewComment - * @summary Get a review comment for a pull request - * @request GET:/repos/{owner}/{repo}/pulls/comments/{comment_id} + * @name StopDetail + * @request GET:/trip/{trip_id}/stop + * @secure */ - pullsGetReviewComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + stopDetail: (tripId: string, params: RequestParams = {}) => + this.request({ + path: \`/trip/\${tripId}/stop\`, method: "GET", + secure: true, format: "json", ...params, }), + }; +} +" +`; - /** - * @description Enables you to edit a review comment. - * - * @tags pulls - * @name PullsUpdateReviewComment - * @summary Update a review comment for a pull request - * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{comment_id} - */ - pullsUpdateReviewComment: ( - owner: string, - repo: string, - commentId: number, - data: { - /** The text of the reply to the review comment. */ - body: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), +exports[`simple > 'giphy' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ - /** - * @description Deletes a review comment. - * - * @tags pulls - * @name PullsDeleteReviewComment - * @summary Delete a review comment for a pull request - * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{comment_id} - */ - pullsDeleteReviewComment: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, - method: "DELETE", - ...params, - }), +export interface Gif { + /** + * The unique bit.ly URL for this GIF + * @example "http://gph.is/1gsWDcL" + */ + bitly_url?: string; + /** Currently unused */ + content_url?: string; + /** + * The date this GIF was added to the GIPHY database. + * @format date-time + * @example "2013-08-01 12:41:48" + */ + create_datetime?: string; + /** + * A URL used for embedding this GIF + * @example "http://giphy.com/embed/YsTs5ltWtEhnq" + */ + embded_url?: string; + /** An array of featured tags for this GIF (Note: Not available when using the Public Beta Key) */ + featured_tags?: string[]; + /** + * This GIF's unique ID + * @example "YsTs5ltWtEhnq" + */ + id?: string; + /** An object containing data for various available formats and sizes of this GIF. */ + images?: { + /** Data surrounding a version of this GIF downsized to be under 2mb. */ + downsized?: Image; + /** Data surrounding a version of this GIF downsized to be under 8mb. */ + downsized_large?: Image; + /** Data surrounding a version of this GIF downsized to be under 5mb. */ + downsized_medium?: Image; + /** Data surrounding a version of this GIF downsized to be under 200kb. */ + downsized_small?: Image; + /** Data surrounding a static preview image of the downsized version of this GIF. */ + downsized_still?: Image; + /** Data surrounding versions of this GIF with a fixed height of 200 pixels. Good for mobile use. */ + fixed_height?: Image; + /** Data surrounding versions of this GIF with a fixed height of 200 pixels and the number of frames reduced to 6. */ + fixed_height_downsampled?: Image; + /** Data surrounding versions of this GIF with a fixed height of 100 pixels. Good for mobile keyboards. */ + fixed_height_small?: Image; + /** Data surrounding a static image of this GIF with a fixed height of 100 pixels. */ + fixed_height_small_still?: Image; + /** Data surrounding a static image of this GIF with a fixed height of 200 pixels. */ + fixed_height_still?: Image; + /** Data surrounding versions of this GIF with a fixed width of 200 pixels. Good for mobile use. */ + fixed_width?: Image; + /** Data surrounding versions of this GIF with a fixed width of 200 pixels and the number of frames reduced to 6. */ + fixed_width_downsampled?: Image; + /** Data surrounding versions of this GIF with a fixed width of 100 pixels. Good for mobile keyboards. */ + fixed_width_small?: Image; + /** Data surrounding a static image of this GIF with a fixed width of 100 pixels. */ + fixed_width_small_still?: Image; + /** Data surrounding a static image of this GIF with a fixed width of 200 pixels. */ + fixed_width_still?: Image; + /** Data surrounding a version of this GIF set to loop for 15 seconds. */ + looping?: Image; + /** Data surrounding the original version of this GIF. Good for desktop use. */ + original?: Image; + /** Data surrounding a static preview image of the original GIF. */ + original_still?: Image; + /** Data surrounding a version of this GIF in .MP4 format limited to 50kb that displays the first 1-2 seconds of the GIF. */ + preview?: Image; + /** Data surrounding a version of this GIF limited to 50kb that displays the first 1-2 seconds of the GIF. */ + preview_gif?: Image; + }; + /** + * The creation or upload date from this GIF's source. + * @format date-time + * @example "2013-08-01 12:41:48" + */ + import_datetime?: string; + /** + * The MPAA-style rating for this content. Examples include Y, G, PG, PG-13 and R + * @example "g" + */ + rating?: string; + /** + * The unique slug used in this GIF's URL + * @example "confused-flying-YsTs5ltWtEhnq" + */ + slug?: string; + /** + * The page on which this GIF was found + * @example "http://www.reddit.com/r/reactiongifs/comments/1xpyaa/superman_goes_to_hollywood/" + */ + source?: string; + /** + * The URL of the webpage on which this GIF was found. + * @example "http://cheezburger.com/5282328320" + */ + source_post_url?: string; + /** + * The top level domain of the source URL. + * @example "cheezburger.com" + */ + source_tld?: string; + /** An array of tags for this GIF (Note: Not available when using the Public Beta Key) */ + tags?: string[]; + /** + * The date on which this gif was marked trending, if applicable. + * @format date-time + * @example "2013-08-01 12:41:48" + */ + trending_datetime?: string; + /** + * Type of the gif. By default, this is almost always gif + * @default "gif" + */ + type?: "gif"; + /** + * The date on which this GIF was last updated. + * @format date-time + * @example "2013-08-01 12:41:48" + */ + update_datetime?: string; + /** + * The unique URL for this GIF + * @example "http://giphy.com/gifs/confused-flying-YsTs5ltWtEhnq" + */ + url?: string; + /** The User Object contains information about the user associated with a GIF and URLs to assets such as that user's avatar image, profile, and more. */ + user?: User; + /** + * The username this GIF is attached to, if applicable + * @example "JoeCool4000" + */ + username?: string; +} - /** - * @description List the reactions to a [pull request review comment](https://docs.github.com/rest/reference/pulls#review-comments). - * - * @tags reactions - * @name ReactionsListForPullRequestReviewComment - * @summary List reactions for a pull request review comment - * @request GET:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions - */ - reactionsListForPullRequestReviewComment: ( - owner: string, - repo: string, - commentId: number, - query?: { - /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a pull request review comment. */ - content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; +export interface Image { + /** + * The URL for this GIF in .MP4 format. + * @example "https://media1.giphy.com/media/cZ7rmKfFYOvYI/giphy.mp4" + */ + mp4?: string; + /** + * The size in bytes of the .MP4 file corresponding to this GIF. + * @example "25123" + */ + mp4_size?: string; + /** + * The number of frames in this GIF. + * @example "15" + */ + frames?: string; + /** + * The height of this GIF in pixels. + * @example "200" + */ + height?: string; + /** + * The size of this GIF in bytes. + * @example "32381" + */ + size?: string; + /** + * The publicly-accessible direct URL for this GIF. + * @example "https://media1.giphy.com/media/cZ7rmKfFYOvYI/200.gif" + */ + url?: string; + /** + * The URL for this GIF in .webp format. + * @example "https://media1.giphy.com/media/cZ7rmKfFYOvYI/giphy.webp" + */ + webp?: string; + /** + * The size in bytes of the .webp file corresponding to this GIF. + * @example "12321" + */ + webp_size?: string; + /** + * The width of this GIF in pixels. + * @example "320" + */ + width?: string; +} + +/** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ +export interface Meta { + /** + * HTTP Response Message + * @example "OK" + */ + msg?: string; + /** + * A unique ID paired with this response from the API. + * @example "57eea03c72381f86e05c35d2" + */ + response_id?: string; + /** + * HTTP Response Code + * @format int32 + * @example 200 + */ + status?: number; +} + +/** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ +export interface Pagination { + /** + * Total number of items returned. + * @format int32 + * @example 25 + */ + count?: number; + /** + * Position in pagination. + * @format int32 + * @example 75 + */ + offset?: number; + /** + * Total number of items available. + * @format int32 + * @example 250 + */ + total_count?: number; +} + +/** The User Object contains information about the user associated with a GIF and URLs to assets such as that user's avatar image, profile, and more. */ +export interface User { + /** + * The URL for this user's avatar image. + * @example "https://media1.giphy.com/avatars/election2016/XwYrZi5H87o6.gif" + */ + avatar_url?: string; + /** + * The URL for the banner image that appears atop this user's profile page. + * @example "https://media4.giphy.com/avatars/cheezburger/XkuejOhoGLE6.jpg" + */ + banner_url?: string; + /** + * The display name associated with this user (contains formatting the base username might not). + * @example "JoeCool4000" + */ + display_name?: string; + /** + * The URL for this user's profile. + * @example "https://giphy.com/cheezburger/" + */ + profile_url?: string; + /** + * The Twitter username associated with this user, if applicable. + * @example "@joecool4000" + */ + twitter?: string; + /** + * The username associated with this user. + * @example "joecool4000" + */ + username?: string; +} + +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://api.giphy.com/v1"; + 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) || {}), }, - params: RequestParams = {}, - ) => - this.request< - Reaction[], - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}/reactions`, - method: "GET", - query: query, - format: "json", - ...params, - }), + }; + } - /** - * @description Create a reaction to a [pull request review comment](https://docs.github.com/rest/reference/pulls#comments). A response with a `Status: 200 OK` means that you already added the reaction type to this pull request review comment. - * - * @tags reactions - * @name ReactionsCreateForPullRequestReviewComment - * @summary Create reaction for a pull request review comment - * @request POST:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions - */ - reactionsCreateForPullRequestReviewComment: ( - owner: string, - repo: string, - commentId: number, - data: { - /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the pull request review comment. */ - content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request< - Reaction, - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}/reactions`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description **Note:** You can also specify a repository by `repository_id` using the route `DELETE /repositories/:repository_id/pulls/comments/:comment_id/reactions/:reaction_id.` Delete a reaction to a [pull request review comment](https://docs.github.com/rest/reference/pulls#review-comments). - * - * @tags reactions - * @name ReactionsDeleteForPullRequestComment - * @summary Delete a pull request comment reaction - * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{comment_id}/reactions/{reaction_id} - */ - reactionsDeleteForPullRequestComment: ( - owner: string, - repo: string, - commentId: number, - reactionId: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}/reactions/${reactionId}`, - method: "DELETE", - ...params, - }), + 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 Giphy + * @version 1.0 + * @termsOfService https://developers.giphy.com/ + * @baseUrl https://api.giphy.com/v1 + * @externalDocs https://developers.giphy.com/docs/ + * @contact + * + * Giphy API + */ +export class Api extends HttpClient { + gifs = { /** - * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Lists details of a pull request by providing its number. When you get, [create](https://docs.github.com/rest/reference/pulls/#create-a-pull-request), or [edit](https://docs.github.com/rest/reference/pulls#update-a-pull-request) a pull request, GitHub creates a merge commit to test whether the pull request can be automatically merged into the base branch. This test commit is not added to the base branch or the head branch. You can review the status of the test commit using the `mergeable` key. For more information, see "[Checking mergeability of pull requests](https://docs.github.com/rest/guides/getting-started-with-the-git-database-api#checking-mergeability-of-pull-requests)". The value of the `mergeable` attribute can be `true`, `false`, or `null`. If the value is `null`, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-`null` value for the `mergeable` attribute in the response. If `mergeable` is `true`, then `merge_commit_sha` will be the SHA of the _test_ merge commit. The value of the `merge_commit_sha` attribute changes depending on the state of the pull request. Before merging a pull request, the `merge_commit_sha` attribute holds the SHA of the _test_ merge commit. After merging a pull request, the `merge_commit_sha` attribute changes depending on how you merged the pull request: * If merged as a [merge commit](https://help.github.com/articles/about-merge-methods-on-github/), `merge_commit_sha` represents the SHA of the merge commit. * If merged via a [squash](https://help.github.com/articles/about-merge-methods-on-github/#squashing-your-merge-commits), `merge_commit_sha` represents the SHA of the squashed commit on the base branch. * If [rebased](https://help.github.com/articles/about-merge-methods-on-github/#rebasing-and-merging-your-commits), `merge_commit_sha` represents the commit that the base branch was updated to. Pass the appropriate [media type](https://docs.github.com/rest/overview/media-types/#commits-commit-comparison-and-pull-requests) to fetch diff and patch formats. + * @description A multiget version of the get GIF by ID endpoint. * - * @tags pulls - * @name PullsGet - * @summary Get a pull request - * @request GET:/repos/{owner}/{repo}/pulls/{pull_number} + * @tags gifs + * @name GetGifsById + * @summary Get GIFs by ID + * @request GET:/gifs + * @secure */ - pullsGet: (owner: string, repo: string, pullNumber: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}`, + getGifsById: ( + query?: { + /** Filters results by specified GIF IDs, separated by commas. */ + ids?: string; + }, + params: RequestParams = {}, + ) => + this.request< + { + data?: Gif[]; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ + pagination?: Pagination; + }, + any + >({ + path: \`/gifs\`, method: "GET", + query: query, + secure: true, format: "json", ...params, }), /** - * @description Draft pull requests are available in public repositories with GitHub Free and GitHub Free for organizations, GitHub Pro, and legacy per-repository billing plans, and in public and private repositories with GitHub Team and GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To open or update a pull request in a public repository, you must have write access to the head or the source branch. For organization-owned repositories, you must be a member of the organization that owns the repository to open or update a pull request. + * @description Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. * - * @tags pulls - * @name PullsUpdate - * @summary Update a pull request - * @request PATCH:/repos/{owner}/{repo}/pulls/{pull_number} + * @tags gifs + * @name RandomGif + * @summary Random GIF + * @request GET:/gifs/random + * @secure */ - pullsUpdate: ( - owner: string, - repo: string, - pullNumber: number, - data: { - /** The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot update the base branch on a pull request to point to another repository. */ - base?: string; - /** The contents of the pull request. */ - body?: string; - /** Indicates whether [maintainers can modify](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork/) the pull request. */ - maintainer_can_modify?: boolean; - /** State of this Pull Request. Either `open` or `closed`. */ - state?: "open" | "closed"; - /** The title of the pull request. */ - title?: string; + randomGif: ( + query?: { + /** Filters results by specified rating. */ + rating?: string; + /** Filters results by specified tag. */ + tag?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}`, - method: "PATCH", - body: data, - type: ContentType.Json, + this.request< + { + data?: Gif; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + }, + any + >({ + path: \`/gifs/random\`, + method: "GET", + query: query, + secure: true, format: "json", ...params, }), /** - * @description Lists all review comments for a pull request. By default, review comments are in ascending order by ID. + * @description Search all GIPHY GIFs for a word or phrase. Punctuation will be stripped and ignored. Use a plus or url encode for phrases. Example paul+rudd, ryan+gosling or american+psycho. * - * @tags pulls - * @name PullsListReviewComments - * @summary List review comments on a pull request - * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/comments + * @tags gifs + * @name SearchGifs + * @summary Search GIFs + * @request GET:/gifs/search + * @secure */ - pullsListReviewComments: ( - owner: string, - repo: string, - pullNumber: number, - query?: { - /** Can be either `asc` or `desc`. Ignored without `sort` parameter. */ - direction?: "asc" | "desc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; + searchGifs: ( + query: { + /** Specify default language for regional content; use a 2-letter ISO 639-1 language code. */ + lang?: string; /** - * Results per page (max 100) - * @default 30 + * The maximum number of records to return. + * @format int32 + * @default 25 */ - per_page?: number; - /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - since?: string; + limit?: number; /** - * One of `created` (when the repository was starred) or `updated` (when it was last pushed to). - * @default "created" + * An optional results offset. + * @format int32 + * @default 0 */ - sort?: "created" | "updated"; + offset?: number; + /** Search query term or prhase. */ + q: string; + /** Filters results by specified rating. */ + rating?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/comments`, + this.request< + { + data?: Gif[]; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ + pagination?: Pagination; + }, + any + >({ + path: \`/gifs/search\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), /** - * @description Creates a review comment in the pull request diff. To add a regular comment to a pull request timeline, see "[Create an issue comment](https://docs.github.com/rest/reference/issues#create-an-issue-comment)." We recommend creating a review comment using `line`, `side`, and optionally `start_line` and `start_side` if your comment applies to more than one line in the pull request diff. You can still create a review comment using the `position` parameter. When you use `position`, the `line`, `side`, `start_line`, and `start_side` parameters are not required. For more information, see the [`comfort-fade` preview notice](https://docs.github.com/rest/reference/pulls#create-a-review-comment-for-a-pull-request-preview-notices). **Note:** The position value equals the number of lines down from the first "@@" hunk header in the file you want to add a comment. The line just below the "@@" line is position 1, the next line is position 2, and so on. The position in the diff continues to increase through lines of whitespace and additional hunks until the beginning of a new file. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @description The translate API draws on search, but uses the GIPHY \`special sauce\` to handle translating from one vocabulary to another. In this case, words and phrases to GIF * - * @tags pulls - * @name PullsCreateReviewComment - * @summary Create a review comment for a pull request - * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/comments + * @tags gifs + * @name TranslateGif + * @summary Translate phrase to GIF + * @request GET:/gifs/translate + * @secure */ - pullsCreateReviewComment: ( - owner: string, - repo: string, - pullNumber: number, - data: { - /** The text of the review comment. */ - body: string; - /** The SHA of the commit needing a comment. Not using the latest commit SHA may render your comment outdated if a subsequent commit modifies the line you specify as the `position`. */ - commit_id?: string; - /** @example 2 */ - in_reply_to?: number; - /** **Required with `comfort-fade` preview**. The line of the blob in the pull request diff that the comment applies to. For a multi-line comment, the last line of the range that your comment applies to. */ - line?: number; - /** The relative path to the file that necessitates a comment. */ - path: string; - /** **Required without `comfort-fade` preview**. The position in the diff where you want to add a review comment. Note this value is not the same as the line number in the file. For help finding the position value, read the note above. */ - position?: number; - /** **Required with `comfort-fade` preview**. In a split diff view, the side of the diff that the pull request's changes appear on. Can be `LEFT` or `RIGHT`. Use `LEFT` for deletions that appear in red. Use `RIGHT` for additions that appear in green or unchanged lines that appear in white and are shown for context. For a multi-line comment, side represents whether the last line of the comment range is a deletion or addition. For more information, see "[Diff view options](https://help.github.com/en/articles/about-comparing-branches-in-pull-requests#diff-view-options)" in the GitHub Help documentation. */ - side?: "LEFT" | "RIGHT"; - /** **Required when using multi-line comments**. To create multi-line comments, you must use the `comfort-fade` preview header. The `start_line` is the first line in the pull request diff that your multi-line comment applies to. To learn more about multi-line comments, see "[Commenting on a pull request](https://help.github.com/en/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)" in the GitHub Help documentation. */ - start_line?: number; - /** **Required when using multi-line comments**. To create multi-line comments, you must use the `comfort-fade` preview header. The `start_side` is the starting side of the diff that the comment applies to. Can be `LEFT` or `RIGHT`. To learn more about multi-line comments, see "[Commenting on a pull request](https://help.github.com/en/articles/commenting-on-a-pull-request#adding-line-comments-to-a-pull-request)" in the GitHub Help documentation. See `side` in this table for additional context. */ - start_side?: "LEFT" | "RIGHT" | "side"; + translateGif: ( + query: { + /** Search term. */ + s: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/comments`, - method: "POST", - body: data, - type: ContentType.Json, + this.request< + { + data?: Gif; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + }, + any + >({ + path: \`/gifs/translate\`, + method: "GET", + query: query, + secure: true, format: "json", ...params, }), /** - * @description Creates a reply to a review comment for a pull request. For the `comment_id`, provide the ID of the review comment you are replying to. This must be the ID of a _top-level review comment_, not a reply to that comment. Replies to replies are not supported. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + * @description Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the GIPHY homepage. Returns 25 results by default. * - * @tags pulls - * @name PullsCreateReplyForReviewComment - * @summary Create a reply for a review comment - * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/comments/{comment_id}/replies + * @tags gifs + * @name TrendingGifs + * @summary Trending GIFs + * @request GET:/gifs/trending + * @secure */ - pullsCreateReplyForReviewComment: ( - owner: string, - repo: string, - pullNumber: number, - commentId: number, - data: { - /** The text of the review comment. */ - body: string; + trendingGifs: ( + query?: { + /** + * The maximum number of records to return. + * @format int32 + * @default 25 + */ + limit?: number; + /** + * An optional results offset. + * @format int32 + * @default 0 + */ + offset?: number; + /** Filters results by specified rating. */ + rating?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/comments/${commentId}/replies`, - method: "POST", - body: data, - type: ContentType.Json, + this.request< + { + data?: Gif[]; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ + pagination?: Pagination; + }, + any + >({ + path: \`/gifs/trending\`, + method: "GET", + query: query, + secure: true, format: "json", ...params, }), /** - * @description Lists a maximum of 250 commits for a pull request. To receive a complete commit list for pull requests with more than 250 commits, use the [List commits](https://docs.github.com/rest/reference/repos#list-commits) endpoint. + * @description Returns a GIF given that GIF's unique ID * - * @tags pulls - * @name PullsListCommits - * @summary List commits on a pull request - * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/commits + * @tags gifs + * @name GetGifById + * @summary Get GIF by Id + * @request GET:/gifs/{gifId} + * @secure */ - pullsListCommits: ( - owner: string, - repo: string, - pullNumber: number, + getGifById: (gifId: number, params: RequestParams = {}) => + this.request< + { + data?: Gif; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + }, + any + >({ + path: \`/gifs/\${gifId}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + }; + stickers = { + /** + * @description Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. + * + * @tags stickers + * @name RandomSticker + * @summary Random Sticker + * @request GET:/stickers/random + * @secure + */ + randomSticker: ( query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + /** Filters results by specified rating. */ + rating?: string; + /** Filters results by specified tag. */ + tag?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/commits`, + this.request< + { + data?: Gif; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + }, + any + >({ + path: \`/stickers/random\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), /** - * @description **Note:** Responses include a maximum of 3000 files. The paginated response returns 30 files per page by default. + * @description Replicates the functionality and requirements of the classic GIPHY search, but returns animated stickers rather than GIFs. * - * @tags pulls - * @name PullsListFiles - * @summary List pull requests files - * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/files + * @tags stickers + * @name SearchStickers + * @summary Search Stickers + * @request GET:/stickers/search + * @secure */ - pullsListFiles: ( - owner: string, - repo: string, - pullNumber: number, - query?: { + searchStickers: ( + query: { + /** Specify default language for regional content; use a 2-letter ISO 639-1 language code. */ + lang?: string; /** - * Page number of the results to fetch. - * @default 1 + * The maximum number of records to return. + * @format int32 + * @default 25 */ - page?: number; + limit?: number; /** - * Results per page (max 100) - * @default 30 + * An optional results offset. + * @format int32 + * @default 0 */ - per_page?: number; + offset?: number; + /** Search query term or prhase. */ + q: string; + /** Filters results by specified rating. */ + rating?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/files`, + this.request< + { + data?: Gif[]; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ + pagination?: Pagination; + }, + any + >({ + path: \`/stickers/search\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), /** - * No description - * - * @tags pulls - * @name PullsCheckIfMerged - * @summary Check if a pull request has been merged - * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/merge - */ - pullsCheckIfMerged: (owner: string, repo: string, pullNumber: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/merge`, - method: "GET", - ...params, - }), - - /** - * @description This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. + * @description The translate API draws on search, but uses the GIPHY \`special sauce\` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. * - * @tags pulls - * @name PullsMerge - * @summary Merge a pull request - * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/merge + * @tags stickers + * @name TranslateSticker + * @summary Translate phrase to Sticker + * @request GET:/stickers/translate + * @secure */ - pullsMerge: ( - owner: string, - repo: string, - pullNumber: number, - data: { - /** Extra detail to append to automatic commit message. */ - commit_message?: string; - /** Title for the automatic commit message. */ - commit_title?: string; - /** Merge method to use. Possible values are `merge`, `squash` or `rebase`. Default is `merge`. */ - merge_method?: "merge" | "squash" | "rebase"; - /** SHA that pull request head must match to allow merge. */ - sha?: string; - } | null, + translateSticker: ( + query: { + /** Search term. */ + s: string; + }, params: RequestParams = {}, ) => this.request< - PullRequestMergeResult, - | BasicError - | { - documentation_url?: string; - message?: string; - } - | ValidationError + { + data?: Gif; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + }, + any >({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/merge`, - method: "PUT", - body: data, - type: ContentType.Json, + path: \`/stickers/translate\`, + method: "GET", + query: query, + secure: true, format: "json", ...params, }), /** - * No description + * @description Fetch Stickers currently trending online. Hand curated by the GIPHY editorial team. Returns 25 results by default. * - * @tags pulls - * @name PullsListRequestedReviewers - * @summary List requested reviewers for a pull request - * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + * @tags stickers + * @name TrendingStickers + * @summary Trending Stickers + * @request GET:/stickers/trending + * @secure */ - pullsListRequestedReviewers: ( - owner: string, - repo: string, - pullNumber: number, + trendingStickers: ( query?: { /** - * Page number of the results to fetch. - * @default 1 + * The maximum number of records to return. + * @format int32 + * @default 25 */ - page?: number; + limit?: number; /** - * Results per page (max 100) - * @default 30 + * An optional results offset. + * @format int32 + * @default 0 */ - per_page?: number; + offset?: number; + /** Filters results by specified rating. */ + rating?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/requested_reviewers`, + this.request< + { + data?: Gif[]; + /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check \`responses\` to see a description of types of response codes the API might give you under different cirumstances. */ + meta?: Meta; + /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ + pagination?: Pagination; + }, + any + >({ + path: \`/stickers/trending\`, + method: "GET", + query: query, + secure: true, + format: "json", + ...params, + }), + }; +} +" +`; + +exports[`simple > 'link-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Pullrequest { + author?: User; + id?: number; + repository?: Repository; + title?: string; +} + +export interface Repository { + owner?: User; + slug?: string; +} + +export interface User { + username?: string; + uuid?: string; +} + +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.clone() 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 Link Example + * @version 1.0.0 + */ +export class Api extends HttpClient { + v20 = { + /** + * No description + * + * @name GetUserByName + * @request GET:/2.0/users/{username} + */ + getUserByName: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/users/\${username}\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description This endpoint triggers [notifications](https://docs.github.com/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-abuse-rate-limits)" for details. + * No description * - * @tags pulls - * @name PullsRequestReviewers - * @summary Request reviewers for a pull request - * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/requested_reviewers + * @name GetRepositoriesByOwner + * @request GET:/2.0/repositories/{username} */ - pullsRequestReviewers: ( - owner: string, - repo: string, - pullNumber: number, - data: { - /** An array of user `login`s that will be requested. */ - reviewers?: string[]; - /** An array of team `slug`s that will be requested. */ - team_reviewers?: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/requested_reviewers`, - method: "POST", - body: data, - type: ContentType.Json, + getRepositoriesByOwner: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}\`, + method: "GET", format: "json", ...params, }), @@ -22969,59 +37299,33 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/requested_reviewers`, - method: "DELETE", - body: data, - type: ContentType.Json, + getRepository: (username: string, slug: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}\`, + method: "GET", + format: "json", ...params, }), /** - * @description The list of reviews returns in chronological order. + * No description * - * @tags pulls - * @name PullsListReviews - * @summary List reviews for a pull request - * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews + * @name GetPullRequestsByRepository + * @request GET:/2.0/repositories/{username}/{slug}/pullrequests */ - pullsListReviews: ( - owner: string, - repo: string, - pullNumber: number, + getPullRequestsByRepository: ( + username: string, + slug: string, query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + state?: "open" | "merged" | "declined"; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/reviews`, + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests\`, method: "GET", query: query, format: "json", @@ -23029,49 +37333,15 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/reviews`, - method: "POST", - body: data, - type: ContentType.Json, + getPullRequestsById: (username: string, slug: string, pid: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests/\${pid}\`, + method: "GET", format: "json", ...params, }), @@ -23079,1099 +37349,2278 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/reviews/${reviewId}`, - method: "GET", - format: "json", + mergePullRequest: (username: string, slug: string, pid: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests/\${pid}/merge\`, + method: "POST", ...params, }), + }; +} +" +`; + +exports[`simple > 'no-definitions-schema' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface BasicErrorModel { + /** + * @min 100 + * @max 600 + */ + code: number; + field?: string | null; + message: string; +} + +export type ExtendedErrorModel = BasicErrorModel & { + rootCause: string; +}; + +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.clone() 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 Empty schema example + * @version 1.0.0 + */ +export class Api extends HttpClient {} +" +`; + +exports[`simple > 'oneof-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Cat { + age?: number; + hunts?: boolean; +} + +export interface Dog { + bark?: boolean; + breed?: "Dingo" | "Husky" | "Retriever" | "Shepherd"; +} + +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; - /** - * @description Update the review summary comment with new text. - * - * @tags pulls - * @name PullsUpdateReview - * @summary Update a review for a pull request - * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} - */ - pullsUpdateReview: ( - owner: string, - repo: string, - pullNumber: number, - reviewId: number, - data: { - /** The body text of the pull request review. */ - body: string; + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/reviews/${reviewId}`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * No description - * - * @tags pulls - * @name PullsDeletePendingReview - * @summary Delete a pending review for a pull request - * @request DELETE:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id} - */ - pullsDeletePendingReview: ( - owner: string, - repo: string, - pullNumber: number, - reviewId: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/reviews/${reviewId}`, - method: "DELETE", - format: "json", - ...params, - }), + 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; + }); - /** - * @description List comments for a specific pull request review. - * - * @tags pulls - * @name PullsListCommentsForReview - * @summary List comments for a pull request review - * @request GET:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/comments - */ - pullsListCommentsForReview: ( - owner: string, - repo: string, - pullNumber: number, - reviewId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/reviews/${reviewId}/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } - /** - * @description **Note:** To dismiss a pull request review on a [protected branch](https://docs.github.com/rest/reference/repos#branches), you must be a repository administrator or be included in the list of people or teams who can dismiss pull request reviews. - * - * @tags pulls - * @name PullsDismissReview - * @summary Dismiss a review for a pull request - * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/dismissals - */ - pullsDismissReview: ( - owner: string, - repo: string, - pullNumber: number, - reviewId: number, - data: { - /** @example ""APPROVE"" */ - event?: string; - /** The message for the pull request review dismissal */ - message: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/reviews/${reviewId}/dismissals`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + if (!response.ok) throw data; + return data; + }); + }; +} +/** + * @title Oneof Example + * @version 1.0.0 + */ +export class Api extends HttpClient { + pets = { /** * No description * - * @tags pulls - * @name PullsSubmitReview - * @summary Submit a review for a pull request - * @request POST:/repos/{owner}/{repo}/pulls/{pull_number}/reviews/{review_id}/events + * @name PetsPartialUpdate + * @request PATCH:/pets */ - pullsSubmitReview: ( - owner: string, - repo: string, - pullNumber: number, - reviewId: number, - data: { - /** The body text of the pull request review */ - body?: string; - /** The review action you want to perform. The review actions include: `APPROVE`, `REQUEST_CHANGES`, or `COMMENT`. When you leave this blank, the API returns _HTTP 422 (Unrecognizable entity)_ and sets the review action state to `PENDING`, which means you will need to re-submit the pull request review using a review action. */ - event: "APPROVE" | "REQUEST_CHANGES" | "COMMENT"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/reviews/${reviewId}/events`, - method: "POST", + petsPartialUpdate: (data: Cat | Dog, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "PATCH", body: data, type: ContentType.Json, - format: "json", ...params, }), + }; +} +" +`; - /** - * @description Updates the pull request branch with the latest upstream changes by merging HEAD from the base branch into the pull request branch. - * - * @tags pulls - * @name PullsUpdateBranch - * @summary Update a pull request branch - * @request PUT:/repos/{owner}/{repo}/pulls/{pull_number}/update-branch - */ - pullsUpdateBranch: ( - owner: string, - repo: string, - pullNumber: number, - data: { - /** The expected SHA of the pull request's HEAD ref. This is the most recent commit on the pull request's branch. If the expected SHA does not match the pull request's HEAD, you will receive a `422 Unprocessable Entity` status. You can use the "[List commits](https://docs.github.com/rest/reference/repos#list-commits)" endpoint to find the most recent commit SHA. Default: SHA of the pull request's current HEAD ref. */ - expected_head_sha?: string; - } | null, - params: RequestParams = {}, - ) => - this.request< - { - message?: string; - url?: string; - }, - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/repos/${owner}/${repo}/pulls/${pullNumber}/update-branch`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), +exports[`simple > 'path-args' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ - /** - * @description Gets the preferred README for a repository. READMEs support [custom media types](https://docs.github.com/rest/reference/repos#custom-media-types) for retrieving the raw content or rendered HTML. - * - * @tags repos - * @name ReposGetReadme - * @summary Get a repository README - * @request GET:/repos/{owner}/{repo}/readme - */ - reposGetReadme: ( - owner: string, - repo: string, - query?: { - /** The name of the commit/branch/tag. Default: the repository’s default branch (usually `master`) */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/readme`, - method: "GET", - query: query, - format: "json", - ...params, - }), +export type QueryParamsType = Record; +export type ResponseFormat = keyof Omit; - /** - * @description This returns a list of releases, which does not include regular Git tags that have not been associated with a release. To get a list of Git tags, use the [Repository Tags API](https://docs.github.com/rest/reference/repos#list-repository-tags). Information about published releases are available to everyone. Only users with push access will receive listings for draft releases. - * - * @tags repos - * @name ReposListReleases - * @summary List releases - * @request GET:/repos/{owner}/{repo}/releases - */ - reposListReleases: ( - owner: string, - repo: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/releases`, - method: "GET", - query: query, - format: "json", - ...params, - }), +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; +} - /** - * @description Users with push access to the repository can create a release. This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. - * - * @tags repos - * @name ReposCreateRelease - * @summary Create a release - * @request POST:/repos/{owner}/{repo}/releases - */ - reposCreateRelease: ( - owner: string, - repo: string, - data: { - /** Text describing the contents of the tag. */ - body?: string; - /** - * `true` to create a draft (unpublished) release, `false` to create a published one. - * @default false - */ - draft?: boolean; - /** The name of the release. */ - name?: string; - /** - * `true` to identify the release as a prerelease. `false` to identify the release as a full release. - * @default false - */ - prerelease?: boolean; - /** The name of the tag. */ - tag_name: string; - /** Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually `master`). */ - target_commitish?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/releases`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), +export type RequestParams = Omit; - /** - * @description To download the asset's binary content, set the `Accept` header of the request to [`application/octet-stream`](https://docs.github.com/rest/overview/media-types). The API will either redirect the client to the location, or stream it directly if possible. API clients should handle both a `200` or `302` response. - * - * @tags repos - * @name ReposGetReleaseAsset - * @summary Get a release asset - * @request GET:/repos/{owner}/{repo}/releases/assets/{asset_id} - */ - reposGetReleaseAsset: (owner: string, repo: string, assetId: number, params: RequestParams = {}) => - this.request< - ReleaseAsset, - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/repos/${owner}/${repo}/releases/assets/${assetId}`, - method: "GET", - format: "json", - ...params, - }), +export interface ApiConfig { + baseUrl?: string; + baseApiParams?: Omit; + securityWorker?: (securityData: SecurityDataType | null) => Promise | RequestParams | void; + customFetch?: typeof fetch; +} - /** - * @description Users with push access to the repository can edit a release asset. - * - * @tags repos - * @name ReposUpdateReleaseAsset - * @summary Update a release asset - * @request PATCH:/repos/{owner}/{repo}/releases/assets/{asset_id} - */ - reposUpdateReleaseAsset: ( - owner: string, - repo: string, - assetId: number, - data: { - /** An alternate short description of the asset. Used in place of the filename. */ - label?: string; - /** The file name of the asset. */ - name?: string; - /** @example ""uploaded"" */ - state?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${assetId}`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), +export interface HttpResponse extends Response { + data: D; + error: E; +} - /** - * No description - * - * @tags repos - * @name ReposDeleteReleaseAsset - * @summary Delete a release asset - * @request DELETE:/repos/{owner}/{repo}/releases/assets/{asset_id} - */ - reposDeleteReleaseAsset: (owner: string, repo: string, assetId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${assetId}`, - method: "DELETE", - ...params, - }), +type CancelToken = Symbol | string | number; - /** - * @description View the latest published full release for the repository. The latest release is the most recent non-prerelease, non-draft release, sorted by the `created_at` attribute. The `created_at` attribute is the date of the commit used for the release, and not the date when the release was drafted or published. - * - * @tags repos - * @name ReposGetLatestRelease - * @summary Get the latest release - * @request GET:/repos/{owner}/{repo}/releases/latest - */ - reposGetLatestRelease: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/releases/latest`, - method: "GET", - format: "json", - ...params, - }), +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 = "http://unknown.io/v666"; + 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; + } - /** - * @description Get a published release with the specified tag. - * - * @tags repos - * @name ReposGetReleaseByTag - * @summary Get a release by tag name - * @request GET:/repos/{owner}/{repo}/releases/tags/{tag} - */ - reposGetReleaseByTag: (owner: string, repo: string, tag: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/releases/tags/${tag}`, - method: "GET", - format: "json", - ...params, - }), + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; - /** - * @description **Note:** This returns an `upload_url` key corresponding to the endpoint for uploading release assets. This key is a [hypermedia resource](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia). - * - * @tags repos - * @name ReposGetRelease - * @summary Get a release - * @request GET:/repos/{owner}/{repo}/releases/{release_id} - */ - reposGetRelease: (owner: string, repo: string, releaseId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/releases/${releaseId}`, - method: "GET", - format: "json", - ...params, - }), + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); - /** - * @description Users with push access to the repository can edit a release. - * - * @tags repos - * @name ReposUpdateRelease - * @summary Update a release - * @request PATCH:/repos/{owner}/{repo}/releases/{release_id} - */ - reposUpdateRelease: ( - owner: string, - repo: string, - releaseId: number, - data: { - /** Text describing the contents of the tag. */ - body?: string; - /** `true` makes the release a draft, and `false` publishes the release. */ - draft?: boolean; - /** The name of the release. */ - name?: string; - /** `true` to identify the release as a prerelease, `false` to identify the release as a full release. */ - prerelease?: boolean; - /** The name of the tag. */ - tag_name?: string; - /** Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists. Default: the repository's default branch (usually `master`). */ - target_commitish?: string; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/releases/${releaseId}`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description Users with push access to the repository can delete a release. - * - * @tags repos - * @name ReposDeleteRelease - * @summary Delete a release - * @request DELETE:/repos/{owner}/{repo}/releases/{release_id} - */ - reposDeleteRelease: (owner: string, repo: string, releaseId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/releases/${releaseId}`, - method: "DELETE", - ...params, - }), + 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 Path Args + * @version 1.0.0 + * @license MIT + * @baseUrl http://unknown.io/v666 + */ +export class Api extends HttpClient { + pets = { /** * No description * - * @tags repos - * @name ReposListReleaseAssets - * @summary List release assets - * @request GET:/repos/{owner}/{repo}/releases/{release_id}/assets + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/pets/{param1}/{param2}/{param3} */ - reposListReleaseAssets: ( - owner: string, - repo: string, - releaseId: number, + listPets: ( + param3: number, + param1?: number, + param2?: number, query?: { /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 + * How many items to return at one time (max 100) + * @format int32 */ - per_page?: number; + queryParam?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/releases/${releaseId}/assets`, + this.request({ + path: \`/pets/\${param1}/\${param2}/\${param3}\`, method: "GET", query: query, format: "json", ...params, }), + }; +} +" +`; + +exports[`simple > 'personal-api-example' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type AuthUserType = OmitIdUserType; + +export type ExtractedProjectType = OmitProjectTypeJob & { + /** Information about job */ + job: JobType; +}; + +/** Information about job */ +export interface FooBar { + kind?: JobKind; +} + +/** Information about job */ +export interface FooBarBaz { + id?: string; + kind?: JobKind; + link?: string; + name?: string; + [key: string]: any; +} + +/** Information about job */ +export interface FooBaz { + link?: string; + name?: string; +} + +/** + * FooBar + * @format int32 + */ +export enum IntEnumWithNames { + Unknown = 0, + String = 1, + Int32 = 2, + Int64 = 3, + Double = 4, + DateTime = 5, + Test2 = 6, + Test23 = 7, + Tess44 = 8, + BooFar = 9, +} + +export enum JobKind { + COMPANY = "COMPANY", + PERSONAL = "PERSONAL", + FREELANCE = "FREELANCE", + OPEN_SOURCE = "OPEN_SOURCE", +} + +/** Information about job */ +export interface JobType { + /** web site address */ + address?: string; + /** + * Exist only in open source jobs + * Format: \`\${username}/\${projectName}\` + */ + github?: string; + id: string; + /** + * Exist only in open source jobs + * Means project is dev. tool (like swagger code generator) + */ + isTool?: boolean; + kind: JobKind; + link?: string; + name?: string; + /** + * Exist only in open source jobs + * Format: \`\${orgname}/\${projectName}\` + */ + npm?: string; +} + +export type JobUpdateType = OmitIdJobType; + +export interface NullableEnum { + /** @format int64 */ + id?: number; + legalCategory?: "SARL" | "ASSOCIATION" | null; +} + +export type OmitIdJobType = OmitJobTypeIdOrId; + +export type OmitIdProjectType = OmitProjectTypeIdOrId; + +export type OmitIdUserType = OmitUserTypeIdOrId; + +export type OmitJobTypeIdOrId = PickJobTypeExcludeKeysIdOrId; + +export type OmitProjectTypeIdOrId = PickProjectTypeExcludeKeysIdOrId; + +export type OmitProjectTypeJob = PickProjectTypeExcludeKeysJob; + +export type OmitUserTypeIdOrId = PickUserTypeExcludeKeysIdOrId; + +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickJobTypeExcludeKeysIdOrId { + /** web site address */ + address?: string; + /** + * Exist only in open source jobs + * Format: \`\${username}/\${projectName}\` + */ + github?: string; + /** + * Exist only in open source jobs + * Means project is dev. tool (like swagger code generator) + */ + isTool?: boolean; + kind: JobKind; + link?: string; + name?: string; + /** + * Exist only in open source jobs + * Format: \`\${orgname}/\${projectName}\` + */ + npm?: string; +} + +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickProjectTypeExcludeKeysIdOrId { + description: string; + job: string; + name?: string; + notImportant?: boolean; + prefix?: string; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickProjectTypeExcludeKeysJob { + description: string; + id: string; + name?: string; + notImportant?: boolean; + prefix?: string; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickUserTypeExcludeKeysIdOrId { + password: string; + username: string; +} + +export interface ProjectType { + description: string; + id: string; + job: string; + name?: string; + notImportant?: boolean; + prefix?: string; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +export type ProjectUpdateType = OmitIdProjectType; + +export type TestAllOfDc = (FooBarBaz & FooBar) & { + prop?: string; +}; + +export type TestAllOfDc2 = FooBarBaz & { + prop?: string; +}; + +export type TestAnyOfDc = (FooBarBaz | FooBar) & { + prop?: string; +}; + +export type TestOneOfDc = (FooBarBaz | FooBar) & { + prop?: string; +}; + +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 = "http://localhost:8080/api/v1"; + 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.clone() 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 http://localhost:8080/api/v1 + */ +export class Api extends HttpClient { + auth = { /** - * @description This endpoint makes use of [a Hypermedia relation](https://docs.github.com/rest/overview/resources-in-the-rest-api#hypermedia) to determine which URL to access. The endpoint you call to upload release assets is specific to your release. Use the `upload_url` returned in the response of the [Create a release endpoint](https://docs.github.com/rest/reference/repos#create-a-release) to upload a release asset. You need to use an HTTP client which supports [SNI](http://en.wikipedia.org/wiki/Server_Name_Indication) to make calls to this endpoint. Most libraries will set the required `Content-Length` header automatically. Use the required `Content-Type` header to provide the media type of the asset. For a list of media types, see [Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml). For example: `application/zip` GitHub expects the asset data in its raw binary form, rather than JSON. You will send the raw binary content of the asset as the request body. Everything else about the endpoint is the same as the rest of the API. For example, you'll still need to pass your authentication to be able to upload an asset. When an upstream failure occurs, you will receive a `502 Bad Gateway` status. This may leave an empty asset with a state of `starter`. It can be safely deleted. **Notes:** * GitHub renames asset filenames that have special characters, non-alphanumeric characters, and leading or trailing periods. The "[List assets for a release](https://docs.github.com/rest/reference/repos#list-assets-for-a-release)" endpoint lists the renamed filenames. For more information and help, contact [GitHub Support](https://support.github.com/contact). * If you upload an asset with the same filename as another uploaded asset, you'll receive an error and must delete the old file before you can re-upload the new asset. + * No description * - * @tags repos - * @name ReposUploadReleaseAsset - * @summary Upload a release asset - * @request POST:/repos/{owner}/{repo}/releases/{release_id}/assets + * @tags Auth + * @name Login + * @request POST:/auth */ - reposUploadReleaseAsset: ( - owner: string, - repo: string, - releaseId: number, - data: WebhookConfigUrl, - query?: { - label?: string; - name?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/releases/${releaseId}/assets`, + login: (data: AuthUserType, params: RequestParams = {}) => + this.request({ + path: \`/auth\`, method: "POST", - query: query, body: data, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Lists all secret scanning alerts for a private repository, from newest to oldest. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the `repo` scope or `security_events` scope. GitHub Apps must have the `secret_scanning_alerts` read permission to use this endpoint. + * No description * - * @tags secret-scanning - * @name SecretScanningListAlertsForRepo - * @summary List secret scanning alerts for a repository - * @request GET:/repos/{owner}/{repo}/secret-scanning/alerts + * @tags Auth + * @name Refresh + * @request POST:/auth/refresh + * @secure */ - secretScanningListAlertsForRepo: ( - owner: string, - repo: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** Set to `open` or `resolved` to only list secret scanning alerts in a specific state. */ - state?: "open" | "resolved"; - }, - params: RequestParams = {}, - ) => - this.request< - SecretScanningAlert[], - void | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/repos/${owner}/${repo}/secret-scanning/alerts`, - method: "GET", - query: query, + refresh: (params: RequestParams = {}) => + this.request({ + path: \`/auth/refresh\`, + method: "POST", + secure: true, format: "json", ...params, }), - + }; + jobs = { /** - * @description Gets a single secret scanning alert detected in a private repository. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the `repo` scope or `security_events` scope. GitHub Apps must have the `secret_scanning_alerts` read permission to use this endpoint. + * No description * - * @tags secret-scanning - * @name SecretScanningGetAlert - * @summary Get a secret scanning alert - * @request GET:/repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} + * @tags Jobs + * @name GetJobs + * @request GET:/jobs + * @secure */ - secretScanningGetAlert: (owner: string, repo: string, alertNumber: AlertNumber, params: RequestParams = {}) => - this.request< - SecretScanningAlert, - void | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/repos/${owner}/${repo}/secret-scanning/alerts/${alertNumber}`, + getJobs: (params: RequestParams = {}) => + this.request({ + path: \`/jobs\`, method: "GET", + secure: true, format: "json", ...params, }), /** - * @description Updates the status of a secret scanning alert in a private repository. To use this endpoint, you must be an administrator for the repository or organization, and you must use an access token with the `repo` scope or `security_events` scope. GitHub Apps must have the `secret_scanning_alerts` write permission to use this endpoint. + * No description * - * @tags secret-scanning - * @name SecretScanningUpdateAlert - * @summary Update a secret scanning alert - * @request PATCH:/repos/{owner}/{repo}/secret-scanning/alerts/{alert_number} + * @tags Jobs + * @name AddJob + * @request POST:/jobs + * @secure */ - secretScanningUpdateAlert: ( - owner: string, - repo: string, - alertNumber: AlertNumber, - data: { - /** **Required when the `state` is `resolved`.** The reason for resolving the alert. Can be one of `false_positive`, `wont_fix`, `revoked`, or `used_in_tests`. */ - resolution?: SecretScanningAlertResolution; - /** Sets the state of the secret scanning alert. Can be either `open` or `resolved`. You must provide `resolution` when you set the state to `resolved`. */ - state: SecretScanningAlertState; - }, - params: RequestParams = {}, - ) => - this.request< - SecretScanningAlert, - void | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/repos/${owner}/${repo}/secret-scanning/alerts/${alertNumber}`, - method: "PATCH", + addJob: (data: JobUpdateType, params: RequestParams = {}) => + this.request({ + path: \`/jobs\`, + method: "POST", body: data, + secure: true, type: ContentType.Json, format: "json", ...params, }), /** - * @description Lists the people that have starred the repository. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the `Accept` header: + * No description * - * @tags activity - * @name ActivityListStargazersForRepo - * @summary List stargazers - * @request GET:/repos/{owner}/{repo}/stargazers + * @tags Jobs + * @name GetJob + * @request GET:/jobs/{id} + * @secure */ - activityListStargazersForRepo: ( - owner: string, - repo: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/stargazers`, + getJob: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, method: "GET", - query: query, + secure: true, format: "json", ...params, }), /** - * @description Returns a weekly aggregate of the number of additions and deletions pushed to a repository. + * No description * - * @tags repos - * @name ReposGetCodeFrequencyStats - * @summary Get the weekly commit activity - * @request GET:/repos/{owner}/{repo}/stats/code_frequency + * @tags Jobs + * @name UpdateJob + * @request PATCH:/jobs/{id} + * @secure */ - reposGetCodeFrequencyStats: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/stats/code_frequency`, - method: "GET", + updateJob: (id: string, params: JobUpdateType, requestParams: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, + method: "PATCH", + body: params, + secure: true, + type: ContentType.Json, format: "json", - ...params, + ...requestParams, }), /** - * @description Returns the last year of commit activity grouped by week. The `days` array is a group of commits per day, starting on `Sunday`. + * No description * - * @tags repos - * @name ReposGetCommitActivityStats - * @summary Get the last year of commit activity - * @request GET:/repos/{owner}/{repo}/stats/commit_activity + * @tags Jobs + * @name DeleteJob + * @request DELETE:/jobs/{id} + * @secure */ - reposGetCommitActivityStats: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/stats/commit_activity`, + deleteJob: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, + method: "DELETE", + secure: true, + format: "json", + ...params, + }), + }; + projects = { + /** + * No description + * + * @tags Projects + * @name GetProjects + * @request GET:/projects + */ + getProjects: (params: RequestParams = {}) => + this.request({ + path: \`/projects\`, method: "GET", format: "json", ...params, }), /** - * @description Returns the `total` number of commits authored by the contributor. In addition, the response includes a Weekly Hash (`weeks` array) with the following information: * `w` - Start of the week, given as a [Unix timestamp](http://en.wikipedia.org/wiki/Unix_time). * `a` - Number of additions * `d` - Number of deletions * `c` - Number of commits + * No description * - * @tags repos - * @name ReposGetContributorsStats - * @summary Get all contributor commit activity - * @request GET:/repos/{owner}/{repo}/stats/contributors + * @tags Projects + * @name AddProjects + * @request POST:/projects + * @secure */ - reposGetContributorsStats: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/stats/contributors`, - method: "GET", + addProjects: (data: ProjectUpdateType, params: RequestParams = {}) => + this.request({ + path: \`/projects\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Returns the total commit counts for the `owner` and total commit counts in `all`. `all` is everyone combined, including the `owner` in the last 52 weeks. If you'd like to get the commit counts for non-owners, you can subtract `owner` from `all`. The array order is oldest week (index 0) to most recent week. + * No description * - * @tags repos - * @name ReposGetParticipationStats - * @summary Get the weekly commit count - * @request GET:/repos/{owner}/{repo}/stats/participation + * @tags Projects + * @name UpdateProject + * @request PATCH:/projects/{id} + * @secure */ - reposGetParticipationStats: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/stats/participation`, - method: "GET", + updateProject: (id: string, data: ProjectUpdateType, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${id}\`, + method: "PATCH", + body: data, + secure: true, + type: ContentType.Json, format: "json", ...params, }), /** - * @description Each array contains the day number, hour number, and number of commits: * `0-6`: Sunday - Saturday * `0-23`: Hour of day * Number of commits For example, `[2, 14, 25]` indicates that there were 25 total commits, during the 2:00pm hour on Tuesdays. All times are based on the time zone of individual commits. + * No description * - * @tags repos - * @name ReposGetPunchCardStats - * @summary Get the hourly commit count for each day - * @request GET:/repos/{owner}/{repo}/stats/punch_card + * @tags Projects + * @name DeleteProject + * @request DELETE:/projects/{id} */ - reposGetPunchCardStats: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/stats/punch_card`, - method: "GET", + deleteProject: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${id}\`, + method: "DELETE", format: "json", ...params, }), + }; +} +" +`; + +exports[`simple > 'petstore' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Error { + /** @format int32 */ + code: number; + message: string; +} + +export interface Pet { + /** @format int64 */ + id: number; + name: string; + tag?: string; +} + +export type Pets = Pet[]; + +export type StringNullable = string | null; + +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 = "http://petstore.swagger.io/v1"; + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license MIT + * @baseUrl http://petstore.swagger.io/v1 + */ +export class Api extends HttpClient { + pets = { /** - * @description Users with push access in a repository can create commit statuses for a given SHA. Note: there is a limit of 1000 statuses per `sha` and `context` within a repository. Attempts to create more than 1000 statuses will result in a validation error. + * No description * - * @tags repos - * @name ReposCreateCommitStatus - * @summary Create a commit status - * @request POST:/repos/{owner}/{repo}/statuses/{sha} + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/pets */ - reposCreateCommitStatus: ( - owner: string, - repo: string, - sha: string, - data: { - /** - * A string label to differentiate this status from the status of other systems. This field is case-insensitive. - * @default "default" - */ - context?: string; - /** A short description of the status. */ - description?: string; - /** The state of the status. Can be one of `error`, `failure`, `pending`, or `success`. */ - state: "error" | "failure" | "pending" | "success"; + listPets: ( + query?: { /** - * The target URL to associate with this status. This URL will be linked from the GitHub UI to allow users to easily see the source of the status. - * For example, if your continuous integration system is posting build status, you would want to provide the deep link for the build output for this specific SHA: - * `http://ci.example.com/user/repo/build/sha` + * How many items to return at one time (max 100) + * @format int32 */ - target_url?: string; + limit?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/statuses/${sha}`, + this.request({ + path: \`/pets\`, + method: "GET", + query: query, + format: "json", + ...params, + }), + + /** + * No description + * + * @tags pets + * @name CreatePets + * @summary Create a pet + * @request POST:/pets + */ + createPets: (params: RequestParams = {}) => + this.request({ + path: \`/pets\`, method: "POST", - body: data, - type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags pets + * @name ShowPetById + * @summary Info for a specific pet + * @request GET:/pets/{petId} + */ + showPetById: (petId: string, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${petId}\`, + method: "GET", format: "json", ...params, }), + }; +} +" +`; + +exports[`simple > 'petstore' 2`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Error { + /** @format int32 */ + code: number; + message: string; +} + +export interface Pet { + /** @format int64 */ + id: number; + name: string; + tag?: string; +} + +export type Pets = Pet[]; + +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 = "http://petstore.swagger.io/v1"; + 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), + }; - /** - * @description Lists the people watching the specified repository. - * - * @tags activity - * @name ActivityListWatchersForRepo - * @summary List watchers - * @request GET:/repos/{owner}/{repo}/subscribers - */ - activityListWatchersForRepo: ( - owner: string, - repo: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams { + return { + ...this.baseApiParams, + ...params1, + ...(params2 || {}), + headers: { + ...(this.baseApiParams.headers || {}), + ...(params1.headers || {}), + ...((params2 && params2.headers) || {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/subscribers`, - method: "GET", - query: query, - format: "json", - ...params, - }), + }; + } - /** - * No description - * - * @tags activity - * @name ActivityGetRepoSubscription - * @summary Get a repository subscription - * @request GET:/repos/{owner}/{repo}/subscription - */ - activityGetRepoSubscription: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/subscription`, - method: "GET", - format: "json", - ...params, - }), + 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; + } - /** - * @description If you would like to watch a repository, set `subscribed` to `true`. If you would like to ignore notifications made within a repository, set `ignored` to `true`. If you would like to stop watching a repository, [delete the repository's subscription](https://docs.github.com/rest/reference/activity#delete-a-repository-subscription) completely. - * - * @tags activity - * @name ActivitySetRepoSubscription - * @summary Set a repository subscription - * @request PUT:/repos/{owner}/{repo}/subscription - */ - activitySetRepoSubscription: ( - owner: string, - repo: string, - data: { - /** Determines if all notifications should be blocked from this repository. */ - ignored?: boolean; - /** Determines if notifications should be received from this repository. */ - subscribed?: boolean; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/subscription`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description This endpoint should only be used to stop watching a repository. To control whether or not you wish to receive notifications from a repository, [set the repository's subscription manually](https://docs.github.com/rest/reference/activity#set-a-repository-subscription). - * - * @tags activity - * @name ActivityDeleteRepoSubscription - * @summary Delete a repository subscription - * @request DELETE:/repos/{owner}/{repo}/subscription - */ - activityDeleteRepoSubscription: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/subscription`, - method: "DELETE", - ...params, - }), + 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 Swagger Petstore + * @version 1.0.0 + * @license MIT + * @baseUrl http://petstore.swagger.io/v1 + */ +export class Api extends HttpClient { + pets = { /** * No description * - * @tags repos - * @name ReposListTags - * @summary List repository tags - * @request GET:/repos/{owner}/{repo}/tags + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/pets */ - reposListTags: ( - owner: string, - repo: string, + listPets: ( query?: { /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 + * How many items to return at one time (max 100) + * @format int32 */ - per_page?: number; + limit?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/tags`, + this.request({ + path: \`/pets\`, method: "GET", query: query, format: "json", ...params, }), - /** - * @description Gets a redirect URL to download a tar archive for a repository. If you omit `:ref`, the repository’s default branch (usually `master`) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use the `Location` header to make a second `GET` request. **Note**: For private repositories, these links are temporary and expire after five minutes. - * - * @tags repos - * @name ReposDownloadTarballArchive - * @summary Download a repository archive (tar) - * @request GET:/repos/{owner}/{repo}/tarball/{ref} - */ - reposDownloadTarballArchive: (owner: string, repo: string, ref: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/tarball/${ref}`, - method: "GET", - ...params, - }), - /** * No description * - * @tags repos - * @name ReposListTeams - * @summary List repository teams - * @request GET:/repos/{owner}/{repo}/teams + * @tags pets + * @name CreatePets + * @summary Create a pet + * @request POST:/pets */ - reposListTeams: ( - owner: string, - repo: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/teams`, - method: "GET", - query: query, - format: "json", + createPets: (params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "POST", ...params, }), /** * No description * - * @tags repos - * @name ReposGetAllTopics - * @summary Get all repository topics - * @request GET:/repos/{owner}/{repo}/topics + * @tags pets + * @name ShowPetById + * @summary Info for a specific pet + * @request GET:/pets/{petId} */ - reposGetAllTopics: (owner: string, repo: string, params: RequestParams = {}) => - this.request< - Topic, - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/repos/${owner}/${repo}/topics`, + showPetById: (petId: string, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${petId}\`, method: "GET", format: "json", ...params, }), + }; +} +" +`; - /** - * No description - * - * @tags repos - * @name ReposReplaceAllTopics - * @summary Replace all repository topics - * @request PUT:/repos/{owner}/{repo}/topics - */ - reposReplaceAllTopics: ( - owner: string, - repo: string, - data: { - /** An array of topics to add to the repository. Pass one or more topics to _replace_ the set of existing topics. Send an empty array (`[]`) to clear all topics from the repository. **Note:** Topic `names` cannot contain uppercase letters. */ - names: string[]; +exports[`simple > 'petstore-expanded' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Error { + /** @format int32 */ + code: number; + message: string; +} + +export interface NewPet { + name: string; + tag?: string; +} + +export type Pet = NewPet & { + /** @format int64 */ + id: number; +}; + +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 = "http://petstore.swagger.io/api"; + 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) || {}), }, - params: RequestParams = {}, - ) => - this.request< - Topic, - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationErrorSimple - >({ - path: `/repos/${owner}/${repo}/topics`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + }; + } - /** - * @description Get the total number of clones and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday. - * - * @tags repos - * @name ReposGetClones - * @summary Get repository clones - * @request GET:/repos/{owner}/{repo}/traffic/clones - */ - reposGetClones: ( - owner: string, - repo: string, - query?: { - /** - * Must be one of: `day`, `week`. - * @default "day" - */ - per?: "day" | "week"; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/traffic/clones`, - method: "GET", - query: query, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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; + }); - /** - * @description Get the top 10 popular contents over the last 14 days. - * - * @tags repos - * @name ReposGetTopPaths - * @summary Get top referral paths - * @request GET:/repos/{owner}/{repo}/traffic/popular/paths - */ - reposGetTopPaths: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/traffic/popular/paths`, - method: "GET", - format: "json", - ...params, - }), + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } - /** - * @description Get the top 10 referrers over the last 14 days. - * - * @tags repos - * @name ReposGetTopReferrers - * @summary Get top referral sources - * @request GET:/repos/{owner}/{repo}/traffic/popular/referrers - */ - reposGetTopReferrers: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/traffic/popular/referrers`, - method: "GET", - format: "json", - ...params, - }), + if (!response.ok) throw data; + return data; + }); + }; +} +/** + * @title Swagger Petstore + * @version 1.0.0 + * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/api + * @contact Swagger API Team (http://swagger.io) + * + * A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification + */ +export class Api extends HttpClient { + pets = { /** - * @description Get the total number of views and breakdown per day or week for the last 14 days. Timestamps are aligned to UTC midnight of the beginning of the day or week. Week begins on Monday. + * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. * - * @tags repos - * @name ReposGetViews - * @summary Get page views - * @request GET:/repos/{owner}/{repo}/traffic/views + * @name FindPets + * @request GET:/pets */ - reposGetViews: ( - owner: string, - repo: string, + findPets: ( query?: { /** - * Must be one of: `day`, `week`. - * @default "day" + * maximum number of results to return + * @format int32 */ - per?: "day" | "week"; + limit?: number; + /** tags to filter by */ + tags?: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/repos/${owner}/${repo}/traffic/views`, + this.request({ + path: \`/pets\`, method: "GET", query: query, format: "json", @@ -24179,26 +39628,14 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/transfer`, + addPet: (data: NewPet, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, method: "POST", body: data, type: ContentType.Json, @@ -24207,1146 +39644,1944 @@ export class Api extends HttpClient - this.request({ - path: `/repos/${owner}/${repo}/vulnerability-alerts`, + findPetById: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, method: "GET", + format: "json", ...params, }), /** - * @description Enables dependency alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "[About security alerts for vulnerable dependencies](https://help.github.com/en/articles/about-security-alerts-for-vulnerable-dependencies)". - * - * @tags repos - * @name ReposEnableVulnerabilityAlerts - * @summary Enable vulnerability alerts - * @request PUT:/repos/{owner}/{repo}/vulnerability-alerts - */ - reposEnableVulnerabilityAlerts: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/vulnerability-alerts`, - method: "PUT", - ...params, - }), - - /** - * @description Disables dependency alerts and the dependency graph for a repository. The authenticated user must have admin access to the repository. For more information, see "[About security alerts for vulnerable dependencies](https://help.github.com/en/articles/about-security-alerts-for-vulnerable-dependencies)". + * @description deletes a single pet based on the ID supplied * - * @tags repos - * @name ReposDisableVulnerabilityAlerts - * @summary Disable vulnerability alerts - * @request DELETE:/repos/{owner}/{repo}/vulnerability-alerts + * @name DeletePet + * @request DELETE:/pets/{id} */ - reposDisableVulnerabilityAlerts: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/vulnerability-alerts`, + deletePet: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, method: "DELETE", ...params, }), + }; +} +" +`; - /** - * @description Gets a redirect URL to download a zip archive for a repository. If you omit `:ref`, the repository’s default branch (usually `master`) will be used. Please make sure your HTTP framework is configured to follow redirects or you will need to use the `Location` header to make a second `GET` request. **Note**: For private repositories, these links are temporary and expire after five minutes. - * - * @tags repos - * @name ReposDownloadZipballArchive - * @summary Download a repository archive (zip) - * @request GET:/repos/{owner}/{repo}/zipball/{ref} - */ - reposDownloadZipballArchive: (owner: string, repo: string, ref: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/zipball/${ref}`, - method: "GET", - ...params, - }), +exports[`simple > 'petstore-expanded' 2`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ - /** - * @description Creates a new repository using a repository template. Use the `template_owner` and `template_repo` route parameters to specify the repository to use as the template. The authenticated user must own or be a member of an organization that owns the repository. To check if a repository is available to use as a template, get the repository's information using the [Get a repository](https://docs.github.com/rest/reference/repos#get-a-repository) endpoint and check that the `is_template` key is `true`. **OAuth scope requirements** When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include: * `public_repo` scope or `repo` scope to create a public repository * `repo` scope to create a private repository - * - * @tags repos - * @name ReposCreateUsingTemplate - * @summary Create a repository using a template - * @request POST:/repos/{template_owner}/{template_repo}/generate - */ - reposCreateUsingTemplate: ( - templateOwner: string, - templateRepo: string, - data: { - /** A short description of the new repository. */ - description?: string; - /** - * Set to `true` to include the directory structure and files from all branches in the template repository, and not just the default branch. Default: `false`. - * @default false - */ - include_all_branches?: boolean; - /** The name of the new repository. */ - name: string; - /** The organization or person who will own the new repository. To create a new repository in an organization, the authenticated user must be a member of the specified organization. */ - owner?: string; - /** - * Either `true` to create a new private repository or `false` to create a new public one. - * @default false - */ - private?: boolean; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${templateOwner}/${templateRepo}/generate`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), +export interface Error { + /** @format int32 */ + code: number; + message: string; +} + +export interface NewPet { + name: string; + tag?: string; +} + +/** Page«TemplateResponseDto» */ +export interface PageTemplateResponseDto { + content?: any[]; + empty?: boolean; + first?: boolean; + last?: boolean; + /** @format int32 */ + number?: number; + /** @format int32 */ + numberOfElements?: number; + pageable?: any; + /** @format int32 */ + size?: number; + sort?: any; + /** @format int64 */ + totalElements?: number; + /** @format int32 */ + totalPages?: number; +} + +export type Pet = NewPet & { + /** @format int64 */ + id: number; +}; + +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 = "http://petstore.swagger.io/api"; + 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", }; - repositories = { - /** - * @description Lists all public repositories in the order that they were created. Note: Pagination is powered exclusively by the `since` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of repositories. - * - * @tags repos - * @name ReposListPublic - * @summary List public repositories - * @request GET:/repositories - */ - reposListPublic: ( - query?: { - /** A repository ID. Only return repositories with an ID greater than this ID. */ - since?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), + + constructor(apiConfig: ApiConfig = {}) { + Object.assign(this, apiConfig); + } + + public setSecurityData = (data: SecurityDataType | null) => { + this.securityData = data; }; - scim = { - /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. - * - * @tags enterprise-admin - * @name EnterpriseAdminListProvisionedGroupsEnterprise - * @summary List provisioned SCIM groups for an enterprise - * @request GET:/scim/v2/enterprises/{enterprise}/Groups - */ - enterpriseAdminListProvisionedGroupsEnterprise: ( - enterprise: string, - query?: { - /** Used for pagination: the number of results to return. */ - count?: number; - /** Used for pagination: the index of the first result to return. */ - startIndex?: number; + + 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) || {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Groups`, - method: "GET", - query: query, - format: "json", - ...params, - }), + }; + } - /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Provision an enterprise group, and invite users to the group. This sends invitation emails to the email address of the invited users to join the GitHub organization that the SCIM group corresponds to. - * - * @tags enterprise-admin - * @name EnterpriseAdminProvisionAndInviteEnterpriseGroup - * @summary Provision a SCIM enterprise group and invite users - * @request POST:/scim/v2/enterprises/{enterprise}/Groups - */ - enterpriseAdminProvisionAndInviteEnterpriseGroup: ( - enterprise: string, - data: { - /** The name of the SCIM group. This must match the GitHub organization that the group maps to. */ - displayName: string; - members?: { - /** The SCIM user ID for a user. */ - value: string; - }[]; - /** The SCIM schema URIs. */ - schemas: string[]; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Groups`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. - * - * @tags enterprise-admin - * @name EnterpriseAdminGetProvisioningInformationForEnterpriseGroup - * @summary Get SCIM provisioning information for an enterprise group - * @request GET:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} - */ - enterpriseAdminGetProvisioningInformationForEnterpriseGroup: ( - enterprise: string, - scimGroupId: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Groups/${scimGroupId}`, - method: "GET", - format: "json", - ...params, - }), + 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 Swagger Petstore + * @version 1.0.0 + * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/api + * @contact Swagger API Team (http://swagger.io) + * + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + */ +export class Api extends HttpClient { + pathParams = { /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Replaces an existing provisioned group’s information. You must provide all the information required for the group as if you were provisioning it for the first time. Any existing group information that you don't provide will be removed, including group membership. If you want to only update a specific attribute, use the [Update an attribute for a SCIM enterprise group](#update-an-attribute-for-a-scim-enterprise-group) endpoint instead. + * No description * - * @tags enterprise-admin - * @name EnterpriseAdminSetInformationForProvisionedEnterpriseGroup - * @summary Set SCIM information for a provisioned enterprise group - * @request PUT:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} + * @name PathParamFooBarBazList + * @request GET:/path-params/{path-param}/{foo-bar-baz} */ - enterpriseAdminSetInformationForProvisionedEnterpriseGroup: ( - enterprise: string, - scimGroupId: string, - data: { - /** The name of the SCIM group. This must match the GitHub organization that the group maps to. */ - displayName: string; - members?: { - /** The SCIM user ID for a user. */ - value: string; - }[]; - /** The SCIM schema URIs. */ - schemas: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Groups/${scimGroupId}`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", + pathParamFooBarBazList: (pathParam: string, fooBarBaz: string, params: RequestParams = {}) => + this.request({ + path: \`/path-params/\${pathParam}/\${fooBarBaz}\`, + method: "GET", ...params, }), - - /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Allows you to change a provisioned group’s individual attributes. To change a group’s values, you must provide a specific Operations JSON format that contains at least one of the add, remove, or replace operations. For examples and more information on the SCIM operations format, see the [SCIM specification](https://tools.ietf.org/html/rfc7644#section-3.5.2). - * - * @tags enterprise-admin - * @name EnterpriseAdminUpdateAttributeForEnterpriseGroup - * @summary Update an attribute for a SCIM enterprise group - * @request PATCH:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} - */ - enterpriseAdminUpdateAttributeForEnterpriseGroup: ( - enterprise: string, - scimGroupId: string, - data: { - /** Array of [SCIM operations](https://tools.ietf.org/html/rfc7644#section-3.5.2). */ - Operations: object[]; - /** The SCIM schema URIs. */ - schemas: string[]; + }; + pets = { + /** + * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. + * + * @name FindPets + * @request GET:/pets + */ + findPets: ( + query?: { + /** + * maximum number of results to return + * @format int32 + */ + limit?: number; + /** tags to filter by */ + tags?: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Groups/${scimGroupId}`, - method: "PATCH", - body: data, - type: ContentType.Json, + this.request({ + path: \`/pets\`, + method: "GET", + query: query, format: "json", ...params, }), /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * @description Creates a new pet in the store. Duplicates are allowed * - * @tags enterprise-admin - * @name EnterpriseAdminDeleteScimGroupFromEnterprise - * @summary Delete a SCIM group from an enterprise - * @request DELETE:/scim/v2/enterprises/{enterprise}/Groups/{scim_group_id} + * @name AddPet + * @request POST:/pets */ - enterpriseAdminDeleteScimGroupFromEnterprise: ( - enterprise: string, - scimGroupId: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Groups/${scimGroupId}`, - method: "DELETE", + addPet: (pet: NewPet, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "POST", + body: pet, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Retrieves a paginated list of all provisioned enterprise members, including pending invitations. When a user with a SAML-provisioned external identity leaves (or is removed from) an enterprise, the account's metadata is immediately removed. However, the returned list of user accounts might not always match the organization or enterprise member list you see on GitHub. This can happen in certain cases where an external identity associated with an organization will not match an organization member: - When a user with a SCIM-provisioned external identity is removed from an enterprise, the account's metadata is preserved to allow the user to re-join the organization in the future. - When inviting a user to join an organization, you can expect to see their external identity in the results before they accept the invitation, or if the invitation is cancelled (or never accepted). - When a user is invited over SCIM, an external identity is created that matches with the invitee's email address. However, this identity is only linked to a user account when the user accepts the invitation by going through SAML SSO. The returned list of external identities can include an entry for a `null` user. These are unlinked SAML identities that are created when a user goes through the following Single Sign-On (SSO) process but does not sign in to their GitHub account after completing SSO: 1. The user is granted access by the IdP and is not a member of the GitHub enterprise. 1. The user attempts to access the GitHub enterprise and initiates the SAML SSO process, and is not currently signed in to their GitHub account. 1. After successfully authenticating with the SAML SSO IdP, the `null` external identity entry is created and the user is prompted to sign in to their GitHub account: - If the user signs in, their GitHub account is linked to this entry. - If the user does not sign in (or does not create a new account when prompted), they are not added to the GitHub enterprise, and the external identity `null` entry remains in place. + * @description Returns a user based on a single ID, if the user does not have access to the pet * - * @tags enterprise-admin - * @name EnterpriseAdminListProvisionedIdentitiesEnterprise - * @summary List SCIM provisioned identities for an enterprise - * @request GET:/scim/v2/enterprises/{enterprise}/Users + * @name FindPetById + * @request GET:/pets/{id} */ - enterpriseAdminListProvisionedIdentitiesEnterprise: ( - enterprise: string, - query?: { - /** Used for pagination: the number of results to return. */ - count?: number; - /** Used for pagination: the index of the first result to return. */ - startIndex?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Users`, + findPetById: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Provision enterprise membership for a user, and send organization invitation emails to the email address. You can optionally include the groups a user will be invited to join. If you do not provide a list of `groups`, the user is provisioned for the enterprise, but no organization invitation emails will be sent. + * @description deletes a single pet based on the ID supplied * - * @tags enterprise-admin - * @name EnterpriseAdminProvisionAndInviteEnterpriseUser - * @summary Provision and invite a SCIM enterprise user - * @request POST:/scim/v2/enterprises/{enterprise}/Users + * @name DeletePet + * @request DELETE:/pets/{id} */ - enterpriseAdminProvisionAndInviteEnterpriseUser: ( - enterprise: string, - data: { - /** List of user emails. */ - emails: { - /** Whether this email address is the primary address. */ - primary: boolean; - /** The type of email address. */ - type: string; - /** The email address. */ - value: string; - }[]; - /** List of SCIM group IDs the user is a member of. */ - groups?: { - value?: string; - }[]; - name: { - /** The last name of the user. */ - familyName: string; - /** The first name of the user. */ - givenName: string; - }; - /** The SCIM schema URIs. */ - schemas: string[]; - /** The username for the user. */ - userName: string; + deletePet: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, + method: "DELETE", + ...params, + }), + }; +} +" +`; + +exports[`simple > 'petstore-minimal' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Pet { + /** @format int64 */ + id: number; + multiple?: string | number; + name: string; + tag?: string; +} + +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 = "http://petstore.swagger.io/api"; + 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) || {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Users`, - method: "POST", - body: data, - type: ContentType.Json, + }; + } + + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license MIT + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/api + * @contact Swagger API Team + * + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + */ +export class Api extends HttpClient { + pets = { + /** + * @description Returns all pets from the system that the user has access to + * + * @name PetsList + * @request GET:/pets + */ + petsList: (params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "GET", format: "json", ...params, }), + }; +} +" +`; + +exports[`simple > 'petstore-simple' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface ErrorModel { + /** @format int32 */ + code: number; + message: string; +} + +export interface NewPet { + name: string; + tag?: string; +} + +export type Pet = NewPet & { + /** @format int64 */ + id: number; +}; + +/** Description of Test type */ +export type Test = NewPet; + +export interface Test2 { + /** Field description */ + data?: NewPet; +} + +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 = "http://petstore.swagger.io/api"; + 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.clone() 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 Swagger Petstore + * @version 1.0.0 + * @license MIT + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/api + * @contact Swagger API Team + * + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + */ +export class Api extends HttpClient { + pets = { /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * @description Returns all pets from the system that the user has access to * - * @tags enterprise-admin - * @name EnterpriseAdminGetProvisioningInformationForEnterpriseUser - * @summary Get SCIM provisioning information for an enterprise user - * @request GET:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + * @name FindPets + * @request GET:/pets */ - enterpriseAdminGetProvisioningInformationForEnterpriseUser: ( - enterprise: string, - scimUserId: string, + findPets: ( + query?: { + /** + * maximum number of results to return + * @format int32 + */ + limit?: number; + /** tags to filter by */ + tags?: string[]; + }, params: RequestParams = {}, ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Users/${scimUserId}`, + this.request({ + path: \`/pets\`, method: "GET", + query: query, format: "json", ...params, }), /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Replaces an existing provisioned user's information. You must provide all the information required for the user as if you were provisioning them for the first time. Any existing user information that you don't provide will be removed. If you want to only update a specific attribute, use the [Update an attribute for a SCIM user](#update-an-attribute-for-an-enterprise-scim-user) endpoint instead. You must at least provide the required values for the user: `userName`, `name`, and `emails`. **Warning:** Setting `active: false` removes the user from the enterprise, deletes the external identity, and deletes the associated `{scim_user_id}`. + * @description Creates a new pet in the store. Duplicates are allowed * - * @tags enterprise-admin - * @name EnterpriseAdminSetInformationForProvisionedEnterpriseUser - * @summary Set SCIM information for a provisioned enterprise user - * @request PUT:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + * @name AddPet + * @request POST:/pets */ - enterpriseAdminSetInformationForProvisionedEnterpriseUser: ( - enterprise: string, - scimUserId: string, - data: { - /** List of user emails. */ - emails: { - /** Whether this email address is the primary address. */ - primary: boolean; - /** The type of email address. */ - type: string; - /** The email address. */ - value: string; - }[]; - /** List of SCIM group IDs the user is a member of. */ - groups?: { - value?: string; - }[]; - name: { - /** The last name of the user. */ - familyName: string; - /** The first name of the user. */ - givenName: string; - }; - /** The SCIM schema URIs. */ - schemas: string[]; - /** The username for the user. */ - userName: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Users/${scimUserId}`, - method: "PUT", - body: data, + addPet: (pet: NewPet, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, + method: "POST", + body: pet, type: ContentType.Json, format: "json", ...params, }), /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. Allows you to change a provisioned user's individual attributes. To change a user's values, you must provide a specific `Operations` JSON format that contains at least one of the `add`, `remove`, or `replace` operations. For examples and more information on the SCIM operations format, see the [SCIM specification](https://tools.ietf.org/html/rfc7644#section-3.5.2). **Note:** Complicated SCIM `path` selectors that include filters are not supported. For example, a `path` selector defined as `"path": "emails[type eq \"work\"]"` will not work. **Warning:** If you set `active:false` using the `replace` operation (as shown in the JSON example below), it removes the user from the enterprise, deletes the external identity, and deletes the associated `:scim_user_id`. ``` { "Operations":[{ "op":"replace", "value":{ "active":false } }] } ``` + * @description Returns a user based on a single ID, if the user does not have access to the pet * - * @tags enterprise-admin - * @name EnterpriseAdminUpdateAttributeForEnterpriseUser - * @summary Update an attribute for a SCIM enterprise user - * @request PATCH:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + * @name FindPetById + * @request GET:/pets/{id} */ - enterpriseAdminUpdateAttributeForEnterpriseUser: ( - enterprise: string, - scimUserId: string, - data: { - /** Array of [SCIM operations](https://tools.ietf.org/html/rfc7644#section-3.5.2). */ - Operations: object[]; - /** The SCIM schema URIs. */ - schemas: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Users/${scimUserId}`, - method: "PATCH", - body: data, - type: ContentType.Json, + findPetById: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, + method: "GET", format: "json", ...params, }), /** - * @description **Note:** The SCIM API endpoints for enterprise accounts are currently in beta and are subject to change. + * @description deletes a single pet based on the ID supplied * - * @tags enterprise-admin - * @name EnterpriseAdminDeleteUserFromEnterprise - * @summary Delete a SCIM user from an enterprise - * @request DELETE:/scim/v2/enterprises/{enterprise}/Users/{scim_user_id} + * @name DeletePet + * @request DELETE:/pets/{id} */ - enterpriseAdminDeleteUserFromEnterprise: (enterprise: string, scimUserId: string, params: RequestParams = {}) => - this.request({ - path: `/scim/v2/enterprises/${enterprise}/Users/${scimUserId}`, + deletePet: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, method: "DELETE", ...params, }), + }; +} +" +`; + +exports[`simple > 'petstore-swagger-io' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface ApiResponse { + /** @format int32 */ + code?: number; + message?: string; + type?: string; +} + +export interface Category { + /** @format int64 */ + id?: number; + name?: string; +} + +export interface Order { + complete?: boolean; + /** @format int64 */ + id?: number; + /** @format int64 */ + petId?: number; + /** @format int32 */ + quantity?: number; + /** @format date-time */ + shipDate?: string; + /** Order Status */ + status?: "placed" | "approved" | "delivered"; +} + +export interface Pet { + category?: Category; + /** @format int64 */ + id?: number; + /** @example "doggie" */ + name: string; + photoUrls: string[]; + /** pet status in the store */ + status?: "available" | "pending" | "sold"; + tags?: Tag[]; +} + +export interface Tag { + /** @format int64 */ + id?: number; + name?: string; +} + +export interface User { + email?: string; + firstName?: string; + /** @format int64 */ + id?: number; + lastName?: string; + password?: string; + phone?: string; + /** + * User Status + * @format int32 + */ + userStatus?: number; + username?: string; +} + +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://petstore.swagger.io/v2"; + 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.clone() 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 Swagger Petstore + * @version 1.0.3 + * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://swagger.io/terms/ + * @baseUrl https://petstore.swagger.io/v2 + * @externalDocs http://swagger.io + * @contact + * + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key \`special-key\` to test the authorization filters. + */ +export class Api extends HttpClient { + pet = { /** - * @description Retrieves a paginated list of all provisioned organization members, including pending invitations. If you provide the `filter` parameter, the resources for all matching provisions members are returned. When a user with a SAML-provisioned external identity leaves (or is removed from) an organization, the account's metadata is immediately removed. However, the returned list of user accounts might not always match the organization or enterprise member list you see on GitHub. This can happen in certain cases where an external identity associated with an organization will not match an organization member: - When a user with a SCIM-provisioned external identity is removed from an organization, the account's metadata is preserved to allow the user to re-join the organization in the future. - When inviting a user to join an organization, you can expect to see their external identity in the results before they accept the invitation, or if the invitation is cancelled (or never accepted). - When a user is invited over SCIM, an external identity is created that matches with the invitee's email address. However, this identity is only linked to a user account when the user accepts the invitation by going through SAML SSO. The returned list of external identities can include an entry for a `null` user. These are unlinked SAML identities that are created when a user goes through the following Single Sign-On (SSO) process but does not sign in to their GitHub account after completing SSO: 1. The user is granted access by the IdP and is not a member of the GitHub organization. 1. The user attempts to access the GitHub organization and initiates the SAML SSO process, and is not currently signed in to their GitHub account. 1. After successfully authenticating with the SAML SSO IdP, the `null` external identity entry is created and the user is prompted to sign in to their GitHub account: - If the user signs in, their GitHub account is linked to this entry. - If the user does not sign in (or does not create a new account when prompted), they are not added to the GitHub organization, and the external identity `null` entry remains in place. + * @description Returns a single pet * - * @tags scim - * @name ScimListProvisionedIdentities - * @summary List SCIM provisioned identities - * @request GET:/scim/v2/organizations/{org}/Users + * @tags pet + * @name GetPetById + * @summary Find pet by ID + * @request GET:/pet/{petId} + * @secure */ - scimListProvisionedIdentities: ( - org: string, - query?: { - /** Used for pagination: the number of results to return. */ - count?: number; - /** - * Filters results using the equals query parameter operator (`eq`). You can filter results that are equal to `id`, `userName`, `emails`, and `external_id`. For example, to search for an identity with the `userName` Octocat, you would use this query: - * - * `?filter=userName%20eq%20\"Octocat\"`. - * - * To filter results for the identity with the email `octocat@github.com`, you would use this query: - * - * `?filter=emails%20eq%20\"octocat@github.com\"`. - */ - filter?: string; - /** Used for pagination: the index of the first result to return. */ - startIndex?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/organizations/${org}/Users`, + getPetById: (petId: number, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}\`, method: "GET", - query: query, + secure: true, format: "json", ...params, }), /** - * @description Provision organization membership for a user, and send an activation email to the email address. + * No description * - * @tags scim - * @name ScimProvisionAndInviteUser - * @summary Provision and invite a SCIM user - * @request POST:/scim/v2/organizations/{org}/Users + * @tags pet + * @name UpdatePetWithForm + * @summary Updates a pet in the store with form data + * @request POST:/pet/{petId} + * @secure */ - scimProvisionAndInviteUser: ( - org: string, + updatePetWithForm: ( + petId: number, data: { - active?: boolean; - /** - * The name of the user, suitable for display to end-users - * @example "Jon Doe" - */ - displayName?: string; - /** - * user emails - * @minItems 1 - * @example [{"value":"someone@example.com","primary":true},{"value":"another@example.com","primary":false}] - */ - emails: { - primary?: boolean; - type?: string; - value: string; - }[]; - externalId?: string; - groups?: string[]; - /** @example {"givenName":"Jane","familyName":"User"} */ - name: { - familyName: string; - formatted?: string; - givenName: string; - }; - schemas?: string[]; - /** - * Configured by the admin. Could be an email, login, or username - * @example "someone@example.com" - */ - userName: string; + /** Updated name of the pet */ + name?: string; + /** Updated status of the pet */ + status?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/scim/v2/organizations/${org}/Users`, + this.request({ + path: \`/pet/\${petId}\`, method: "POST", body: data, - type: ContentType.Json, - format: "json", + secure: true, + type: ContentType.FormData, ...params, }), /** * No description * - * @tags scim - * @name ScimGetProvisioningInformationForUser - * @summary Get SCIM provisioning information for a user - * @request GET:/scim/v2/organizations/{org}/Users/{scim_user_id} + * @tags pet + * @name DeletePet + * @summary Deletes a pet + * @request DELETE:/pet/{petId} + * @secure */ - scimGetProvisioningInformationForUser: (org: string, scimUserId: string, params: RequestParams = {}) => - this.request({ - path: `/scim/v2/organizations/${org}/Users/${scimUserId}`, - method: "GET", - format: "json", + deletePet: (petId: number, params: RequestParams = {}) => + this.request({ + path: \`/pet/\${petId}\`, + method: "DELETE", + secure: true, ...params, }), /** - * @description Replaces an existing provisioned user's information. You must provide all the information required for the user as if you were provisioning them for the first time. Any existing user information that you don't provide will be removed. If you want to only update a specific attribute, use the [Update an attribute for a SCIM user](https://docs.github.com/rest/reference/scim#update-an-attribute-for-a-scim-user) endpoint instead. You must at least provide the required values for the user: `userName`, `name`, and `emails`. **Warning:** Setting `active: false` removes the user from the organization, deletes the external identity, and deletes the associated `{scim_user_id}`. + * No description * - * @tags scim - * @name ScimSetInformationForProvisionedUser - * @summary Update a provisioned organization membership - * @request PUT:/scim/v2/organizations/{org}/Users/{scim_user_id} + * @tags pet + * @name UploadFile + * @summary uploads an image + * @request POST:/pet/{petId}/uploadImage + * @secure */ - scimSetInformationForProvisionedUser: ( - org: string, - scimUserId: string, + uploadFile: ( + petId: number, data: { - active?: boolean; - /** - * The name of the user, suitable for display to end-users - * @example "Jon Doe" - */ - displayName?: string; - /** - * user emails - * @minItems 1 - * @example [{"value":"someone@example.com","primary":true},{"value":"another@example.com","primary":false}] - */ - emails: { - primary?: boolean; - type?: string; - value: string; - }[]; - externalId?: string; - groups?: string[]; - /** @example {"givenName":"Jane","familyName":"User"} */ - name: { - familyName: string; - formatted?: string; - givenName: string; - }; - schemas?: string[]; - /** - * Configured by the admin. Could be an email, login, or username - * @example "someone@example.com" - */ - userName: string; + /** Additional data to pass to server */ + additionalMetadata?: string; + /** file to upload */ + file?: File; }, params: RequestParams = {}, ) => - this.request({ - path: `/scim/v2/organizations/${org}/Users/${scimUserId}`, - method: "PUT", + this.request({ + path: \`/pet/\${petId}/uploadImage\`, + method: "POST", body: data, - type: ContentType.Json, + secure: true, + type: ContentType.FormData, format: "json", ...params, }), /** - * @description Allows you to change a provisioned user's individual attributes. To change a user's values, you must provide a specific `Operations` JSON format that contains at least one of the `add`, `remove`, or `replace` operations. For examples and more information on the SCIM operations format, see the [SCIM specification](https://tools.ietf.org/html/rfc7644#section-3.5.2). **Note:** Complicated SCIM `path` selectors that include filters are not supported. For example, a `path` selector defined as `"path": "emails[type eq \"work\"]"` will not work. **Warning:** If you set `active:false` using the `replace` operation (as shown in the JSON example below), it removes the user from the organization, deletes the external identity, and deletes the associated `:scim_user_id`. ``` { "Operations":[{ "op":"replace", "value":{ "active":false } }] } ``` + * No description * - * @tags scim - * @name ScimUpdateAttributeForUser - * @summary Update an attribute for a SCIM user - * @request PATCH:/scim/v2/organizations/{org}/Users/{scim_user_id} + * @tags pet + * @name AddPet + * @summary Add a new pet to the store + * @request POST:/pet + * @secure */ - scimUpdateAttributeForUser: ( - org: string, - scimUserId: string, - data: { - /** - * Set of operations to be performed - * @minItems 1 - * @example [{"op":"replace","value":{"active":false}}] - */ - Operations: { - op: "add" | "remove" | "replace"; - path?: string; - value?: - | { - active?: boolean | null; - externalId?: string | null; - familyName?: string | null; - givenName?: string | null; - userName?: string | null; - } - | { - primary?: boolean; - value?: string; - }[] - | string; - }[]; - schemas?: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scim/v2/organizations/${org}/Users/${scimUserId}`, - method: "PATCH", - body: data, + addPet: (body: Pet, params: RequestParams = {}) => + this.request({ + path: \`/pet\`, + method: "POST", + body: body, + secure: true, type: ContentType.Json, - format: "json", ...params, }), /** * No description * - * @tags scim - * @name ScimDeleteUserFromOrg - * @summary Delete a SCIM user from an organization - * @request DELETE:/scim/v2/organizations/{org}/Users/{scim_user_id} + * @tags pet + * @name UpdatePet + * @summary Update an existing pet + * @request PUT:/pet + * @secure */ - scimDeleteUserFromOrg: (org: string, scimUserId: string, params: RequestParams = {}) => - this.request({ - path: `/scim/v2/organizations/${org}/Users/${scimUserId}`, - method: "DELETE", + updatePet: (body: Pet, params: RequestParams = {}) => + this.request({ + path: \`/pet\`, + method: "PUT", + body: body, + secure: true, + type: ContentType.Json, ...params, }), - }; - search = { + /** - * @description Searches for query terms inside of a file. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for code, you can get text match metadata for the file **content** and file **path** fields when you pass the `text-match` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find the definition of the `addClass` function inside [jQuery](https://github.com/jquery/jquery) repository, your query would look something like this: `q=addClass+in:file+language:js+repo:jquery/jquery` This query searches for the keyword `addClass` within a file's contents. The query limits the search to files where the language is JavaScript in the `jquery/jquery` repository. #### Considerations for code search Due to the complexity of searching code, there are a few restrictions on how searches are performed: * Only the _default branch_ is considered. In most cases, this will be the `master` branch. * Only files smaller than 384 KB are searchable. * You must always include at least one search term when searching source code. For example, searching for [`language:go`](https://github.com/search?utf8=%E2%9C%93&q=language%3Ago&type=Code) is not valid, while [`amazing language:go`](https://github.com/search?utf8=%E2%9C%93&q=amazing+language%3Ago&type=Code) is. + * @description Multiple status values can be provided with comma separated strings * - * @tags search - * @name SearchCode - * @summary Search code - * @request GET:/search/code + * @tags pet + * @name FindPetsByStatus + * @summary Finds Pets by status + * @request GET:/pet/findByStatus + * @secure */ - searchCode: ( + findPetsByStatus: ( query: { - /** - * Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching code](https://help.github.com/articles/searching-code/)" for a detailed list of qualifiers. */ - q: string; - /** Sorts the results of your query. Can only be `indexed`, which indicates how recently a file has been indexed by the GitHub search infrastructure. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ - sort?: "indexed"; + /** Status values that need to be considered for filter */ + status: ("available" | "pending" | "sold")[]; }, params: RequestParams = {}, ) => - this.request< - { - incomplete_results: boolean; - items: CodeSearchResultItem[]; - total_count: number; - }, - | BasicError - | ValidationError - | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/search/code`, + this.request({ + path: \`/pet/findByStatus\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), /** - * @description Find commits via various criteria on the default branch (usually `master`). This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for commits, you can get text match metadata for the **message** field when you provide the `text-match` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find commits related to CSS in the [octocat/Spoon-Knife](https://github.com/octocat/Spoon-Knife) repository. Your query would look something like this: `q=repo:octocat/Spoon-Knife+css` + * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. * - * @tags search - * @name SearchCommits - * @summary Search commits - * @request GET:/search/commits + * @tags pet + * @name FindPetsByTags + * @summary Finds Pets by tags + * @request GET:/pet/findByTags + * @deprecated + * @secure */ - searchCommits: ( + findPetsByTags: ( query: { - /** - * Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching commits](https://help.github.com/articles/searching-commits/)" for a detailed list of qualifiers. */ - q: string; - /** Sorts the results of your query by `author-date` or `committer-date`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ - sort?: "author-date" | "committer-date"; + /** Tags to filter by */ + tags: string[]; }, params: RequestParams = {}, ) => - this.request< - { - incomplete_results: boolean; - items: CommitSearchResultItem[]; - total_count: number; - }, - { - documentation_url: string; - message: string; - } - >({ - path: `/search/commits`, + this.request({ + path: \`/pet/findByTags\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), - + }; + store = { /** - * @description Find issues by state and keyword. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for issues, you can get text match metadata for the issue **title**, issue **body**, and issue **comment body** fields when you pass the `text-match` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find the oldest unresolved Python bugs on Windows. Your query might look something like this. `q=windows+label:bug+language:python+state:open&sort=created&order=asc` This query searches for the keyword `windows`, within any open issue that is labeled as `bug`. The search runs across repositories whose primary language is Python. The results are sorted by creation date in ascending order, which means the oldest issues appear first in the search results. **Note:** For [user-to-server](https://docs.github.com/developers/apps/identifying-and-authorizing-users-for-github-apps#user-to-server-requests) GitHub App requests, you can't retrieve a combination of issues and pull requests in a single query. Requests that don't include the `is:issue` or `is:pull-request` qualifier will receive an HTTP `422 Unprocessable Entity` response. To get results for both issues and pull requests, you must send separate queries for issues and pull requests. For more information about the `is` qualifier, see "[Searching only issues or pull requests](https://docs.github.com/github/searching-for-information-on-github/searching-issues-and-pull-requests#search-only-issues-or-pull-requests)." + * @description Returns a map of status codes to quantities * - * @tags search - * @name SearchIssuesAndPullRequests - * @summary Search issues and pull requests - * @request GET:/search/issues + * @tags store + * @name GetInventory + * @summary Returns pet inventories by status + * @request GET:/store/inventory + * @secure */ - searchIssuesAndPullRequests: ( - query: { - /** - * Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching issues and pull requests](https://help.github.com/articles/searching-issues-and-pull-requests/)" for a detailed list of qualifiers. */ - q: string; - /** Sorts the results of your query by the number of `comments`, `reactions`, `reactions-+1`, `reactions--1`, `reactions-smile`, `reactions-thinking_face`, `reactions-heart`, `reactions-tada`, or `interactions`. You can also sort results by how recently the items were `created` or `updated`, Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ - sort?: - | "comments" - | "reactions" - | "reactions-+1" - | "reactions--1" - | "reactions-smile" - | "reactions-thinking_face" - | "reactions-heart" - | "reactions-tada" - | "interactions" - | "created" - | "updated"; - }, - params: RequestParams = {}, - ) => - this.request< - { - incomplete_results: boolean; - items: IssueSearchResultItem[]; - total_count: number; - }, - | BasicError - | ValidationError - | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/search/issues`, + getInventory: (params: RequestParams = {}) => + this.request, any>({ + path: \`/store/inventory\`, method: "GET", - query: query, + secure: true, format: "json", ...params, }), /** - * @description Find labels in a repository with names or descriptions that match search keywords. Returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for labels, you can get text match metadata for the label **name** and **description** fields when you pass the `text-match` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to find labels in the `linguist` repository that match `bug`, `defect`, or `enhancement`. Your query might look like this: `q=bug+defect+enhancement&repository_id=64778136` The labels that best match the query appear first in the search results. + * @description For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions * - * @tags search - * @name SearchLabels - * @summary Search labels - * @request GET:/search/labels + * @tags store + * @name GetOrderById + * @summary Find purchase order by ID + * @request GET:/store/order/{orderId} */ - searchLabels: ( - query: { - /** - * Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The search keywords. This endpoint does not accept qualifiers in the query. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). */ - q: string; - /** The id of the repository. */ - repository_id: number; - /** Sorts the results of your query by when the label was `created` or `updated`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ - sort?: "created" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request< - { - incomplete_results: boolean; - items: LabelSearchResultItem[]; - total_count: number; - }, - BasicError | ValidationError - >({ - path: `/search/labels`, + getOrderById: (orderId: number, params: RequestParams = {}) => + this.request({ + path: \`/store/order/\${orderId}\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description Find repositories via various criteria. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for repositories, you can get text match metadata for the **name** and **description** fields when you pass the `text-match` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to search for popular Tetris repositories written in assembly code, your query might look like this: `q=tetris+language:assembly&sort=stars&order=desc` This query searches for repositories with the word `tetris` in the name, the description, or the README. The results are limited to repositories where the primary language is assembly. The results are sorted by stars in descending order, so that the most popular repositories appear first in the search results. When you include the `mercy` preview header, you can also search for multiple topics by adding more `topic:` instances. For example, your query might look like this: `q=topic:ruby+topic:rails` + * @description For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors * - * @tags search - * @name SearchRepos - * @summary Search repositories - * @request GET:/search/repositories + * @tags store + * @name DeleteOrder + * @summary Delete purchase order by ID + * @request DELETE:/store/order/{orderId} */ - searchRepos: ( - query: { - /** - * Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching for repositories](https://help.github.com/articles/searching-for-repositories/)" for a detailed list of qualifiers. */ - q: string; - /** Sorts the results of your query by number of `stars`, `forks`, or `help-wanted-issues` or how recently the items were `updated`. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ - sort?: "stars" | "forks" | "help-wanted-issues" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request< - { - incomplete_results: boolean; - items: RepoSearchResultItem[]; - total_count: number; - }, - | ValidationError - | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/search/repositories`, - method: "GET", - query: query, - format: "json", + deleteOrder: (orderId: number, params: RequestParams = {}) => + this.request({ + path: \`/store/order/\${orderId}\`, + method: "DELETE", ...params, }), /** - * @description Find topics via various criteria. Results are sorted by best match. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). See "[Searching topics](https://help.github.com/articles/searching-topics/)" for a detailed list of qualifiers. When searching for topics, you can get text match metadata for the topic's **short\_description**, **description**, **name**, or **display\_name** field when you pass the `text-match` media type. For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you want to search for topics related to Ruby that are featured on https://github.com/topics. Your query might look like this: `q=ruby+is:featured` This query searches for topics with the keyword `ruby` and limits the results to find only topics that are featured. The topics that are the best match for the query appear first in the search results. + * No description * - * @tags search - * @name SearchTopics - * @summary Search topics - * @request GET:/search/topics + * @tags store + * @name PlaceOrder + * @summary Place an order for a pet + * @request POST:/store/order */ - searchTopics: ( - query: { - /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). */ - q: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - incomplete_results: boolean; - items: TopicSearchResultItem[]; - total_count: number; - }, - { - documentation_url: string; - message: string; - } - >({ - path: `/search/topics`, + placeOrder: (body: Order, params: RequestParams = {}) => + this.request({ + path: \`/store/order\`, + method: "POST", + body: body, + type: ContentType.Json, + format: "json", + ...params, + }), + }; + user = { + /** + * No description + * + * @tags user + * @name GetUserByName + * @summary Get user by user name + * @request GET:/user/{username} + */ + getUserByName: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description Find users via various criteria. This method returns up to 100 results [per page](https://docs.github.com/rest/overview/resources-in-the-rest-api#pagination). When searching for users, you can get text match metadata for the issue **login**, **email**, and **name** fields when you pass the `text-match` media type. For more details about highlighting search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For more details about how to receive highlighted search results, see [Text match metadata](https://docs.github.com/rest/reference/search#text-match-metadata). For example, if you're looking for a list of popular users, you might try this query: `q=tom+repos:%3E42+followers:%3E1000` This query searches for users with the name `tom`. The results are restricted to users with more than 42 repositories and over 1,000 followers. + * @description This can only be done by the logged in user. * - * @tags search - * @name SearchUsers - * @summary Search users - * @request GET:/search/users + * @tags user + * @name UpdateUser + * @summary Updated user + * @request PUT:/user/{username} */ - searchUsers: ( + updateUser: (username: string, body: User, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "PUT", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name DeleteUser + * @summary Delete user + * @request DELETE:/user/{username} + */ + deleteUser: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/user/\${username}\`, + method: "DELETE", + ...params, + }), + + /** + * No description + * + * @tags user + * @name LoginUser + * @summary Logs user into the system + * @request GET:/user/login + */ + loginUser: ( query: { - /** - * Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). See "[Searching users](https://help.github.com/articles/searching-users/)" for a detailed list of qualifiers. */ - q: string; - /** Sorts the results of your query by number of `followers` or `repositories`, or when the person `joined` GitHub. Default: [best match](https://docs.github.com/rest/reference/search#ranking-search-results) */ - sort?: "followers" | "repositories" | "joined"; + /** The password for login in clear text */ + password: string; + /** The user name for login */ + username: string; }, params: RequestParams = {}, ) => - this.request< - { - incomplete_results: boolean; - items: UserSearchResultItem[]; - total_count: number; - }, - | ValidationError - | { - code?: string; - documentation_url?: string; - message?: string; - } - >({ - path: `/search/users`, + this.request({ + path: \`/user/login\`, method: "GET", query: query, format: "json", ...params, }), - }; - teams = { + /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the [Get a team by name](https://docs.github.com/rest/reference/teams#get-a-team-by-name) endpoint. + * No description * - * @tags teams - * @name TeamsGetLegacy - * @summary Get a team (Legacy) - * @request GET:/teams/{team_id} - * @deprecated + * @tags user + * @name LogoutUser + * @summary Logs out current logged in user session + * @request GET:/user/logout */ - teamsGetLegacy: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, + logoutUser: (params: RequestParams = {}) => + this.request({ + path: \`/user/logout\`, method: "GET", - format: "json", ...params, }), - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a team](https://docs.github.com/rest/reference/teams#update-a-team) endpoint. To edit a team, the authenticated user must either be an organization owner or a team maintainer. **Note:** With nested teams, the `privacy` for parent teams cannot be `secret`. - * - * @tags teams - * @name TeamsUpdateLegacy - * @summary Update a team (Legacy) - * @request PATCH:/teams/{team_id} - * @deprecated - */ - teamsUpdateLegacy: ( - teamId: number, - data: { - /** The description of the team. */ - description?: string; - /** The name of the team. */ - name: string; - /** The ID of a team to set as the parent team. */ - parent_team_id?: number | null; - /** - * **Deprecated**. The permission that new repositories will be added to the team with when none is specified. Can be one of: - * \* `pull` - team members can pull, but not push to or administer newly-added repositories. - * \* `push` - team members can pull and push, but not administer newly-added repositories. - * \* `admin` - team members can pull, push and administer newly-added repositories. - * @default "pull" - */ - permission?: "pull" | "push" | "admin"; - /** - * The level of privacy this team should have. Editing teams without specifying this parameter leaves `privacy` intact. The options are: - * **For a non-nested team:** - * \* `secret` - only visible to organization owners and members of this team. - * \* `closed` - visible to all members of this organization. - * **For a parent or child team:** - * \* `closed` - visible to all members of this organization. - */ - privacy?: "secret" | "closed"; + /** + * @description This can only be done by the logged in user. + * + * @tags user + * @name CreateUser + * @summary Create user + * @request POST:/user + */ + createUser: (body: User, params: RequestParams = {}) => + this.request({ + path: \`/user\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags user + * @name CreateUsersWithArrayInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithArray + */ + createUsersWithArrayInput: (body: User[], params: RequestParams = {}) => + this.request({ + path: \`/user/createWithArray\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + + /** + * No description + * + * @tags user + * @name CreateUsersWithListInput + * @summary Creates list of users with given input array + * @request POST:/user/createWithList + */ + createUsersWithListInput: (body: User[], params: RequestParams = {}) => + this.request({ + path: \`/user/createWithList\`, + method: "POST", + body: body, + type: ContentType.Json, + ...params, + }), + }; +} +" +`; + +exports[`simple > 'petstore-with-external-docs' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface ErrorModel { + /** @format int32 */ + code: number; + message: string; +} + +export interface NewPet { + name: string; + tag?: string; +} + +export type Pet = NewPet & { + /** @format int64 */ + id: number; +}; + +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 = "http://petstore.swagger.io/api"; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Delete a team](https://docs.github.com/rest/reference/teams#delete-a-team) endpoint. To delete a team, the authenticated user must be an organization owner or team maintainer. If you are an organization owner, deleting a parent team will delete all of its child teams as well. - * - * @tags teams - * @name TeamsDeleteLegacy - * @summary Delete a team (Legacy) - * @request DELETE:/teams/{team_id} - * @deprecated - */ - teamsDeleteLegacy: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "DELETE", - ...params, - }), + 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 Swagger Petstore + * @version 1.0.0 + * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) + * @termsOfService http://swagger.io/terms/ + * @baseUrl http://petstore.swagger.io/api + * @externalDocs https://swagger.io/about + * @contact Swagger API Team (http://swagger.io) + * + * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification + */ +export class Api extends HttpClient { + pets = { /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List discussions`](https://docs.github.com/rest/reference/teams#list-discussions) endpoint. List all discussions on a team's page. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @description Returns all pets from the system that the user has access to * - * @tags teams - * @name TeamsListDiscussionsLegacy - * @summary List discussions (Legacy) - * @request GET:/teams/{team_id}/discussions - * @deprecated + * @name FindPets + * @request GET:/pets */ - teamsListDiscussionsLegacy: ( - teamId: number, + findPets: ( query?: { /** - * One of `asc` (ascending) or `desc` (descending). - * @default "desc" - */ - direction?: "asc" | "desc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 + * maximum number of results to return + * @format int32 */ - per_page?: number; + limit?: number; + /** tags to filter by */ + tags?: string[]; }, params: RequestParams = {}, ) => - this.request({ - path: `/teams/${teamId}/discussions`, + this.request({ + path: \`/pets\`, method: "GET", query: query, format: "json", @@ -25354,1426 +41589,2082 @@ export class Api extends HttpClient - this.request({ - path: `/teams/${teamId}/discussions`, + addPet: (pet: NewPet, params: RequestParams = {}) => + this.request({ + path: \`/pets\`, method: "POST", - body: data, + body: pet, type: ContentType.Json, format: "json", ...params, }), /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get a discussion](https://docs.github.com/rest/reference/teams#get-a-discussion) endpoint. Get a specific discussion on a team's page. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @description Returns a user based on a single ID, if the user does not have access to the pet * - * @tags teams - * @name TeamsGetDiscussionLegacy - * @summary Get a discussion (Legacy) - * @request GET:/teams/{team_id}/discussions/{discussion_number} - * @deprecated + * @name FindPetById + * @request GET:/pets/{id} */ - teamsGetDiscussionLegacy: (teamId: number, discussionNumber: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}`, + findPetById: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, method: "GET", format: "json", ...params, }), /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a discussion](https://docs.github.com/rest/reference/teams#update-a-discussion) endpoint. Edits the title and body text of a discussion post. Only the parameters you provide are updated. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). - * - * @tags teams - * @name TeamsUpdateDiscussionLegacy - * @summary Update a discussion (Legacy) - * @request PATCH:/teams/{team_id}/discussions/{discussion_number} - * @deprecated - */ - teamsUpdateDiscussionLegacy: ( - teamId: number, - discussionNumber: number, - data: { - /** The discussion post's body text. */ - body?: string; - /** The discussion post's title. */ - title?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`Delete a discussion`](https://docs.github.com/rest/reference/teams#delete-a-discussion) endpoint. Delete a discussion from a team's page. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @description deletes a single pet based on the ID supplied * - * @tags teams - * @name TeamsDeleteDiscussionLegacy - * @summary Delete a discussion (Legacy) - * @request DELETE:/teams/{team_id}/discussions/{discussion_number} - * @deprecated + * @name DeletePet + * @request DELETE:/pets/{id} */ - teamsDeleteDiscussionLegacy: (teamId: number, discussionNumber: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}`, + deletePet: (id: number, params: RequestParams = {}) => + this.request({ + path: \`/pets/\${id}\`, method: "DELETE", ...params, }), + }; +} +" +`; - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [List discussion comments](https://docs.github.com/rest/reference/teams#list-discussion-comments) endpoint. List all comments on a team discussion. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). - * - * @tags teams - * @name TeamsListDiscussionCommentsLegacy - * @summary List discussion comments (Legacy) - * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments - * @deprecated - */ - teamsListDiscussionCommentsLegacy: ( - teamId: number, - discussionNumber: number, - query?: { - /** - * One of `asc` (ascending) or `desc` (descending). - * @default "desc" - */ - direction?: "asc" | "desc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), +exports[`simple > 'query-path-param' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Create a discussion comment](https://docs.github.com/rest/reference/teams#create-a-discussion-comment) endpoint. Creates a new comment on a team discussion. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. - * - * @tags teams - * @name TeamsCreateDiscussionCommentLegacy - * @summary Create a discussion comment (Legacy) - * @request POST:/teams/{team_id}/discussions/{discussion_number}/comments - * @deprecated - */ - teamsCreateDiscussionCommentLegacy: ( - teamId: number, - discussionNumber: number, - data: { - /** The discussion comment's body text. */ - body: string; +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 = "http://unknown.io/v666"; + 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) || {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}/comments`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + }; + } - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get a discussion comment](https://docs.github.com/rest/reference/teams#get-a-discussion-comment) endpoint. Get a specific comment on a team discussion. OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). - * - * @tags teams - * @name TeamsGetDiscussionCommentLegacy - * @summary Get a discussion comment (Legacy) - * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} - * @deprecated - */ - teamsGetDiscussionCommentLegacy: ( - teamId: number, - discussionNumber: number, - commentNumber: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}/comments/${commentNumber}`, - method: "GET", - format: "json", - ...params, - }), + 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; + } - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Update a discussion comment](https://docs.github.com/rest/reference/teams#update-a-discussion-comment) endpoint. Edits the body text of a discussion comment. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). - * - * @tags teams - * @name TeamsUpdateDiscussionCommentLegacy - * @summary Update a discussion comment (Legacy) - * @request PATCH:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} - * @deprecated - */ - teamsUpdateDiscussionCommentLegacy: ( - teamId: number, - discussionNumber: number, - commentNumber: number, - data: { - /** The discussion comment's body text. */ - body: string; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}/comments/${commentNumber}`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Delete a discussion comment](https://docs.github.com/rest/reference/teams#delete-a-discussion-comment) endpoint. Deletes a comment on a team discussion. OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). - * - * @tags teams - * @name TeamsDeleteDiscussionCommentLegacy - * @summary Delete a discussion comment (Legacy) - * @request DELETE:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number} - * @deprecated - */ - teamsDeleteDiscussionCommentLegacy: ( - teamId: number, - discussionNumber: number, - commentNumber: number, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}/comments/${commentNumber}`, - method: "DELETE", - ...params, - }), + 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 Query Path Param + * @version 1.0.0 + * @license MIT + * @baseUrl http://unknown.io/v666 + */ +export class Api extends HttpClient { + foobarbaz = { /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List reactions for a team discussion comment`](https://docs.github.com/rest/reference/reactions#list-reactions-for-a-team-discussion-comment) endpoint. List the reactions to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * No description * - * @tags reactions - * @name ReactionsListForTeamDiscussionCommentLegacy - * @summary List reactions for a team discussion comment (Legacy) - * @request GET:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions - * @deprecated + * @tags pets + * @name ListPets + * @summary List all pets + * @request GET:/foobarbaz/{query} */ - reactionsListForTeamDiscussionCommentLegacy: ( - teamId: number, - discussionNumber: number, - commentNumber: number, - query?: { - /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. */ - content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; + listPets: ( + query?: number, + queryParams?: { /** - * Results per page (max 100) - * @default 30 + * How many items to return at one time (max 100) + * @format int32 */ - per_page?: number; + queryParam?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}/comments/${commentNumber}/reactions`, + this.request({ + path: \`/foobarbaz/\${query}\`, method: "GET", - query: query, + query: queryParams, format: "json", ...params, }), + }; +} +" +`; - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new "[Create reaction for a team discussion comment](https://docs.github.com/rest/reference/reactions#create-reaction-for-a-team-discussion-comment)" endpoint. Create a reaction to a [team discussion comment](https://docs.github.com/rest/reference/teams#discussion-comments). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a `Status: 200 OK` means that you already added the reaction type to this team discussion comment. - * - * @tags reactions - * @name ReactionsCreateForTeamDiscussionCommentLegacy - * @summary Create reaction for a team discussion comment (Legacy) - * @request POST:/teams/{team_id}/discussions/{discussion_number}/comments/{comment_number}/reactions - * @deprecated - */ - reactionsCreateForTeamDiscussionCommentLegacy: ( - teamId: number, - discussionNumber: number, - commentNumber: number, - data: { - /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion comment. */ - content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}/comments/${commentNumber}/reactions`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), +exports[`simple > 'recursive-schema' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List reactions for a team discussion`](https://docs.github.com/rest/reference/reactions#list-reactions-for-a-team-discussion) endpoint. List the reactions to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the `read:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). - * - * @tags reactions - * @name ReactionsListForTeamDiscussionLegacy - * @summary List reactions for a team discussion (Legacy) - * @request GET:/teams/{team_id}/discussions/{discussion_number}/reactions - * @deprecated - */ - reactionsListForTeamDiscussionLegacy: ( - teamId: number, - discussionNumber: number, - query?: { - /** Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. */ - content?: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}/reactions`, - method: "GET", - query: query, - format: "json", - ...params, - }), +/** RECURSIVE */ +export interface RecursiveObject { + /** RECURSIVE */ + bar?: RecursiveObject; + /** + * Unique identifier of the GitHub app + * @example 37 + */ + id?: number; +} - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`Create reaction for a team discussion`](https://docs.github.com/rest/reference/reactions#create-reaction-for-a-team-discussion) endpoint. Create a reaction to a [team discussion](https://docs.github.com/rest/reference/teams#discussions). OAuth access tokens require the `write:discussion` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). A response with a `Status: 200 OK` means that you already added the reaction type to this team discussion. - * - * @tags reactions - * @name ReactionsCreateForTeamDiscussionLegacy - * @summary Create reaction for a team discussion (Legacy) - * @request POST:/teams/{team_id}/discussions/{discussion_number}/reactions - * @deprecated - */ - reactionsCreateForTeamDiscussionLegacy: ( - teamId: number, - discussionNumber: number, - data: { - /** The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the team discussion. */ - content: "+1" | "-1" | "laugh" | "confused" | "heart" | "hooray" | "rocket" | "eyes"; +export type 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) || {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/discussions/${discussionNumber}/reactions`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + }; + } - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List pending team invitations`](https://docs.github.com/rest/reference/teams#list-pending-team-invitations) endpoint. The return hash contains a `role` field which refers to the Organization Invitation role and will be one of the following values: `direct_member`, `admin`, `billing_manager`, `hiring_manager`, or `reinstate`. If the invitee is not a GitHub member, the `login` field in the return hash will be `null`. - * - * @tags teams - * @name TeamsListPendingInvitationsLegacy - * @summary List pending team invitations (Legacy) - * @request GET:/teams/{team_id}/invitations - * @deprecated - */ - teamsListPendingInvitationsLegacy: ( - teamId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/invitations`, - method: "GET", - query: query, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List team members`](https://docs.github.com/rest/reference/teams#list-team-members) endpoint. Team members will include the members of child teams. - * - * @tags teams - * @name TeamsListMembersLegacy - * @summary List team members (Legacy) - * @request GET:/teams/{team_id}/members - * @deprecated - */ - teamsListMembersLegacy: ( - teamId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** - * Filters members returned by their role in the team. Can be one of: - * \* `member` - normal members of the team. - * \* `maintainer` - team maintainers. - * \* `all` - all members of the team. - * @default "all" - */ - role?: "member" | "maintainer" | "all"; + 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 + */ +export class Api extends HttpClient {} +" +`; + +exports[`simple > 'responses' 1`] = ` +"/* 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 = ""; + 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) || {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/members`, - method: "GET", - query: query, - format: "json", - ...params, - }), + }; + } - /** - * @description The "Get team member" endpoint (described below) is deprecated. We recommend using the [Get team membership for a user](https://docs.github.com/rest/reference/teams#get-team-membership-for-a-user) endpoint instead. It allows you to get both active and pending memberships. To list members in a team, the team must be visible to the authenticated user. - * - * @tags teams - * @name TeamsGetMemberLegacy - * @summary Get team member (Legacy) - * @request GET:/teams/{team_id}/members/{username} - * @deprecated - */ - teamsGetMemberLegacy: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "GET", - ...params, - }), + 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; + } - /** - * @description The "Add team member" endpoint (described below) is deprecated. We recommend using the [Add or update team membership for a user](https://docs.github.com/rest/reference/teams#add-or-update-team-membership-for-a-user) endpoint instead. It allows you to invite new organization members to your teams. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To add someone to a team, the authenticated user must be an organization owner or a team maintainer in the team they're changing. The person being added to the team must be a member of the team's organization. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." - * - * @tags teams - * @name TeamsAddMemberLegacy - * @summary Add team member (Legacy) - * @request PUT:/teams/{team_id}/members/{username} - * @deprecated - */ - teamsAddMemberLegacy: (teamId: number, username: string, params: RequestParams = {}) => - this.request< - void, - | BasicError - | void - | { - /** @example ""https://docs.github.com/rest"" */ - documentation_url?: string; - errors?: { - code?: string; - field?: string; - resource?: string; - }[]; - message?: string; - } - >({ - path: `/teams/${teamId}/members/${username}`, - method: "PUT", - ...params, - }), + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; - /** - * @description The "Remove team member" endpoint (described below) is deprecated. We recommend using the [Remove team membership for a user](https://docs.github.com/rest/reference/teams#remove-team-membership-for-a-user) endpoint instead. It allows you to remove both active and pending memberships. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To remove a team member, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. Removing a team member does not delete the user, it just removes them from the team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." - * - * @tags teams - * @name TeamsRemoveMemberLegacy - * @summary Remove team member (Legacy) - * @request DELETE:/teams/{team_id}/members/{username} - * @deprecated - */ - teamsRemoveMemberLegacy: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "DELETE", - ...params, - }), + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Get team membership for a user](https://docs.github.com/rest/reference/teams#get-team-membership-for-a-user) endpoint. Team members will include the members of child teams. To get a user's membership with a team, the team must be visible to the authenticated user. **Note:** The `role` for organization owners returns as `maintainer`. For more information about `maintainer` roles, see [Create a team](https://docs.github.com/rest/reference/teams#create-a-team). - * - * @tags teams - * @name TeamsGetMembershipForUserLegacy - * @summary Get team membership for a user (Legacy) - * @request GET:/teams/{team_id}/memberships/{username} - * @deprecated - */ - teamsGetMembershipForUserLegacy: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/memberships/${username}`, - method: "GET", - format: "json", - ...params, - }), + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Add or update team membership for a user](https://docs.github.com/rest/reference/teams#add-or-update-team-membership-for-a-user) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. If the user is already a member of the team's organization, this endpoint will add the user to the team. To add a membership between an organization member and a team, the authenticated user must be an organization owner or a team maintainer. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." If the user is unaffiliated with the team's organization, this endpoint will send an invitation to the user via email. This newly-created membership will be in the "pending" state until the user accepts the invitation, at which point the membership will transition to the "active" state and the user will be added as a member of the team. To add a membership between an unaffiliated user and a team, the authenticated user must be an organization owner. If the user is already a member of the team, this endpoint will update the role of the team member's role. To update the membership of a team member, the authenticated user must be an organization owner or a team maintainer. - * - * @tags teams - * @name TeamsAddOrUpdateMembershipForUserLegacy - * @summary Add or update team membership for a user (Legacy) - * @request PUT:/teams/{team_id}/memberships/{username} - * @deprecated - */ - teamsAddOrUpdateMembershipForUserLegacy: ( - teamId: number, - username: string, - data: { - /** - * The role that this user should have in the team. Can be one of: - * \* `member` - a normal member of the team. - * \* `maintainer` - a team maintainer. Able to add/remove other team members, promote other team members to team maintainer, and edit the team's name and description. - * @default "member" - */ - role?: "member" | "maintainer"; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request< - TeamMembership, - | void - | BasicError - | { - /** @example ""https://help.github.com/articles/github-and-trade-controls"" */ - documentation_url?: string; - errors?: { - code?: string; - field?: string; - resource?: string; - }[]; - message?: string; - } - >({ - path: `/teams/${teamId}/memberships/${username}`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove team membership for a user](https://docs.github.com/rest/reference/teams#remove-team-membership-for-a-user) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. To remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. Removing team membership does not delete the user, it just removes their membership from the team. **Note:** When you have team synchronization set up for a team with your organization's identity provider (IdP), you will see an error if you attempt to use the API for making changes to the team's membership. If you have access to manage group membership in your IdP, you can manage GitHub team membership through your identity provider, which automatically adds and removes team members in an organization. For more information, see "[Synchronizing teams between your identity provider and GitHub](https://help.github.com/articles/synchronizing-teams-between-your-identity-provider-and-github/)." - * - * @tags teams - * @name TeamsRemoveMembershipForUserLegacy - * @summary Remove team membership for a user (Legacy) - * @request DELETE:/teams/{team_id}/memberships/{username} - * @deprecated - */ - teamsRemoveMembershipForUserLegacy: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/memberships/${username}`, - method: "DELETE", - ...params, - }), + 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; + }); - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List team projects`](https://docs.github.com/rest/reference/teams#list-team-projects) endpoint. Lists the organization projects for a team. - * - * @tags teams - * @name TeamsListProjectsLegacy - * @summary List team projects (Legacy) - * @request GET:/teams/{team_id}/projects - * @deprecated - */ - teamsListProjectsLegacy: ( - teamId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request< - TeamProject[], - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/teams/${teamId}/projects`, - method: "GET", - query: query, - format: "json", - ...params, - }), + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} +/** + * @title Title + * @version latest + * + * Description + */ +export class Api extends HttpClient { + api = { /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Check team permissions for a project](https://docs.github.com/rest/reference/teams#check-team-permissions-for-a-project) endpoint. Checks whether a team has `read`, `write`, or `admin` permissions for an organization project. The response includes projects inherited from a parent team. + * No description * - * @tags teams - * @name TeamsCheckPermissionsForProjectLegacy - * @summary Check team permissions for a project (Legacy) - * @request GET:/teams/{team_id}/projects/{project_id} - * @deprecated + * @name GetData + * @request GET:/api */ - teamsCheckPermissionsForProjectLegacy: (teamId: number, projectId: number, params: RequestParams = {}) => + getData: (params: RequestParams = {}) => this.request< - TeamProject, - void | { - documentation_url: string; - message: string; - } + { + data?: string; + }, + any >({ - path: `/teams/${teamId}/projects/${projectId}`, + path: \`/api\`, method: "GET", format: "json", ...params, }), + }; +} +" +`; - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Add or update team project permissions](https://docs.github.com/rest/reference/teams#add-or-update-team-project-permissions) endpoint. Adds an organization project to a team. To add a project to a team or update the team's permission on a project, the authenticated user must have `admin` permissions for the project. The project and team must be part of the same organization. - * - * @tags teams - * @name TeamsAddOrUpdateProjectPermissionsLegacy - * @summary Add or update team project permissions (Legacy) - * @request PUT:/teams/{team_id}/projects/{project_id} - * @deprecated - */ - teamsAddOrUpdateProjectPermissionsLegacy: ( - teamId: number, - projectId: number, - data: { - /** - * The permission to grant to the team for this project. Can be one of: - * \* `read` - team members can read, but not write to or administer this project. - * \* `write` - team members can read and write, but not administer this project. - * \* `admin` - team members can read, write and administer this project. - * Default: the team's `permission` attribute will be used to determine what permission to grant the team on this project. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." - */ - permission?: "read" | "write" | "admin"; +exports[`simple > 'swaggerhub-template' 1`] = ` +"/* 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://virtserver.swaggerhub.com/sdfsdfsffs/sdfff/1.0.0"; + 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) || {}), }, - params: RequestParams = {}, - ) => - this.request< - void, - | { - documentation_url?: string; - message?: string; - } - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/teams/${teamId}/projects/${projectId}`, - method: "PUT", - body: data, - type: ContentType.Json, - ...params, - }), + }; + } - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove a project from a team](https://docs.github.com/rest/reference/teams#remove-a-project-from-a-team) endpoint. Removes an organization project from a team. An organization owner or a team maintainer can remove any project from the team. To remove a project from a team as an organization member, the authenticated user must have `read` access to both the team and project, or `admin` access to the team or project. **Note:** This endpoint removes the project from the team, but does not delete it. - * - * @tags teams - * @name TeamsRemoveProjectLegacy - * @summary Remove a project from a team (Legacy) - * @request DELETE:/teams/{team_id}/projects/{project_id} - * @deprecated - */ - teamsRemoveProjectLegacy: (teamId: number, projectId: number, params: RequestParams = {}) => - this.request< - void, - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/teams/${teamId}/projects/${projectId}`, - method: "DELETE", - ...params, - }), + 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; + } - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [List team repositories](https://docs.github.com/rest/reference/teams#list-team-repositories) endpoint. - * - * @tags teams - * @name TeamsListReposLegacy - * @summary List team repositories (Legacy) - * @request GET:/teams/{team_id}/repos - * @deprecated - */ - teamsListReposLegacy: ( - teamId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description **Note**: Repositories inherited through a parent team will also be checked. **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Check team permissions for a repository](https://docs.github.com/rest/reference/teams#check-team-permissions-for-a-repository) endpoint. You can also get information about the specified repository, including what permissions the team grants on it, by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the `Accept` header: - * - * @tags teams - * @name TeamsCheckPermissionsForRepoLegacy - * @summary Check team permissions for a repository (Legacy) - * @request GET:/teams/{team_id}/repos/{owner}/{repo} - * @deprecated - */ - teamsCheckPermissionsForRepoLegacy: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, - method: "GET", - format: "json", - ...params, - }), + 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; + }); - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new "[Add or update team repository permissions](https://docs.github.com/rest/reference/teams#add-or-update-team-repository-permissions)" endpoint. To add a repository to a team or update the team's permission on a repository, the authenticated user must have admin access to the repository, and must be able to see the team. The repository must be owned by the organization, or a direct fork of a repository owned by the organization. You will get a `422 Unprocessable Entity` status if you attempt to add a repository to a team that is not owned by the organization. Note that, if you choose not to pass any parameters, you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." - * - * @tags teams - * @name TeamsAddOrUpdateRepoPermissionsLegacy - * @summary Add or update team repository permissions (Legacy) - * @request PUT:/teams/{team_id}/repos/{owner}/{repo} - * @deprecated - */ - teamsAddOrUpdateRepoPermissionsLegacy: ( - teamId: number, - owner: string, - repo: string, - data: { - /** - * The permission to grant the team on this repository. Can be one of: - * \* `pull` - team members can pull, but not push to or administer this repository. - * \* `push` - team members can pull and push, but not administer this repository. - * \* `admin` - team members can pull, push and administer this repository. - * - * If no permission is specified, the team's `permission` attribute will be used to determine what permission to grant the team on this repository. - */ - permission?: "pull" | "push" | "admin"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, - method: "PUT", - body: data, - type: ContentType.Json, - ...params, - }), + if (cancelToken) { + this.abortControllers.delete(cancelToken); + } + + if (!response.ok) throw data; + return data; + }); + }; +} +/** + * @title Sample Application Flow OAuth2 Project + * @version 1.0.0 + * @baseUrl https://virtserver.swaggerhub.com/sdfsdfsffs/sdfff/1.0.0 + * + * This is an example of using OAuth2 Application Flow in a specification to describe security to your API. + */ +export class Api extends HttpClient { + example = { /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [Remove a repository from a team](https://docs.github.com/rest/reference/teams#remove-a-repository-from-a-team) endpoint. If the authenticated user is an organization owner or a team maintainer, they can remove any repositories from the team. To remove a repository from a team as an organization member, the authenticated user must have admin access to the repository and must be able to see the team. NOTE: This does not delete the repository, it just removes it from the team. + * @description This is an example operation to show how security is applied to the call. * - * @tags teams - * @name TeamsRemoveRepoLegacy - * @summary Remove a repository from a team (Legacy) - * @request DELETE:/teams/{team_id}/repos/{owner}/{repo} - * @deprecated + * @name ExampleList + * @summary Server example operation + * @request GET:/example + * @secure */ - teamsRemoveRepoLegacy: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => + exampleList: (params: RequestParams = {}) => this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, - method: "DELETE", + path: \`/example\`, + method: "GET", + secure: true, ...params, }), - + }; + ping = { /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List IdP groups for a team`](https://docs.github.com/rest/reference/teams#list-idp-groups-for-a-team) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. List IdP groups connected to a team on GitHub. + * @description This operation shows how to override the global security defined above, as we want to open it up for all users. * - * @tags teams - * @name TeamsListIdpGroupsForLegacy - * @summary List IdP groups for a team (Legacy) - * @request GET:/teams/{team_id}/team-sync/group-mappings - * @deprecated + * @name PingList + * @summary Server heartbeat operation + * @request GET:/ping */ - teamsListIdpGroupsForLegacy: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/team-sync/group-mappings`, + pingList: (params: RequestParams = {}) => + this.request({ + path: \`/ping\`, method: "GET", - format: "json", ...params, }), + }; +} +" +`; - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`Create or update IdP group connections`](https://docs.github.com/rest/reference/teams#create-or-update-idp-group-connections) endpoint. Team synchronization is available for organizations using GitHub Enterprise Cloud. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. Creates, updates, or removes a connection between a team and an IdP group. When adding groups to a team, you must include all new and existing groups to avoid replacing existing groups with the new ones. Specifying an empty `groups` array will remove all connections for a team. - * - * @tags teams - * @name TeamsCreateOrUpdateIdpGroupConnectionsLegacy - * @summary Create or update IdP group connections (Legacy) - * @request PATCH:/teams/{team_id}/team-sync/group-mappings - * @deprecated - */ - teamsCreateOrUpdateIdpGroupConnectionsLegacy: ( - teamId: number, - data: { - /** The IdP groups you want to connect to a GitHub team. When updating, the new `groups` object will replace the original one. You must include any existing groups that you don't want to remove. */ - groups: { - /** @example ""moar cheese pleese"" */ - description?: string; - /** Description of the IdP group. */ - group_description: string; - /** ID of the IdP group. */ - group_id: string; - /** Name of the IdP group. */ - group_name: string; - /** @example ""caceab43fc9ffa20081c"" */ - id?: string; - /** @example ""external-team-6c13e7288ef7"" */ - name?: string; - }[]; - /** @example ""I am not a timestamp"" */ - synced_at?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/team-sync/group-mappings`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), +exports[`simple > 'tsoa-odd-types-3' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ - /** - * @description **Deprecation Notice:** This endpoint route is deprecated and will be removed from the Teams API. We recommend migrating your existing code to use the new [`List child teams`](https://docs.github.com/rest/reference/teams#list-child-teams) endpoint. - * - * @tags teams - * @name TeamsListChildLegacy - * @summary List child teams (Legacy) - * @request GET:/teams/{team_id}/teams - * @deprecated - */ - teamsListChildLegacy: ( - teamId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; +export interface AuthUser { + password: string; + username: string; +} + +export interface GetProfileBioDTO { + /** @format int32 */ + candidateId?: number; + cityName?: string | null; +} + +export interface Job { + address?: string | null; + github?: string | null; + id: string; + isTool?: boolean | null; + kind: Kind; + link?: string | null; + name?: string | null; + npm?: string | null; +} + +export type JobUpdate = OmitJobId | PickJobGithub | Record; + +export enum Kind { + COMPANY = "COMPANY", + PERSONAL = "PERSONAL", + FREELANCE = "FREELANCE", + OPEN_SOURCE = "OPEN_SOURCE", +} + +export type OmitJobId = PickJobExcludeKeysId; + +/** From T, pick a set of properties whose keys are in the union K */ +export interface PickJobExcludeKeysId { + address?: string; + github?: string; + isTool?: boolean; + kind: Kind; + link?: string; + name?: string; + 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; + name?: string; + notImportant?: boolean; + prefix?: string; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +export interface Project { + description: string; + id: string; + job: Job; + name?: string | null; + notImportant?: boolean | null; + prefix?: string | null; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +export interface ProjectUpdate { + description: string; + job: string; + name?: string | null; + notImportant?: boolean | null; + prefix?: string | null; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +export type UpdatedJob = Job; + +export interface UpdatedProject { + description: string; + id: string; + job: string; + name?: string | null; + notImportant?: boolean | null; + prefix?: string | null; + tags: string[]; + teamSize: string; + /** @format double */ + year: number; +} + +export interface User { + id: string; + username: string; +} + +export interface UserUpdate { + id?: string | null; + username?: string | null; +} + +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 = "http://localhost:8080/api/v1"; + 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) || {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/teams/${teamId}/teams`, - method: "GET", - query: query, - format: "json", - ...params, - }), + }; + } + + 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; }; - user = { - /** - * @description If the authenticated user is authenticated through basic authentication or OAuth with the `user` scope, then the response lists public and private profile information. If the authenticated user is authenticated through OAuth without the `user` scope, then the response lists only public profile information. - * - * @tags users - * @name UsersGetAuthenticated - * @summary Get the authenticated user - * @request GET:/user - */ - usersGetAuthenticated: (params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "GET", - format: "json", - ...params, - }), - /** - * @description **Note:** If your email is set to private and you send an `email` parameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API. - * - * @tags users - * @name UsersUpdateAuthenticated - * @summary Update the authenticated user - * @request PATCH:/user - */ - usersUpdateAuthenticated: ( - data: { - /** The new short biography of the user. */ - bio?: string; - /** - * The new blog URL of the user. - * @example "blog.example.com" - */ - blog?: string; - /** - * The new company of the user. - * @example "Acme corporation" - */ - company?: string; - /** - * The publicly visible email address of the user. - * @example "omar@example.com" - */ - email?: string; - /** The new hiring availability of the user. */ - hireable?: boolean; - /** - * The new location of the user. - * @example "Berlin, Germany" - */ - location?: string; - /** - * The new name of the user. - * @example "Omar Jahandar" - */ - name?: string; - /** - * The new Twitter username of the user. - * @example "therealomarj" - */ - twitter_username?: string | null; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description List the users you've blocked on your personal account. - * - * @tags users - * @name UsersListBlockedByAuthenticated - * @summary List users blocked by the authenticated user - * @request GET:/user/blocks - */ - usersListBlockedByAuthenticated: (params: RequestParams = {}) => - this.request< - SimpleUser[], - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/user/blocks`, - method: "GET", - format: "json", - ...params, - }), + 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 http://localhost:8080/api/v1 + */ +export class Api extends HttpClient { + auth = { /** * No description * - * @tags users - * @name UsersCheckBlocked - * @summary Check if a user is blocked by the authenticated user - * @request GET:/user/blocks/{username} + * @tags Auth + * @name Login + * @request POST:/auth */ - usersCheckBlocked: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/blocks/${username}`, - method: "GET", + login: (data?: AuthUser, params: RequestParams = {}) => + this.request({ + path: \`/auth\`, + method: "POST", + body: data, + type: ContentType.Json, + format: "json", ...params, }), /** * No description * - * @tags users - * @name UsersBlock - * @summary Block a user - * @request PUT:/user/blocks/{username} + * @tags Auth + * @name Refresh + * @request POST:/auth/refresh + * @secure */ - usersBlock: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/blocks/${username}`, - method: "PUT", + refresh: (params: RequestParams = {}) => + this.request({ + path: \`/auth/refresh\`, + method: "POST", + secure: true, + format: "json", ...params, }), - + }; + jobs = { /** * No description * - * @tags users - * @name UsersUnblock - * @summary Unblock a user - * @request DELETE:/user/blocks/{username} + * @tags Jobs + * @name GetJobs + * @request GET:/jobs + * @secure */ - usersUnblock: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/blocks/${username}`, - method: "DELETE", + getJobs: (params: RequestParams = {}) => + this.request({ + path: \`/jobs\`, + method: "GET", + secure: true, + format: "json", ...params, }), /** - * @description Sets the visibility for your primary email addresses. + * No description * - * @tags users - * @name UsersSetPrimaryEmailVisibilityForAuthenticated - * @summary Set primary email visibility for the authenticated user - * @request PATCH:/user/email/visibility + * @tags Jobs + * @name AddJob + * @request POST:/jobs + * @secure */ - usersSetPrimaryEmailVisibilityForAuthenticated: ( - data: { - /** - * An email address associated with the GitHub user account to manage. - * @example "org@example.com" - */ - email: string; - /** Denotes whether an email is publically visible. */ - visibility: "public" | "private"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/email/visibility`, - method: "PATCH", + addJob: (data: PickJobGithub, params: RequestParams = {}) => + this.request({ + path: \`/jobs\`, + method: "POST", body: data, + secure: true, type: ContentType.Json, format: "json", ...params, }), /** - * @description Lists all of your email addresses, and specifies which one is visible to the public. This endpoint is accessible with the `user:email` scope. + * No description * - * @tags users - * @name UsersListEmailsForAuthenticated - * @summary List email addresses for the authenticated user - * @request GET:/user/emails + * @tags Jobs + * @name GetJob + * @request GET:/jobs/{id} + * @secure */ - usersListEmailsForAuthenticated: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/emails`, + getJob: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, method: "GET", - query: query, + secure: true, format: "json", ...params, }), /** - * @description This endpoint is accessible with the `user` scope. + * No description * - * @tags users - * @name UsersAddEmailForAuthenticated - * @summary Add an email address for the authenticated user - * @request POST:/user/emails + * @tags Jobs + * @name UpdateJob + * @request PATCH:/jobs/{id} + * @secure */ - usersAddEmailForAuthenticated: ( - data: - | { - /** - * Adds one or more email addresses to your GitHub account. Must contain at least one email address. **Note:** Alternatively, you can pass a single email address or an `array` of emails addresses directly, but we recommend that you pass an object using the `emails` key. - * @example [] - */ - emails: string[]; - } - | string[] - | string, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/emails`, - method: "POST", + updateJob: (id: string, data: JobUpdate, params: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, + method: "PATCH", body: data, + secure: true, type: ContentType.Json, format: "json", ...params, }), /** - * @description This endpoint is accessible with the `user` scope. + * No description * - * @tags users - * @name UsersDeleteEmailForAuthenticated - * @summary Delete an email address for the authenticated user - * @request DELETE:/user/emails + * @tags Jobs + * @name DeleteJob + * @request DELETE:/jobs/{id} + * @secure */ - usersDeleteEmailForAuthenticated: ( - data: - | { - /** Email addresses associated with the GitHub user account. */ - emails: string[]; - } - | string[] - | string, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/emails`, + deleteJob: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/jobs/\${id}\`, method: "DELETE", - body: data, - type: ContentType.Json, + secure: true, + format: "json", ...params, }), - + }; + xRoute = { /** - * @description Lists the people following the authenticated user. + * No description * - * @tags users - * @name UsersListFollowersForAuthenticatedUser - * @summary List followers of the authenticated user - * @request GET:/user/followers + * @tags Jobs + * @name GetJobs + * @request GET:x-route + * @secure */ - usersListFollowersForAuthenticatedUser: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/followers`, + getJobs: (params: RequestParams = {}) => + this.request({ + path: \`x-route\`, method: "GET", - query: query, + secure: true, format: "json", ...params, }), /** - * @description Lists the people who the authenticated user follows. + * No description * - * @tags users - * @name UsersListFollowedByAuthenticated - * @summary List the people the authenticated user follows - * @request GET:/user/following + * @tags Jobs + * @name AddJob + * @request POST:x-route + * @secure */ - usersListFollowedByAuthenticated: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/following`, - method: "GET", - query: query, + addJob: (data: PickJobGithub, params: RequestParams = {}) => + this.request({ + path: \`x-route\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, format: "json", ...params, }), - + }; + projects = { /** * No description * - * @tags users - * @name UsersCheckPersonIsFollowedByAuthenticated - * @summary Check if a person is followed by the authenticated user - * @request GET:/user/following/{username} + * @tags Projects + * @name GetProjects + * @request GET:/projects */ - usersCheckPersonIsFollowedByAuthenticated: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, + getProjects: (params: RequestParams = {}) => + this.request({ + path: \`/projects\`, method: "GET", + format: "json", ...params, }), /** - * @description Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the `user:follow` scope. + * No description * - * @tags users - * @name UsersFollow - * @summary Follow a user - * @request PUT:/user/following/{username} + * @tags Projects + * @name AddProjects + * @request POST:/projects + * @secure */ - usersFollow: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "PUT", + addProjects: (data: ProjectUpdate, params: RequestParams = {}) => + this.request({ + path: \`/projects\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + format: "json", ...params, }), /** - * @description Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the `user:follow` scope. + * No description * - * @tags users - * @name UsersUnfollow - * @summary Unfollow a user - * @request DELETE:/user/following/{username} + * @tags Projects + * @name UpdateProject + * @request PATCH:/projects/{id} + * @secure */ - usersUnfollow: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "DELETE", + updateProject: (id: string, data: ProjectUpdate, params: RequestParams = {}) => + this.request({ + path: \`/projects/\${id}\`, + method: "PATCH", + body: data, + secure: true, + type: ContentType.Json, + format: "json", ...params, }), - + }; + users = { /** - * @description Lists the current user's GPG keys. Requires that you are authenticated via Basic Auth or via OAuth with at least `read:gpg_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * No description * - * @tags users - * @name UsersListGpgKeysForAuthenticated - * @summary List GPG keys for the authenticated user - * @request GET:/user/gpg_keys + * @tags Users + * @name GetUsers + * @request GET:/users + * @secure */ - usersListGpgKeysForAuthenticated: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/gpg_keys`, + getUsers: (params: RequestParams = {}) => + this.request({ + path: \`/users\`, method: "GET", - query: query, + secure: true, format: "json", ...params, }), /** - * @description Adds a GPG key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least `write:gpg_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * No description * - * @tags users - * @name UsersCreateGpgKeyForAuthenticated - * @summary Create a GPG key for the authenticated user - * @request POST:/user/gpg_keys + * @tags Users + * @name AddUser + * @request POST:/users + * @secure */ - usersCreateGpgKeyForAuthenticated: ( - data: { - /** A GPG key in ASCII-armored format. */ - armored_public_key: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/gpg_keys`, + addUser: (data: AuthUser, params: RequestParams = {}) => + this.request({ + path: \`/users\`, method: "POST", body: data, + secure: true, type: ContentType.Json, format: "json", ...params, }), /** - * @description View extended details for a single GPG key. Requires that you are authenticated via Basic Auth or via OAuth with at least `read:gpg_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * No description * - * @tags users - * @name UsersGetGpgKeyForAuthenticated - * @summary Get a GPG key for the authenticated user - * @request GET:/user/gpg_keys/{gpg_key_id} + * @tags Users + * @name DeleteUser + * @request DELETE:/users/{id} + * @secure */ - usersGetGpgKeyForAuthenticated: (gpgKeyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/gpg_keys/${gpgKeyId}`, - method: "GET", + deleteUser: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/users/\${id}\`, + method: "DELETE", + secure: true, format: "json", ...params, }), /** - * @description Removes a GPG key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least `admin:gpg_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * No description * - * @tags users - * @name UsersDeleteGpgKeyForAuthenticated - * @summary Delete a GPG key for the authenticated user - * @request DELETE:/user/gpg_keys/{gpg_key_id} + * @tags Users + * @name UpdateUser + * @request PATCH:/users/{id} + * @secure */ - usersDeleteGpgKeyForAuthenticated: (gpgKeyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/gpg_keys/${gpgKeyId}`, - method: "DELETE", + updateUser: (id: string, data: UserUpdate, params: RequestParams = {}) => + this.request({ + path: \`/users/\${id}\`, + method: "PATCH", + body: data, + secure: true, + type: ContentType.Json, + format: "json", ...params, }), + }; +} +" +`; + +exports[`simple > 'uber' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface Activities { + /** + * Total number of items available. + * @format int32 + */ + count?: number; + history?: Activity[]; + /** + * Number of items to retrieve (100 max). + * @format int32 + */ + limit?: number; + /** + * Position in pagination. + * @format int32 + */ + offset?: number; +} + +export interface Activity { + /** Unique identifier for the activity */ + uuid?: string; +} + +export interface Error { + /** @format int32 */ + code?: number; + fields?: string; + message?: string; +} + +export interface PriceEstimate { + /** [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code. */ + currency_code?: string; + /** Display name of product. */ + display_name?: string; + /** Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI. */ + estimate?: string; + /** Upper bound of the estimated price. */ + high_estimate?: number; + /** Lower bound of the estimated price. */ + low_estimate?: number; + /** Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles */ + product_id?: string; + /** Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier. */ + surge_multiplier?: number; +} + +export interface Product { + /** Capacity of product. For example, 4 people. */ + capacity?: number; + /** Description of product. */ + description?: string; + /** Display name of product. */ + display_name?: string; + /** Image URL representing the product. */ + image?: string; + /** Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. */ + product_id?: string; +} + +export interface ProductList { + /** Contains the list of products */ + products?: Product[]; +} + +export interface Profile { + /** Email address of the Uber user */ + email?: string; + /** First name of the Uber user. */ + first_name?: string; + /** Last name of the Uber user. */ + last_name?: string; + /** Image URL of the Uber user. */ + picture?: string; + /** Promo code of the Uber user. */ + promo_code?: string; +} + +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://api.uber.com/v1"; + 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.clone() 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 Uber API + * @version 1.0.0 + * @baseUrl https://api.uber.com/v1 + * + * Move your app forward with the Uber API + */ +export class Api extends HttpClient { + products = { /** - * @description Lists installations of your GitHub App that the authenticated user has explicit permission (`:read`, `:write`, or `:admin`) to access. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. You can find the permissions for the installation under the `permissions` key. + * @description The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order. * - * @tags apps - * @name AppsListInstallationsForAuthenticatedUser - * @summary List app installations accessible to the user access token - * @request GET:/user/installations + * @tags Products + * @name ProductsList + * @summary Product Types + * @request GET:/products + * @secure */ - appsListInstallationsForAuthenticatedUser: ( - query?: { + productsList: ( + query: { /** - * Page number of the results to fetch. - * @default 1 + * Latitude component of location. + * @format double */ - page?: number; + latitude: number; /** - * Results per page (max 100) - * @default 30 + * Longitude component of location. + * @format double */ - per_page?: number; + longitude: number; }, params: RequestParams = {}, ) => - this.request< - { - installations: Installation[]; - total_count: number; - }, - | BasicError - | { - documentation_url: string; - message: string; - } - >({ - path: `/user/installations`, + this.request({ + path: \`/products\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), - + }; + estimates = { /** - * @description List repositories that the authenticated user has explicit permission (`:read`, `:write`, or `:admin`) to access for an installation. The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. The access the user has to each repository is included in the hash under the `permissions` key. + * @description The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.

The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier. * - * @tags apps - * @name AppsListInstallationReposForAuthenticatedUser - * @summary List repositories accessible to the user access token - * @request GET:/user/installations/{installation_id}/repositories + * @tags Estimates + * @name PriceList + * @summary Price Estimates + * @request GET:/estimates/price */ - appsListInstallationReposForAuthenticatedUser: ( - installationId: number, - query?: { + priceList: ( + query: { /** - * Page number of the results to fetch. - * @default 1 + * Latitude component of end location. + * @format double */ - page?: number; + end_latitude?: number; /** - * Results per page (max 100) - * @default 30 + * Longitude component of end location. + * @format double */ - per_page?: number; + end_longitude: number; + /** + * Latitude component of start location. + * @format double + */ + start_latitude: number; + /** + * Longitude component of start location. + * @format double + */ + start_longitude: number; }, params: RequestParams = {}, ) => - this.request< - { - repositories: Repository[]; - repository_selection?: string; - total_count: number; - }, - BasicError - >({ - path: `/user/installations/${installationId}/repositories`, + this.request({ + path: \`/estimates/price\`, method: "GET", query: query, format: "json", @@ -26781,1652 +43672,2428 @@ export class Api extends HttpClient - this.request({ - path: `/user/installations/${installationId}/repositories/${repositoryId}`, - method: "PUT", - ...params, - }), - - /** - * @description Remove a single repository from an installation. The authenticated user must have admin access to the repository. You must use a personal access token (which you can create via the [command line](https://docs.github.com/github/authenticating-to-github/creating-a-personal-access-token) or [Basic Authentication](https://docs.github.com/rest/overview/other-authentication-methods#basic-authentication)) to access this endpoint. - * - * @tags apps - * @name AppsRemoveRepoFromInstallation - * @summary Remove a repository from an app installation - * @request DELETE:/user/installations/{installation_id}/repositories/{repository_id} - */ - appsRemoveRepoFromInstallation: (installationId: number, repositoryId: number, params: RequestParams = {}) => - this.request({ - path: `/user/installations/${installationId}/repositories/${repositoryId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Shows which type of GitHub user can interact with your public repositories and when the restriction expires. If there are no restrictions, you will see an empty response. - * - * @tags interactions - * @name InteractionsGetRestrictionsForAuthenticatedUser - * @summary Get interaction restrictions for your public repositories - * @request GET:/user/interaction-limits - */ - interactionsGetRestrictionsForAuthenticatedUser: (params: RequestParams = {}) => - this.request({ - path: `/user/interaction-limits`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Temporarily restricts which type of GitHub user can interact with your public repositories. Setting the interaction limit at the user level will overwrite any interaction limits that are set for individual repositories owned by the user. - * - * @tags interactions - * @name InteractionsSetRestrictionsForAuthenticatedUser - * @summary Set interaction restrictions for your public repositories - * @request PUT:/user/interaction-limits - */ - interactionsSetRestrictionsForAuthenticatedUser: (data: InteractionLimit, params: RequestParams = {}) => - this.request({ - path: `/user/interaction-limits`, - method: "PUT", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Removes any interaction restrictions from your public repositories. - * - * @tags interactions - * @name InteractionsRemoveRestrictionsForAuthenticatedUser - * @summary Remove interaction restrictions from your public repositories - * @request DELETE:/user/interaction-limits - */ - interactionsRemoveRestrictionsForAuthenticatedUser: (params: RequestParams = {}) => - this.request({ - path: `/user/interaction-limits`, - method: "DELETE", - ...params, - }), - - /** - * @description List issues across owned and member repositories assigned to the authenticated user. **Note**: GitHub's REST API v3 considers every pull request an issue, but not every issue is a pull request. For this reason, "Issues" endpoints may return both issues and pull requests in the response. You can identify pull requests by the `pull_request` key. Be aware that the `id` of a pull request returned from "Issues" endpoints will be an _issue id_. To find out the pull request id, use the "[List pull requests](https://docs.github.com/rest/reference/pulls#list-pull-requests)" endpoint. + * @description The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. * - * @tags issues - * @name IssuesListForAuthenticatedUser - * @summary List user account issues assigned to the authenticated user - * @request GET:/user/issues + * @tags Estimates + * @name TimeList + * @summary Time Estimates + * @request GET:/estimates/time */ - issuesListForAuthenticatedUser: ( - query?: { - /** - * One of `asc` (ascending) or `desc` (descending). - * @default "desc" - */ - direction?: "asc" | "desc"; - /** - * Indicates which sorts of issues to return. Can be one of: - * \* `assigned`: Issues assigned to you - * \* `created`: Issues created by you - * \* `mentioned`: Issues mentioning you - * \* `subscribed`: Issues you're subscribed to updates for - * \* `all`: All issues the authenticated user can see, regardless of participation or creation - * @default "assigned" - */ - filter?: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** A list of comma separated label names. Example: `bug,ui,@high` */ - labels?: string; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; + timeList: ( + query: { /** - * Results per page (max 100) - * @default 30 + * Unique customer identifier to be used for experience customization. + * @format uuid */ - per_page?: number; - /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - since?: string; + customer_uuid?: string; + /** Unique identifier representing a specific product for a given latitude & longitude. */ + product_id?: string; /** - * What to sort results by. Can be either `created`, `updated`, `comments`. - * @default "created" + * Latitude component of start location. + * @format double */ - sort?: "created" | "updated" | "comments"; + start_latitude: number; /** - * Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`. - * @default "open" + * Longitude component of start location. + * @format double */ - state?: "open" | "closed" | "all"; + start_longitude: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/user/issues`, + this.request({ + path: \`/estimates/time\`, method: "GET", query: query, format: "json", ...params, }), - + }; + me = { /** - * @description Lists the public SSH keys for the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least `read:public_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @description The User Profile endpoint returns information about the Uber user that has authorized with the application. * - * @tags users - * @name UsersListPublicSshKeysForAuthenticated - * @summary List public SSH keys for the authenticated user - * @request GET:/user/keys + * @tags User + * @name GetMe + * @summary User Profile + * @request GET:/me */ - usersListPublicSshKeysForAuthenticated: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/keys`, + getMe: (params: RequestParams = {}) => + this.request({ + path: \`/me\`, method: "GET", - query: query, format: "json", ...params, }), - + }; + history = { /** - * @description Adds a public SSH key to the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least `write:public_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). + * @description The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. * - * @tags users - * @name UsersCreatePublicSshKeyForAuthenticated - * @summary Create a public SSH key for the authenticated user - * @request POST:/user/keys + * @tags User + * @name HistoryList + * @summary User Activity + * @request GET:/history */ - usersCreatePublicSshKeyForAuthenticated: ( - data: { + historyList: ( + query?: { /** - * The public SSH key to add to your GitHub account. - * @pattern ^ssh-(rsa|dss|ed25519) |^ecdsa-sha2-nistp(256|384|521) + * Number of items to retrieve. Default is 5, maximum is 100. + * @format int32 */ - key: string; + limit?: number; /** - * A descriptive name for the new key. - * @example "Personal MacBook Air" + * Offset the list of returned results by this amount. Default is zero. + * @format int32 */ - title?: string; + offset?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/user/keys`, - method: "POST", - body: data, - type: ContentType.Json, + this.request({ + path: \`/history\`, + method: "GET", + query: query, format: "json", ...params, }), + }; +} +" +`; + +exports[`simple > 'up-banking' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ +/** Provides information about an Up bank account. */ +export interface AccountResource { + attributes: { + /** The bank account type of this account. */ + accountType: AccountTypeEnum; /** - * @description View extended details for a single public SSH key. Requires that you are authenticated via Basic Auth or via OAuth with at least `read:public_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). - * - * @tags users - * @name UsersGetPublicSshKeyForAuthenticated - * @summary Get a public SSH key for the authenticated user - * @request GET:/user/keys/{key_id} + * The available balance of the account, taking into account any amounts + * that are currently on hold. */ - usersGetPublicSshKeyForAuthenticated: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "GET", - format: "json", - ...params, - }), + balance: MoneyObject; + /** + * The date-time at which this account was first opened. + * @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; + links?: { + /** The canonical link to this resource within the API. */ + self: string; + }; + relationships: { + transactions: { + links?: { + /** The link to retrieve the related resource(s) in this relationship. */ + related: string; + }; + }; + }; + /** The type of this resource: \`accounts\` */ + type: string; +} + +/** + * Specifies the type of bank account. Currently returned values are \`SAVER\` + * and \`TRANSACTIONAL\`. + */ +export enum AccountTypeEnum { + SAVER = "SAVER", + TRANSACTIONAL = "TRANSACTIONAL", +} + +/** + * Provides information about an instant reimbursement in the form of + * cashback. + */ +export interface CashbackObject { + /** The total amount of cashback paid, represented as a positive value. */ + amount: MoneyObject; + /** A brief description of why this cashback was paid. */ + description: string; +} + +/** Provides information about a category and its ancestry. */ +export interface CategoryResource { + attributes: { + /** The name of this category as seen in the Up application. */ + name: string; + }; + /** + * The unique identifier for this category. This is a human-readable but + * URL-safe value. + */ + id: string; + links?: { + /** The canonical link to this resource within the API. */ + self: string; + }; + relationships: { + children: { + data: { + /** The unique identifier of the resource within its type. */ + id: string; + /** The type of this resource: \`categories\` */ + type: string; + }[]; + links?: { + /** The link to retrieve the related resource(s) in this relationship. */ + related: string; + }; + }; + parent: { + data: { + /** 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; + }; + }; + }; + /** The type of this resource: \`categories\` */ + type: string; +} + +/** + * Request to create a new webhook. This currently only requires a \`url\` + * attribute. + */ +export interface CreateWebhookRequest { + /** The webhook resource to create. */ + data: WebhookInputResource; +} + +/** Successful response after creating a webhook. */ +export interface CreateWebhookResponse { + /** The webhook that was created. */ + data: WebhookResource; +} +/** Provides information about an error processing a request. */ +export interface ErrorObject { + /** + * A detailed description of this error. This should be considered unique + * to individual occurrences of an error and subject to change. It is + * useful for debugging purposes. + */ + detail: string; + /** + * If applicable, location in the request that this error relates to. This + * may be a parameter in the query string, or a an attribute in the + * request body. + */ + source?: { /** - * @description Removes a public SSH key from the authenticated user's GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least `admin:public_key` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/). - * - * @tags users - * @name UsersDeletePublicSshKeyForAuthenticated - * @summary Delete a public SSH key for the authenticated user - * @request DELETE:/user/keys/{key_id} + * If this error relates to a query parameter, the name of the + * parameter. */ - usersDeletePublicSshKeyForAuthenticated: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "DELETE", - ...params, - }), + parameter?: string; + /** + * If this error relates to an attribute in the request body, a + * rfc-6901 JSON pointer to the attribute. + */ + pointer?: string; + }; + /** + * The HTTP status code associated with this error. This can also be + * obtained from the response headers. The status indicates the broad type + * of error according to HTTP semantics. + */ + status: string; + /** + * A short description of this error. This should be stable across + * multiple occurrences of this type of error and typically expands on the + * reason for the status code. + */ + title: string; +} + +/** Generic error response that returns one or more errors. */ +export interface ErrorResponse { + /** The list of errors returned in this response. */ + errors: ErrorObject[]; +} + +/** Successful response to get a single account. */ +export interface GetAccountResponse { + /** The account returned in this response. */ + data: AccountResource; +} + +/** Successful response to get a single category and its ancestry. */ +export interface GetCategoryResponse { + /** The category returned in this response. */ + data: CategoryResource; +} + +/** Successful response to get a single transaction. */ +export interface GetTransactionResponse { + /** The transaction returned in this response. */ + data: TransactionResource; +} +/** Successful response to get a single webhook. */ +export interface GetWebhookResponse { + /** The webhook returned in this response. */ + data: WebhookResource; +} + +/** + * Provides information about the amount at which a transaction was in the + * \`HELD\` status. + */ +export interface HoldInfoObject { + /** + * The amount of this transaction while in the \`HELD\` status, in + * Australian dollars. + */ + amount: MoneyObject; + /** + * The foreign currency amount of this transaction while in the \`HELD\` + * status. This field will be \`null\` for domestic transactions. The amount + * was converted to the AUD amount reflected in the \`amount\` field. + */ + foreignAmount: MoneyObject | null; +} + +/** + * Successful response to get all accounts. This returns a paginated list of + * accounts, which can be scrolled by following the \`prev\` and \`next\` links + * if present. + */ +export interface ListAccountsResponse { + /** The list of accounts returned in this response. */ + data: AccountResource[]; + links: { /** - * @description Lists the active subscriptions for the authenticated user. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an [OAuth token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/). - * - * @tags apps - * @name AppsListSubscriptionsForAuthenticatedUser - * @summary List subscriptions for the authenticated user - * @request GET:/user/marketplace_purchases + * The link to the next page in the results. If this value is \`null\` + * there is no next page. */ - appsListSubscriptionsForAuthenticatedUser: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/marketplace_purchases`, - method: "GET", - query: query, - format: "json", - ...params, - }), + 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; + }; +} + +/** + * Successful response to get all categories and their ancestry. The + * returned list is not paginated. + */ +export interface ListCategoriesResponse { + /** The list of categories returned in this response. */ + data: CategoryResource[]; +} +/** + * Successful response to get all tags. This returns a paginated list of + * tags, which can be scrolled by following the \`prev\` and \`next\` links if + * present. + */ +export interface ListTagsResponse { + /** The list of tags returned in this response. */ + data: TagResource[]; + links: { /** - * @description Lists the active subscriptions for the authenticated user. You must use a [user-to-server OAuth access token](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/#identifying-users-on-your-site), created for a user who has authorized your GitHub App, to access this endpoint. . OAuth Apps must authenticate using an [OAuth token](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/). - * - * @tags apps - * @name AppsListSubscriptionsForAuthenticatedUserStubbed - * @summary List subscriptions for the authenticated user (stubbed) - * @request GET:/user/marketplace_purchases/stubbed + * The link to the next page in the results. If this value is \`null\` + * there is no next page. */ - appsListSubscriptionsForAuthenticatedUserStubbed: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/marketplace_purchases/stubbed`, - method: "GET", - query: query, - format: "json", - ...params, - }), + 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; + }; +} +/** + * Successful response to get all transactions. This returns a paginated + * list of transactions, which can be scrolled by following the \`prev\` and + * \`next\` links if present. + */ +export interface ListTransactionsResponse { + /** The list of transactions returned in this response. */ + data: TransactionResource[]; + links: { /** - * No description - * - * @tags orgs - * @name OrgsListMembershipsForAuthenticatedUser - * @summary List organization memberships for the authenticated user - * @request GET:/user/memberships/orgs + * The link to the next page in the results. If this value is \`null\` + * there is no next page. */ - orgsListMembershipsForAuthenticatedUser: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; + 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; + }; +} + +/** + * Successful response to get all delivery logs for a webhook. This returns + * a paginated list of delivery logs, which can be scrolled by following the + * \`next\` and \`prev\` links if present. + */ +export interface ListWebhookDeliveryLogsResponse { + /** The list of delivery logs returned in this response. */ + data: WebhookDeliveryLogResource[]; + links: { + /** + * 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; + }; +} + +/** + * Successful response to get all webhooks. This returns a paginated list of + * webhooks, which can be scrolled by following the \`prev\` and \`next\` links + * if present. + */ +export interface ListWebhooksResponse { + /** The list of webhooks returned in this response. */ + data: WebhookResource[]; + links: { + /** + * 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; + }; +} + +/** Provides information about a value of money. */ +export interface MoneyObject { + /** The ISO 4217 currency code. */ + currencyCode: string; + /** + * The amount of money, formatted as a string in the relevant currency. + * For example, for an Australian dollar value of $10.56, this field will + * be \`"10.56"\`. The currency symbol is not included in the string. + */ + value: string; + /** + * The amount of money in the smallest denomination for the currency, as a + * 64-bit integer. For example, for an Australian dollar value of $10.56, + * this field will be \`1056\`. + */ + valueInBaseUnits: number; +} + +/** Basic ping response to verify authentication. */ +export interface PingResponse { + meta: { + /** The unique identifier of the authenticated customer. */ + id: string; + /** A cute emoji that represents the response status. */ + statusEmoji: string; + }; +} + +/** + * Provides information about how a Round Up was applied, such as whether or + * not a boost was included in the Round Up. + */ +export interface RoundUpObject { + /** + * The total amount of this Round Up, including any boosts, represented as + * a negative value. + */ + amount: MoneyObject; + /** + * The portion of the Round Up \`amount\` owing to boosted Round Ups, + * represented as a negative value. If no boost was added to the Round Up + * this field will be \`null\`. + */ + boostPortion: MoneyObject | null; +} + +/** Bla bla bla foo bar baz */ +export enum SomeEnumName { + Foo = "Foo", + Bar = "Bar", + Baz = "Baz", + Bad = "Bad", +} + +/** Uniquely identifies a single tag in the API. */ +export interface TagInputResourceIdentifier { + /** The label of the tag, which also acts as the tag’s unique identifier. */ + id: string; + /** The type of this resource: \`tags\` */ + type: string; +} + +/** Provides information about a tag. */ +export interface TagResource { + /** The label of the tag, which also acts as the tag’s unique identifier. */ + id: string; + relationships: { + transactions: { + links?: { + /** The link to retrieve the related resource(s) in this relationship. */ + related: string; + }; + }; + }; + /** The type of this resource: \`tags\` */ + type: string; +} + +export interface TransactionResource { + attributes: { + /** + * 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. + */ + amount: MoneyObject; + /** + * If all or part of this transaction was instantly reimbursed in the + * form of cashback, details of the reimbursement. + */ + 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; + /** + * 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. + */ + 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 + * transaction while \`HELD\`. + */ + holdInfo: HoldInfoObject | null; + /** + * Attached message for this transaction, such as a payment message, or a + * transfer note. + */ + message: string | null; + /** + * 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. + */ + rawText: string | null; + /** + * Details of how this transaction was rounded-up. If no Round Up was + * applied this field will be \`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. + * @format date-time + */ + settledAt: string | null; + /** + * The current processing status of this transaction, according to + * whether or not this transaction has settled or is still held. + */ + status: TransactionStatusEnum; + }; + /** The unique identifier for this transaction. */ + id: string; + links?: { + /** The canonical link to this resource within the API. */ + self: string; + }; + relationships: { + account: { + data: { + /** 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. */ + related: string; + }; + }; + category: { + data: { + /** 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; + }; + }; + parentCategory: { + data: { + /** 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; + }; + }; + tags: { + data: { + /** 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?: { /** - * Results per page (max 100) - * @default 30 + * The link to retrieve or modify linkage between this resources and the + * related resource(s) in this relationship. */ - per_page?: number; - /** Indicates the state of the memberships to return. Can be either `active` or `pending`. If not specified, the API returns both active and pending memberships. */ - state?: "active" | "pending"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/memberships/orgs`, - method: "GET", - query: query, - format: "json", - ...params, - }), + self: string; + }; + }; + }; + /** The type of this resource: \`transactions\` */ + type: string; +} - /** - * No description - * - * @tags orgs - * @name OrgsGetMembershipForAuthenticatedUser - * @summary Get an organization membership for the authenticated user - * @request GET:/user/memberships/orgs/{org} - */ - orgsGetMembershipForAuthenticatedUser: (org: string, params: RequestParams = {}) => - this.request({ - path: `/user/memberships/orgs/${org}`, - method: "GET", - format: "json", - ...params, - }), +/** + * Specifies which stage of processing a transaction is currently at. + * Currently returned values are \`HELD\` and \`SETTLED\`. When a transaction is + * held, its account’s \`availableBalance\` is affected. When a transaction is + * settled, its account’s \`currentBalance\` is affected. + */ +export enum TransactionStatusEnum { + HELD = "HELD", + SETTLED = "SETTLED", +} + +/** Request to add or remove tags associated with a transaction. */ +export interface UpdateTransactionTagsRequest { + /** The tags to add to or remove from the transaction. */ + data: TagInputResourceIdentifier[]; +} +/** + * Provides historical webhook event delivery information for analysis and + * debugging purposes. + */ +export interface WebhookDeliveryLogResource { + attributes: { /** - * No description - * - * @tags orgs - * @name OrgsUpdateMembershipForAuthenticatedUser - * @summary Update an organization membership for the authenticated user - * @request PATCH:/user/memberships/orgs/{org} + * The date-time at which this log entry was created. + * @format date-time */ - orgsUpdateMembershipForAuthenticatedUser: ( - org: string, + 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. */ + body: string; + }; + /** Information about the response that was received from the webhook URL. */ + response: { + /** The payload that was received in the response body. */ + body: string; + /** The HTTP status code received in the response. */ + statusCode: number; + } | null; + }; + /** The unique identifier for this log entry. */ + id: string; + relationships: { + webhookEvent: { data: { - /** The state that the membership should be in. Only `"active"` will be accepted. */ - state: "active"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/memberships/orgs/${org}`, - method: "PATCH", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + /** The unique identifier of the resource within its type. */ + id: string; + /** The type of this resource: \`webhook-events\` */ + type: string; + }; + }; + }; + /** The type of this resource: \`webhook-delivery-logs\` */ + type: string; +} + +/** + * Specifies the nature of the success or failure of a webhook delivery + * attempt to the subscribed webhook URL. The currently returned values are + * described below: + * + * - **\`DELIVERED\`**: The event was delivered to the webhook URL + * successfully and a \`200\` response was received. + * - **\`UNDELIVERABLE\`**: The webhook URL was not reachable, or timed out. + * - **\`BAD_RESPONSE_CODE\`**: The event was delivered to the webhook URL + * but a non-\`200\` response was received. + */ +export enum WebhookDeliveryStatusEnum { + DELIVERED = "DELIVERED", + UNDELIVERABLE = "UNDELIVERABLE", + BAD_RESPONSE_CODE = "BAD_RESPONSE_CODE", +} + +/** Asynchronous callback request used for webhook event delivery. */ +export interface WebhookEventCallback { + /** The webhook event data sent to the subscribed webhook. */ + data: WebhookEventResource; +} +/** + * Provides the event data used in asynchronous webhook event callbacks to + * subscribed endpoints. Webhooks events have defined \`eventType\`s and may + * optionally relate to other resources within the Up API. + */ +export interface WebhookEventResource { + attributes: { /** - * @description Lists all migrations a user has started. - * - * @tags migrations - * @name MigrationsListForAuthenticatedUser - * @summary List user migrations - * @request GET:/user/migrations + * The date-time at which this event was generated. + * @format date-time */ - migrationsListForAuthenticatedUser: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/migrations`, - method: "GET", - query: query, - format: "json", - ...params, - }), - + createdAt: string; /** - * @description Initiates the generation of a user migration archive. - * - * @tags migrations - * @name MigrationsStartForAuthenticatedUser - * @summary Start a user migration - * @request POST:/user/migrations + * The type of this event. This can be used to determine what action to + * take in response to the event. */ - migrationsStartForAuthenticatedUser: ( + eventType: WebhookEventTypeEnum; + }; + /** + * The unique identifier for this event. This will remain constant across + * delivery retries. + */ + id: string; + relationships: { + transaction?: { data: { - /** - * Exclude attributes from the API response to improve performance - * @example ["repositories"] - */ - exclude?: "repositories"[]; - /** - * Do not include attachments in the migration - * @example true - */ - exclude_attachments?: boolean; - /** - * Lock the repositories being migrated at the start of the migration - * @example true - */ - lock_repositories?: boolean; - repositories: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/migrations`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + /** 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; + }; + }; + webhook: { + data: { + /** 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. */ + related: string; + }; + }; + }; + /** The type of this resource: \`webhook-events\` */ + type: string; +} - /** - * @description Fetches a single user migration. The response includes the `state` of the migration, which can be one of the following values: * `pending` - the migration hasn't started yet. * `exporting` - the migration is in progress. * `exported` - the migration finished successfully. * `failed` - the migration failed. Once the migration has been `exported` you can [download the migration archive](https://docs.github.com/rest/reference/migrations#download-a-user-migration-archive). - * - * @tags migrations - * @name MigrationsGetStatusForAuthenticatedUser - * @summary Get a user migration status - * @request GET:/user/migrations/{migration_id} - */ - migrationsGetStatusForAuthenticatedUser: ( - migrationId: number, - query?: { - exclude?: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/migrations/${migrationId}`, - method: "GET", - query: query, - format: "json", - ...params, - }), +/** + * Specifies the type of a webhook event. This can be used to determine what + * action to take in response to the event, such as which relationships to + * expect. + */ +export enum WebhookEventTypeEnum { + TRANSACTION_CREATED = "TRANSACTION_CREATED", + TRANSACTION_SETTLED = "TRANSACTION_SETTLED", + TRANSACTION_DELETED = "TRANSACTION_DELETED", + PING = "PING", +} +/** Represents a webhook specified as request input. */ +export interface WebhookInputResource { + attributes: { /** - * @description Fetches the URL to download the migration archive as a `tar.gz` file. Depending on the resources your repository uses, the migration archive can contain JSON files with data for these objects: * attachments * bases * commit\_comments * issue\_comments * issue\_events * issues * milestones * organizations * projects * protected\_branches * pull\_request\_reviews * pull\_requests * releases * repositories * review\_comments * schema * users The archive will also contain an `attachments` directory that includes all attachment files uploaded to GitHub.com and a `repositories` directory that contains the repository's Git data. - * - * @tags migrations - * @name MigrationsGetArchiveForAuthenticatedUser - * @summary Download a user migration archive - * @request GET:/user/migrations/{migration_id}/archive + * An optional description for this webhook, up to 64 characters in + * length. */ - migrationsGetArchiveForAuthenticatedUser: (migrationId: number, params: RequestParams = {}) => - this.request({ - path: `/user/migrations/${migrationId}/archive`, - method: "GET", - ...params, - }), - + description?: string | null; /** - * @description Deletes a previous migration archive. Downloadable migration archives are automatically deleted after seven days. Migration metadata, which is returned in the [List user migrations](https://docs.github.com/rest/reference/migrations#list-user-migrations) and [Get a user migration status](https://docs.github.com/rest/reference/migrations#get-a-user-migration-status) endpoints, will continue to be available even after an archive is deleted. - * - * @tags migrations - * @name MigrationsDeleteArchiveForAuthenticatedUser - * @summary Delete a user migration archive - * @request DELETE:/user/migrations/{migration_id}/archive + * 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 */ - migrationsDeleteArchiveForAuthenticatedUser: (migrationId: number, params: RequestParams = {}) => - this.request({ - path: `/user/migrations/${migrationId}/archive`, - method: "DELETE", - ...params, - }), + url: string; + }; +} +/** Provides information about a webhook. */ +export interface WebhookResource { + attributes: { /** - * @description Unlocks a repository. You can lock repositories when you [start a user migration](https://docs.github.com/rest/reference/migrations#start-a-user-migration). Once the migration is complete you can unlock each repository to begin using it again or [delete the repository](https://docs.github.com/rest/reference/repos#delete-a-repository) if you no longer need the source data. Returns a status of `404 Not Found` if the repository is not locked. - * - * @tags migrations - * @name MigrationsUnlockRepoForAuthenticatedUser - * @summary Unlock a user repository - * @request DELETE:/user/migrations/{migration_id}/repos/{repo_name}/lock + * The date-time at which this webhook was created. + * @format date-time */ - migrationsUnlockRepoForAuthenticatedUser: (migrationId: number, repoName: string, params: RequestParams = {}) => - this.request({ - path: `/user/migrations/${migrationId}/repos/${repoName}/lock`, - method: "DELETE", - ...params, - }), - + createdAt: string; /** - * @description Lists all the repositories for this user migration. - * - * @tags migrations - * @name MigrationsListReposForUser - * @summary List repositories for a user migration - * @request GET:/user/migrations/{migration_id}/repositories + * An optional description that was provided at the time the webhook was + * created. */ - migrationsListReposForUser: ( - migrationId: number, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/migrations/${migrationId}/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - + description: string | null; /** - * @description List organizations for the authenticated user. **OAuth scope requirements** This only lists organizations that your authorization allows you to operate on in some way (e.g., you can list teams with `read:org` scope, you can publicize your organization membership with `user` scope, etc.). Therefore, this API requires at least `user` or `read:org` scope. OAuth requests with insufficient scope receive a `403 Forbidden` response. + * A shared secret key used to sign all webhook events sent to the + * configured webhook URL. This field is returned only once, upon the + * initial creation of the webhook. If lost, create a new webhook and + * delete this webhook. * - * @tags orgs - * @name OrgsListForAuthenticatedUser - * @summary List organizations for the authenticated user - * @request GET:/user/orgs + * The webhook URL receives a request with a + * \`X-Up-Authenticity-Signature\` header, which is the SHA-256 HMAC of + * the entire raw request body signed using this \`secretKey\`. It is + * advised to compute and check this signature to verify the + * authenticity of requests sent to the webhook URL. See + * [Handling webhook events](#callback_post_webhookURL) for full + * details. */ - orgsListForAuthenticatedUser: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + secretKey?: string; + /** The URL that this webhook is configured to \`POST\` events to. */ + url: string; + }; + /** The unique identifier for this webhook. */ + id: string; + links?: { + /** The canonical link to this resource within the API. */ + self: string; + }; + relationships: { + logs: { + links?: { + /** The link to retrieve the related resource(s) in this relationship. */ + related: string; + }; + }; + }; + /** The type of this resource: \`webhooks\` */ + type: string; +} + +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://api.up.com.au/api/v1"; + 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) || {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/orgs`, - method: "GET", - query: query, - format: "json", - ...params, - }), + }; + } - /** - * No description - * - * @tags projects - * @name ProjectsCreateForAuthenticatedUser - * @summary Create a user project - * @request POST:/user/projects - */ - projectsCreateForAuthenticatedUser: ( - data: { - /** - * Body of the project - * @example "This project represents the sprint of the first week in January" - */ - body?: string | null; - /** - * Name of the project - * @example "Week One Sprint" - */ - name: string; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request< - Project, - | BasicError - | { - documentation_url: string; - message: string; - } - | ValidationErrorSimple - >({ - path: `/user/projects`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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 Up API + * @version v1 + * @baseUrl https://api.up.com.au/api/v1 + * @contact API Specification and Support (https://github.com/up-banking/api) + * + * The Up API gives you programmatic access to your balances and + * transaction data. You can request past transactions or set up + * webhooks to receive real-time events when new transactions hit your + * account. It’s new, it’s exciting and it’s just the beginning. + */ +export class Api extends HttpClient { + accounts = { /** - * @description Lists your publicly visible email address, which you can set with the [Set primary email visibility for the authenticated user](https://docs.github.com/rest/reference/users#set-primary-email-visibility-for-the-authenticated-user) endpoint. This endpoint is accessible with the `user:email` scope. + * @description Retrieve a paginated list of all accounts for the currently authenticated user. The returned list is paginated and can be scrolled by following the \`prev\` and \`next\` links where present. * - * @tags users - * @name UsersListPublicEmailsForAuthenticated - * @summary List public email addresses for the authenticated user - * @request GET:/user/public_emails + * @tags Accounts + * @name AccountsList + * @summary List accounts + * @request GET:/accounts + * @secure */ - usersListPublicEmailsForAuthenticated: ( + accountsList: ( query?: { /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 + * The number of records to return in each page. + * @example 30 */ - per_page?: number; + "page[size]"?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/user/public_emails`, + this.request({ + path: \`/accounts\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), /** - * @description Lists repositories that the authenticated user has explicit permission (`:read`, `:write`, or `:admin`) to access. The authenticated user has explicit permission to access repositories they own, repositories where they are a collaborator, and repositories that they can access through an organization membership. + * @description Retrieve a specific account by providing its unique identifier. * - * @tags repos - * @name ReposListForAuthenticatedUser - * @summary List repositories for the authenticated user - * @request GET:/user/repos + * @tags Accounts + * @name AccountsDetail + * @summary Retrieve account + * @request GET:/accounts/{id} + * @secure */ - reposListForAuthenticatedUser: ( + accountsDetail: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/accounts/\${id}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + + /** + * @description Retrieve a list of all transactions for a specific account. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. To narrow the results to a specific date range pass one or both of \`filter[since]\` and \`filter[until]\` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last. + * + * @tags Transactions + * @name TransactionsDetail + * @summary List transactions by account + * @request GET:/accounts/{accountId}/transactions + * @secure + */ + transactionsDetail: ( + accountId: string, query?: { /** - * Comma-separated list of values. Can include: - * \* `owner`: Repositories that are owned by the authenticated user. - * \* `collaborator`: Repositories that the user has been added to as a collaborator. - * \* `organization_member`: Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on. - * @default "owner,collaborator,organization_member" + * The category identifier for which to filter transactions. + * Both parent and child categories can be filtered through + * this parameter. Providing an invalid category identifier + * results in a \`404\` response. + * @example "good-life" */ - affiliation?: string; - /** Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - before?: string; - /** Can be one of `asc` or `desc`. Default: `asc` when using `full_name`, otherwise `desc` */ - direction?: "asc" | "desc"; + "filter[category]"?: string; /** - * Page number of the results to fetch. - * @default 1 + * The start date-time from which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-01-01T01:02:03+10:00" */ - page?: number; + "filter[since]"?: string; /** - * Results per page (max 100) - * @default 30 + * The transaction status for which to return records. This + * can be used to filter \`HELD\` transactions from those + * that are \`SETTLED\`. + * @example "HELD" */ - per_page?: number; - /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - since?: string; + "filter[status]"?: TransactionStatusEnum; /** - * Can be one of `created`, `updated`, `pushed`, `full_name`. - * @default "full_name" + * A transaction tag to filter for which to return records. + * If the tag does not exist, zero records are returned and + * a success response is given. + * @example "Holiday" */ - sort?: "created" | "updated" | "pushed" | "full_name"; + "filter[tag]"?: string; /** - * Can be one of `all`, `owner`, `public`, `private`, `member`. Default: `all` - * - * Will cause a `422` error if used in the same request as **visibility** or **affiliation**. Will cause a `422` error if used in the same request as **visibility** or **affiliation**. - * @default "all" + * The end date-time up to which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-02-01T01:02:03+10:00" */ - type?: "all" | "owner" | "public" | "private" | "member"; + "filter[until]"?: string; /** - * Can be one of `all`, `public`, or `private`. - * @default "all" + * The number of records to return in each page. + * @example 30 */ - visibility?: "all" | "public" | "private"; + "page[size]"?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/user/repos`, + this.request({ + path: \`/accounts/\${accountId}/transactions\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), - + }; + categories = { /** - * @description Creates a new repository for the authenticated user. **OAuth scope requirements** When using [OAuth](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/), authorizations must include: * `public_repo` scope or `repo` scope to create a public repository * `repo` scope to create a private repository + * @description Retrieve a list of all categories and their ancestry. The returned list is not paginated. * - * @tags repos - * @name ReposCreateForAuthenticatedUser - * @summary Create a repository for the authenticated user - * @request POST:/user/repos + * @tags Categories + * @name CategoriesList + * @summary List categories + * @request GET:/categories + * @secure */ - reposCreateForAuthenticatedUser: ( - data: { - /** - * Whether to allow merge commits for pull requests. - * @default true - * @example true - */ - allow_merge_commit?: boolean; - /** - * Whether to allow rebase merges for pull requests. - * @default true - * @example true - */ - allow_rebase_merge?: boolean; - /** - * Whether to allow squash merges for pull requests. - * @default true - * @example true - */ - allow_squash_merge?: boolean; - /** - * Whether the repository is initialized with a minimal README. - * @default false - */ - auto_init?: boolean; - /** - * Whether to delete head branches when pull requests are merged - * @default false - * @example false - */ - delete_branch_on_merge?: boolean; - /** A short description of the repository. */ - description?: string; - /** - * The desired language or platform to apply to the .gitignore. - * @example "Haskell" - */ - gitignore_template?: string; - /** - * Whether downloads are enabled. - * @default true - * @example true - */ - has_downloads?: boolean; - /** - * Whether issues are enabled. - * @default true - * @example true - */ - has_issues?: boolean; - /** - * Whether projects are enabled. - * @default true - * @example true - */ - has_projects?: boolean; - /** - * Whether the wiki is enabled. - * @default true - * @example true - */ - has_wiki?: boolean; - /** A URL with more information about the repository. */ - homepage?: string; - /** - * Whether this repository acts as a template that can be used to generate new repositories. - * @default false - * @example true - */ - is_template?: boolean; - /** - * The license keyword of the open source license for this repository. - * @example "mit" - */ - license_template?: string; - /** - * The name of the repository. - * @example "Team Environment" - */ - name: string; + categoriesList: ( + query?: { /** - * Whether the repository is private or public. - * @default false + * The unique identifier of a parent category for which to + * return only its children. Providing an invalid category + * identifier results in a \`404\` response. + * @example "good-life" */ - private?: boolean; - /** The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization. */ - team_id?: number; + "filter[parent]"?: string; }, params: RequestParams = {}, ) => - this.request({ - path: `/user/repos`, - method: "POST", - body: data, - type: ContentType.Json, + this.request({ + path: \`/categories\`, + method: "GET", + query: query, + secure: true, format: "json", ...params, }), /** - * @description When authenticating as a user, this endpoint will list all currently open repository invitations for that user. + * @description Retrieve a specific category by providing its unique identifier. * - * @tags repos - * @name ReposListInvitationsForAuthenticatedUser - * @summary List repository invitations for the authenticated user - * @request GET:/user/repository_invitations + * @tags Categories + * @name CategoriesDetail + * @summary Retrieve category + * @request GET:/categories/{id} + * @secure */ - reposListInvitationsForAuthenticatedUser: ( + categoriesDetail: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/categories/\${id}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + }; + util = { + /** + * @description Make a basic ping request to the API. This is useful to verify that authentication is functioning correctly. On authentication success an HTTP \`200\` status is returned. On failure an HTTP \`401\` error response is returned. + * + * @tags Utility endpoints + * @name PingList + * @summary Ping + * @request GET:/util/ping + * @secure + */ + pingList: (params: RequestParams = {}) => + this.request({ + path: \`/util/ping\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + }; + tags = { + /** + * @description Retrieve a list of all tags currently in use. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered lexicographically. The \`transactions\` relationship for each tag exposes a link to get the transactions with the given tag. + * + * @tags Tags + * @name TagsList + * @summary List tags + * @request GET:/tags + * @secure + */ + tagsList: ( query?: { /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 + * The number of records to return in each page. + * @example 50 */ - per_page?: number; + "page[size]"?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/user/repository_invitations`, + this.request({ + path: \`/tags\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), - + }; + transactions = { /** - * No description + * @description Associates one or more tags with a specific transaction. No more than 6 tags may be present on any single transaction. Duplicate tags are silently ignored. An HTTP \`204\` is returned on success. The associated tags, along with this request URL, are also exposed via the \`tags\` relationship on the transaction resource returned from \`/transactions/{id}\`. * - * @tags repos - * @name ReposAcceptInvitation - * @summary Accept a repository invitation - * @request PATCH:/user/repository_invitations/{invitation_id} + * @tags Tags + * @name RelationshipsTagsCreate + * @summary Add tags to transaction + * @request POST:/transactions/{transactionId}/relationships/tags + * @secure */ - reposAcceptInvitation: (invitationId: number, params: RequestParams = {}) => - this.request({ - path: `/user/repository_invitations/${invitationId}`, - method: "PATCH", + relationshipsTagsCreate: (transactionId: string, data: UpdateTransactionTagsRequest, params: RequestParams = {}) => + this.request({ + path: \`/transactions/\${transactionId}/relationships/tags\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, ...params, }), /** - * No description + * @description Disassociates one or more tags from a specific transaction. Tags that are not associated are silently ignored. An HTTP \`204\` is returned on success. The associated tags, along with this request URL, are also exposed via the \`tags\` relationship on the transaction resource returned from \`/transactions/{id}\`. * - * @tags repos - * @name ReposDeclineInvitation - * @summary Decline a repository invitation - * @request DELETE:/user/repository_invitations/{invitation_id} + * @tags Tags + * @name RelationshipsTagsDelete + * @summary Remove tags from transaction + * @request DELETE:/transactions/{transactionId}/relationships/tags + * @secure */ - reposDeclineInvitation: (invitationId: number, params: RequestParams = {}) => - this.request({ - path: `/user/repository_invitations/${invitationId}`, + relationshipsTagsDelete: (transactionId: string, data: UpdateTransactionTagsRequest, params: RequestParams = {}) => + this.request({ + path: \`/transactions/\${transactionId}/relationships/tags\`, method: "DELETE", + body: data, + secure: true, + type: ContentType.Json, ...params, }), /** - * @description Lists repositories the authenticated user has starred. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the `Accept` header: + * @description Retrieve a list of all transactions across all accounts for the currently authenticated user. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. To narrow the results to a specific date range pass one or both of \`filter[since]\` and \`filter[until]\` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last. * - * @tags activity - * @name ActivityListReposStarredByAuthenticatedUser - * @summary List repositories starred by the authenticated user - * @request GET:/user/starred + * @tags Transactions + * @name TransactionsList + * @summary List transactions + * @request GET:/transactions + * @secure */ - activityListReposStarredByAuthenticatedUser: ( + transactionsList: ( query?: { /** - * One of `asc` (ascending) or `desc` (descending). - * @default "desc" + * The category identifier for which to filter transactions. + * Both parent and child categories can be filtered through + * this parameter. Providing an invalid category identifier + * results in a \`404\` response. + * @example "good-life" */ - direction?: "asc" | "desc"; + "filter[category]"?: string; /** - * Page number of the results to fetch. - * @default 1 + * The start date-time from which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-01-01T01:02:03+10:00" */ - page?: number; + "filter[since]"?: string; /** - * Results per page (max 100) - * @default 30 + * The transaction status for which to return records. This + * can be used to filter \`HELD\` transactions from those + * that are \`SETTLED\`. + * @example "HELD" */ - per_page?: number; + "filter[status]"?: TransactionStatusEnum; /** - * One of `created` (when the repository was starred) or `updated` (when it was last pushed to). - * @default "created" + * A transaction tag to filter for which to return records. + * If the tag does not exist, zero records are returned and + * a success response is given. + * @example "Holiday" */ - sort?: "created" | "updated"; + "filter[tag]"?: string; + /** + * The end date-time up to which to return records, + * formatted according to rfc-3339. Not to be used for + * pagination purposes. + * @format date-time + * @example "2020-02-01T01:02:03+10:00" + */ + "filter[until]"?: string; + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; + /** Blablabla bla */ + someEnumName?: SomeEnumName; }, params: RequestParams = {}, ) => - this.request({ - path: `/user/starred`, + this.request({ + path: \`/transactions\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), /** - * No description + * @description Retrieve a specific transaction by providing its unique identifier. * - * @tags activity - * @name ActivityCheckRepoIsStarredByAuthenticatedUser - * @summary Check if a repository is starred by the authenticated user - * @request GET:/user/starred/{owner}/{repo} + * @tags Transactions + * @name TransactionsDetail + * @summary Retrieve transaction + * @request GET:/transactions/{id} + * @secure */ - activityCheckRepoIsStarredByAuthenticatedUser: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/starred/${owner}/${repo}`, + transactionsDetail: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/transactions/\${id}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + }; + webhooks = { + /** + * @description Retrieve a list of configured webhooks. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered oldest first to newest last. + * + * @tags Webhooks + * @name WebhooksList + * @summary List webhooks + * @request GET:/webhooks + * @secure + */ + webhooksList: ( + query?: { + /** + * The number of records to return in each page. + * @example 30 + */ + "page[size]"?: number; + }, + params: RequestParams = {}, + ) => + this.request({ + path: \`/webhooks\`, method: "GET", + query: query, + secure: true, + format: "json", ...params, }), /** - * @description Note that you'll need to set `Content-Length` to zero when calling out to this endpoint. For more information, see "[HTTP verbs](https://docs.github.com/rest/overview/resources-in-the-rest-api#http-verbs)." + * @description Create a new webhook with a given URL. The URL will receive webhook events as JSON-encoded \`POST\` requests. The URL must respond with a HTTP \`200\` status on success. There is currently a limit of 10 webhooks at any given time. Once this limit is reached, existing webhooks will need to be deleted before new webhooks can be created. Event delivery is retried with exponential backoff if the URL is unreachable or it does not respond with a \`200\` status. The response includes a \`secretKey\` attribute, which is used to sign requests sent to the webhook URL. It will not be returned from any other endpoints within the Up API. If the \`secretKey\` is lost, simply create a new webhook with the same URL, capture its \`secretKey\` and then delete the original webhook. See [Handling webhook events](#callback_post_webhookURL) for details on how to process webhook events. It is probably a good idea to test the webhook by [sending it a \`PING\` event](#post_webhooks_webhookId_ping) after creating it. * - * @tags activity - * @name ActivityStarRepoForAuthenticatedUser - * @summary Star a repository for the authenticated user - * @request PUT:/user/starred/{owner}/{repo} + * @tags Webhooks + * @name WebhooksCreate + * @summary Create webhook + * @request POST:/webhooks + * @secure */ - activityStarRepoForAuthenticatedUser: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/starred/${owner}/${repo}`, - method: "PUT", + webhooksCreate: (data: CreateWebhookRequest, params: RequestParams = {}) => + this.request({ + path: \`/webhooks\`, + method: "POST", + body: data, + secure: true, + type: ContentType.Json, + format: "json", ...params, }), /** - * No description + * @description Retrieve a specific webhook by providing its unique identifier. * - * @tags activity - * @name ActivityUnstarRepoForAuthenticatedUser - * @summary Unstar a repository for the authenticated user - * @request DELETE:/user/starred/{owner}/{repo} + * @tags Webhooks + * @name WebhooksDetail + * @summary Retrieve webhook + * @request GET:/webhooks/{id} + * @secure */ - activityUnstarRepoForAuthenticatedUser: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/starred/${owner}/${repo}`, + webhooksDetail: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/webhooks/\${id}\`, + method: "GET", + secure: true, + format: "json", + ...params, + }), + + /** + * @description Delete a specific webhook by providing its unique identifier. Once deleted, webhook events will no longer be sent to the configured URL. + * + * @tags Webhooks + * @name WebhooksDelete + * @summary Delete webhook + * @request DELETE:/webhooks/{id} + * @secure + */ + webhooksDelete: (id: string, params: RequestParams = {}) => + this.request({ + path: \`/webhooks/\${id}\`, method: "DELETE", + secure: true, ...params, }), /** - * @description Lists repositories the authenticated user is watching. + * @description Send a \`PING\` event to a webhook by providing its unique identifier. This is useful for testing and debugging purposes. The event is delivered asynchronously and its data is returned in the response to this request. * - * @tags activity - * @name ActivityListWatchedReposForAuthenticatedUser - * @summary List repositories watched by the authenticated user - * @request GET:/user/subscriptions + * @tags Webhooks + * @name PingCreate + * @summary Ping webhook + * @request POST:/webhooks/{webhookId}/ping + * @secure */ - activityListWatchedReposForAuthenticatedUser: ( - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/subscriptions`, - method: "GET", - query: query, + pingCreate: (webhookId: string, params: RequestParams = {}) => + this.request({ + path: \`/webhooks/\${webhookId}/ping\`, + method: "POST", + secure: true, format: "json", ...params, }), /** - * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires `user`, `repo`, or `read:org` [scope](https://docs.github.com/apps/building-oauth-apps/understanding-scopes-for-oauth-apps/) when authenticating via [OAuth](https://docs.github.com/apps/building-oauth-apps/). + * @description Retrieve a list of delivery logs for a webhook by providing its unique identifier. This is useful for analysis and debugging purposes. The returned list is [paginated](#pagination) and can be scrolled by following the \`next\` and \`prev\` links where present. Results are ordered newest first to oldest last. Logs may be automatically purged after a period of time. * - * @tags teams - * @name TeamsListForAuthenticatedUser - * @summary List teams for the authenticated user - * @request GET:/user/teams + * @tags Webhooks + * @name LogsDetail + * @summary List webhook logs + * @request GET:/webhooks/{webhookId}/logs + * @secure */ - teamsListForAuthenticatedUser: ( + logsDetail: ( + webhookId: string, query?: { /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 + * The number of records to return in each page. + * @example 30 */ - per_page?: number; + "page[size]"?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/user/teams`, + this.request({ + path: \`/webhooks/\${webhookId}/logs\`, method: "GET", query: query, + secure: true, format: "json", ...params, }), }; - users = { +} +" +`; + +exports[`simple > 'uspto' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export interface DataSetList { + apis?: { /** - * @description Lists all users, in the order that they signed up on GitHub. This list includes personal user accounts and organization accounts. Note: Pagination is powered exclusively by the `since` parameter. Use the [Link header](https://docs.github.com/rest/overview/resources-in-the-rest-api#link-header) to get the URL for the next page of users. - * - * @tags users - * @name UsersList - * @summary List users - * @request GET:/users + * A URL to the API console for each API + * @format uriref */ - usersList: ( - query?: { - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** A user ID. Only return users with an ID greater than this ID. */ - since?: number; + apiDocumentationUrl?: string; + /** To be used as a dataset parameter value */ + apiKey?: string; + /** + * The URL describing the dataset's fields + * @format uriref + */ + apiUrl?: string; + /** To be used as a version parameter value */ + apiVersionNumber?: string; + }[]; + total?: number; +} + +export enum SomeEnum { + Foo = "Foo", + Bar = "Bar", + FooBar = "Foo Bar", +} + +export enum Status { + Resolved = "resolved", + New = "new", + InProgress = "in progress", +} + +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 = "{scheme}://developer.uspto.gov/ds-api"; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description Provides publicly available information about someone with a GitHub account. GitHub Apps with the `Plan` user permission can use this endpoint to retrieve information about a user's GitHub plan. The GitHub App must be authenticated as a user. See "[Identifying and authorizing users for GitHub Apps](https://docs.github.com/apps/building-github-apps/identifying-and-authorizing-users-for-github-apps/)" for details about authentication. For an example response, see 'Response with GitHub plan information' below" The `email` key in the following response is the publicly visible email address from your GitHub [profile page](https://github.com/settings/profile). When setting up your profile, you can select a primary email address to be “public” which provides an email entry for this endpoint. If you do not set a public email address for `email`, then it will have a value of `null`. You only see publicly visible email addresses when authenticated with GitHub. For more information, see [Authentication](https://docs.github.com/rest/overview/resources-in-the-rest-api#authentication). The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see "[Emails API](https://docs.github.com/rest/reference/users#emails)". - * - * @tags users - * @name UsersGetByUsername - * @summary Get a user - * @request GET:/users/{username} - */ - usersGetByUsername: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}`, - method: "GET", - format: "json", - ...params, - }), + 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 USPTO Data Set API + * @version 1.0.0 + * @baseUrl {scheme}://developer.uspto.gov/ds-api + * @contact Open Data Portal (https://developer.uspto.gov) + * + * The Data Set API (DSAPI) allows the public users to discover and search USPTO exported data sets. This is a generic API that allows USPTO users to make any CSV based data files searchable through API. With the help of GET call, it returns the list of data fields that are searchable. With the help of POST call, data can be fetched based on the filters on the field names. Please note that POST call is used to search the actual data. The reason for the POST call is that it allows users to specify any complex search criteria without worry about the GET size limitations as well as encoding of the input parameters. + */ +export class Api extends HttpClient { + /** + * No description + * + * @tags metadata + * @name ListDataSets + * @summary List available data sets + * @request GET:/ + */ + listDataSets = (params: RequestParams = {}) => + this.request({ + path: \`/\`, + method: "GET", + format: "json", + ...params, + }); + dataset = { /** - * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. + * @description This GET API returns the list of all the searchable field names that are in the oa_citations. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the syntax options shown below. * - * @tags activity - * @name ActivityListEventsForAuthenticatedUser - * @summary List events for the authenticated user - * @request GET:/users/{username}/events + * @tags metadata + * @name ListSearchableFields + * @summary Provides the general information about the API and the list of fields that can be used to query the dataset. + * @request GET:/{dataset}/{version}/fields */ - activityListEventsForAuthenticatedUser: ( - username: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/events`, + listSearchableFields: (dataset: string, version: string, params: RequestParams = {}) => + this.request({ + path: \`/\${dataset}/\${version}/fields\`, method: "GET", - query: query, format: "json", ...params, }), /** - * @description This is the user's organization dashboard. You must be authenticated as the user to view this. + * @description This API is based on Solr/Lucense Search. The data is indexed using SOLR. This GET API returns the list of all the searchable field names that are in the Solr Index. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the Solr/Lucene Syntax. Please refer https://lucene.apache.org/core/3_6_2/queryparsersyntax.html#Overview for the query syntax. List of field names that are searchable can be determined using above GET api. * - * @tags activity - * @name ActivityListOrgEventsForAuthenticatedUser - * @summary List organization events for the authenticated user - * @request GET:/users/{username}/events/orgs/{org} + * @tags search + * @name PerformSearch + * @summary Provides search capability for the data set with the given search criteria. + * @request POST:/{dataset}/{version}/records */ - activityListOrgEventsForAuthenticatedUser: ( - username: string, - org: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; + performSearch: ( + version: string, + dataset: string, + data: { /** - * Results per page (max 100) - * @default 30 + * Uses Lucene Query Syntax in the format of propertyName:value, propertyName:[num1 TO num2] and date range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the response please see the 'docs' element which has the list of record objects. Each record structure would consist of all the fields and their corresponding values. + * @default "*:*" */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/events/orgs/${org}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags activity - * @name ActivityListPublicEventsForUser - * @summary List public events for a user - * @request GET:/users/{username}/events/public - */ - activityListPublicEventsForUser: ( - username: string, - query?: { + criteria: string; /** - * Page number of the results to fetch. - * @default 1 + * Specify number of rows to be returned. If you run the search with default values, in the response you will see 'numFound' attribute which will tell the number of records available in the dataset. + * @default 100 */ - page?: number; + rows?: number; /** - * Results per page (max 100) - * @default 30 + * Starting record number. Default value is 0. + * @default 0 */ - per_page?: number; + start?: number; }, params: RequestParams = {}, ) => - this.request({ - path: `/users/${username}/events/public`, - method: "GET", - query: query, + this.request[], void>({ + path: \`/\${dataset}/\${version}/records\`, + method: "POST", + body: data, + type: ContentType.UrlEncoded, format: "json", ...params, }), + }; +} +" +`; - /** - * @description Lists the people following the specified user. - * - * @tags users - * @name UsersListFollowersForUser - * @summary List followers of a user - * @request GET:/users/{username}/followers - */ - usersListFollowersForUser: ( - username: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; +exports[`simple > 'wrong-enum-subtypes' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +export type Test = { + x?: "A-B"[]; +} & { + y?: string; +}; + +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) || {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/followers`, - method: "GET", - query: query, - format: "json", - ...params, - }), + }; + } - /** - * @description Lists the people who the specified user follows. - * - * @tags users - * @name UsersListFollowingForUser - * @summary List the people a user follows - * @request GET:/users/{username}/following - */ - usersListFollowingForUser: ( - username: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + 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 } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/following`, - method: "GET", - query: query, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() 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 Test + * @version test + */ +export class Api extends HttpClient {} +" +`; + +exports[`simple > 'wrong-schema-names' 1`] = ` +"/* eslint-disable */ +/* tslint:disable */ +/* + * --------------------------------------------------------------- + * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## + * ## ## + * ## AUTHOR: acacode ## + * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## + * --------------------------------------------------------------- + */ + +/** + * Not found response + * @example "Not found" + */ +export type DF = string; + +/** + * Not found response + * @example "Not found" + */ +export type Type404 = string; + +/** + * Not found response + * @example "Not found" + */ +export type Type405 = string; + +/** + * Not found response + * @example "Not found" + */ +export type TypeFF = string; + +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]); + } - /** - * No description - * - * @tags users - * @name UsersCheckFollowingForUser - * @summary Check if a user follows another user - * @request GET:/users/{username}/following/{target_user} - */ - usersCheckFollowingForUser: (username: string, targetUser: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/following/${targetUser}`, - method: "GET", - ...params, - }), + protected addArrayQueryParam(query: QueryParamsType, key: string) { + const value = query[key]; + return value.map((v: any) => this.encodeQueryParam(key, v)).join("&"); + } - /** - * @description Lists public gists for the specified user: - * - * @tags gists - * @name GistsListForUser - * @summary List gists for a user - * @request GET:/users/{username}/gists - */ - gistsListForUser: ( - username: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), + 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("&"); + } - /** - * @description Lists the GPG keys for a user. This information is accessible by anyone. - * - * @tags users - * @name UsersListGpgKeysForUser - * @summary List GPG keys for a user - * @request GET:/users/{username}/gpg_keys - */ - usersListGpgKeysForUser: ( - username: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/gpg_keys`, - method: "GET", - query: query, - format: "json", - ...params, - }), + protected addQueryParams(rawQuery?: QueryParamsType): string { + const queryString = this.toQueryString(rawQuery); + return queryString ? \`?\${queryString}\` : ""; + } - /** - * @description Provides hovercard information when authenticated through basic auth or OAuth with the `repo` scope. You can find out more about someone in relation to their pull requests, issues, repositories, and organizations. The `subject_type` and `subject_id` parameters provide context for the person's hovercard, which returns more information than without the parameters. For example, if you wanted to find out more about `octocat` who owns the `Spoon-Knife` repository via cURL, it would look like this: ```shell curl -u username:token https://api.github.com/users/octocat/hovercard?subject_type=repository&subject_id=1300192 ``` - * - * @tags users - * @name UsersGetContextForUser - * @summary Get contextual information for a user - * @request GET:/users/{username}/hovercard - */ - usersGetContextForUser: ( - username: string, - query?: { - /** Uses the ID for the `subject_type` you specified. **Required** when using `subject_type`. */ - subject_id?: string; - /** Identifies which additional information you'd like to receive about the person's hovercard. Can be `organization`, `repository`, `issue`, `pull_request`. **Required** when using `subject_id`. */ - subject_type?: "organization" | "repository" | "issue" | "pull_request"; + 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) || {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/hovercard`, - method: "GET", - query: query, - format: "json", - ...params, - }), + }; + } - /** - * @description Enables an authenticated GitHub App to find the user’s installation information. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. - * - * @tags apps - * @name AppsGetUserInstallation - * @summary Get a user installation for the authenticated app - * @request GET:/users/{username}/installation - */ - appsGetUserInstallation: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/installation`, - method: "GET", - format: "json", - ...params, - }), + 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; + } - /** - * @description Lists the _verified_ public SSH keys for a user. This is accessible by anyone. - * - * @tags users - * @name UsersListPublicKeysForUser - * @summary List public keys for a user - * @request GET:/users/{username}/keys - */ - usersListPublicKeysForUser: ( - username: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/keys`, - method: "GET", - query: query, - format: "json", - ...params, - }), + const abortController = new AbortController(); + this.abortControllers.set(cancelToken, abortController); + return abortController.signal; + }; - /** - * @description List [public organization memberships](https://help.github.com/articles/publicizing-or-concealing-organization-membership) for the specified user. This method only lists _public_ memberships, regardless of authentication. If you need to fetch all of the organization memberships (public and private) for the authenticated user, use the [List organizations for the authenticated user](https://docs.github.com/rest/reference/orgs#list-organizations-for-the-authenticated-user) API instead. - * - * @tags orgs - * @name OrgsListForUser - * @summary List organizations for a user - * @request GET:/users/{username}/orgs - */ - orgsListForUser: ( - username: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/orgs`, - method: "GET", - query: query, - format: "json", - ...params, - }), + public abortRequest = (cancelToken: CancelToken) => { + const abortController = this.abortControllers.get(cancelToken); - /** - * No description - * - * @tags projects - * @name ProjectsListForUser - * @summary List user projects - * @request GET:/users/{username}/projects - */ - projectsListForUser: ( - username: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** - * Indicates the state of the projects to return. Can be either `open`, `closed`, or `all`. - * @default "open" - */ - state?: "open" | "closed" | "all"; - }, - params: RequestParams = {}, - ) => - this.request< - Project[], - | { - documentation_url: string; - message: string; - } - | ValidationError - >({ - path: `/users/${username}/projects`, - method: "GET", - query: query, - format: "json", - ...params, - }), + if (abortController) { + abortController.abort(); + this.abortControllers.delete(cancelToken); + } + }; - /** - * @description These are events that you've received by watching repos and following users. If you are authenticated as the given user, you will see private events. Otherwise, you'll only see public events. - * - * @tags activity - * @name ActivityListReceivedEventsForUser - * @summary List events received by the authenticated user - * @request GET:/users/{username}/received_events - */ - activityListReceivedEventsForUser: ( - username: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/received_events`, - method: "GET", - query: query, - format: "json", - ...params, - }), + 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; - /** - * No description - * - * @tags activity - * @name ActivityListReceivedPublicEventsForUser - * @summary List public events received by a user - * @request GET:/users/{username}/received_events/public - */ - activityListReceivedPublicEventsForUser: ( - username: string, - query?: { - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { + ...requestParams, + headers: { + ...(requestParams.headers || {}), + ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/received_events/public`, - method: "GET", - query: query, - format: "json", - ...params, - }), + signal: (cancelToken ? this.createAbortSignal(cancelToken) : requestParams.signal) || null, + body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), + }).then(async (response) => { + const r = response.clone() as HttpResponse; + r.data = null as unknown as T; + r.error = null as unknown as E; - /** - * @description Lists public repositories for the specified user. - * - * @tags repos - * @name ReposListForUser - * @summary List repositories for a user - * @request GET:/users/{username}/repos - */ - reposListForUser: ( - username: string, - query?: { - /** Can be one of `asc` or `desc`. Default: `asc` when using `full_name`, otherwise `desc` */ - direction?: "asc" | "desc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** - * Can be one of `created`, `updated`, `pushed`, `full_name`. - * @default "full_name" - */ - sort?: "created" | "updated" | "pushed" | "full_name"; - /** - * Can be one of `all`, `owner`, `member`. - * @default "owner" - */ - type?: "all" | "owner" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), + 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 Link Example + * @version 1.0.0 + */ +export class Api extends HttpClient { + v20 = { /** - * @description Gets the summary of the free and paid GitHub Actions minutes used. Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "[Managing billing for GitHub Actions](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-actions)". Access tokens must have the `user` scope. + * No description * - * @tags billing - * @name BillingGetGithubActionsBillingUser - * @summary Get GitHub Actions billing for a user - * @request GET:/users/{username}/settings/billing/actions + * @name GetUserByName + * @request GET:/2.0/users/{username} */ - billingGetGithubActionsBillingUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/settings/billing/actions`, + getUserByName: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/users/\${username}\`, method: "GET", format: "json", ...params, }), /** - * @description Gets the free and paid storage used for GitHub Packages in gigabytes. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the `user` scope. + * No description * - * @tags billing - * @name BillingGetGithubPackagesBillingUser - * @summary Get GitHub Packages billing for a user - * @request GET:/users/{username}/settings/billing/packages + * @name GetRepositoriesByOwner + * @request GET:/2.0/repositories/{username} */ - billingGetGithubPackagesBillingUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/settings/billing/packages`, + getRepositoriesByOwner: (username: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}\`, method: "GET", format: "json", ...params, }), /** - * @description Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages. Paid minutes only apply to packages stored for private repositories. For more information, see "[Managing billing for GitHub Packages](https://help.github.com/github/setting-up-and-managing-billing-and-payments-on-github/managing-billing-for-github-packages)." Access tokens must have the `user` scope. + * No description * - * @tags billing - * @name BillingGetSharedStorageBillingUser - * @summary Get shared storage billing for a user - * @request GET:/users/{username}/settings/billing/shared-storage + * @name GetRepository + * @request GET:/2.0/repositories/{username}/{slug} */ - billingGetSharedStorageBillingUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/settings/billing/shared-storage`, + getRepository: (username: string, slug: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}\`, method: "GET", format: "json", ...params, }), /** - * @description Lists repositories a user has starred. You can also find out _when_ stars were created by passing the following custom [media type](https://docs.github.com/rest/overview/media-types/) via the `Accept` header: + * No description * - * @tags activity - * @name ActivityListReposStarredByUser - * @summary List repositories starred by a user - * @request GET:/users/{username}/starred + * @name GetPullRequestsByRepository + * @request GET:/2.0/repositories/{username}/{slug}/pullrequests */ - activityListReposStarredByUser: ( + getPullRequestsByRepository: ( username: string, + slug: string, query?: { - /** - * One of `asc` (ascending) or `desc` (descending). - * @default "desc" - */ - direction?: "asc" | "desc"; - /** - * Page number of the results to fetch. - * @default 1 - */ - page?: number; - /** - * Results per page (max 100) - * @default 30 - */ - per_page?: number; - /** - * One of `created` (when the repository was starred) or `updated` (when it was last pushed to). - * @default "created" - */ - sort?: "created" | "updated"; + state?: "open" | "merged" | "declined"; }, params: RequestParams = {}, ) => - this.request({ - path: `/users/${username}/starred`, + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests\`, method: "GET", query: query, format: "json", @@ -28434,51 +46101,32 @@ export class Api extends HttpClient - this.request({ - path: `/users/${username}/subscriptions`, + getPullRequestsById: (username: string, slug: string, pid: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests/\${pid}\`, method: "GET", - query: query, format: "json", ...params, }), - }; - zen = { + /** - * @description Get a random sentence from the Zen of GitHub + * No description * - * @tags meta - * @name MetaGetZen - * @summary Get the Zen of GitHub - * @request GET:/zen + * @name MergePullRequest + * @request POST:/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge */ - metaGetZen: (params: RequestParams = {}) => - this.request({ - path: `/zen`, - method: "GET", + mergePullRequest: (username: string, slug: string, pid: string, params: RequestParams = {}) => + this.request({ + path: \`/2.0/repositories/\${username}/\${slug}/pullrequests/\${pid}/merge\`, + method: "POST", ...params, }), }; } +" +`; diff --git a/tests/allSchemas.js b/tests/allSchemas.js deleted file mode 100644 index b94af4a7..00000000 --- a/tests/allSchemas.js +++ /dev/null @@ -1,46 +0,0 @@ -const { resolve } = require("node:path"); -const dotenv = require("dotenv"); -const createSchemaInfos = require("./helpers/createSchemaInfos"); - -dotenv.config(); - -let allSchemas = [ - ...createSchemaInfos({ - absolutePathToSchemas: resolve(__dirname, "./schemas/v2.0"), - absoluteOutputPath: resolve(__dirname, "./generated/v2.0"), - }), - ...createSchemaInfos({ - absolutePathToSchemas: resolve(__dirname, "./schemas/v3.0"), - absoluteOutputPath: resolve(__dirname, "./generated/v3.0"), - }), -]; - -if (process.env.TEST_FILE_NAME) { - allSchemas = allSchemas.filter( - (schema) => schema.apiFileName === process.env.TEST_FILE_NAME, - ); - console.warn( - "TEST ONLY", - process.env.TEST_FILE_NAME, - "found:", - allSchemas.map((it) => it.apiFileName).join(", ") || "", - ); -} - -if (process.env.TEST_SCHEMA_VERSION) { - allSchemas = allSchemas.filter((schema) => - schema.outputPath.endsWith(process.env.TEST_SCHEMA_VERSION), - ); - console.warn( - "TEST ONLY", - process.env.TEST_SCHEMA_VERSION, - "found:", - allSchemas.map((it) => it.apiFileName).join(", ") || "", - ); -} - -if (!allSchemas.length) { - console.warn("TEST SCHEMES NOT FOUND"); -} - -module.exports = allSchemas; diff --git a/tests/extended.test.ts b/tests/extended.test.ts new file mode 100644 index 00000000..f9d36b8d --- /dev/null +++ b/tests/extended.test.ts @@ -0,0 +1,48 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../src/index.js"; +import { collectAllSchemas } from "./utils.js"; + +describe("extended", async () => { + let tmpdir: string; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + const schemas = await collectAllSchemas(); + + test.each(schemas)("$name", async (schema) => { + // @ts-expect-error + await generateApi({ + name: schema.name, + input: schema.filePath, + output: tmpdir, + silent: true, + extractEnums: true, + extractRequestBody: true, + extractRequestParams: true, + extractResponseBody: true, + extractResponseError: true, + extractResponses: true, + generateClient: true, + generateRouteTypes: true, + sortRoutes: true, + sortTypes: true, + }); + + const content = await fs.readFile(path.join(tmpdir, `${schema.name}.ts`), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/schemas/v2.0/adafruit.yaml b/tests/fixtures/schemas/v2.0/adafruit.yaml similarity index 100% rename from tests/schemas/v2.0/adafruit.yaml rename to tests/fixtures/schemas/v2.0/adafruit.yaml diff --git a/tests/schemas/v2.0/another-example.json b/tests/fixtures/schemas/v2.0/another-example.json similarity index 100% rename from tests/schemas/v2.0/another-example.json rename to tests/fixtures/schemas/v2.0/another-example.json diff --git a/tests/schemas/v2.0/another-schema.json b/tests/fixtures/schemas/v2.0/another-schema.json similarity index 100% rename from tests/schemas/v2.0/another-schema.json rename to tests/fixtures/schemas/v2.0/another-schema.json diff --git a/tests/schemas/v2.0/api-with-examples.yaml b/tests/fixtures/schemas/v2.0/api-with-examples.yaml similarity index 100% rename from tests/schemas/v2.0/api-with-examples.yaml rename to tests/fixtures/schemas/v2.0/api-with-examples.yaml diff --git a/tests/schemas/v2.0/authentiq.json b/tests/fixtures/schemas/v2.0/authentiq.json similarity index 100% rename from tests/schemas/v2.0/authentiq.json rename to tests/fixtures/schemas/v2.0/authentiq.json diff --git a/tests/schemas/v2.0/enums.json b/tests/fixtures/schemas/v2.0/enums.json similarity index 100% rename from tests/schemas/v2.0/enums.json rename to tests/fixtures/schemas/v2.0/enums.json diff --git a/tests/schemas/v2.0/example1.json b/tests/fixtures/schemas/v2.0/example1.json similarity index 100% rename from tests/schemas/v2.0/example1.json rename to tests/fixtures/schemas/v2.0/example1.json diff --git a/tests/schemas/v2.0/file-formdata-example.json b/tests/fixtures/schemas/v2.0/file-formdata-example.json similarity index 100% rename from tests/schemas/v2.0/file-formdata-example.json rename to tests/fixtures/schemas/v2.0/file-formdata-example.json diff --git a/tests/schemas/v2.0/furkot-example.yaml b/tests/fixtures/schemas/v2.0/furkot-example.yaml similarity index 100% rename from tests/schemas/v2.0/furkot-example.yaml rename to tests/fixtures/schemas/v2.0/furkot-example.yaml diff --git a/tests/schemas/v2.0/giphy.yaml b/tests/fixtures/schemas/v2.0/giphy.yaml similarity index 100% rename from tests/schemas/v2.0/giphy.yaml rename to tests/fixtures/schemas/v2.0/giphy.yaml diff --git a/tests/schemas/v2.0/path-args.yaml b/tests/fixtures/schemas/v2.0/path-args.yaml similarity index 100% rename from tests/schemas/v2.0/path-args.yaml rename to tests/fixtures/schemas/v2.0/path-args.yaml diff --git a/tests/schemas/v2.0/petstore-expanded.json b/tests/fixtures/schemas/v2.0/petstore-expanded.json similarity index 100% rename from tests/schemas/v2.0/petstore-expanded.json rename to tests/fixtures/schemas/v2.0/petstore-expanded.json diff --git a/tests/schemas/v2.0/petstore-minimal.json b/tests/fixtures/schemas/v2.0/petstore-minimal.json similarity index 100% rename from tests/schemas/v2.0/petstore-minimal.json rename to tests/fixtures/schemas/v2.0/petstore-minimal.json diff --git a/tests/schemas/v2.0/petstore-simple.yaml b/tests/fixtures/schemas/v2.0/petstore-simple.yaml similarity index 100% rename from tests/schemas/v2.0/petstore-simple.yaml rename to tests/fixtures/schemas/v2.0/petstore-simple.yaml diff --git a/tests/schemas/v2.0/petstore-swagger-io.json b/tests/fixtures/schemas/v2.0/petstore-swagger-io.json similarity index 100% rename from tests/schemas/v2.0/petstore-swagger-io.json rename to tests/fixtures/schemas/v2.0/petstore-swagger-io.json diff --git a/tests/schemas/v2.0/petstore-with-external-docs.yaml b/tests/fixtures/schemas/v2.0/petstore-with-external-docs.yaml similarity index 100% rename from tests/schemas/v2.0/petstore-with-external-docs.yaml rename to tests/fixtures/schemas/v2.0/petstore-with-external-docs.yaml diff --git a/tests/schemas/v2.0/petstore.yaml b/tests/fixtures/schemas/v2.0/petstore.yaml similarity index 100% rename from tests/schemas/v2.0/petstore.yaml rename to tests/fixtures/schemas/v2.0/petstore.yaml diff --git a/tests/schemas/v2.0/query-path-param.yaml b/tests/fixtures/schemas/v2.0/query-path-param.yaml similarity index 100% rename from tests/schemas/v2.0/query-path-param.yaml rename to tests/fixtures/schemas/v2.0/query-path-param.yaml diff --git a/tests/schemas/v2.0/uber.yaml b/tests/fixtures/schemas/v2.0/uber.yaml similarity index 100% rename from tests/schemas/v2.0/uber.yaml rename to tests/fixtures/schemas/v2.0/uber.yaml diff --git a/tests/schemas/v3.0/additional-properties.yaml b/tests/fixtures/schemas/v3.0/additional-properties.yaml similarity index 100% rename from tests/schemas/v3.0/additional-properties.yaml rename to tests/fixtures/schemas/v3.0/additional-properties.yaml diff --git a/tests/schemas/v3.0/additional-properties2.json b/tests/fixtures/schemas/v3.0/additional-properties2.json similarity index 100% rename from tests/schemas/v3.0/additional-properties2.json rename to tests/fixtures/schemas/v3.0/additional-properties2.json diff --git a/tests/schemas/v3.0/allof-example.yaml b/tests/fixtures/schemas/v3.0/allof-example.yaml similarity index 100% rename from tests/schemas/v3.0/allof-example.yaml rename to tests/fixtures/schemas/v3.0/allof-example.yaml diff --git a/tests/schemas/v3.0/anyof-example.yaml b/tests/fixtures/schemas/v3.0/anyof-example.yaml similarity index 100% rename from tests/schemas/v3.0/anyof-example.yaml rename to tests/fixtures/schemas/v3.0/anyof-example.yaml diff --git a/tests/schemas/v3.0/api-with-examples.yaml b/tests/fixtures/schemas/v3.0/api-with-examples.yaml similarity index 100% rename from tests/schemas/v3.0/api-with-examples.yaml rename to tests/fixtures/schemas/v3.0/api-with-examples.yaml diff --git a/tests/schemas/v3.0/callback-example.yaml b/tests/fixtures/schemas/v3.0/callback-example.yaml similarity index 100% rename from tests/schemas/v3.0/callback-example.yaml rename to tests/fixtures/schemas/v3.0/callback-example.yaml diff --git a/tests/schemas/v3.0/components-responses.yaml b/tests/fixtures/schemas/v3.0/components-responses.yaml similarity index 100% rename from tests/schemas/v3.0/components-responses.yaml rename to tests/fixtures/schemas/v3.0/components-responses.yaml diff --git a/tests/schemas/v3.0/explode-param-3.0.1.yaml b/tests/fixtures/schemas/v3.0/explode-param-3.yaml similarity index 100% rename from tests/schemas/v3.0/explode-param-3.0.1.yaml rename to tests/fixtures/schemas/v3.0/explode-param-3.yaml diff --git a/tests/schemas/v3.0/full-swagger-scheme.json b/tests/fixtures/schemas/v3.0/full-swagger-scheme.json similarity index 100% rename from tests/schemas/v3.0/full-swagger-scheme.json rename to tests/fixtures/schemas/v3.0/full-swagger-scheme.json diff --git a/tests/schemas/v3.0/link-example.yaml b/tests/fixtures/schemas/v3.0/link-example.yaml similarity index 100% rename from tests/schemas/v3.0/link-example.yaml rename to tests/fixtures/schemas/v3.0/link-example.yaml diff --git a/tests/schemas/v3.0/no-definitions-schema.yaml b/tests/fixtures/schemas/v3.0/no-definitions-schema.yaml similarity index 100% rename from tests/schemas/v3.0/no-definitions-schema.yaml rename to tests/fixtures/schemas/v3.0/no-definitions-schema.yaml diff --git a/tests/schemas/v3.0/oneof-example.yaml b/tests/fixtures/schemas/v3.0/oneof-example.yaml similarity index 100% rename from tests/schemas/v3.0/oneof-example.yaml rename to tests/fixtures/schemas/v3.0/oneof-example.yaml diff --git a/tests/schemas/v3.0/personal-api-example.json b/tests/fixtures/schemas/v3.0/personal-api-example.json similarity index 100% rename from tests/schemas/v3.0/personal-api-example.json rename to tests/fixtures/schemas/v3.0/personal-api-example.json diff --git a/tests/schemas/v3.0/petstore-expanded.yaml b/tests/fixtures/schemas/v3.0/petstore-expanded.yaml similarity index 100% rename from tests/schemas/v3.0/petstore-expanded.yaml rename to tests/fixtures/schemas/v3.0/petstore-expanded.yaml diff --git a/tests/schemas/v3.0/petstore.yaml b/tests/fixtures/schemas/v3.0/petstore.yaml similarity index 100% rename from tests/schemas/v3.0/petstore.yaml rename to tests/fixtures/schemas/v3.0/petstore.yaml diff --git a/tests/schemas/v3.0/recursive-schema.json b/tests/fixtures/schemas/v3.0/recursive-schema.json similarity index 100% rename from tests/schemas/v3.0/recursive-schema.json rename to tests/fixtures/schemas/v3.0/recursive-schema.json diff --git a/tests/schemas/v3.0/responses.yaml b/tests/fixtures/schemas/v3.0/responses.yaml similarity index 100% rename from tests/schemas/v3.0/responses.yaml rename to tests/fixtures/schemas/v3.0/responses.yaml diff --git a/tests/schemas/v3.0/swaggerhub-template.yaml b/tests/fixtures/schemas/v3.0/swaggerhub-template.yaml similarity index 100% rename from tests/schemas/v3.0/swaggerhub-template.yaml rename to tests/fixtures/schemas/v3.0/swaggerhub-template.yaml diff --git a/tests/schemas/v3.0/tsoa-odd-types-3.0.2.json b/tests/fixtures/schemas/v3.0/tsoa-odd-types-3.json similarity index 100% rename from tests/schemas/v3.0/tsoa-odd-types-3.0.2.json rename to tests/fixtures/schemas/v3.0/tsoa-odd-types-3.json diff --git a/tests/schemas/v3.0/up-banking.json b/tests/fixtures/schemas/v3.0/up-banking.json similarity index 100% rename from tests/schemas/v3.0/up-banking.json rename to tests/fixtures/schemas/v3.0/up-banking.json diff --git a/tests/schemas/v3.0/uspto.yaml b/tests/fixtures/schemas/v3.0/uspto.yaml similarity index 100% rename from tests/schemas/v3.0/uspto.yaml rename to tests/fixtures/schemas/v3.0/uspto.yaml diff --git a/tests/schemas/v3.0/wrong-enum-subtypes.yaml b/tests/fixtures/schemas/v3.0/wrong-enum-subtypes.yaml similarity index 100% rename from tests/schemas/v3.0/wrong-enum-subtypes.yaml rename to tests/fixtures/schemas/v3.0/wrong-enum-subtypes.yaml diff --git a/tests/schemas/v3.0/wrong-schema-names.yaml b/tests/fixtures/schemas/v3.0/wrong-schema-names.yaml similarity index 100% rename from tests/schemas/v3.0/wrong-schema-names.yaml rename to tests/fixtures/schemas/v3.0/wrong-schema-names.yaml diff --git a/tests/generate-extended.js b/tests/generate-extended.js deleted file mode 100644 index 4bb4ef6e..00000000 --- a/tests/generate-extended.js +++ /dev/null @@ -1,87 +0,0 @@ -const _ = require("lodash"); -const { resolve } = require("node: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); - - const stackLines = _.split(this.stack, "\n"); - const realStack = stackLines.slice(1); - const stackLineExtraSpace = - (realStack[0] && realStack[0].split("at")[0]) || ""; - - this.stack = [ - stackLines[0], - `${stackLineExtraSpace}at ${resolve(outputPath, fileName)}`, - ...realStack, - ].join("\n"); - } -} - -allSchemas.forEach(async ({ absolutePath, apiFileName, outputPath }) => { - const name = apiFileName; - const input = absolutePath; - const output = outputPath; - - const typePrefix = "IMySuperPrefix"; - const typeSuffix = "MySuperSuffix"; - - await generateApiForTest({ - name: name, - input: input, - output: output, - generateClient: true, - generateRouteTypes: false, - silent: !process.env.TEST_WITH_DEBUG, - debug: process.env.TEST_WITH_DEBUG, - extractRequestBody: true, - extractResponseBody: true, - extractEnums: true, - extractRequestParams: true, - extractResponseError: true, - extractResponses: true, - typePrefix: typePrefix, - typeSuffix: typeSuffix, - sortTypes: true, - sortRoutes: true, - debugExtras: ["generate-extended", apiFileName], - }).then((result) => { - result.configuration.modelTypes.forEach((modelType) => { - if (modelType.name) { - if (modelType.name.startsWith(`${typePrefix}${typePrefix}`)) { - throw new GenerateExtendedError( - `[${outputPath}][${apiFileName}] modelType has prefix/suffix duplicates - ${modelType.name}`, - output, - name, - ); - } - if (!modelType.name.startsWith(typePrefix)) { - throw new GenerateExtendedError( - `[${outputPath}][${apiFileName}] modelType has not prefix/suffix - ${modelType.name}`, - output, - name, - ); - } - if (modelType.name.endsWith(`${typeSuffix}${typeSuffix}`)) { - throw new GenerateExtendedError( - `[${outputPath}][${apiFileName}] modelType has prefix/suffix duplicates - ${modelType.name}`, - output, - name, - ); - } - if (!modelType.name.endsWith(typeSuffix)) { - throw new GenerateExtendedError( - `[${outputPath}][${apiFileName}] modelType has not prefix/suffix - ${modelType.name}`, - output, - name, - ); - } - } - }); - }); -}); diff --git a/tests/generate.js b/tests/generate.js deleted file mode 100644 index 89309b11..00000000 --- a/tests/generate.js +++ /dev/null @@ -1,20 +0,0 @@ -const allSchemas = require("./allSchemas"); -const dotenv = require("dotenv"); -const { generateApiForTest } = require("./helpers/generateApiForTest"); - -dotenv.config(); - -allSchemas.forEach(({ absolutePath, apiFileName, outputPath }) => { - generateApiForTest({ - testName: "generate script", - name: apiFileName, - input: absolutePath, - output: outputPath, - generateClient: true, - generateRouteTypes: false, - 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 deleted file mode 100644 index 7be62365..00000000 --- a/tests/generated/v2.0/adafruit.ts +++ /dev/null @@ -1,2310 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Activity { - action?: string; - /** @format dateTime */ - created_at?: string; - data?: object; - id?: number; - model?: string; - /** @format dateTime */ - updated_at?: string; - user_id?: number; -} - -export interface Block { - block_feeds?: BlockFeed[]; - column?: number; - description?: string; - key?: string; - name?: string; - row?: number; - size_x?: number; - size_y?: number; - visual_type?: string; -} - -export interface BlockFeed { - feed?: Feed; - group?: Group; - id?: string; -} - -export interface Dashboard { - blocks?: Block[]; - description?: string; - key?: string; - name?: string; -} - -export interface Data { - completed_at?: string; - created_at?: string; - created_epoch?: number; - ele?: number; - expiration?: string; - feed_id?: number; - group_id?: number; - id?: string; - lat?: number; - lon?: number; - updated_at?: string; - value?: string; -} - -export interface DataResponse { - completed_at?: string; - created_at?: string; - created_epoch?: number; - ele?: number; - expiration?: string; - feed_id?: number; - group_id?: number; - id?: string; - lat?: number; - lon?: number; - updated_at?: string; - value?: string; -} - -export interface Error { - code?: string; - message?: string; -} - -export interface Feed { - created_at?: string; - description?: string; - /** Additional details about this feed. */ - details?: { - data?: { - /** Number of data points stored by this feed. */ - count?: number; - first?: Record; - last?: Record; - }; - /** Access control list for this feed */ - shared_with?: object[]; - }; - enabled?: boolean; - group?: Record; - groups?: ShallowGroup[]; - history?: boolean; - id?: number; - key?: string; - last_value?: string; - license?: string; - name?: string; - status?: string; - /** Is status notification active? */ - status_notify?: boolean; - /** Status notification timeout in minutes. */ - status_timeout?: number; - unit_symbol?: string; - unit_type?: string; - updated_at?: string; - /** @default "private" */ - visibility?: "private" | "public" | "in progress" | "out of access"; -} - -export interface Group { - created_at?: string; - description?: string; - feeds?: Feed[]; - id?: number; - name?: string; - updated_at?: string; -} - -export interface Permission { - created_at?: string; - id?: number; - /** @default "feed" */ - model?: "feed" | "group" | "dashboard"; - object_id?: number; - /** @default "public" */ - scope?: "secret" | "public" | "user" | "organization"; - scope_value?: string; - updated_at?: string; - user_id?: number; -} - -export interface ShallowGroup { - created_at?: string; - description?: string; - id?: number; - name?: string; - updated_at?: string; -} - -export interface Token { - token?: string; -} - -export interface Trigger { - name?: string; -} - -export interface User { - color?: string; - /** @format dateTime */ - created_at?: string; - id?: number; - name?: string; - time_zone?: string; - /** @format dateTime */ - updated_at?: string; - username?: string; -} - -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://io.adafruit.com/api/v2"; - 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.clone() 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 Adafruit IO - * @version 2.0.0 - * @baseUrl https://io.adafruit.com/api/v2 - * - * ### The Internet of Things for Everyone - * - * The Adafruit IO HTTP API provides access to your Adafruit IO data from any programming language or hardware environment that can speak HTTP. The easiest way to get started is with [an Adafruit IO learn guide](https://learn.adafruit.com/series/adafruit-io-basics) and [a simple Internet of Things capable device like the Feather Huzzah](https://www.adafruit.com/product/2821). - * - * This API documentation is hosted on GitHub Pages and is available at [https://github.com/adafruit/io-api](https://github.com/adafruit/io-api). For questions or comments visit the [Adafruit IO Forums](https://forums.adafruit.com/viewforum.php?f=56) or the [adafruit-io channel on the Adafruit Discord server](https://discord.gg/adafruit). - * - * #### Authentication - * - * Authentication for every API request happens through the `X-AIO-Key` header or query parameter and your IO API key. A simple cURL request to get all available feeds for a user with the username "io_username" and the key "io_key_12345" could look like this: - * - * $ curl -H "X-AIO-Key: io_key_12345" https://io.adafruit.com/api/v2/io_username/feeds - * - * Or like this: - * - * $ curl "https://io.adafruit.com/api/v2/io_username/feeds?X-AIO-Key=io_key_12345 - * - * Using the node.js [request](https://github.com/request/request) library, IO HTTP requests are as easy as: - * - * ```js - * var request = require('request'); - * - * var options = { - * url: 'https://io.adafruit.com/api/v2/io_username/feeds', - * headers: { - * 'X-AIO-Key': 'io_key_12345', - * 'Content-Type': 'application/json' - * } - * }; - * - * function callback(error, response, body) { - * if (!error && response.statusCode == 200) { - * var feeds = JSON.parse(body); - * console.log(feeds.length + " FEEDS AVAILABLE"); - * - * feeds.forEach(function (feed) { - * console.log(feed.name, feed.key); - * }) - * } - * } - * - * request(options, callback); - * ``` - * - * Using the ESP8266 Arduino HTTPClient library, an HTTPS GET request would look like this (replacing `---` with your own values in the appropriate locations): - * - * ```arduino - * /// based on - * /// https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266HTTPClient/examples/Authorization/Authorization.ino - * - * #include - * #include - * #include - * #include - * - * ESP8266WiFiMulti WiFiMulti; - * - * const char* ssid = "---"; - * const char* password = "---"; - * - * const char* host = "io.adafruit.com"; - * - * const char* io_key = "---"; - * const char* path_with_username = "/api/v2/---/dashboards"; - * - * // Use web browser to view and copy - * // SHA1 fingerprint of the certificate - * const char* fingerprint = "77 00 54 2D DA E7 D8 03 27 31 23 99 EB 27 DB CB A5 4C 57 18"; - * - * void setup() { - * Serial.begin(115200); - * - * for(uint8_t t = 4; t > 0; t--) { - * Serial.printf("[SETUP] WAIT %d...\n", t); - * Serial.flush(); - * delay(1000); - * } - * - * WiFi.mode(WIFI_STA); - * WiFiMulti.addAP(ssid, password); - * - * // wait for WiFi connection - * while(WiFiMulti.run() != WL_CONNECTED) { - * Serial.print('.'); - * delay(1000); - * } - * - * Serial.println("[WIFI] connected!"); - * - * HTTPClient http; - * - * // start request with URL and TLS cert fingerprint for verification - * http.begin("https://" + String(host) + String(path_with_username), fingerprint); - * - * // IO API authentication - * http.addHeader("X-AIO-Key", io_key); - * - * // start connection and send HTTP header - * int httpCode = http.GET(); - * - * // httpCode will be negative on error - * if(httpCode > 0) { - * // HTTP header has been send and Server response header has been handled - * Serial.printf("[HTTP] GET response: %d\n", httpCode); - * - * // HTTP 200 OK - * if(httpCode == HTTP_CODE_OK) { - * String payload = http.getString(); - * Serial.println(payload); - * } - * - * http.end(); - * } - * } - * - * void loop() {} - * ``` - * - * #### Client Libraries - * - * We have client libraries to help you get started with your project: [Python](https://github.com/adafruit/io-client-python), [Ruby](https://github.com/adafruit/io-client-ruby), [Arduino C++](https://github.com/adafruit/Adafruit_IO_Arduino), [Javascript](https://github.com/adafruit/adafruit-io-node), and [Go](https://github.com/adafruit/io-client-go) are available. They're all open source, so if they don't already do what you want, you can fork and add any feature you'd like. - * - */ -export class Api extends HttpClient { - user = { - /** - * No description - * - * @tags Users - * @name CurrentUser - * @summary Get information about the current user - * @request GET:/user - * @secure - */ - currentUser: (params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - }; - webhooks = { - /** - * No description - * - * @tags Webhooks, Data - * @name CreateWebhookFeedData - * @summary Send data to a feed via webhook URL. - * @request POST:/webhooks/feed/:token - * @secure - */ - createWebhookFeedData: ( - token: string, - payload: { - value?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/webhooks/feed/${token}`, - method: "POST", - body: payload, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description The raw data webhook receiver accepts POST requests and stores the raw request body on your feed. This is useful when you don't have control of the webhook sender. If feed history is turned on, payloads will be truncated at 1024 bytes. If feed history is turned off, payloads will be truncated at 100KB. - * - * @tags Webhooks, Data - * @name CreateRawWebhookFeedData - * @summary Send arbitrary data to a feed via webhook URL. - * @request POST:/webhooks/feed/:token/raw - * @secure - */ - createRawWebhookFeedData: (token: string, params: RequestParams = {}) => - this.request({ - path: `/webhooks/feed/${token}/raw`, - method: "POST", - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - username = { - /** - * @description Delete all your activities. - * - * @tags Activities - * @name DestroyActivities - * @summary All activities for current user - * @request DELETE:/{username}/activities - * @secure - */ - destroyActivities: (username: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/activities`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * @description The Activities endpoint returns information about the user's activities. - * - * @tags Activities - * @name AllActivities - * @summary All activities for current user - * @request GET:/{username}/activities - * @secure - */ - allActivities: ( - username: string, - query?: { - /** - * End time for filtering, returns records created before give time. - * @format date-time - */ - end_time?: string; - /** Limit the number of records returned. */ - limit?: number; - /** - * Start time for filtering, returns records created after given time. - * @format date-time - */ - start_time?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/activities`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description The Activities endpoint returns information about the user's activities. - * - * @tags Activities - * @name GetActivity - * @summary Get activities by type for current user - * @request GET:/{username}/activities/{type} - * @secure - */ - getActivity: ( - username: string, - type: string, - query?: { - /** - * End time for filtering, returns records created before give time. - * @format date-time - */ - end_time?: string; - /** Limit the number of records returned. */ - limit?: number; - /** - * Start time for filtering, returns records created after given time. - * @format date-time - */ - start_time?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/activities/${type}`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description The Dashboards endpoint returns information about the user's dashboards. - * - * @tags Dashboards - * @name AllDashboards - * @summary All dashboards for current user - * @request GET:/{username}/dashboards - * @secure - */ - allDashboards: (username: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/dashboards`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Dashboards - * @name CreateDashboard - * @summary Create a new Dashboard - * @request POST:/{username}/dashboards - * @secure - */ - createDashboard: (username: string, dashboard: Dashboard, params: RequestParams = {}) => - this.request({ - path: `/${username}/dashboards`, - method: "POST", - body: dashboard, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description The Blocks endpoint returns information about the user's blocks. - * - * @tags Blocks - * @name AllBlocks - * @summary All blocks for current user - * @request GET:/{username}/dashboards/{dashboard_id}/blocks - * @secure - */ - allBlocks: (username: string, dashboardId: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/dashboards/${dashboardId}/blocks`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Blocks - * @name CreateBlock - * @summary Create a new Block - * @request POST:/{username}/dashboards/{dashboard_id}/blocks - * @secure - */ - createBlock: (username: string, dashboardId: string, block: Block, params: RequestParams = {}) => - this.request({ - path: `/${username}/dashboards/${dashboardId}/blocks`, - method: "POST", - body: block, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Blocks - * @name DestroyBlock - * @summary Delete an existing Block - * @request DELETE:/{username}/dashboards/{dashboard_id}/blocks/{id} - * @secure - */ - destroyBlock: (username: string, dashboardId: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/dashboards/${dashboardId}/blocks/${id}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Blocks - * @name GetBlock - * @summary Returns Block based on ID - * @request GET:/{username}/dashboards/{dashboard_id}/blocks/{id} - * @secure - */ - getBlock: (username: string, dashboardId: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/dashboards/${dashboardId}/blocks/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Blocks - * @name UpdateBlock - * @summary Update properties of an existing Block - * @request PATCH:/{username}/dashboards/{dashboard_id}/blocks/{id} - * @secure - */ - updateBlock: ( - username: string, - dashboardId: string, - id: string, - block: { - block_feeds?: { - feed_id?: string; - group_id?: string; - }[]; - column?: number; - dashboard_id?: number; - description?: string; - key?: string; - name?: string; - properties?: object; - row?: number; - size_x?: number; - size_y?: number; - visual_type?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/dashboards/${dashboardId}/blocks/${id}`, - method: "PATCH", - body: block, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Blocks - * @name ReplaceBlock - * @summary Replace an existing Block - * @request PUT:/{username}/dashboards/{dashboard_id}/blocks/{id} - * @secure - */ - replaceBlock: ( - username: string, - dashboardId: string, - id: string, - block: { - block_feeds?: { - feed_id?: string; - group_id?: string; - }[]; - column?: number; - dashboard_id?: number; - description?: string; - key?: string; - name?: string; - properties?: object; - row?: number; - size_x?: number; - size_y?: number; - visual_type?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/dashboards/${dashboardId}/blocks/${id}`, - method: "PUT", - body: block, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Dashboards - * @name DestroyDashboard - * @summary Delete an existing Dashboard - * @request DELETE:/{username}/dashboards/{id} - * @secure - */ - destroyDashboard: (username: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/dashboards/${id}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Dashboards - * @name GetDashboard - * @summary Returns Dashboard based on ID - * @request GET:/{username}/dashboards/{id} - * @secure - */ - getDashboard: (username: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/dashboards/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Dashboards - * @name UpdateDashboard - * @summary Update properties of an existing Dashboard - * @request PATCH:/{username}/dashboards/{id} - * @secure - */ - updateDashboard: ( - username: string, - id: string, - dashboard: { - description?: string; - key?: string; - name?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/dashboards/${id}`, - method: "PATCH", - body: dashboard, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Dashboards - * @name ReplaceDashboard - * @summary Replace an existing Dashboard - * @request PUT:/{username}/dashboards/{id} - * @secure - */ - replaceDashboard: ( - username: string, - id: string, - dashboard: { - description?: string; - key?: string; - name?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/dashboards/${id}`, - method: "PUT", - body: dashboard, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description The Feeds endpoint returns information about the user's feeds. The response includes the latest value of each feed, and other metadata about each feed. - * - * @tags Feeds - * @name AllFeeds - * @summary All feeds for current user - * @request GET:/{username}/feeds - * @secure - */ - allFeeds: (username: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/feeds`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Feeds - * @name CreateFeed - * @summary Create a new Feed - * @request POST:/{username}/feeds - * @secure - */ - createFeed: ( - username: string, - feed: Feed, - query?: { - group_key?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds`, - method: "POST", - query: query, - body: feed, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Feeds - * @name DestroyFeed - * @summary Delete an existing Feed - * @request DELETE:/{username}/feeds/{feed_key} - * @secure - */ - destroyFeed: (username: string, feedKey: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/feeds/${feedKey}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * @description Returns feed based on the feed key - * - * @tags Feeds - * @name GetFeed - * @summary Get feed by feed key - * @request GET:/{username}/feeds/{feed_key} - * @secure - */ - getFeed: (username: string, feedKey: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/feeds/${feedKey}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Feeds - * @name UpdateFeed - * @summary Update properties of an existing Feed - * @request PATCH:/{username}/feeds/{feed_key} - * @secure - */ - updateFeed: ( - username: string, - feedKey: string, - feed: { - description?: string; - key?: string; - license?: string; - name?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}`, - method: "PATCH", - body: feed, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Feeds - * @name ReplaceFeed - * @summary Replace an existing Feed - * @request PUT:/{username}/feeds/{feed_key} - * @secure - */ - replaceFeed: ( - username: string, - feedKey: string, - feed: { - description?: string; - key?: string; - license?: string; - name?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}`, - method: "PUT", - body: feed, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Data - * @name AllData - * @summary Get all data for the given feed - * @request GET:/{username}/feeds/{feed_key}/data - * @secure - */ - allData: ( - username: string, - feedKey: string, - query?: { - /** - * End time for filtering, returns records created before give time. - * @format date-time - */ - end_time?: string; - /** List of Data record fields to include in response as comma separated list. Acceptable values are: `value`, `lat`, `lon`, `ele`, `id`, and `created_at`. */ - include?: string; - /** Limit the number of records returned. */ - limit?: number; - /** - * Start time for filtering, returns records created after given time. - * @format date-time - */ - start_time?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}/data`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Create new data records on the given feed. **NOTE:** when feed history is on, data `value` size is limited to 1KB, when feed history is turned off data value size is limited to 100KB. - * - * @tags Data - * @name CreateData - * @summary Create new Data - * @request POST:/{username}/feeds/{feed_key}/data - * @secure - */ - createData: ( - username: string, - feedKey: string, - datum: { - /** @format dateTime */ - created_at?: string; - ele?: string; - epoch?: number; - lat?: string; - lon?: string; - value?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}/data`, - method: "POST", - body: datum, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Data - * @name BatchCreateData - * @summary Create multiple new Data records - * @request POST:/{username}/feeds/{feed_key}/data/batch - * @secure - */ - batchCreateData: (username: string, feedKey: string, data: Data, params: RequestParams = {}) => - this.request({ - path: `/${username}/feeds/${feedKey}/data/batch`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description The Chart API is what we use on io.adafruit.com to populate charts over varying timespans with a consistent number of data points. The maximum number of points returned is 480. This API works by aggregating slices of time into a single value by averaging. All time-based parameters are optional, if none are given it will default to 1 hour at the finest-grained resolution possible. - * - * @tags Data - * @name ChartData - * @summary Chart data for current feed - * @request GET:/{username}/feeds/{feed_key}/data/chart - * @secure - */ - chartData: ( - username: string, - feedKey: string, - query?: { - /** - * End time for filtering, returns records created before give time. - * @format date-time - */ - end_time?: string; - /** - * The number of hours the chart should cover. - * @format int32 - */ - hours?: number; - /** - * A resolution size in minutes. By giving a resolution value you will get back grouped data points aggregated over resolution-sized intervals. NOTE: time span is preferred over resolution, so if you request a span of time that includes more than max limit points you may get a larger resolution than you requested. Valid resolutions are 1, 5, 10, 30, 60, and 120. - * @format int32 - */ - resolution?: number; - /** - * Start time for filtering, returns records created after given time. - * @format date-time - */ - start_time?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** The names of the columns returned as data. */ - columns?: string[]; - /** The actual chart data. */ - data?: string[][]; - feed?: { - id?: number; - key?: string; - name?: string; - }; - parameters?: object; - }, - void - >({ - path: `/${username}/feeds/${feedKey}/data/chart`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Get the oldest data point in the feed. This request sets the queue pointer to the beginning of the feed. - * - * @tags Data - * @name FirstData - * @summary First Data in Queue - * @request GET:/{username}/feeds/{feed_key}/data/first - * @secure - */ - firstData: ( - username: string, - feedKey: string, - query?: { - /** List of Data record fields to include in response as comma separated list. Acceptable values are: `value`, `lat`, `lon`, `ele`, `id`, and `created_at`. */ - include?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}/data/first`, - method: "GET", - query: query, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get the most recent data point in the feed. This request sets the queue pointer to the end of the feed. - * - * @tags Data - * @name LastData - * @summary Last Data in Queue - * @request GET:/{username}/feeds/{feed_key}/data/last - * @secure - */ - lastData: ( - username: string, - feedKey: string, - query?: { - /** List of Data record fields to include in response as comma separated list. Acceptable values are: `value`, `lat`, `lon`, `ele`, `id`, and `created_at`. */ - include?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}/data/last`, - method: "GET", - query: query, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get the next newest data point in the feed. If queue processing hasn't been started, the first data point in the feed will be returned. - * - * @tags Data - * @name NextData - * @summary Next Data in Queue - * @request GET:/{username}/feeds/{feed_key}/data/next - * @secure - */ - nextData: ( - username: string, - feedKey: string, - query?: { - /** List of Data record fields to include in response as comma separated list. Acceptable values are: `value`, `lat`, `lon`, `ele`, `id`, and `created_at`. */ - include?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}/data/next`, - method: "GET", - query: query, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get the previously processed data point in the feed. NOTE: this method doesn't move the processing queue pointer. - * - * @tags Data - * @name PreviousData - * @summary Previous Data in Queue - * @request GET:/{username}/feeds/{feed_key}/data/previous - * @secure - */ - previousData: ( - username: string, - feedKey: string, - query?: { - /** List of Data record fields to include in response as comma separated list. Acceptable values are: `value`, `lat`, `lon`, `ele`, `id`, and `created_at`. */ - include?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}/data/previous`, - method: "GET", - query: query, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get the most recent data point in the feed in an MQTT compatible CSV format: `value,lat,lon,ele` - * - * @tags Data - * @name RetainData - * @summary Last Data in MQTT CSV format - * @request GET:/{username}/feeds/{feed_key}/data/retain - * @secure - */ - retainData: (username: string, feedKey: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/feeds/${feedKey}/data/retain`, - method: "GET", - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags Data - * @name DestroyData - * @summary Delete existing Data - * @request DELETE:/{username}/feeds/{feed_key}/data/{id} - * @secure - */ - destroyData: (username: string, feedKey: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/feeds/${feedKey}/data/${id}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Data - * @name GetData - * @summary Returns data based on feed key - * @request GET:/{username}/feeds/{feed_key}/data/{id} - * @secure - */ - getData: ( - username: string, - feedKey: string, - id: string, - query?: { - /** List of Data record fields to include in response as comma separated list. Acceptable values are: `value`, `lat`, `lon`, `ele`, `id`, and `created_at`. */ - include?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}/data/${id}`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Data - * @name UpdateData - * @summary Update properties of existing Data - * @request PATCH:/{username}/feeds/{feed_key}/data/{id} - * @secure - */ - updateData: ( - username: string, - feedKey: string, - id: string, - datum: { - /** @format dateTime */ - created_at?: string; - ele?: string; - epoch?: number; - lat?: string; - lon?: string; - value?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}/data/${id}`, - method: "PATCH", - body: datum, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Data - * @name ReplaceData - * @summary Replace existing Data - * @request PUT:/{username}/feeds/{feed_key}/data/{id} - * @secure - */ - replaceData: ( - username: string, - feedKey: string, - id: string, - datum: { - /** @format dateTime */ - created_at?: string; - ele?: string; - epoch?: number; - lat?: string; - lon?: string; - value?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/feeds/${feedKey}/data/${id}`, - method: "PUT", - body: datum, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Returns more detailed feed record based on the feed key - * - * @tags Feeds - * @name GetFeedDetails - * @summary Get detailed feed by feed key - * @request GET:/{username}/feeds/{feed_key}/details - * @secure - */ - getFeedDetails: (username: string, feedKey: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/feeds/${feedKey}/details`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * @description The Groups endpoint returns information about the user's groups. The response includes the latest value of each feed in the group, and other metadata about the group. - * - * @tags Groups - * @name AllGroups - * @summary All groups for current user - * @request GET:/{username}/groups - * @secure - */ - allGroups: (username: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/groups`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Groups - * @name CreateGroup - * @summary Create a new Group - * @request POST:/{username}/groups - * @secure - */ - createGroup: (username: string, group: Group, params: RequestParams = {}) => - this.request({ - path: `/${username}/groups`, - method: "POST", - body: group, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Groups - * @name DestroyGroup - * @summary Delete an existing Group - * @request DELETE:/{username}/groups/{group_key} - * @secure - */ - destroyGroup: (username: string, groupKey: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/groups/${groupKey}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Groups - * @name GetGroup - * @summary Returns Group based on ID - * @request GET:/{username}/groups/{group_key} - * @secure - */ - getGroup: (username: string, groupKey: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/groups/${groupKey}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Groups - * @name UpdateGroup - * @summary Update properties of an existing Group - * @request PATCH:/{username}/groups/{group_key} - * @secure - */ - updateGroup: ( - username: string, - groupKey: string, - group: { - description?: string; - key?: string; - name?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/groups/${groupKey}`, - method: "PATCH", - body: group, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Groups - * @name ReplaceGroup - * @summary Replace an existing Group - * @request PUT:/{username}/groups/{group_key} - * @secure - */ - replaceGroup: ( - username: string, - groupKey: string, - group: { - description?: string; - key?: string; - name?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/groups/${groupKey}`, - method: "PUT", - body: group, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Groups, Feeds - * @name AddFeedToGroup - * @summary Add an existing Feed to a Group - * @request POST:/{username}/groups/{group_key}/add - * @secure - */ - addFeedToGroup: ( - groupKey: string, - username: string, - query?: { - feed_key?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/groups/${groupKey}/add`, - method: "POST", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Data - * @name CreateGroupData - * @summary Create new data for multiple feeds in a group - * @request POST:/{username}/groups/{group_key}/data - * @secure - */ - createGroupData: ( - username: string, - groupKey: string, - group_feed_data: { - /** Optional created_at timestamp which will be applied to all feed values created. */ - created_at?: string; - /** An array of feed data records with `key` and `value` properties. */ - feeds: { - key: string; - value: string; - }[]; - /** A location record with `lat`, `lon`, and [optional] `ele` properties. */ - location?: { - ele?: number; - lat: number; - lon: number; - }; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/groups/${groupKey}/data`, - method: "POST", - body: group_feed_data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description The Group Feeds endpoint returns information about the user's feeds. The response includes the latest value of each feed, and other metadata about each feed, but only for feeds within the given group. - * - * @tags Groups, Feeds - * @name AllGroupFeeds - * @summary All feeds for current user in a given group - * @request GET:/{username}/groups/{group_key}/feeds - * @secure - */ - allGroupFeeds: (groupKey: string, username: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/groups/${groupKey}/feeds`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Feeds - * @name CreateGroupFeed - * @summary Create a new Feed in a Group - * @request POST:/{username}/groups/{group_key}/feeds - * @secure - */ - createGroupFeed: ( - username: string, - groupKey: string, - feed: { - description?: string; - key?: string; - license?: string; - name?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/groups/${groupKey}/feeds`, - method: "POST", - body: feed, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Data - * @name AllGroupFeedData - * @summary All data for current feed in a specific group - * @request GET:/{username}/groups/{group_key}/feeds/{feed_key}/data - * @secure - */ - allGroupFeedData: ( - username: string, - groupKey: string, - feedKey: string, - query?: { - /** - * End time for filtering data. Returns data created before give time. - * @format date-time - */ - end_time?: string; - /** Limit the number of records returned. */ - limit?: number; - /** - * Start time for filtering data. Returns data created after given time. - * @format date-time - */ - start_time?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/groups/${groupKey}/feeds/${feedKey}/data`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Data - * @name CreateGroupFeedData - * @summary Create new Data in a feed belonging to a particular group - * @request POST:/{username}/groups/{group_key}/feeds/{feed_key}/data - * @secure - */ - createGroupFeedData: ( - username: string, - groupKey: string, - feedKey: string, - datum: { - /** @format dateTime */ - created_at?: string; - ele?: string; - epoch?: number; - lat?: string; - lon?: string; - value?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/groups/${groupKey}/feeds/${feedKey}/data`, - method: "POST", - body: datum, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Data - * @name BatchCreateGroupFeedData - * @summary Create multiple new Data records in a feed belonging to a particular group - * @request POST:/{username}/groups/{group_key}/feeds/{feed_key}/data/batch - * @secure - */ - batchCreateGroupFeedData: ( - username: string, - groupKey: string, - feedKey: string, - data: { - /** @format dateTime */ - created_at?: string; - ele?: string; - epoch?: number; - lat?: string; - lon?: string; - value?: string; - }[], - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/groups/${groupKey}/feeds/${feedKey}/data/batch`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Groups, Feeds - * @name RemoveFeedFromGroup - * @summary Remove a Feed from a Group - * @request POST:/{username}/groups/{group_key}/remove - * @secure - */ - removeFeedFromGroup: ( - groupKey: string, - username: string, - query?: { - feed_key?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/groups/${groupKey}/remove`, - method: "POST", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Users - * @name GetCurrentUserThrottle - * @summary Get the user's data rate limit and current activity level. - * @request GET:/{username}/throttle - * @secure - */ - getCurrentUserThrottle: (username: string, params: RequestParams = {}) => - this.request< - { - /** Actions taken inside the time window. */ - active_data_rate?: number; - /** Max possible actions inside the time window (usually 1 minute). */ - data_rate_limit?: number; - }, - void - >({ - path: `/${username}/throttle`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * @description The Tokens endpoint returns information about the user's tokens. - * - * @tags Tokens - * @name AllTokens - * @summary All tokens for current user - * @request GET:/{username}/tokens - * @secure - */ - allTokens: (username: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/tokens`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Tokens - * @name CreateToken - * @summary Create a new Token - * @request POST:/{username}/tokens - * @secure - */ - createToken: (username: string, token: Token, params: RequestParams = {}) => - this.request({ - path: `/${username}/tokens`, - method: "POST", - body: token, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Tokens - * @name DestroyToken - * @summary Delete an existing Token - * @request DELETE:/{username}/tokens/{id} - * @secure - */ - destroyToken: (username: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/tokens/${id}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Tokens - * @name GetToken - * @summary Returns Token based on ID - * @request GET:/{username}/tokens/{id} - * @secure - */ - getToken: (username: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/tokens/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Tokens - * @name UpdateToken - * @summary Update properties of an existing Token - * @request PATCH:/{username}/tokens/{id} - * @secure - */ - updateToken: ( - username: string, - id: string, - token: { - token?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/tokens/${id}`, - method: "PATCH", - body: token, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Tokens - * @name ReplaceToken - * @summary Replace an existing Token - * @request PUT:/{username}/tokens/{id} - * @secure - */ - replaceToken: ( - username: string, - id: string, - token: { - token?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/tokens/${id}`, - method: "PUT", - body: token, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description The Triggers endpoint returns information about the user's triggers. - * - * @tags Triggers - * @name AllTriggers - * @summary All triggers for current user - * @request GET:/{username}/triggers - * @secure - */ - allTriggers: (username: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/triggers`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Triggers - * @name CreateTrigger - * @summary Create a new Trigger - * @request POST:/{username}/triggers - * @secure - */ - createTrigger: (username: string, trigger: Trigger, params: RequestParams = {}) => - this.request({ - path: `/${username}/triggers`, - method: "POST", - body: trigger, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Triggers - * @name DestroyTrigger - * @summary Delete an existing Trigger - * @request DELETE:/{username}/triggers/{id} - * @secure - */ - destroyTrigger: (username: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/triggers/${id}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Triggers - * @name GetTrigger - * @summary Returns Trigger based on ID - * @request GET:/{username}/triggers/{id} - * @secure - */ - getTrigger: (username: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/triggers/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Triggers - * @name UpdateTrigger - * @summary Update properties of an existing Trigger - * @request PATCH:/{username}/triggers/{id} - * @secure - */ - updateTrigger: ( - username: string, - id: string, - trigger: { - name?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/triggers/${id}`, - method: "PATCH", - body: trigger, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Triggers - * @name ReplaceTrigger - * @summary Replace an existing Trigger - * @request PUT:/{username}/triggers/{id} - * @secure - */ - replaceTrigger: ( - username: string, - id: string, - trigger: { - name?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/triggers/${id}`, - method: "PUT", - body: trigger, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description The Permissions endpoint returns information about the user's permissions. - * - * @tags Permissions - * @name AllPermissions - * @summary All permissions for current user and type - * @request GET:/{username}/{type}/{type_id}/acl - * @secure - */ - allPermissions: (username: string, type: string, typeId: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/${type}/${typeId}/acl`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Permissions - * @name CreatePermission - * @summary Create a new Permission - * @request POST:/{username}/{type}/{type_id}/acl - * @secure - */ - createPermission: ( - username: string, - type: string, - typeId: string, - permission: Permission, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/${type}/${typeId}/acl`, - method: "POST", - body: permission, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Permissions - * @name DestroyPermission - * @summary Delete an existing Permission - * @request DELETE:/{username}/{type}/{type_id}/acl/{id} - * @secure - */ - destroyPermission: (username: string, type: string, typeId: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/${type}/${typeId}/acl/${id}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Permissions - * @name GetPermission - * @summary Returns Permission based on ID - * @request GET:/{username}/{type}/{type_id}/acl/{id} - * @secure - */ - getPermission: (username: string, type: string, typeId: string, id: string, params: RequestParams = {}) => - this.request({ - path: `/${username}/${type}/${typeId}/acl/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Permissions - * @name UpdatePermission - * @summary Update properties of an existing Permission - * @request PATCH:/{username}/{type}/{type_id}/acl/{id} - * @secure - */ - updatePermission: ( - username: string, - type: string, - typeId: string, - id: string, - permission: { - /** @default "r" */ - mode?: "r" | "w" | "rw"; - /** @default "public" */ - scope?: "secret" | "public" | "user" | "organization"; - scope_value?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/${type}/${typeId}/acl/${id}`, - method: "PATCH", - body: permission, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Permissions - * @name ReplacePermission - * @summary Replace an existing Permission - * @request PUT:/{username}/{type}/{type_id}/acl/{id} - * @secure - */ - replacePermission: ( - username: string, - type: string, - typeId: string, - id: string, - permission: { - /** @default "r" */ - mode?: "r" | "w" | "rw"; - /** @default "public" */ - scope?: "secret" | "public" | "user" | "organization"; - scope_value?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${username}/${type}/${typeId}/acl/${id}`, - method: "PUT", - body: permission, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/another-example.ts b/tests/generated/v2.0/another-example.ts deleted file mode 100644 index e87e75d6..00000000 --- a/tests/generated/v2.0/another-example.ts +++ /dev/null @@ -1,831 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** some description */ -export interface Amount { - /** some description */ - currency: Currency; - /** - * some description - * @format double - * @min 0.01 - * @max 1000000000000000 - */ - value: number; -} - -/** - * An uploaded response - * Describes the result of uploading an image resource - * @example {"code":0,"type":"type","message":"message"} - */ -export interface ApiResponse { - /** @format int32 */ - code?: number; - message?: string; - type?: string; -} - -/** - * Pet category - * A category for a pet - * @example {"name":"name","id":6} - */ -export interface Category { - /** @format int64 */ - id?: number; - name?: string; -} - -/** - * some description - * @pattern ^[A-Z]{3,3}$ - */ -export type Currency = string; - -/** - * Pet Order - * An order for a pets from the pet store - * @example {"petId":6,"quantity":1,"id":0,"shipDate":"2000-01-23T04:56:07.000+00:00","complete":false,"status":"placed"} - */ -export interface Order { - /** @default false */ - complete?: boolean; - /** @format int64 */ - id?: number; - /** @format int64 */ - petId?: number; - /** @format int32 */ - quantity?: number; - /** @format date-time */ - shipDate?: string; - /** Order Status */ - status?: "placed" | "approved" | "delivered" | null; -} - -/** - * a Pet - * A pet for sale in the pet store - * @example {"photoUrls":["photoUrls","photoUrls"],"name":"doggie","id":0,"category":{"name":"name","id":6},"tags":[{"name":"name","id":1},{"name":"name","id":1}],"status":"available"} - */ -export interface Pet { - /** A category for a pet */ - category?: Category; - /** @format int64 */ - id?: number; - /** @example "doggie" */ - name: string; - photoUrls: string[]; - /** pet status in the store */ - status?: "available" | "pending" | "sold"; - tags?: Tag[]; -} - -export enum PetIds { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -export enum PetIdsWithWrongEnum { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -export enum PetNames { - FluffyHero = "Fluffy Hero", - PiggyPo = "Piggy Po", - SwaggerTypescriptApi = "Swagger Typescript Api", - UPPER_CASE = "UPPER_CASE", -} - -/** - * Pet Tag - * A tag for a pet - * @example {"name":"name","id":1} - */ -export interface Tag { - /** @format int64 */ - id?: number; - name?: string; -} - -/** - * a User - * A User who is purchasing from the pet store - * @example {"firstName":"firstName","lastName":"lastName","password":"password","userStatus":6,"phone":"phone","id":0,"email":"email","username":"username"} - */ -export interface User { - email?: string; - firstName?: string; - /** @format int64 */ - id?: number; - lastName?: string; - password?: string; - phone?: string; - /** - * User Status - * @format int32 - */ - userStatus?: number; - username?: string; -} - -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 = "http://petstore.swagger.io/v2"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/v2 - * @externalDocs http://swagger.io - * @contact - * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - */ -export class Api extends HttpClient { - pet = { - /** - * No description - * - * @tags pet - * @name AddPet - * @summary Add a new pet to the store - * @request POST:/pet - * @secure - */ - addPet: (body: Pet, params: RequestParams = {}) => - this.request({ - path: `/pet`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePet - * @summary Update an existing pet - * @request PUT:/pet - * @secure - */ - updatePet: (body: Pet, params: RequestParams = {}) => - this.request({ - path: `/pet`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * @description Multiple status values can be provided with comma separated strings - * - * @tags pet - * @name FindPetsByStatus - * @summary Finds Pets by status - * @request GET:/pet/findByStatus - * @secure - */ - findPetsByStatus: ( - query: { - /** Status values that need to be considered for filter */ - status: ("available" | "pending" | "sold")[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/findByStatus`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pet - * @name SingleFormUrlEncodedRequest - * @summary summary - * @request POST:/pet/single-form-url-encoded - */ - singleFormUrlEncodedRequest: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/single-form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name FormUrlEncodedRequest - * @summary summary - * @request POST:/pet/form-url-encoded - */ - formUrlEncodedRequest: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name FormUrlEncodedRequest2 - * @summary summary - * @request POST:/pet/end-form-url-encoded - * @originalName formUrlEncodedRequest - * @duplicate - */ - formUrlEncodedRequest2: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/end-form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @tags pet - * @name FindPetsByTags - * @summary Finds Pets by tags - * @request GET:/pet/findByTags - * @deprecated - * @secure - */ - findPetsByTags: ( - query: { - /** Tags to filter by */ - tags: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/findByTags`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Returns a single pet - * - * @tags pet - * @name GetPetById - * @summary Find pet by ID - * @request GET:/pet/{petId} - * @secure - */ - getPetById: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePetWithForm - * @summary Updates a pet in the store with form data - * @request POST:/pet/{petId} - * @secure - */ - updatePetWithForm: ( - petId: number, - data: { - /** Updated name of the pet */ - name?: string; - /** Updated status of the pet */ - status?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/${petId}`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name DeletePet - * @summary Deletes a pet - * @request DELETE:/pet/{petId} - * @secure - */ - deletePet: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UploadFile - * @summary uploads an image - * @request POST:/pet/{petId}/uploadImage - * @secure - */ - uploadFile: ( - petId: number, - data: { - /** Additional data to pass to server */ - additionalMetadata?: string; - /** file to upload */ - file?: File; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/${petId}/uploadImage`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - format: "json", - ...params, - }), - }; - store = { - /** - * @description Returns a map of status codes to quantities - * - * @tags store - * @name GetInventory - * @summary Returns pet inventories by status - * @request GET:/store/inventory - * @secure - */ - getInventory: (params: RequestParams = {}) => - this.request, any>({ - path: `/store/inventory`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags store - * @name PlaceOrder - * @summary Place an order for a pet - * @request POST:/store/order - */ - placeOrder: (body: Order, params: RequestParams = {}) => - this.request({ - path: `/store/order`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @tags store - * @name GetOrderById - * @summary Find purchase order by ID - * @request GET:/store/order/{orderId} - */ - getOrderById: (orderId: number, params: RequestParams = {}) => - this.request({ - path: `/store/order/${orderId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @tags store - * @name DeleteOrder - * @summary Delete purchase order by ID - * @request DELETE:/store/order/{orderId} - */ - deleteOrder: (orderId: string, params: RequestParams = {}) => - this.request({ - path: `/store/order/${orderId}`, - method: "DELETE", - ...params, - }), - }; - user = { - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name CreateUser - * @summary Create user - * @request POST:/user - */ - createUser: (body: User, params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithArrayInput - * @summary Creates list of users with given input array - * @request POST:/user/createWithArray - */ - createUsersWithArrayInput: (body: User[], params: RequestParams = {}) => - this.request({ - path: `/user/createWithArray`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithListInput - * @summary Creates list of users with given input array - * @request POST:/user/createWithList - */ - createUsersWithListInput: (body: User[], params: RequestParams = {}) => - this.request({ - path: `/user/createWithList`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name LoginUser - * @summary Logs user into the system - * @request GET:/user/login - */ - loginUser: ( - query: { - /** The password for login in clear text */ - password: string; - /** The user name for login */ - username: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/login`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags user - * @name LogoutUser - * @summary Logs out current logged in user session - * @request GET:/user/logout - */ - logoutUser: (params: RequestParams = {}) => - this.request({ - path: `/user/logout`, - method: "GET", - ...params, - }), - - /** - * No description - * - * @tags user - * @name GetUserByName - * @summary Get user by user name - * @request GET:/user/{username} - */ - getUserByName: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name UpdateUser - * @summary Updated user - * @request PUT:/user/{username} - */ - updateUser: (username: string, body: User, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "PUT", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name DeleteUser - * @summary Delete user - * @request DELETE:/user/{username} - */ - deleteUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "DELETE", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/another-schema.ts b/tests/generated/v2.0/another-schema.ts deleted file mode 100644 index 9520976d..00000000 --- a/tests/generated/v2.0/another-schema.ts +++ /dev/null @@ -1,301 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Bar { - A?: string; - /** @format int32 */ - B: number; - Baz?: Baz; - /** @format date-time */ - C: string; -} - -export interface Baz { - Color: Color; - /** @format decimal */ - D: number; -} - -export enum Color { - RED = 0, - GREEN = 1, - BLUE = 2, -} - -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.clone() 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 - */ -export class Api extends HttpClient { - api = { - /** - * No description - * - * @tags Foo - * @name FooGetBarDescriptions - * @request GET:/api/Foo/GetBarDescriptions - */ - fooGetBarDescriptions: (params: RequestParams = {}) => - this.request({ - path: `/api/Foo/GetBarDescriptions`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Foo - * @name FooGetBar - * @request GET:/api/Foo/GetBar - */ - fooGetBar: ( - query: { - /** @format int32 */ - id: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/api/Foo/GetBar`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Foo - * @name FooSetBar - * @request POST:/api/Foo/SetBar - */ - fooSetBar: (value: Bar | null, params: RequestParams = {}) => - this.request({ - path: `/api/Foo/SetBar`, - method: "POST", - body: value, - type: ContentType.Json, - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/api-with-examples.ts b/tests/generated/v2.0/api-with-examples.ts deleted file mode 100644 index 0a830375..00000000 --- a/tests/generated/v2.0/api-with-examples.ts +++ /dev/null @@ -1,292 +0,0 @@ -/* 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 = ""; - 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.clone() 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 Simple API overview - * @version v2 - */ -export class Api extends HttpClient { - /** - * @description multiple line 1 multiple line 2 multiple line 3 - * - * @name ListVersionsv2 - * @summary List API versions - * @request GET:/ - */ - listVersionsv2 = (params: RequestParams = {}) => - this.request({ - path: `/`, - method: "GET", - format: "json", - ...params, - }); - - v2 = { - /** - * No description - * - * @name GetVersionDetailsv2 - * @summary Show API version details - * @request GET:/v2 - */ - getVersionDetailsv2: (params: RequestParams = {}) => - this.request({ - path: `/v2`, - method: "GET", - format: "json", - ...params, - }), - }; - withCharset = { - /** - * @description consumes contains charset - * - * @name WithCharset - * @summary consumes contains charset - * @request POST:/with-charset/ - */ - withCharset: (someParm: string, params: RequestParams = {}) => - this.request({ - path: `/with-charset/`, - method: "POST", - body: someParm, - type: ContentType.Json, - ...params, - }), - }; - consumesPlainText = { - /** - * @description consumes plain text - * - * @name ConsumesPlainText - * @summary consumes plain text - * @request POST:/consumes-plain-text/ - */ - consumesPlainText: (someParm: string, params: RequestParams = {}) => - this.request({ - path: `/consumes-plain-text/`, - method: "POST", - body: someParm, - type: ContentType.Text, - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/authentiq.ts b/tests/generated/v2.0/authentiq.ts deleted file mode 100644 index 4b760c36..00000000 --- a/tests/generated/v2.0/authentiq.ts +++ /dev/null @@ -1,643 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Authentiq ID in JWT format, self-signed. */ -export interface AuthentiqID { - /** device token for push messages */ - devtoken?: string; - /** UUID and public signing key */ - sub: string; -} - -/** Claim in JWT format, self- or issuer-signed. */ -export interface Claims { - email?: string; - phone?: string; - /** claim scope */ - scope: string; - /** UUID */ - sub: string; - type?: string; -} - -export interface Error { - detail?: string; - error: number; - title?: string; - /** unique uri for this error */ - type?: string; -} - -/** PushToken in JWT format, self-signed. */ -export interface PushToken { - /** audience (URI) */ - aud: string; - exp?: number; - iat?: number; - /** issuer (URI) */ - iss: string; - nbf: number; - /** UUID and public signing key */ - sub: string; -} - -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://6-dot-authentiqio.appspot.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 Authentiq - * @version 6 - * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://authentiq.com/terms/ - * @baseUrl https://6-dot-authentiqio.appspot.com - * @contact Authentiq team (http://authentiq.io/support) - * - * Strong authentication, without the passwords. - */ -export class Api extends HttpClient { - wrongPathParams1 = { - /** - * @description DDD - * - * @tags key, delete - * @name WrongPathParams1 - * @request DELETE:/wrong-path-params1/{pathParam1}/{path_param2}/{path_param3}/:pathParam4 - */ - wrongPathParams1: ( - pathParam1: string, - pathParam2: string, - pathParam3: string, - pathParam4: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/wrong-path-params1/${pathParam1}/${pathParam2}/${pathParam3}/${pathParam4}`, - method: "DELETE", - ...params, - }), - }; - wrongPathParams2 = { - /** - * @description DDD - * - * @tags key, delete - * @name WrongPathParams2 - * @request DELETE:/wrong-path-params2 - */ - wrongPathParams2: (pathParam1: string, params: RequestParams = {}) => - this.request({ - path: `/wrong-path-params2`, - method: "DELETE", - ...params, - }), - }; - key = { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret: ( - query: { - /** verification code sent by email */ - code?: string; - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** pending or done */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "DELETE", - query: query, - format: "json", - ...params, - }), - - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister: (body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - keyRevoke: ( - pk: string, - query: { - /** revokation secret */ - secret: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "DELETE", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey: (pk: string, params: RequestParams = {}) => - this.request< - { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey: (pk: string, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "HEAD", - ...params, - }), - - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate: (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind: (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "PUT", - body: body, - format: "json", - ...params, - }), - }; - login = { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest: ( - query: { - /** URI App will connect to */ - callback: string; - }, - body: PushToken, - params: RequestParams = {}, - ) => - this.request< - { - /** sent */ - status?: string; - }, - Error - >({ - path: `/login`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }), - }; - scope = { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest: ( - body: Claims, - query?: { - /** test only mode, using test issuer */ - test?: number; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }, - Error - >({ - path: `/scope`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }), - - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete: (job: string, params: RequestParams = {}) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "DELETE", - format: "json", - ...params, - }), - - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve: (job: string, params: RequestParams = {}) => - this.request< - { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "HEAD", - ...params, - }), - - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm: (job: string, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "POST", - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate: (job: string, params: RequestParams = {}) => - this.request< - { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "PUT", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/enums.ts b/tests/generated/v2.0/enums.ts deleted file mode 100644 index 0a1b16d2..00000000 --- a/tests/generated/v2.0/enums.ts +++ /dev/null @@ -1,285 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** @format int32 */ -export enum EmptyEnum { - Bla = "Bla", - Blabla = "Blabla", - Boiler = "Boiler", -} - -/** @format int32 */ -export enum EnumWithMoreNames { - Bla = 1, - Blabla = "Blabla", - Boiler = "Boiler", -} - -export enum OnlyEnumNames { - Bla = "Bla", - Blabla = "Blabla", - Boiler = "Boiler", -} - -/** @format int32 */ -export enum SomeInterestEnum { - Bla = 6, - Blabla = 2, - Boiler = 1, - Bbabab = 67, - Nowadays = 88, - FAIL = 122, - Vvvvv = 88, - ASdasAS = 0, - ASDsacZX = 213, - Zook = 12378, - EnumMm = 123125, - VCsa = 32452, - Yuuu = 1111, - ASddd = 66666, - ASdsdsa = "ASdsdsa", - ASDds = "ASDds", - HSDFDS = "HSDFDS", -} - -export enum StringCompleteEnums { - Bla = "foo", - Blabla = "bar", - Boiler = "baz", -} - -export enum StringEnums { - Bla = "foo", - Blabla = "bar", - Boiler = "Boiler", -} - -export enum StringOnlyEnumNames { - Bla = "Bla", - Blabla = "Blabla", - Boiler = "Boiler", -} - -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://ffff.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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://ffff.com - */ -export class Api extends HttpClient {} diff --git a/tests/generated/v2.0/example1.ts b/tests/generated/v2.0/example1.ts deleted file mode 100644 index bae0a69c..00000000 --- a/tests/generated/v2.0/example1.ts +++ /dev/null @@ -1,295 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** - * some description - * @pattern ^[A-Z]{3,3}$ - */ -export type Currency = string; - -/** A TDE certificate that can be uploaded into a server. */ -export type TdeCertificate = { - /** Resource ID. */ - id?: string; - /** Resource name. */ - name?: string; - /** Resource type. */ - type?: string; -} & { - /** Resource properties. */ - properties?: TdeCertificateProperties; -}; - -/** A TDE certificate that can be uploaded into a server. */ -export type TdeCertificate2 = { - /** Resource ID. */ - id?: string; - /** Resource name. */ - name?: string; - /** Resource type. */ - type?: string; -}; - -/** Properties of a TDE certificate. */ -export interface TdeCertificateProperties { - /** The certificate password. */ - certPassword?: string; - /** The base64 encoded certificate private blob. */ - privateBlob: string; -} - -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://management.azure.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 SqlManagementClient - * @version 2017-10-01-preview - * @baseUrl https://management.azure.com - * - * The Azure SQL Database management API provides a RESTful set of web APIs that interact with Azure SQL Database services to manage your databases. The API enables users to create, retrieve, update, and delete databases, servers, and other entities. - */ -export class Api extends HttpClient { - subscriptions = { - /** - * @description Creates a TDE certificate for a given server. - * - * @tags ManagedInstanceTdeCertificates - * @name ManagedInstanceTdeCertificatesCreate - * @request POST:/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/tdeCertificates - */ - managedInstanceTdeCertificatesCreate: ( - resourceGroupName: string, - managedInstanceName: string, - subscriptionId: string, - query: { - /** The API version to use for the request. */ - "api-version": string; - }, - parameters: TdeCertificate, - params: RequestParams = {}, - ) => - this.request({ - path: `/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.Sql/managedInstances/${managedInstanceName}/tdeCertificates`, - method: "POST", - query: query, - body: parameters, - type: ContentType.Json, - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/file-formdata-example.ts b/tests/generated/v2.0/file-formdata-example.ts deleted file mode 100644 index 8c14477a..00000000 --- a/tests/generated/v2.0/file-formdata-example.ts +++ /dev/null @@ -1,256 +0,0 @@ -/* 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 = ""; - 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.clone() 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 Title - * @version v0.1 - */ -export class Api extends HttpClient { - uploadFile = { - /** - * No description - * - * @tags tag - * @name UploadFile - * @summary Upload file - * @request POST:/upload-file - */ - uploadFile: ( - data: { - /** - * File description - * @format binary - */ - file?: File; - /** Boolean flag */ - someFlag?: boolean; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/upload-file`, - method: "POST", - body: data, - type: ContentType.FormData, - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/furkot-example.ts b/tests/generated/v2.0/furkot-example.ts deleted file mode 100644 index 9e6b9f0a..00000000 --- a/tests/generated/v2.0/furkot-example.ts +++ /dev/null @@ -1,340 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Step { - /** address of the stop */ - address?: string; - /** - * arrival at the stop in its local timezone as YYYY-MM-DDThh:mm - * @format date-time - */ - arrival?: string; - /** geographical coordinates of the stop */ - coordinates?: { - /** - * latitude - * @format float - */ - lat?: number; - /** - * longitude - * @format float - */ - lon?: number; - }; - /** - * departure from the stop in its local timezone as YYYY-MM-DDThh:mm - * @format date-time - */ - departure?: string; - /** name of the stop */ - name?: string; - /** - * number of nights - * @format int64 - */ - nights?: number; - /** route leading to the stop */ - route?: { - /** - * route distance in meters - * @format int64 - */ - distance?: number; - /** - * route duration in seconds - * @format int64 - */ - duration?: number; - /** travel mode */ - mode?: "car" | "motorcycle" | "bicycle" | "walk" | "other"; - /** route path compatible with Google polyline encoding algorithm */ - polyline?: string; - }; - /** url of the page with more information about the stop */ - url?: string; -} - -export interface Trip { - /** - * begin of the trip in its local timezone as YYYY-MM-DDThh:mm - * @format date-time - */ - begin?: string; - /** description of the trip (truncated to 200 characters) */ - description?: string; - /** - * end of the trip in its local timezone as YYYY-MM-DDThh:mm - * @format date-time - */ - end?: string; - /** Unique ID of the trip */ - id?: string; - /** name of the trip */ - name?: string; -} - -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://trips.furkot.com/pub/api"; - 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.clone() 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 Furkot Trips - * @version 1.0.0 - * @baseUrl https://trips.furkot.com/pub/api - * @externalDocs https://help.furkot.com/widgets/furkot-api.html - * @contact - * - * Furkot provides Rest API to access user trip data. - * Using Furkot API an application can list user trips and display stops for a specific trip. - * Furkot API uses OAuth2 protocol to authorize applications to access data on behalf of users. - */ -export class Api extends HttpClient { - trip = { - /** - * @description list user's trips - * - * @name TripList - * @request GET:/trip - * @secure - */ - tripList: (params: RequestParams = {}) => - this.request({ - path: `/trip`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * @description list stops for a trip identified by {trip_id} - * - * @name StopDetail - * @request GET:/trip/{trip_id}/stop - * @secure - */ - stopDetail: (tripId: string, params: RequestParams = {}) => - this.request({ - path: `/trip/${tripId}/stop`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/giphy.ts b/tests/generated/v2.0/giphy.ts deleted file mode 100644 index e3be8b63..00000000 --- a/tests/generated/v2.0/giphy.ts +++ /dev/null @@ -1,875 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Gif { - /** - * The unique bit.ly URL for this GIF - * @example "http://gph.is/1gsWDcL" - */ - bitly_url?: string; - /** Currently unused */ - content_url?: string; - /** - * The date this GIF was added to the GIPHY database. - * @format date-time - * @example "2013-08-01 12:41:48" - */ - create_datetime?: string; - /** - * A URL used for embedding this GIF - * @example "http://giphy.com/embed/YsTs5ltWtEhnq" - */ - embded_url?: string; - /** An array of featured tags for this GIF (Note: Not available when using the Public Beta Key) */ - featured_tags?: string[]; - /** - * This GIF's unique ID - * @example "YsTs5ltWtEhnq" - */ - id?: string; - /** An object containing data for various available formats and sizes of this GIF. */ - images?: { - /** Data surrounding a version of this GIF downsized to be under 2mb. */ - downsized?: Image; - /** Data surrounding a version of this GIF downsized to be under 8mb. */ - downsized_large?: Image; - /** Data surrounding a version of this GIF downsized to be under 5mb. */ - downsized_medium?: Image; - /** Data surrounding a version of this GIF downsized to be under 200kb. */ - downsized_small?: Image; - /** Data surrounding a static preview image of the downsized version of this GIF. */ - downsized_still?: Image; - /** Data surrounding versions of this GIF with a fixed height of 200 pixels. Good for mobile use. */ - fixed_height?: Image; - /** Data surrounding versions of this GIF with a fixed height of 200 pixels and the number of frames reduced to 6. */ - fixed_height_downsampled?: Image; - /** Data surrounding versions of this GIF with a fixed height of 100 pixels. Good for mobile keyboards. */ - fixed_height_small?: Image; - /** Data surrounding a static image of this GIF with a fixed height of 100 pixels. */ - fixed_height_small_still?: Image; - /** Data surrounding a static image of this GIF with a fixed height of 200 pixels. */ - fixed_height_still?: Image; - /** Data surrounding versions of this GIF with a fixed width of 200 pixels. Good for mobile use. */ - fixed_width?: Image; - /** Data surrounding versions of this GIF with a fixed width of 200 pixels and the number of frames reduced to 6. */ - fixed_width_downsampled?: Image; - /** Data surrounding versions of this GIF with a fixed width of 100 pixels. Good for mobile keyboards. */ - fixed_width_small?: Image; - /** Data surrounding a static image of this GIF with a fixed width of 100 pixels. */ - fixed_width_small_still?: Image; - /** Data surrounding a static image of this GIF with a fixed width of 200 pixels. */ - fixed_width_still?: Image; - /** Data surrounding a version of this GIF set to loop for 15 seconds. */ - looping?: Image; - /** Data surrounding the original version of this GIF. Good for desktop use. */ - original?: Image; - /** Data surrounding a static preview image of the original GIF. */ - original_still?: Image; - /** Data surrounding a version of this GIF in .MP4 format limited to 50kb that displays the first 1-2 seconds of the GIF. */ - preview?: Image; - /** Data surrounding a version of this GIF limited to 50kb that displays the first 1-2 seconds of the GIF. */ - preview_gif?: Image; - }; - /** - * The creation or upload date from this GIF's source. - * @format date-time - * @example "2013-08-01 12:41:48" - */ - import_datetime?: string; - /** - * The MPAA-style rating for this content. Examples include Y, G, PG, PG-13 and R - * @example "g" - */ - rating?: string; - /** - * The unique slug used in this GIF's URL - * @example "confused-flying-YsTs5ltWtEhnq" - */ - slug?: string; - /** - * The page on which this GIF was found - * @example "http://www.reddit.com/r/reactiongifs/comments/1xpyaa/superman_goes_to_hollywood/" - */ - source?: string; - /** - * The URL of the webpage on which this GIF was found. - * @example "http://cheezburger.com/5282328320" - */ - source_post_url?: string; - /** - * The top level domain of the source URL. - * @example "cheezburger.com" - */ - source_tld?: string; - /** An array of tags for this GIF (Note: Not available when using the Public Beta Key) */ - tags?: string[]; - /** - * The date on which this gif was marked trending, if applicable. - * @format date-time - * @example "2013-08-01 12:41:48" - */ - trending_datetime?: string; - /** - * Type of the gif. By default, this is almost always gif - * @default "gif" - */ - type?: "gif"; - /** - * The date on which this GIF was last updated. - * @format date-time - * @example "2013-08-01 12:41:48" - */ - update_datetime?: string; - /** - * The unique URL for this GIF - * @example "http://giphy.com/gifs/confused-flying-YsTs5ltWtEhnq" - */ - url?: string; - /** The User Object contains information about the user associated with a GIF and URLs to assets such as that user's avatar image, profile, and more. */ - user?: User; - /** - * The username this GIF is attached to, if applicable - * @example "JoeCool4000" - */ - username?: string; -} - -export interface Image { - /** - * The URL for this GIF in .MP4 format. - * @example "https://media1.giphy.com/media/cZ7rmKfFYOvYI/giphy.mp4" - */ - mp4?: string; - /** - * The size in bytes of the .MP4 file corresponding to this GIF. - * @example "25123" - */ - mp4_size?: string; - /** - * The number of frames in this GIF. - * @example "15" - */ - frames?: string; - /** - * The height of this GIF in pixels. - * @example "200" - */ - height?: string; - /** - * The size of this GIF in bytes. - * @example "32381" - */ - size?: string; - /** - * The publicly-accessible direct URL for this GIF. - * @example "https://media1.giphy.com/media/cZ7rmKfFYOvYI/200.gif" - */ - url?: string; - /** - * The URL for this GIF in .webp format. - * @example "https://media1.giphy.com/media/cZ7rmKfFYOvYI/giphy.webp" - */ - webp?: string; - /** - * The size in bytes of the .webp file corresponding to this GIF. - * @example "12321" - */ - webp_size?: string; - /** - * The width of this GIF in pixels. - * @example "320" - */ - width?: string; -} - -/** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ -export interface Meta { - /** - * HTTP Response Message - * @example "OK" - */ - msg?: string; - /** - * A unique ID paired with this response from the API. - * @example "57eea03c72381f86e05c35d2" - */ - response_id?: string; - /** - * HTTP Response Code - * @format int32 - * @example 200 - */ - status?: number; -} - -/** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ -export interface Pagination { - /** - * Total number of items returned. - * @format int32 - * @example 25 - */ - count?: number; - /** - * Position in pagination. - * @format int32 - * @example 75 - */ - offset?: number; - /** - * Total number of items available. - * @format int32 - * @example 250 - */ - total_count?: number; -} - -/** The User Object contains information about the user associated with a GIF and URLs to assets such as that user's avatar image, profile, and more. */ -export interface User { - /** - * The URL for this user's avatar image. - * @example "https://media1.giphy.com/avatars/election2016/XwYrZi5H87o6.gif" - */ - avatar_url?: string; - /** - * The URL for the banner image that appears atop this user's profile page. - * @example "https://media4.giphy.com/avatars/cheezburger/XkuejOhoGLE6.jpg" - */ - banner_url?: string; - /** - * The display name associated with this user (contains formatting the base username might not). - * @example "JoeCool4000" - */ - display_name?: string; - /** - * The URL for this user's profile. - * @example "https://giphy.com/cheezburger/" - */ - profile_url?: string; - /** - * The Twitter username associated with this user, if applicable. - * @example "@joecool4000" - */ - twitter?: string; - /** - * The username associated with this user. - * @example "joecool4000" - */ - username?: string; -} - -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://api.giphy.com/v1"; - 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.clone() 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 Giphy - * @version 1.0 - * @termsOfService https://developers.giphy.com/ - * @baseUrl https://api.giphy.com/v1 - * @externalDocs https://developers.giphy.com/docs/ - * @contact - * - * Giphy API - */ -export class Api extends HttpClient { - gifs = { - /** - * @description A multiget version of the get GIF by ID endpoint. - * - * @tags gifs - * @name GetGifsById - * @summary Get GIFs by ID - * @request GET:/gifs - * @secure - */ - getGifsById: ( - query?: { - /** Filters results by specified GIF IDs, separated by commas. */ - ids?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - data?: Gif[]; - /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ - meta?: Meta; - /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ - pagination?: Pagination; - }, - any - >({ - path: `/gifs`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. - * - * @tags gifs - * @name RandomGif - * @summary Random GIF - * @request GET:/gifs/random - * @secure - */ - randomGif: ( - query?: { - /** Filters results by specified rating. */ - rating?: string; - /** Filters results by specified tag. */ - tag?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - data?: Gif; - /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ - meta?: Meta; - }, - any - >({ - path: `/gifs/random`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Search all GIPHY GIFs for a word or phrase. Punctuation will be stripped and ignored. Use a plus or url encode for phrases. Example paul+rudd, ryan+gosling or american+psycho. - * - * @tags gifs - * @name SearchGifs - * @summary Search GIFs - * @request GET:/gifs/search - * @secure - */ - searchGifs: ( - query: { - /** Specify default language for regional content; use a 2-letter ISO 639-1 language code. */ - lang?: string; - /** - * The maximum number of records to return. - * @format int32 - * @default 25 - */ - limit?: number; - /** - * An optional results offset. - * @format int32 - * @default 0 - */ - offset?: number; - /** Search query term or prhase. */ - q: string; - /** Filters results by specified rating. */ - rating?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - data?: Gif[]; - /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ - meta?: Meta; - /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ - pagination?: Pagination; - }, - any - >({ - path: `/gifs/search`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description The translate API draws on search, but uses the GIPHY `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIF - * - * @tags gifs - * @name TranslateGif - * @summary Translate phrase to GIF - * @request GET:/gifs/translate - * @secure - */ - translateGif: ( - query: { - /** Search term. */ - s: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - data?: Gif; - /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ - meta?: Meta; - }, - any - >({ - path: `/gifs/translate`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Fetch GIFs currently trending online. Hand curated by the GIPHY editorial team. The data returned mirrors the GIFs showcased on the GIPHY homepage. Returns 25 results by default. - * - * @tags gifs - * @name TrendingGifs - * @summary Trending GIFs - * @request GET:/gifs/trending - * @secure - */ - trendingGifs: ( - query?: { - /** - * The maximum number of records to return. - * @format int32 - * @default 25 - */ - limit?: number; - /** - * An optional results offset. - * @format int32 - * @default 0 - */ - offset?: number; - /** Filters results by specified rating. */ - rating?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - data?: Gif[]; - /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ - meta?: Meta; - /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ - pagination?: Pagination; - }, - any - >({ - path: `/gifs/trending`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Returns a GIF given that GIF's unique ID - * - * @tags gifs - * @name GetGifById - * @summary Get GIF by Id - * @request GET:/gifs/{gifId} - * @secure - */ - getGifById: (gifId: number, params: RequestParams = {}) => - this.request< - { - data?: Gif; - /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ - meta?: Meta; - }, - any - >({ - path: `/gifs/${gifId}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - }; - stickers = { - /** - * @description Returns a random GIF, limited by tag. Excluding the tag parameter will return a random GIF from the GIPHY catalog. - * - * @tags stickers - * @name RandomSticker - * @summary Random Sticker - * @request GET:/stickers/random - * @secure - */ - randomSticker: ( - query?: { - /** Filters results by specified rating. */ - rating?: string; - /** Filters results by specified tag. */ - tag?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - data?: Gif; - /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ - meta?: Meta; - }, - any - >({ - path: `/stickers/random`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Replicates the functionality and requirements of the classic GIPHY search, but returns animated stickers rather than GIFs. - * - * @tags stickers - * @name SearchStickers - * @summary Search Stickers - * @request GET:/stickers/search - * @secure - */ - searchStickers: ( - query: { - /** Specify default language for regional content; use a 2-letter ISO 639-1 language code. */ - lang?: string; - /** - * The maximum number of records to return. - * @format int32 - * @default 25 - */ - limit?: number; - /** - * An optional results offset. - * @format int32 - * @default 0 - */ - offset?: number; - /** Search query term or prhase. */ - q: string; - /** Filters results by specified rating. */ - rating?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - data?: Gif[]; - /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ - meta?: Meta; - /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ - pagination?: Pagination; - }, - any - >({ - path: `/stickers/search`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description The translate API draws on search, but uses the GIPHY `special sauce` to handle translating from one vocabulary to another. In this case, words and phrases to GIFs. - * - * @tags stickers - * @name TranslateSticker - * @summary Translate phrase to Sticker - * @request GET:/stickers/translate - * @secure - */ - translateSticker: ( - query: { - /** Search term. */ - s: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - data?: Gif; - /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ - meta?: Meta; - }, - any - >({ - path: `/stickers/translate`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Fetch Stickers currently trending online. Hand curated by the GIPHY editorial team. Returns 25 results by default. - * - * @tags stickers - * @name TrendingStickers - * @summary Trending Stickers - * @request GET:/stickers/trending - * @secure - */ - trendingStickers: ( - query?: { - /** - * The maximum number of records to return. - * @format int32 - * @default 25 - */ - limit?: number; - /** - * An optional results offset. - * @format int32 - * @default 0 - */ - offset?: number; - /** Filters results by specified rating. */ - rating?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - data?: Gif[]; - /** The Meta Object contains basic information regarding the request, whether it was successful, and the response given by the API. Check `responses` to see a description of types of response codes the API might give you under different cirumstances. */ - meta?: Meta; - /** The Pagination Object contains information relating to the number of total results available as well as the number of results fetched and their relative positions. */ - pagination?: Pagination; - }, - any - >({ - path: `/stickers/trending`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/github-swagger.ts b/tests/generated/v2.0/github-swagger.ts deleted file mode 100644 index d66f30d4..00000000 --- a/tests/generated/v2.0/github-swagger.ts +++ /dev/null @@ -1,6284 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** A user or organization */ -export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - 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; - /** The account username */ - login?: string; - /** The full account name */ - 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"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - 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?: { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601. */ - created_at?: string; - id?: number; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface Commit { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export interface CommitCommentBody { - body: string; - /** Deprecated - Use position parameter instead. */ - line?: string; - /** Line number in the file to comment on. Defaults to null. */ - number?: string; - /** Relative path of the file to comment on. */ - path?: string; - /** Line index in the diff to comment on. */ - position?: number; - /** SHA of the commit to comment on. */ - sha: string; -} - -export type Commits = { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -}[]; - -export interface CompareCommits { - ahead_by?: number; - base_commit?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - behind_by?: number; - commits?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - }; - /** The Total number of commits authored by the contributor. */ - total?: number; - weeks?: { - /** Number of additions. */ - a?: number; - /** Number of commits. */ - c?: number; - /** Number of deletions. */ - d?: number; - /** Start of the week. */ - 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; - /** A GitHub user */ - creator?: User; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -} - -export type DeploymentStatuses = { - created_at?: string; - /** A GitHub user */ - 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 { - /** A user or organization */ - actor?: Actor; - created_at?: object; - id?: number; - /** A GitHub organization */ - 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; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - description?: string; - files?: { - "ring.erl"?: { - filename?: string; - raw_url?: string; - size?: number; - }; - }; - forks?: { - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }[]; - git_pull_url?: string; - git_push_url?: string; - history?: { - change_status?: { - additions?: number; - deletions?: number; - total?: number; - }; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - committed_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - version?: string; - }[]; - html_url?: string; - id?: string; - public?: boolean; - url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - 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; - }; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** A user or organization */ - actor?: Actor; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - event?: string; - issue?: { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }; - url?: string; -} - -export type IssueEvents = IssueEvent[]; - -export type Issues = { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface IssuesComment { - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export type IssuesComments = { - _links?: { - html?: { - href?: string; - }; - pull_request?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - body?: string; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - 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 { - /** Error message */ - message?: string; -} - -export interface MergesSuccessful { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A user or organization */ - 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[]; -} - -/** A GitHub organization */ -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 address. This address is not publicized. */ - billing_email?: string; - company?: string; - /** Publicly visible email address. */ - email?: string; - location?: string; - name?: string; -} - -export interface PostGist { - description?: string; - files?: { - "file1.txt"?: { - content?: string; - }; - }; - public?: boolean; -} - -export interface PostRepo { - /** True to create an initial commit with empty README. Default is false. */ - auto_init?: boolean; - description?: string; - /** Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell" Ignored if auto_init parameter is not provided. */ - gitignore_template?: string; - /** True to enable downloads for this repository, false to disable them. Default is true. */ - has_downloads?: boolean; - /** True to enable issues for this repository, false to disable them. Default is true. */ - has_issues?: boolean; - /** True to enable the wiki for this repository, false to disable it. Default is true. */ - has_wiki?: boolean; - homepage?: string; - name: string; - /** True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. */ - private?: boolean; - /** The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization. */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - merged_at?: string; - number?: number; - patch_url?: string; - state?: "open" | "closed"; - title?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 = { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub organization */ - organization?: Organization; - /** A user or organization */ - owner?: Actor; - /** Is present when the repo is a fork. Parent is the repo this repo was forked from. */ - parent?: Repo; - private?: boolean; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - pushed_at?: string; - size?: number; - /** Is present when the repo is a fork. Source is the ultimate source for the network. */ - source?: Repo; - ssh_url?: string; - svn_url?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - watchers?: number; - watchers_count?: number; -} - -export type RepoComments = { - body?: string; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface RepoCommit { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** 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; - 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; - /** A user or organization */ - 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; - /** A GitHub user */ - 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 { - /** A GitHub user */ - user?: User; -} - -export interface SearchUsers { - items?: Users; - total_count?: number; -} - -export interface SearchUsersByKeyword { - users?: Users; -} - -export interface Subscription { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** String of the tag message. */ - message?: string; - object?: { - sha?: string; - /** String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob. */ - type?: "commit" | "tree" | "blob"; - url?: string; - }; - sha?: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag?: string; - tagger?: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - url?: string; -} - -export interface TagBody { - /** String of the tag message. */ - message: string; - /** String of the SHA of the git object this is tagging. */ - object: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag: string; - tagger: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - /** 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 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?: { - /** One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink. */ - mode?: "100644" | "100755" | "040000" | "160000" | "120000"; - path?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - size?: number; - type?: "blob" | "tree" | "commit"; - url?: string; - }[]; - url?: string; -} - -export interface Trees { - base_tree?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - tree?: Tree[]; - url?: string; -} - -/** A GitHub user */ -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 = "https://api.github.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 - * @termsOfService https://help.github.com/articles/github-terms-of-service/#b-api-terms - * @baseUrl https://api.github.com - * @externalDocs https://developer.github.com/v3/ - * - * Powerful collaboration, code review, and code management for open source and private projects. - */ -export class Api extends HttpClient { - someop = { - /** - * No description - * - * @tags someop - * @name SomeOp1 - * @request POST:/someop - */ - someOp1: ( - data: Events, - query?: { - /** - * description - * @default 0 - */ - queryParam1?: number; - /** - * description - * @default 20 - */ - queryParam2?: number; - /** description */ - queryParam3?: string[]; - /** - * description - * @default 0 - */ - queryParamBar3?: number; - /** - * description - * @default 0 - */ - 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?: { - /** @default 0 */ - page?: number; - /** @default 20 */ - size?: number; - sort?: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/someop/${fooId}/bars/bar-bar`, - method: "POST", - query: query, - body: data, - format: "json", - ...params, - }), - }; - emojis = { - /** - * @description Lists all the emojis available to use on GitHub. - * - * @name EmojisList - * @request GET:/emojis - */ - emojisList: (params: RequestParams = {}) => - this.request({ - path: `/emojis`, - method: "GET", - format: "json", - ...params, - }), - }; - events = { - /** - * @description List public events. - * - * @name EventsList - * @request GET:/events - */ - eventsList: (params: RequestParams = {}) => - this.request({ - path: `/events`, - method: "GET", - format: "json", - ...params, - }), - }; - feeds = { - /** - * @description List Feeds. GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticating user. - * - * @name FeedsList - * @request GET:/feeds - */ - feedsList: (params: RequestParams = {}) => - this.request({ - path: `/feeds`, - method: "GET", - format: "json", - ...params, - }), - }; - gists = { - /** - * @description List the authenticated user's gists or if called anonymously, this will return all public gists. - * - * @name GistsList - * @request GET:/gists - */ - gistsList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a gist. - * - * @name GistsCreate - * @request POST:/gists - */ - gistsCreate: (body: PostGist, params: RequestParams = {}) => - this.request({ - path: `/gists`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List all public gists. - * - * @name PublicList - * @request GET:/gists/public - */ - publicList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists/public`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List the authenticated user's starred gists. - * - * @name StarredList - * @request GET:/gists/starred - */ - starredList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists/starred`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Delete a gist. - * - * @name GistsDelete - * @request DELETE:/gists/{id} - */ - gistsDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single gist. - * - * @name GistsDetail - * @request GET:/gists/{id} - */ - gistsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit a gist. - * - * @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, - }), - - /** - * @description List comments on a gist. - * - * @name CommentsDetail - * @request GET:/gists/{id}/comments - */ - commentsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/comments`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a commen - * - * @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, - }), - - /** - * @description Delete a comment. - * - * @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, - }), - - /** - * @description Get a single comment. - * - * @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, - }), - - /** - * @description Edit a comment. - * - * @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, - }), - - /** - * @description Fork a gist. - * - * @name ForksCreate - * @request POST:/gists/{id}/forks - */ - forksCreate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/forks`, - method: "POST", - ...params, - }), - - /** - * @description Unstar a gist. - * - * @name StarDelete - * @request DELETE:/gists/{id}/star - */ - starDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if a gist is starred. - * - * @name StarDetail - * @request GET:/gists/{id}/star - */ - starDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "GET", - ...params, - }), - - /** - * @description Star a gist. - * - * @name StarUpdate - * @request PUT:/gists/{id}/star - */ - starUpdate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "PUT", - ...params, - }), - }; - gitignore = { - /** - * @description Listing available templates. List all templates available to pass as an option when creating a repository. - * - * @name TemplatesList - * @request GET:/gitignore/templates - */ - templatesList: (params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get a single template. - * - * @name TemplatesDetail - * @request GET:/gitignore/templates/{language} - */ - templatesDetail: (language: string, params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates/${language}`, - method: "GET", - format: "json", - ...params, - }), - }; - issues = { - /** - * @description List issues. List all issues across all the authenticated user's visible repositories. - * - * @name IssuesList - * @request GET:/issues - */ - issuesList: ( - query: { - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "open" */ - state: "open" | "closed"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - legacy = { - /** - * @description Find issues by state and keyword. - * - * @name IssuesSearchDetail - * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} - * @deprecated - */ - 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, - }), - - /** - * @description Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter. - * - * @name ReposSearchDetail - * @request GET:/legacy/repos/search/{keyword} - * @deprecated - */ - reposSearchDetail: ( - keyword: string, - query?: { - /** Filter results by language */ - language?: string; - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - /** The page number to fetch */ - start_page?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/legacy/repos/search/${keyword}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description This API call is added for compatibility reasons only. - * - * @name UserEmailDetail - * @request GET:/legacy/user/email/{email} - * @deprecated - */ - userEmailDetail: (email: string, params: RequestParams = {}) => - this.request({ - path: `/legacy/user/email/${email}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Find users by keyword. - * - * @name UserSearchDetail - * @request GET:/legacy/user/search/{keyword} - * @deprecated - */ - userSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - /** The page number to fetch */ - start_page?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/legacy/user/search/${keyword}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - markdown = { - /** - * @description Render an arbitrary Markdown document - * - * @name MarkdownCreate - * @request POST:/markdown - */ - markdownCreate: (body: Markdown, params: RequestParams = {}) => - this.request({ - path: `/markdown`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description Render a Markdown document in raw mode - * - * @name PostMarkdown - * @request POST:/markdown/raw - */ - postMarkdown: (params: RequestParams = {}) => - this.request({ - path: `/markdown/raw`, - method: "POST", - type: ContentType.Text, - ...params, - }), - }; - meta = { - /** - * @description This gives some information about GitHub.com, the service. - * - * @name MetaList - * @request GET:/meta - */ - metaList: (params: RequestParams = {}) => - this.request({ - path: `/meta`, - method: "GET", - format: "json", - ...params, - }), - }; - networks = { - /** - * @description List public events for a network of repositories. - * - * @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 = { - /** - * @description List your notifications. List all notifications for the current user, grouped by repository. - * - * @name NotificationsList - * @request GET:/notifications - */ - notificationsList: ( - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/notifications`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Mark as read. Marking a notification as "read" removes it from the default view on GitHub.com. - * - * @name NotificationsUpdate - * @request PUT:/notifications - */ - notificationsUpdate: (body: NotificationMarkRead, params: RequestParams = {}) => - this.request({ - path: `/notifications`, - method: "PUT", - body: body, - ...params, - }), - - /** - * @description View a single thread. - * - * @name ThreadsDetail - * @request GET:/notifications/threads/{id} - */ - threadsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Mark a thread as read - * - * @name ThreadsPartialUpdate - * @request PATCH:/notifications/threads/{id} - */ - threadsPartialUpdate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}`, - method: "PATCH", - ...params, - }), - - /** - * @description Delete a Thread Subscription. - * - * @name ThreadsSubscriptionDelete - * @request DELETE:/notifications/threads/{id}/subscription - */ - threadsSubscriptionDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}/subscription`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a Thread Subscription. - * - * @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, - }), - - /** - * @description Set a Thread Subscription. This lets you subscribe to a thread, or ignore it. Subscribing to a thread is unnecessary if the user is already subscribed to the repository. Ignoring a thread will mute all future notifications (until you comment or get @mentioned). - * - * @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 = { - /** - * @description Get an Organization. - * - * @name OrgsDetail - * @request GET:/orgs/{org} - */ - orgsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit an Organization. - * - * @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, - }), - - /** - * @description List public events for an organization. - * - * @name EventsDetail - * @request GET:/orgs/{org}/events - */ - eventsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/events`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List issues. List all issues for a given organization for the authenticated user. - * - * @name IssuesDetail - * @request GET:/orgs/{org}/issues - */ - issuesDetail: ( - org: string, - query: { - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "open" */ - state: "open" | "closed"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Members list. List all users who are members of an organization. A member is a user tha belongs to at least 1 team in the organization. If the authenticated user is also an owner of this organization then both concealed and public members will be returned. If the requester is not an owner of the organization the query will be redirected to the public members list. - * - * @name MembersDetail - * @request GET:/orgs/{org}/members - */ - membersDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/members`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Remove a member. Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. - * - * @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, - }), - - /** - * @description Check if a user is, publicly or privately, a member of the organization. - * - * @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, - }), - - /** - * @description Public members list. Members of an organization can choose to have their membership publicized or not. - * - * @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, - }), - - /** - * @description Conceal a user's membership. - * - * @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, - }), - - /** - * @description Check public membership. - * - * @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, - }), - - /** - * @description Publicize a user's membership. - * - * @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, - }), - - /** - * @description List repositories for the specified org. - * - * @name ReposDetail - * @request GET:/orgs/{org}/repos - */ - reposDetail: ( - org: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @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, - }), - - /** - * @description List teams. - * - * @name TeamsDetail - * @request GET:/orgs/{org}/teams - */ - teamsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/teams`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create team. In order to create a team, the authenticated user must be an owner of organization. - * - * @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 = { - /** - * @description Get your current rate limit status Note: Accessing this endpoint does not count against your rate limit. - * - * @name RateLimitList - * @request GET:/rate_limit - */ - rateLimitList: (params: RequestParams = {}) => - this.request({ - path: `/rate_limit`, - method: "GET", - format: "json", - ...params, - }), - }; - repos = { - /** - * @description Delete a Repository. Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required. - * - * @name ReposDelete - * @request DELETE:/repos/{owner}/{repo} - */ - reposDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get repository. - * - * @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, - }), - - /** - * @description Edit repository. - * - * @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, - }), - - /** - * @description List assignees. This call lists all the available assignees (owner + collaborators) to which issues may be assigned. - * - * @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, - }), - - /** - * @description Check assignee. You may also check to see if a particular user is an assignee for a repository. - * - * @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, - }), - - /** - * @description Get list of branches - * - * @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, - }), - - /** - * @description Get Branch - * - * @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, - }), - - /** - * @description List. When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list. - * - * @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, - }), - - /** - * @description Remove collaborator. - * - * @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, - }), - - /** - * @description Check if user is a collaborator - * - * @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, - }), - - /** - * @description Add collaborator. - * - * @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, - }), - - /** - * @description List commit comments for a repository. Comments are ordered by ascending ID. - * - * @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, - }), - - /** - * @description Delete a commit comment - * - * @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, - }), - - /** - * @description Get a single commit comment. - * - * @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, - }), - - /** - * @description Update a commit comment. - * - * @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, - }), - - /** - * @description List commits on a repository. - * - * @name CommitsDetail - * @request GET:/repos/{owner}/{repo}/commits - */ - commitsDetail: ( - owner: string, - repo: string, - query?: { - /** GitHub login, name, or email by which to filter by commit author. */ - author?: string; - /** Only commits containing this file path will be returned. */ - path?: string; - /** Sha or branch to start listing commits from. */ - sha?: string; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - /** ISO 8601 Date - Only commits before this date will be returned. */ - until?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/commits`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get the combined Status for a specific Ref The Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access this endpoint during the preview period, you must provide a custom media type in the Accept header: application/vnd.github.she-hulk-preview+json - * - * @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, - }), - - /** - * @description Get a single commit. - * - * @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, - }), - - /** - * @description List comments for a single commitList comments for a single commit. - * - * @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, - }), - - /** - * @description Create a commit comment. - * - * @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, - }), - - /** - * @description Compare two commits - * - * @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, - }), - - /** - * @description Delete a file. This method deletes a file in a repository. - * - * @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, - }), - - /** - * @description Get contents. This method returns the contents of a file or directory in a repository. Files and symlinks support a custom media type for getting the raw content. Directories and submodules do not support custom media types. Note: This API supports files up to 1 megabyte in size. Here can be many outcomes. For details see "http://developer.github.com/v3/repos/contents/" - * - * @name ContentsDetail - * @request GET:/repos/{owner}/{repo}/contents/{path} - */ - contentsDetail: ( - owner: string, - repo: string, - path: string, - query?: { - /** The content path. */ - path?: string; - /** The String name of the Commit/Branch/Tag. Defaults to 'master'. */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a file. - * - * @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, - }), - - /** - * @description Get list of contributors. - * - * @name ContributorsDetail - * @request GET:/repos/{owner}/{repo}/contributors - */ - contributorsDetail: ( - owner: string, - repo: string, - query: { - /** Set to 1 or true to include anonymous contributors in results. */ - anon: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/contributors`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Users with pull access can view deployments for a repository - * - * @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, - }), - - /** - * @description Users with push access can create a deployment for a given ref - * - * @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, - }), - - /** - * @description Users with pull access can view deployment statuses for a deployment - * - * @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, - }), - - /** - * @description Create a Deployment Status Users with push access can create deployment statuses for a given deployment: - * - * @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, - }), - - /** - * @description Deprecated. List downloads for a repository. - * - * @name DownloadsDetail - * @request GET:/repos/{owner}/{repo}/downloads - * @deprecated - */ - downloadsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/downloads`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Deprecated. Delete a download. - * - * @name DownloadsDelete - * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - */ - downloadsDelete: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Deprecated. Get a single download. - * - * @name DownloadsDetail2 - * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - * @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, - }), - - /** - * @description Get list of repository events. - * - * @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, - }), - - /** - * @description List forks. - * - * @name ForksDetail - * @request GET:/repos/{owner}/{repo}/forks - */ - forksDetail: ( - owner: string, - repo: string, - query?: { - /** @default "newes" */ - sort?: "newes" | "oldes" | "watchers"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/forks`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a fork. Forking a Repository happens asynchronously. Therefore, you may have to wai a short period before accessing the git objects. If this takes longer than 5 minutes, be sure to contact Support. - * - * @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, - }), - - /** - * @description Create a Blob. - * - * @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, - }), - - /** - * @description Get a Blob. Since blobs can be any arbitrary binary data, the input and responses for the blob API takes an encoding parameter that can be either utf-8 or base64. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it. - * - * @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, - }), - - /** - * @description Create a Commit. - * - * @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, - }), - - /** - * @description Get a Commit. - * - * @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, - }), - - /** - * @description Get all References - * - * @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, - }), - - /** - * @description Create a Reference - * - * @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, - }), - - /** - * @description Delete a Reference Example: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a Example: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0 - * - * @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, - }), - - /** - * @description Get a Reference - * - * @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, - }), - - /** - * @description Update a Reference - * - * @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, - }), - - /** - * @description Create a Tag Object. Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary. - * - * @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, - }), - - /** - * @description Get a Tag. - * - * @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, - }), - - /** - * @description Create a Tree. The tree creation API will take nested entries as well. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out. - * - * @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, - }), - - /** - * @description Get a Tree. - * - * @name GitTreesDetail - * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} - */ - gitTreesDetail: ( - owner: string, - repo: string, - shaCode: string, - query?: { - /** Get a Tree Recursively. (0 or 1) */ - recursive?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get list of hooks. - * - * @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, - }), - - /** - * @description Create a hook. - * - * @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, - }), - - /** - * @description Delete a hook. - * - * @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, - }), - - /** - * @description Get single hook. - * - * @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, - }), - - /** - * @description Edit a hook. - * - * @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, - }), - - /** - * @description Test a push hook. This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated. Note: Previously /repos/:owner/:repo/hooks/:id/tes - * - * @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, - }), - - /** - * @description List issues for a repository. - * - * @name IssuesDetail - * @request GET:/repos/{owner}/{repo}/issues - */ - issuesDetail: ( - owner: string, - repo: string, - query: { - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "open" */ - state: "open" | "closed"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create an issue. Any user with pull access to a repository can create an issue. - * - * @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, - }), - - /** - * @description List comments in a repository. - * - * @name IssuesCommentsDetail - * @request GET:/repos/{owner}/{repo}/issues/comments - */ - issuesCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - sort?: "created" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Delete a comment. - * - * @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, - }), - - /** - * @description Get a single comment. - * - * @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, - }), - - /** - * @description Edit a comment. - * - * @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, - }), - - /** - * @description List issue events for a repository. - * - * @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, - }), - - /** - * @description Get a single event. - * - * @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, - }), - - /** - * @description Get a single issue - * - * @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, - }), - - /** - * @description Edit an issue. Issue owners and users with push access can edit an issue. - * - * @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, - }), - - /** - * @description List comments on an issue. - * - * @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, - }), - - /** - * @description Create a comment. - * - * @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, - }), - - /** - * @description List events for an issue. - * - * @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, - }), - - /** - * @description Remove all labels from an issue. - * - * @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, - }), - - /** - * @description List labels on an issue. - * - * @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, - }), - - /** - * @description Add labels to an issue. - * - * @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, - }), - - /** - * @description Replace all labels for an issue. Sending an empty array ([]) will remove all Labels from the Issue. - * - * @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, - }), - - /** - * @description Remove a label from an issue. - * - * @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, - }), - - /** - * @description Get list of keys. - * - * @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, - }), - - /** - * @description Create a key. - * - * @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, - }), - - /** - * @description Delete a key. - * - * @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, - }), - - /** - * @description Get a key - * - * @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, - }), - - /** - * @description List all labels for this repository. - * - * @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, - }), - - /** - * @description Create a label. - * - * @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, - }), - - /** - * @description Delete a label. - * - * @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, - }), - - /** - * @description Get a single label. - * - * @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, - }), - - /** - * @description Update a label. - * - * @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, - }), - - /** - * @description List languages. List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language. - * - * @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, - }), - - /** - * @description Perform a merge. - * - * @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, - }), - - /** - * @description List milestones for a repository. - * - * @name MilestonesDetail - * @request GET:/repos/{owner}/{repo}/milestones - */ - milestonesDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "due_date" */ - sort?: "due_date" | "completeness"; - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/milestones`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a milestone. - * - * @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, - }), - - /** - * @description Delete a milestone. - * - * @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, - }), - - /** - * @description Get a single milestone. - * - * @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, - }), - - /** - * @description Update a milestone. - * - * @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, - }), - - /** - * @description Get labels for every issue in a milestone. - * - * @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, - }), - - /** - * @description List your notifications in a repository List all notifications for the current user. - * - * @name NotificationsDetail - * @request GET:/repos/{owner}/{repo}/notifications - */ - notificationsDetail: ( - owner: string, - repo: string, - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/notifications`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Mark notifications as read in a repository. Marking all notifications in a repository as "read" removes them from the default view on GitHub.com. - * - * @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, - }), - - /** - * @description List pull requests. - * - * @name PullsDetail - * @request GET:/repos/{owner}/{repo}/pulls - */ - pullsDetail: ( - owner: string, - repo: string, - query?: { - /** Filter pulls by base branch name. Example - gh-pages. */ - base?: string; - /** - * Filter pulls by head user and branch name in the format of 'user:ref-name'. - * Example: github:new-script-format. - */ - head?: string; - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a pull request. - * - * @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, - }), - - /** - * @description List comments in a repository. By default, Review Comments are ordered by ascending ID. - * - * @name PullsCommentsDetail - * @request GET:/repos/{owner}/{repo}/pulls/comments - */ - pullsCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - sort?: "created" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Delete a comment. - * - * @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, - }), - - /** - * @description Get a single comment. - * - * @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, - }), - - /** - * @description Edit a comment. - * - * @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, - }), - - /** - * @description Get a single pull request. - * - * @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, - }), - - /** - * @description Update a pull request. - * - * @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, - }), - - /** - * @description List comments on a pull request. - * - * @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, - }), - - /** - * @description Create a comment. #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ ) description: | Alternative Input. Instead of passing commit_id, path, and position you can reply to an existing Pull Request Comment like this: body Required string in_reply_to Required number - Comment id to reply to. - * - * @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, - }), - - /** - * @description List commits on a pull request. - * - * @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, - }), - - /** - * @description List pull requests files. - * - * @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, - }), - - /** - * @description Get if a pull request has been merged. - * - * @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, - }), - - /** - * @description Merge a pull request (Merge Button's) - * - * @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, - }), - - /** - * @description Get the README. This method returns the preferred README for a repository. - * - * @name ReadmeDetail - * @request GET:/repos/{owner}/{repo}/readme - */ - readmeDetail: ( - owner: string, - repo: string, - query?: { - /** The String name of the Commit/Branch/Tag. Defaults to master. */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/readme`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only - * - * @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, - }), - - /** - * @description Create a release Users with push access to the repository can create a release. - * - * @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, - }), - - /** - * @description Delete a release asset - * - * @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, - }), - - /** - * @description Get a single release asset - * - * @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, - }), - - /** - * @description Edit a release asset Users with push access to the repository can edit a release asset. - * - * @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, - }), - - /** - * @description Users with push access to the repository can delete a release. - * - * @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, - }), - - /** - * @description Get a single release - * - * @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, - }), - - /** - * @description Users with push access to the repository can edit a release - * - * @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, - }), - - /** - * @description List assets for a release - * - * @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, - }), - - /** - * @description List Stargazers. - * - * @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, - }), - - /** - * @description Get the number of additions and deletions per week. Returns a weekly aggregate of the number of additions and deletions pushed to a repository. - * - * @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, - }), - - /** - * @description Get the last year of commit activity data. Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday. - * - * @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, - }), - - /** - * @description Get contributors list with additions, deletions, and commit counts. - * - * @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, - }), - - /** - * @description Get the weekly commit count for the repo owner and everyone else. - * - * @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, - }), - - /** - * @description Get the number of commits per hour in each day. Each array contains the day number, hour number, and number of commits 0-6 Sunday - Saturday 0-23 Hour of day Number of commits For example, [2, 14, 25] indicates that there were 25 total commits, during the 2.00pm hour on Tuesdays. All times are based on the time zone of individual commits. - * - * @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, - }), - - /** - * @description List Statuses for a specific Ref. - * - * @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, - }), - - /** - * @description Create a Status. - * - * @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, - }), - - /** - * @description List watchers. - * - * @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, - }), - - /** - * @description Delete a Repository Subscription. - * - * @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, - }), - - /** - * @description Get a Repository Subscription. - * - * @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, - }), - - /** - * @description Set a Repository Subscription - * - * @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, - }), - - /** - * @description Get list of tags. - * - * @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, - }), - - /** - * @description Get list of teams - * - * @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, - }), - - /** - * @description List Stargazers. New implementation. - * - * @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, - }), - - /** - * @description Get archive link. This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. Note: For private repositories, these links are temporary and expire quickly. - * - * @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 = { - /** - * @description List all public repositories. This provides a dump of every public repository, in the order that they were created. Note: Pagination is powered exclusively by the since parameter. is the Link header to get the URL for the next page of repositories. - * - * @name RepositoriesList - * @request GET:/repositories - */ - repositoriesList: ( - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - search = { - /** - * @description Search code. - * - * @name CodeList - * @request GET:/search/code - */ - codeList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported code - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier - * you can restrict the search to just the file contents, the file path, - * or both. - * 'Languages' Searches code based on the language it's written in. - * 'Forks' Filters repositories based on the number of forks, and/or - * whether code from forked repositories should be included in the results - * at all. - * 'Size' Finds files that match a certain size (in bytes). - * 'Path' Specifies the path that the resulting file must be at. - * 'Extension' Matches files with a certain extension. - * 'Users' or 'Repositories' Limits searches to a specific user or repository. - */ - q: string; - /** - * Can only be 'indexed', which indicates how recently a file has been indexed - * by the GitHub search infrastructure. If not provided, results are sorted - * by best match. - */ - sort?: "indexed"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/code`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Find issues by state and keyword. (This method returns up to 100 results per page.) - * - * @name IssuesList - * @request GET:/search/issues - */ - issuesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The q search term can also contain any combination of the supported issue search qualifiers: */ - q: string; - /** The sort field. Can be comments, created, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "created" | "comments"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Search repositories. - * - * @name RepositoriesList - * @request GET:/search/repositories - */ - repositoriesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported repository - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the repository name, description, readme, - * or any combination of these. - * 'Size' Finds repositories that match a certain size (in kilobytes). - * 'Forks' Filters repositories based on the number of forks, and/or whether - * forked repositories should be included in the results at all. - * 'Created' and 'Last Updated' Filters repositories based on times of - * creation, or when they were last updated. - * 'Users or Repositories' Limits searches to a specific user or repository. - * 'Languages' Searches repositories based on the language they are written in. - * 'Stars' Searches repositories based on the number of stars. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "stars" | "forks" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Search users. - * - * @name UsersList - * @request GET:/search/users - */ - usersList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported user - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the username, public email, full name, - * location, or any combination of these. - * 'Repository count' Filters users based on the number of repositories they - * have. - * 'Location' Filter users by the location indicated in their profile. - * 'Language' Search for users that have repositories that match a certain - * language. - * 'Created' Filter users based on when they joined. - * 'Followers' Filter users based on the number of followers they have. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "followers" | "repositories" | "joined"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - teams = { - /** - * @description Delete team. In order to delete a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @name TeamsDelete - * @request DELETE:/teams/{teamId} - */ - teamsDelete: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get team. - * - * @name TeamsDetail - * @request GET:/teams/{teamId} - */ - teamsDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit team. In order to edit a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @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, - }), - - /** - * @description List team members. In order to list members in a team, the authenticated user must be a member of the team. - * - * @name MembersDetail - * @request GET:/teams/{teamId}/members - */ - membersDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description The "Remove team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships. Remove team member. In order to remove a user from a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. NOTE This does not delete the user, it just remove them from the team. - * - * @name MembersDelete - * @request DELETE:/teams/{teamId}/members/{username} - * @deprecated - */ - membersDelete: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description The "Get team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships. Get team member. In order to get if a user is a member of a team, the authenticated user mus be a member of the team. - * - * @name MembersDetail2 - * @request GET:/teams/{teamId}/members/{username} - * @deprecated - * @originalName membersDetail - * @duplicate - */ - membersDetail2: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "GET", - ...params, - }), - - /** - * @description The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams. Add team member. In order to add a user to a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. - * - * @name MembersUpdate - * @request PUT:/teams/{teamId}/members/{username} - * @deprecated - */ - membersUpdate: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "PUT", - ...params, - }), - - /** - * @description Remove team membership. In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team. - * - * @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, - }), - - /** - * @description Get team membership. In order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization. - * - * @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, - }), - - /** - * @description Add team membership. In order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. If the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team. If the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the 'pending' state until the user accepts the invitation, at which point the membership will transition to the 'active' state and the user will be added as a member of the team. - * - * @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, - }), - - /** - * @description List team repos - * - * @name ReposDetail - * @request GET:/teams/{teamId}/repos - */ - reposDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/repos`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team. - * - * @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, - }), - - /** - * @description Check if a team manages a repository - * - * @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, - }), - - /** - * @description In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization. - * - * @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 = { - /** - * @description Get the authenticated user. - * - * @name UserList - * @request GET:/user - */ - userList: (params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Update the authenticated user. - * - * @name UserPartialUpdate - * @request PATCH:/user - */ - userPartialUpdate: (body: UserUpdate, params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Delete email address(es). You can include a single email address or an array of addresses. - * - * @name EmailsDelete - * @request DELETE:/user/emails - */ - emailsDelete: (body: UserEmails, params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "DELETE", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description List email addresses for a user. In the final version of the API, this method will return an array of hashes with extended information for each email address indicating if the address has been verified and if it's primary email address for GitHub. Until API v3 is finalized, use the application/vnd.github.v3 media type to get other response format. - * - * @name EmailsList - * @request GET:/user/emails - */ - emailsList: (params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "GET", - ...params, - }), - - /** - * @description Add email address(es). You can post a single email address or an array of addresses. - * - * @name EmailsCreate - * @request POST:/user/emails - */ - emailsCreate: (body: EmailsPost, params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "POST", - body: body, - ...params, - }), - - /** - * @description List the authenticated user's followers - * - * @name FollowersList - * @request GET:/user/followers - */ - followersList: (params: RequestParams = {}) => - this.request({ - path: `/user/followers`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List who the authenticated user is following. - * - * @name FollowingList - * @request GET:/user/following - */ - followingList: (params: RequestParams = {}) => - this.request({ - path: `/user/following`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Unfollow a user. Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingDelete - * @request DELETE:/user/following/{username} - */ - followingDelete: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if you are following a user. - * - * @name FollowingDetail - * @request GET:/user/following/{username} - */ - followingDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "GET", - ...params, - }), - - /** - * @description Follow a user. Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingUpdate - * @request PUT:/user/following/{username} - */ - followingUpdate: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "PUT", - ...params, - }), - - /** - * @description List issues. List all issues across owned and member repositories for the authenticated user. - * - * @name IssuesList - * @request GET:/user/issues - */ - issuesList: ( - query: { - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "open" */ - state: "open" | "closed"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List your public keys. Lists the current user's keys. Management of public keys via the API requires that you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes. - * - * @name KeysList - * @request GET:/user/keys - */ - keysList: (params: RequestParams = {}) => - this.request({ - path: `/user/keys`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a public key. - * - * @name KeysCreate - * @request POST:/user/keys - */ - keysCreate: (body: UserKeysPost, params: RequestParams = {}) => - this.request({ - path: `/user/keys`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope. - * - * @name KeysDelete - * @request DELETE:/user/keys/{keyId} - */ - keysDelete: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single public key. - * - * @name KeysDetail - * @request GET:/user/keys/{keyId} - */ - keysDetail: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List public and private organizations for the authenticated user. - * - * @name OrgsList - * @request GET:/user/orgs - */ - orgsList: (params: RequestParams = {}) => - this.request({ - path: `/user/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List repositories for the authenticated user. Note that this does not include repositories owned by organizations which the user can access. You can lis user organizations and list organization repositories separately. - * - * @name ReposList - * @request GET:/user/repos - */ - reposList: ( - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @name ReposCreate - * @request POST:/user/repos - */ - reposCreate: (body: PostRepo, params: RequestParams = {}) => - this.request({ - path: `/user/repos`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description List repositories being starred by the authenticated user. - * - * @name StarredList - * @request GET:/user/starred - */ - starredList: ( - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "created" */ - sort?: "created" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/starred`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Unstar a repository - * - * @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, - }), - - /** - * @description Check if you are starring a repository. - * - * @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, - }), - - /** - * @description Star a repository. - * - * @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, - }), - - /** - * @description List repositories being watched by the authenticated user. - * - * @name SubscriptionsList - * @request GET:/user/subscriptions - */ - subscriptionsList: (params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Stop watching a repository - * - * @name SubscriptionsDelete - * @request DELETE:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if you are watching a repository. - * - * @name SubscriptionsDetail - * @request GET:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "GET", - ...params, - }), - - /** - * @description Watch a repository. - * - * @name SubscriptionsUpdate - * @request PUT:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsUpdate: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "PUT", - ...params, - }), - - /** - * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth. - * - * @name TeamsList - * @request GET:/user/teams - */ - teamsList: (params: RequestParams = {}) => - this.request({ - path: `/user/teams`, - method: "GET", - format: "json", - ...params, - }), - }; - users = { - /** - * @description Get all users. This provides a dump of every user, in the order that they signed up for GitHub. Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users. - * - * @name UsersList - * @request GET:/users - */ - usersList: ( - query?: { - /** The integer ID of the last user that you've seen. */ - since?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get a single user. - * - * @name UsersDetail - * @request GET:/users/{username} - */ - usersDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. - * - * @name EventsDetail - * @request GET:/users/{username}/events - */ - eventsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/events`, - method: "GET", - ...params, - }), - - /** - * @description This is the user's organization dashboard. You must be authenticated as the user to view this. - * - * @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, - }), - - /** - * @description List a user's followers - * - * @name FollowersDetail - * @request GET:/users/{username}/followers - */ - followersDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/followers`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Check if one user follows another. - * - * @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, - }), - - /** - * @description List a users gists. - * - * @name GistsDetail - * @request GET:/users/{username}/gists - */ - gistsDetail: ( - username: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List public keys for a user. Lists the verified public keys for a user. This is accessible by anyone. - * - * @name KeysDetail - * @request GET:/users/{username}/keys - */ - keysDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/keys`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List all public organizations for a user. - * - * @name OrgsDetail - * @request GET:/users/{username}/orgs - */ - orgsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description These are events that you'll only see public events. - * - * @name ReceivedEventsDetail - * @request GET:/users/{username}/received_events - */ - receivedEventsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/received_events`, - method: "GET", - ...params, - }), - - /** - * @description List public events that a user has received - * - * @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, - }), - - /** - * @description List public repositories for the specified user. - * - * @name ReposDetail - * @request GET:/users/{username}/repos - */ - reposDetail: ( - username: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List repositories being starred by a user. - * - * @name StarredDetail - * @request GET:/users/{username}/starred - */ - starredDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/starred`, - method: "GET", - ...params, - }), - - /** - * @description List repositories being watched by a user. - * - * @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/generated/v2.0/path-args.ts b/tests/generated/v2.0/path-args.ts deleted file mode 100644 index e8c521c6..00000000 --- a/tests/generated/v2.0/path-args.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* 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 = "http://unknown.io/v666"; - 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.clone() 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 Path Args - * @version 1.0.0 - * @license MIT - * @baseUrl http://unknown.io/v666 - */ -export class Api extends HttpClient { - pets = { - /** - * No description - * - * @tags pets - * @name ListPets - * @summary List all pets - * @request GET:/pets/{param1}/{param2}/{param3} - */ - listPets: ( - param3: number, - param1?: number, - param2?: number, - query?: { - /** - * How many items to return at one time (max 100) - * @format int32 - */ - queryParam?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pets/${param1}/${param2}/${param3}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/petstore-expanded.ts b/tests/generated/v2.0/petstore-expanded.ts deleted file mode 100644 index f903f774..00000000 --- a/tests/generated/v2.0/petstore-expanded.ts +++ /dev/null @@ -1,353 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Error { - /** @format int32 */ - code: number; - message: string; -} - -export interface NewPet { - name: string; - tag?: string; -} - -/** Page«TemplateResponseDto» */ -export interface PageTemplateResponseDto { - content?: any[]; - empty?: boolean; - first?: boolean; - last?: boolean; - /** @format int32 */ - number?: number; - /** @format int32 */ - numberOfElements?: number; - pageable?: any; - /** @format int32 */ - size?: number; - sort?: any; - /** @format int64 */ - totalElements?: number; - /** @format int32 */ - totalPages?: number; -} - -export type Pet = NewPet & { - /** @format int64 */ - id: number; -}; - -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 = "http://petstore.swagger.io/api"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/api - * @contact Swagger API Team (http://swagger.io) - * - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - pathParams = { - /** - * No description - * - * @name PathParamFooBarBazList - * @request GET:/path-params/{path-param}/{foo-bar-baz} - */ - pathParamFooBarBazList: (pathParam: string, fooBarBaz: string, params: RequestParams = {}) => - this.request({ - path: `/path-params/${pathParam}/${fooBarBaz}`, - method: "GET", - ...params, - }), - }; - pets = { - /** - * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. - * - * @name FindPets - * @request GET:/pets - */ - findPets: ( - query?: { - /** - * maximum number of results to return - * @format int32 - */ - limit?: number; - /** tags to filter by */ - tags?: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pets`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Creates a new pet in the store. Duplicates are allowed - * - * @name AddPet - * @request POST:/pets - */ - addPet: (pet: NewPet, params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "POST", - body: pet, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Returns a user based on a single ID, if the user does not have access to the pet - * - * @name FindPetById - * @request GET:/pets/{id} - */ - findPetById: (id: number, params: RequestParams = {}) => - this.request({ - path: `/pets/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description deletes a single pet based on the ID supplied - * - * @name DeletePet - * @request DELETE:/pets/{id} - */ - deletePet: (id: number, params: RequestParams = {}) => - this.request({ - path: `/pets/${id}`, - method: "DELETE", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/petstore-minimal.ts b/tests/generated/v2.0/petstore-minimal.ts deleted file mode 100644 index 618242fb..00000000 --- a/tests/generated/v2.0/petstore-minimal.ts +++ /dev/null @@ -1,256 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Pet { - /** @format int64 */ - id: number; - multiple?: string | number; - name: string; - tag?: string; -} - -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 = "http://petstore.swagger.io/api"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license MIT - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/api - * @contact Swagger API Team - * - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - pets = { - /** - * @description Returns all pets from the system that the user has access to - * - * @name PetsList - * @request GET:/pets - */ - petsList: (params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "GET", - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/petstore-simple.ts b/tests/generated/v2.0/petstore-simple.ts deleted file mode 100644 index 952bd81f..00000000 --- a/tests/generated/v2.0/petstore-simple.ts +++ /dev/null @@ -1,327 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface ErrorModel { - /** @format int32 */ - code: number; - message: string; -} - -export interface NewPet { - name: string; - tag?: string; -} - -export type Pet = NewPet & { - /** @format int64 */ - id: number; -}; - -/** Description of Test type */ -export type Test = NewPet; - -export interface Test2 { - /** Field description */ - data?: NewPet; -} - -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 = "http://petstore.swagger.io/api"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license MIT - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/api - * @contact Swagger API Team - * - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - pets = { - /** - * @description Returns all pets from the system that the user has access to - * - * @name FindPets - * @request GET:/pets - */ - findPets: ( - query?: { - /** - * maximum number of results to return - * @format int32 - */ - limit?: number; - /** tags to filter by */ - tags?: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pets`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Creates a new pet in the store. Duplicates are allowed - * - * @name AddPet - * @request POST:/pets - */ - addPet: (pet: NewPet, params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "POST", - body: pet, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Returns a user based on a single ID, if the user does not have access to the pet - * - * @name FindPetById - * @request GET:/pets/{id} - */ - findPetById: (id: number, params: RequestParams = {}) => - this.request({ - path: `/pets/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description deletes a single pet based on the ID supplied - * - * @name DeletePet - * @request DELETE:/pets/{id} - */ - deletePet: (id: number, params: RequestParams = {}) => - this.request({ - path: `/pets/${id}`, - method: "DELETE", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/petstore-swagger-io.ts b/tests/generated/v2.0/petstore-swagger-io.ts deleted file mode 100644 index a4a4ddb0..00000000 --- a/tests/generated/v2.0/petstore-swagger-io.ts +++ /dev/null @@ -1,685 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface ApiResponse { - /** @format int32 */ - code?: number; - message?: string; - type?: string; -} - -export interface Category { - /** @format int64 */ - id?: number; - name?: string; -} - -export interface Order { - complete?: boolean; - /** @format int64 */ - id?: number; - /** @format int64 */ - petId?: number; - /** @format int32 */ - quantity?: number; - /** @format date-time */ - shipDate?: string; - /** Order Status */ - status?: "placed" | "approved" | "delivered"; -} - -export interface Pet { - category?: Category; - /** @format int64 */ - id?: number; - /** @example "doggie" */ - name: string; - photoUrls: string[]; - /** pet status in the store */ - status?: "available" | "pending" | "sold"; - tags?: Tag[]; -} - -export interface Tag { - /** @format int64 */ - id?: number; - name?: string; -} - -export interface User { - email?: string; - firstName?: string; - /** @format int64 */ - id?: number; - lastName?: string; - password?: string; - phone?: string; - /** - * User Status - * @format int32 - */ - userStatus?: number; - username?: string; -} - -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://petstore.swagger.io/v2"; - 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.clone() 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 Swagger Petstore - * @version 1.0.3 - * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl https://petstore.swagger.io/v2 - * @externalDocs http://swagger.io - * @contact - * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - */ -export class Api extends HttpClient { - pet = { - /** - * @description Returns a single pet - * - * @tags pet - * @name GetPetById - * @summary Find pet by ID - * @request GET:/pet/{petId} - * @secure - */ - getPetById: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePetWithForm - * @summary Updates a pet in the store with form data - * @request POST:/pet/{petId} - * @secure - */ - updatePetWithForm: ( - petId: number, - data: { - /** Updated name of the pet */ - name?: string; - /** Updated status of the pet */ - status?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/${petId}`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name DeletePet - * @summary Deletes a pet - * @request DELETE:/pet/{petId} - * @secure - */ - deletePet: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UploadFile - * @summary uploads an image - * @request POST:/pet/{petId}/uploadImage - * @secure - */ - uploadFile: ( - petId: number, - data: { - /** Additional data to pass to server */ - additionalMetadata?: string; - /** file to upload */ - file?: File; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/${petId}/uploadImage`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pet - * @name AddPet - * @summary Add a new pet to the store - * @request POST:/pet - * @secure - */ - addPet: (body: Pet, params: RequestParams = {}) => - this.request({ - path: `/pet`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePet - * @summary Update an existing pet - * @request PUT:/pet - * @secure - */ - updatePet: (body: Pet, params: RequestParams = {}) => - this.request({ - path: `/pet`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * @description Multiple status values can be provided with comma separated strings - * - * @tags pet - * @name FindPetsByStatus - * @summary Finds Pets by status - * @request GET:/pet/findByStatus - * @secure - */ - findPetsByStatus: ( - query: { - /** Status values that need to be considered for filter */ - status: ("available" | "pending" | "sold")[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/findByStatus`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @tags pet - * @name FindPetsByTags - * @summary Finds Pets by tags - * @request GET:/pet/findByTags - * @deprecated - * @secure - */ - findPetsByTags: ( - query: { - /** Tags to filter by */ - tags: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/findByTags`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - }; - store = { - /** - * @description Returns a map of status codes to quantities - * - * @tags store - * @name GetInventory - * @summary Returns pet inventories by status - * @request GET:/store/inventory - * @secure - */ - getInventory: (params: RequestParams = {}) => - this.request, any>({ - path: `/store/inventory`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions - * - * @tags store - * @name GetOrderById - * @summary Find purchase order by ID - * @request GET:/store/order/{orderId} - */ - getOrderById: (orderId: number, params: RequestParams = {}) => - this.request({ - path: `/store/order/${orderId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors - * - * @tags store - * @name DeleteOrder - * @summary Delete purchase order by ID - * @request DELETE:/store/order/{orderId} - */ - deleteOrder: (orderId: number, params: RequestParams = {}) => - this.request({ - path: `/store/order/${orderId}`, - method: "DELETE", - ...params, - }), - - /** - * No description - * - * @tags store - * @name PlaceOrder - * @summary Place an order for a pet - * @request POST:/store/order - */ - placeOrder: (body: Order, params: RequestParams = {}) => - this.request({ - path: `/store/order`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - user = { - /** - * No description - * - * @tags user - * @name GetUserByName - * @summary Get user by user name - * @request GET:/user/{username} - */ - getUserByName: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name UpdateUser - * @summary Updated user - * @request PUT:/user/{username} - */ - updateUser: (username: string, body: User, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "PUT", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name DeleteUser - * @summary Delete user - * @request DELETE:/user/{username} - */ - deleteUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "DELETE", - ...params, - }), - - /** - * No description - * - * @tags user - * @name LoginUser - * @summary Logs user into the system - * @request GET:/user/login - */ - loginUser: ( - query: { - /** The password for login in clear text */ - password: string; - /** The user name for login */ - username: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/login`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags user - * @name LogoutUser - * @summary Logs out current logged in user session - * @request GET:/user/logout - */ - logoutUser: (params: RequestParams = {}) => - this.request({ - path: `/user/logout`, - method: "GET", - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name CreateUser - * @summary Create user - * @request POST:/user - */ - createUser: (body: User, params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithArrayInput - * @summary Creates list of users with given input array - * @request POST:/user/createWithArray - */ - createUsersWithArrayInput: (body: User[], params: RequestParams = {}) => - this.request({ - path: `/user/createWithArray`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithListInput - * @summary Creates list of users with given input array - * @request POST:/user/createWithList - */ - createUsersWithListInput: (body: User[], params: RequestParams = {}) => - this.request({ - path: `/user/createWithList`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/petstore-with-external-docs.ts b/tests/generated/v2.0/petstore-with-external-docs.ts deleted file mode 100644 index 902d064b..00000000 --- a/tests/generated/v2.0/petstore-with-external-docs.ts +++ /dev/null @@ -1,320 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface ErrorModel { - /** @format int32 */ - code: number; - message: string; -} - -export interface NewPet { - name: string; - tag?: string; -} - -export type Pet = NewPet & { - /** @format int64 */ - id: number; -}; - -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 = "http://petstore.swagger.io/api"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/api - * @externalDocs https://swagger.io/about - * @contact Swagger API Team (http://swagger.io) - * - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - pets = { - /** - * @description Returns all pets from the system that the user has access to - * - * @name FindPets - * @request GET:/pets - */ - findPets: ( - query?: { - /** - * maximum number of results to return - * @format int32 - */ - limit?: number; - /** tags to filter by */ - tags?: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pets`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Creates a new pet in the store. Duplicates are allowed - * - * @name AddPet - * @request POST:/pets - */ - addPet: (pet: NewPet, params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "POST", - body: pet, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Returns a user based on a single ID, if the user does not have access to the pet - * - * @name FindPetById - * @request GET:/pets/{id} - */ - findPetById: (id: number, params: RequestParams = {}) => - this.request({ - path: `/pets/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description deletes a single pet based on the ID supplied - * - * @name DeletePet - * @request DELETE:/pets/{id} - */ - deletePet: (id: number, params: RequestParams = {}) => - this.request({ - path: `/pets/${id}`, - method: "DELETE", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/petstore.ts b/tests/generated/v2.0/petstore.ts deleted file mode 100644 index 1a517200..00000000 --- a/tests/generated/v2.0/petstore.ts +++ /dev/null @@ -1,302 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Error { - /** @format int32 */ - code: number; - message: string; -} - -export interface Pet { - /** @format int64 */ - id: number; - name: string; - tag?: string; -} - -export type Pets = Pet[]; - -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 = "http://petstore.swagger.io/v1"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license MIT - * @baseUrl http://petstore.swagger.io/v1 - */ -export class Api extends HttpClient { - pets = { - /** - * No description - * - * @tags pets - * @name ListPets - * @summary List all pets - * @request GET:/pets - */ - listPets: ( - query?: { - /** - * How many items to return at one time (max 100) - * @format int32 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pets`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pets - * @name CreatePets - * @summary Create a pet - * @request POST:/pets - */ - createPets: (params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "POST", - ...params, - }), - - /** - * No description - * - * @tags pets - * @name ShowPetById - * @summary Info for a specific pet - * @request GET:/pets/{petId} - */ - showPetById: (petId: string, params: RequestParams = {}) => - this.request({ - path: `/pets/${petId}`, - method: "GET", - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/query-path-param.ts b/tests/generated/v2.0/query-path-param.ts deleted file mode 100644 index 24c57b78..00000000 --- a/tests/generated/v2.0/query-path-param.ts +++ /dev/null @@ -1,257 +0,0 @@ -/* 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 = "http://unknown.io/v666"; - 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.clone() 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 Query Path Param - * @version 1.0.0 - * @license MIT - * @baseUrl http://unknown.io/v666 - */ -export class Api extends HttpClient { - foobarbaz = { - /** - * No description - * - * @tags pets - * @name ListPets - * @summary List all pets - * @request GET:/foobarbaz/{query} - */ - listPets: ( - query?: number, - queryParams?: { - /** - * How many items to return at one time (max 100) - * @format int32 - */ - queryParam?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/foobarbaz/${query}`, - method: "GET", - query: queryParams, - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v2.0/uber.ts b/tests/generated/v2.0/uber.ts deleted file mode 100644 index 68597934..00000000 --- a/tests/generated/v2.0/uber.ts +++ /dev/null @@ -1,472 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Activities { - /** - * Total number of items available. - * @format int32 - */ - count?: number; - history?: Activity[]; - /** - * Number of items to retrieve (100 max). - * @format int32 - */ - limit?: number; - /** - * Position in pagination. - * @format int32 - */ - offset?: number; -} - -export interface Activity { - /** Unique identifier for the activity */ - uuid?: string; -} - -export interface Error { - /** @format int32 */ - code?: number; - fields?: string; - message?: string; -} - -export interface PriceEstimate { - /** [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code. */ - currency_code?: string; - /** Display name of product. */ - display_name?: string; - /** Formatted string of estimate in local currency of the start location. Estimate could be a range, a single number (flat rate) or "Metered" for TAXI. */ - estimate?: string; - /** Upper bound of the estimated price. */ - high_estimate?: number; - /** Lower bound of the estimated price. */ - low_estimate?: number; - /** Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles */ - product_id?: string; - /** Expected surge multiplier. Surge is active if surge_multiplier is greater than 1. Price estimate already factors in the surge multiplier. */ - surge_multiplier?: number; -} - -export interface Product { - /** Capacity of product. For example, 4 people. */ - capacity?: number; - /** Description of product. */ - description?: string; - /** Display name of product. */ - display_name?: string; - /** Image URL representing the product. */ - image?: string; - /** Unique identifier representing a specific product for a given latitude & longitude. For example, uberX in San Francisco will have a different product_id than uberX in Los Angeles. */ - product_id?: string; -} - -export interface ProductList { - /** Contains the list of products */ - products?: Product[]; -} - -export interface Profile { - /** Email address of the Uber user */ - email?: string; - /** First name of the Uber user. */ - first_name?: string; - /** Last name of the Uber user. */ - last_name?: string; - /** Image URL of the Uber user. */ - picture?: string; - /** Promo code of the Uber user. */ - promo_code?: string; -} - -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://api.uber.com/v1"; - 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.clone() 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 Uber API - * @version 1.0.0 - * @baseUrl https://api.uber.com/v1 - * - * Move your app forward with the Uber API - */ -export class Api extends HttpClient { - products = { - /** - * @description The Products endpoint returns information about the Uber products offered at a given location. The response includes the display name and other details about each product, and lists the products in the proper display order. - * - * @tags Products - * @name ProductsList - * @summary Product Types - * @request GET:/products - * @secure - */ - productsList: ( - query: { - /** - * Latitude component of location. - * @format double - */ - latitude: number; - /** - * Longitude component of location. - * @format double - */ - longitude: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/products`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - }; - estimates = { - /** - * @description The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.

The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier. - * - * @tags Estimates - * @name PriceList - * @summary Price Estimates - * @request GET:/estimates/price - */ - priceList: ( - query: { - /** - * Latitude component of end location. - * @format double - */ - end_latitude?: number; - /** - * Longitude component of end location. - * @format double - */ - end_longitude: number; - /** - * Latitude component of start location. - * @format double - */ - start_latitude: number; - /** - * Longitude component of start location. - * @format double - */ - start_longitude: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/estimates/price`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description The Time Estimates endpoint returns ETAs for all products offered at a given location, with the responses expressed as integers in seconds. We recommend that this endpoint be called every minute to provide the most accurate, up-to-date ETAs. - * - * @tags Estimates - * @name TimeList - * @summary Time Estimates - * @request GET:/estimates/time - */ - timeList: ( - query: { - /** - * Unique customer identifier to be used for experience customization. - * @format uuid - */ - customer_uuid?: string; - /** Unique identifier representing a specific product for a given latitude & longitude. */ - product_id?: string; - /** - * Latitude component of start location. - * @format double - */ - start_latitude: number; - /** - * Longitude component of start location. - * @format double - */ - start_longitude: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/estimates/time`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - me = { - /** - * @description The User Profile endpoint returns information about the Uber user that has authorized with the application. - * - * @tags User - * @name GetMe - * @summary User Profile - * @request GET:/me - */ - getMe: (params: RequestParams = {}) => - this.request({ - path: `/me`, - method: "GET", - format: "json", - ...params, - }), - }; - history = { - /** - * @description The User Activity endpoint returns data about a user's lifetime activity with Uber. The response will include pickup locations and times, dropoff locations and times, the distance of past requests, and information about which products were requested.

The history array in the response will have a maximum length based on the limit parameter. The response value count may exceed limit, therefore subsequent API requests may be necessary. - * - * @tags User - * @name HistoryList - * @summary User Activity - * @request GET:/history - */ - historyList: ( - query?: { - /** - * Number of items to retrieve. Default is 5, maximum is 100. - * @format int32 - */ - limit?: number; - /** - * Offset the list of returned results by this amount. Default is zero. - * @format int32 - */ - offset?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/history`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/additional-properties.ts b/tests/generated/v3.0/additional-properties.ts deleted file mode 100644 index bbf18d8f..00000000 --- a/tests/generated/v3.0/additional-properties.ts +++ /dev/null @@ -1,233 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Message { - code?: number; - text?: string; -} - -export type Messages = Record; - -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.clone() 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 Additional properties Example - * @version 1.0.0 - */ -export class Api extends HttpClient {} diff --git a/tests/generated/v3.0/additional-properties2.ts b/tests/generated/v3.0/additional-properties2.ts deleted file mode 100644 index 84c93361..00000000 --- a/tests/generated/v3.0/additional-properties2.ts +++ /dev/null @@ -1,229 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type Primitive = string | number | boolean | null; - -export type PrimitiveMap = Record; - -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.clone() 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 - */ -export class Api extends HttpClient {} diff --git a/tests/generated/v3.0/allof-example.ts b/tests/generated/v3.0/allof-example.ts deleted file mode 100644 index 8574e2ff..00000000 --- a/tests/generated/v3.0/allof-example.ts +++ /dev/null @@ -1,257 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type Cat = Pet & { - age?: number; - hunts?: boolean; -}; - -export type Dog = Pet & { - bark?: boolean; - breed: "Dingo" | "Husky" | "Retriever" | "Shepherd"; -}; - -export interface Pet { - pet_type: string; -} - -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.clone() 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 Allof Example - * @version 1.0.0 - */ -export class Api extends HttpClient { - pets = { - /** - * No description - * - * @name PetsPartialUpdate - * @request PATCH:/pets - */ - petsPartialUpdate: (data: Cat | Dog, params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "PATCH", - body: data, - type: ContentType.Json, - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/anyof-example.ts b/tests/generated/v3.0/anyof-example.ts deleted file mode 100644 index 7b952cdd..00000000 --- a/tests/generated/v3.0/anyof-example.ts +++ /dev/null @@ -1,253 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface PetByAge { - age: number; - nickname?: string; -} - -export interface PetByType { - hunts?: boolean; - pet_type: "Cat" | "Dog"; -} - -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.clone() 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 Anyof Example - * @version 1.0.0 - */ -export class Api extends HttpClient { - pets = { - /** - * No description - * - * @name PetsPartialUpdate - * @request PATCH:/pets - */ - petsPartialUpdate: (data: PetByAge | PetByType, params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "PATCH", - body: data, - type: ContentType.Json, - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/api-with-examples.ts b/tests/generated/v3.0/api-with-examples.ts deleted file mode 100644 index af498c48..00000000 --- a/tests/generated/v3.0/api-with-examples.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* 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 = ""; - 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.clone() 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 Simple API overview - * @version 2.0.0 - */ -export class Api extends HttpClient { - /** - * No description - * - * @name ListVersionsv2 - * @summary List API versions - * @request GET:/ - */ - listVersionsv2 = (params: RequestParams = {}) => - this.request({ - path: `/`, - method: "GET", - format: "json", - ...params, - }); - - v2 = { - /** - * No description - * - * @name GetVersionDetailsv2 - * @summary Show API version details - * @request GET:/v2 - */ - getVersionDetailsv2: (params: RequestParams = {}) => - this.request({ - path: `/v2`, - method: "GET", - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/callback-example.ts b/tests/generated/v3.0/callback-example.ts deleted file mode 100644 index 7ea2467f..00000000 --- a/tests/generated/v3.0/callback-example.ts +++ /dev/null @@ -1,263 +0,0 @@ -/* 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 = ""; - 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.clone() 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 Callback Example - * @version 1.0.0 - */ -export class Api extends HttpClient { - streams = { - /** - * @description subscribes a client to receive out-of-band data - * - * @name StreamsCreate - * @request POST:/streams - */ - streamsCreate: ( - query: { - /** - * the location where data will be sent. Must be network accessible - * by the source server - * @format uri - * @example "https://tonys-server.com" - */ - callbackUrl: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** - * this unique identifier allows management of the subscription - * @example "2531329f-fb09-4ef7-887e-84e648214436" - */ - subscriptionId: string; - }, - any - >({ - path: `/streams`, - method: "POST", - query: query, - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/components-responses.ts b/tests/generated/v3.0/components-responses.ts deleted file mode 100644 index bb72ddfd..00000000 --- a/tests/generated/v3.0/components-responses.ts +++ /dev/null @@ -1,248 +0,0 @@ -/* 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 = ""; - 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.clone() 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 Title - * @version latest - * - * Description - */ -export class Api extends HttpClient { - api = { - /** - * No description - * - * @name GetData - * @request GET:/api - */ - getData: (params: RequestParams = {}) => - this.request< - { - data?: string; - }, - any - >({ - path: `/api`, - method: "GET", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/explode-param-3.0.1.ts b/tests/generated/v3.0/explode-param-3.0.1.ts deleted file mode 100644 index b3c020cb..00000000 --- a/tests/generated/v3.0/explode-param-3.0.1.ts +++ /dev/null @@ -1,294 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Floop { - info?: string; -} - -export interface QueryParams { - /** - * Page size - * @format int32 - * @min 0 - */ - "page-size"?: number | null; - /** - * Page number - * @format int32 - * @min 0 - */ - page?: number | null; -} - -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.clone() 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 API - * @version 0.1 - * - * Documentation - */ -export class Api extends HttpClient { - user = { - /** - * No description - * - * @name CreateFile - * @summary Some summary - * @request POST:/{user}/foos - */ - createFile: ( - user: string, - data: { - /** @default "" */ - meme: string; - memeType?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/${user}/foos`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - something = { - /** - * No description - * - * @name Gets - * @request GET:/something/ - */ - gets: ( - query?: { - params?: QueryParams; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/something/`, - method: "GET", - query: query, - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/link-example.ts b/tests/generated/v3.0/link-example.ts deleted file mode 100644 index 127cd943..00000000 --- a/tests/generated/v3.0/link-example.ts +++ /dev/null @@ -1,336 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Pullrequest { - author?: User; - id?: number; - repository?: Repository; - title?: string; -} - -export interface Repository { - owner?: User; - slug?: string; -} - -export interface User { - username?: string; - uuid?: string; -} - -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.clone() 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 Link Example - * @version 1.0.0 - */ -export class Api extends HttpClient { - v20 = { - /** - * No description - * - * @name GetUserByName - * @request GET:/2.0/users/{username} - */ - getUserByName: (username: string, params: RequestParams = {}) => - this.request({ - path: `/2.0/users/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name GetRepositoriesByOwner - * @request GET:/2.0/repositories/{username} - */ - getRepositoriesByOwner: (username: string, params: RequestParams = {}) => - this.request({ - path: `/2.0/repositories/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name GetRepository - * @request GET:/2.0/repositories/{username}/{slug} - */ - getRepository: (username: string, slug: string, params: RequestParams = {}) => - this.request({ - path: `/2.0/repositories/${username}/${slug}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name GetPullRequestsByRepository - * @request GET:/2.0/repositories/{username}/{slug}/pullrequests - */ - getPullRequestsByRepository: ( - username: string, - slug: string, - query?: { - state?: "open" | "merged" | "declined"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/2.0/repositories/${username}/${slug}/pullrequests`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @name GetPullRequestsById - * @request GET:/2.0/repositories/{username}/{slug}/pullrequests/{pid} - */ - getPullRequestsById: (username: string, slug: string, pid: string, params: RequestParams = {}) => - this.request({ - path: `/2.0/repositories/${username}/${slug}/pullrequests/${pid}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name MergePullRequest - * @request POST:/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge - */ - mergePullRequest: (username: string, slug: string, pid: string, params: RequestParams = {}) => - this.request({ - path: `/2.0/repositories/${username}/${slug}/pullrequests/${pid}/merge`, - method: "POST", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/no-definitions-schema.ts b/tests/generated/v3.0/no-definitions-schema.ts deleted file mode 100644 index 6ae05ba1..00000000 --- a/tests/generated/v3.0/no-definitions-schema.ts +++ /dev/null @@ -1,240 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface BasicErrorModel { - /** - * @min 100 - * @max 600 - */ - code: number; - field?: string | null; - message: string; -} - -export type ExtendedErrorModel = BasicErrorModel & { - rootCause: string; -}; - -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.clone() 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 Empty schema example - * @version 1.0.0 - */ -export class Api extends HttpClient {} diff --git a/tests/generated/v3.0/oneof-example.ts b/tests/generated/v3.0/oneof-example.ts deleted file mode 100644 index 5621d729..00000000 --- a/tests/generated/v3.0/oneof-example.ts +++ /dev/null @@ -1,253 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Cat { - age?: number; - hunts?: boolean; -} - -export interface Dog { - bark?: boolean; - breed?: "Dingo" | "Husky" | "Retriever" | "Shepherd"; -} - -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.clone() 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 Oneof Example - * @version 1.0.0 - */ -export class Api extends HttpClient { - pets = { - /** - * No description - * - * @name PetsPartialUpdate - * @request PATCH:/pets - */ - petsPartialUpdate: (data: Cat | Dog, params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "PATCH", - body: data, - type: ContentType.Json, - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/personal-api-example.ts b/tests/generated/v3.0/personal-api-example.ts deleted file mode 100644 index 1e9454bc..00000000 --- a/tests/generated/v3.0/personal-api-example.ts +++ /dev/null @@ -1,606 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type AuthUserType = OmitIdUserType; - -export type ExtractedProjectType = OmitProjectTypeJob & { - /** Information about job */ - job: JobType; -}; - -/** Information about job */ -export interface FooBar { - kind?: JobKind; -} - -/** Information about job */ -export interface FooBarBaz { - id?: string; - kind?: JobKind; - link?: string; - name?: string; - [key: string]: any; -} - -/** Information about job */ -export interface FooBaz { - link?: string; - name?: string; -} - -/** - * FooBar - * @format int32 - */ -export enum IntEnumWithNames { - Unknown = 0, - String = 1, - Int32 = 2, - Int64 = 3, - Double = 4, - DateTime = 5, - Test2 = 6, - Test23 = 7, - Tess44 = 8, - BooFar = 9, -} - -export enum JobKind { - COMPANY = "COMPANY", - PERSONAL = "PERSONAL", - FREELANCE = "FREELANCE", - OPEN_SOURCE = "OPEN_SOURCE", -} - -/** Information about job */ -export interface JobType { - /** web site address */ - address?: string; - /** - * Exist only in open source jobs - * Format: `${username}/${projectName}` - */ - github?: string; - id: string; - /** - * Exist only in open source jobs - * Means project is dev. tool (like swagger code generator) - */ - isTool?: boolean; - kind: JobKind; - link?: string; - name?: string; - /** - * Exist only in open source jobs - * Format: `${orgname}/${projectName}` - */ - npm?: string; -} - -export type JobUpdateType = OmitIdJobType; - -export interface NullableEnum { - /** @format int64 */ - id?: number; - legalCategory?: "SARL" | "ASSOCIATION" | null; -} - -export type OmitIdJobType = OmitJobTypeIdOrId; - -export type OmitIdProjectType = OmitProjectTypeIdOrId; - -export type OmitIdUserType = OmitUserTypeIdOrId; - -export type OmitJobTypeIdOrId = PickJobTypeExcludeKeysIdOrId; - -export type OmitProjectTypeIdOrId = PickProjectTypeExcludeKeysIdOrId; - -export type OmitProjectTypeJob = PickProjectTypeExcludeKeysJob; - -export type OmitUserTypeIdOrId = PickUserTypeExcludeKeysIdOrId; - -/** From T, pick a set of properties whose keys are in the union K */ -export interface PickJobTypeExcludeKeysIdOrId { - /** web site address */ - address?: string; - /** - * Exist only in open source jobs - * Format: `${username}/${projectName}` - */ - github?: string; - /** - * Exist only in open source jobs - * Means project is dev. tool (like swagger code generator) - */ - isTool?: boolean; - kind: JobKind; - link?: string; - name?: string; - /** - * Exist only in open source jobs - * Format: `${orgname}/${projectName}` - */ - npm?: string; -} - -/** From T, pick a set of properties whose keys are in the union K */ -export interface PickProjectTypeExcludeKeysIdOrId { - description: string; - job: string; - name?: string; - notImportant?: boolean; - prefix?: string; - tags: string[]; - teamSize: string; - /** @format double */ - year: number; -} - -/** From T, pick a set of properties whose keys are in the union K */ -export interface PickProjectTypeExcludeKeysJob { - description: string; - id: string; - name?: string; - notImportant?: boolean; - prefix?: string; - tags: string[]; - teamSize: string; - /** @format double */ - year: number; -} - -/** From T, pick a set of properties whose keys are in the union K */ -export interface PickUserTypeExcludeKeysIdOrId { - password: string; - username: string; -} - -export interface ProjectType { - description: string; - id: string; - job: string; - name?: string; - notImportant?: boolean; - prefix?: string; - tags: string[]; - teamSize: string; - /** @format double */ - year: number; -} - -export type ProjectUpdateType = OmitIdProjectType; - -export type TestAllOfDc = (FooBarBaz & FooBar) & { - prop?: string; -}; - -export type TestAllOfDc2 = FooBarBaz & { - prop?: string; -}; - -export type TestAnyOfDc = (FooBarBaz | FooBar) & { - prop?: string; -}; - -export type TestOneOfDc = (FooBarBaz | FooBar) & { - prop?: string; -}; - -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 = "http://localhost:8080/api/v1"; - 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.clone() 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 http://localhost:8080/api/v1 - */ -export class Api extends HttpClient { - auth = { - /** - * No description - * - * @tags Auth - * @name Login - * @request POST:/auth - */ - login: (data: AuthUserType, params: RequestParams = {}) => - this.request({ - path: `/auth`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Auth - * @name Refresh - * @request POST:/auth/refresh - * @secure - */ - refresh: (params: RequestParams = {}) => - this.request({ - path: `/auth/refresh`, - method: "POST", - secure: true, - format: "json", - ...params, - }), - }; - jobs = { - /** - * No description - * - * @tags Jobs - * @name GetJobs - * @request GET:/jobs - * @secure - */ - getJobs: (params: RequestParams = {}) => - this.request({ - path: `/jobs`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name AddJob - * @request POST:/jobs - * @secure - */ - addJob: (data: JobUpdateType, params: RequestParams = {}) => - this.request({ - path: `/jobs`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name GetJob - * @request GET:/jobs/{id} - * @secure - */ - getJob: (id: string, params: RequestParams = {}) => - this.request({ - path: `/jobs/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name UpdateJob - * @request PATCH:/jobs/{id} - * @secure - */ - updateJob: (id: string, params: JobUpdateType, requestParams: RequestParams = {}) => - this.request({ - path: `/jobs/${id}`, - method: "PATCH", - body: params, - secure: true, - type: ContentType.Json, - format: "json", - ...requestParams, - }), - - /** - * No description - * - * @tags Jobs - * @name DeleteJob - * @request DELETE:/jobs/{id} - * @secure - */ - deleteJob: (id: string, params: RequestParams = {}) => - this.request({ - path: `/jobs/${id}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - }; - projects = { - /** - * No description - * - * @tags Projects - * @name GetProjects - * @request GET:/projects - */ - getProjects: (params: RequestParams = {}) => - this.request({ - path: `/projects`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Projects - * @name AddProjects - * @request POST:/projects - * @secure - */ - addProjects: (data: ProjectUpdateType, params: RequestParams = {}) => - this.request({ - path: `/projects`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Projects - * @name UpdateProject - * @request PATCH:/projects/{id} - * @secure - */ - updateProject: (id: string, data: ProjectUpdateType, params: RequestParams = {}) => - this.request({ - path: `/projects/${id}`, - method: "PATCH", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Projects - * @name DeleteProject - * @request DELETE:/projects/{id} - */ - deleteProject: (id: string, params: RequestParams = {}) => - this.request({ - path: `/projects/${id}`, - method: "DELETE", - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/petstore-expanded.ts b/tests/generated/v3.0/petstore-expanded.ts deleted file mode 100644 index 26ac904a..00000000 --- a/tests/generated/v3.0/petstore-expanded.ts +++ /dev/null @@ -1,319 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Error { - /** @format int32 */ - code: number; - message: string; -} - -export interface NewPet { - name: string; - tag?: string; -} - -export type Pet = NewPet & { - /** @format int64 */ - id: number; -}; - -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 = "http://petstore.swagger.io/api"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/api - * @contact Swagger API Team (http://swagger.io) - * - * A sample API that uses a petstore as an example to demonstrate features in the OpenAPI 3.0 specification - */ -export class Api extends HttpClient { - pets = { - /** - * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. - * - * @name FindPets - * @request GET:/pets - */ - findPets: ( - query?: { - /** - * maximum number of results to return - * @format int32 - */ - limit?: number; - /** tags to filter by */ - tags?: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pets`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Creates a new pet in the store. Duplicates are allowed - * - * @name AddPet - * @request POST:/pets - */ - addPet: (data: NewPet, params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Returns a user based on a single ID, if the user does not have access to the pet - * - * @name FindPetById - * @request GET:/pets/{id} - */ - findPetById: (id: number, params: RequestParams = {}) => - this.request({ - path: `/pets/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description deletes a single pet based on the ID supplied - * - * @name DeletePet - * @request DELETE:/pets/{id} - */ - deletePet: (id: number, params: RequestParams = {}) => - this.request({ - path: `/pets/${id}`, - method: "DELETE", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/petstore.ts b/tests/generated/v3.0/petstore.ts deleted file mode 100644 index 7ac4b9ef..00000000 --- a/tests/generated/v3.0/petstore.ts +++ /dev/null @@ -1,304 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Error { - /** @format int32 */ - code: number; - message: string; -} - -export interface Pet { - /** @format int64 */ - id: number; - name: string; - tag?: string; -} - -export type Pets = Pet[]; - -export type StringNullable = string | null; - -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 = "http://petstore.swagger.io/v1"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license MIT - * @baseUrl http://petstore.swagger.io/v1 - */ -export class Api extends HttpClient { - pets = { - /** - * No description - * - * @tags pets - * @name ListPets - * @summary List all pets - * @request GET:/pets - */ - listPets: ( - query?: { - /** - * How many items to return at one time (max 100) - * @format int32 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pets`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pets - * @name CreatePets - * @summary Create a pet - * @request POST:/pets - */ - createPets: (params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "POST", - ...params, - }), - - /** - * No description - * - * @tags pets - * @name ShowPetById - * @summary Info for a specific pet - * @request GET:/pets/{petId} - */ - showPetById: (petId: string, params: RequestParams = {}) => - this.request({ - path: `/pets/${petId}`, - method: "GET", - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/recursive-schema.ts b/tests/generated/v3.0/recursive-schema.ts deleted file mode 100644 index 681923e1..00000000 --- a/tests/generated/v3.0/recursive-schema.ts +++ /dev/null @@ -1,236 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** RECURSIVE */ -export interface RecursiveObject { - /** RECURSIVE */ - bar?: RecursiveObject; - /** - * Unique identifier of the GitHub app - * @example 37 - */ - id?: number; -} - -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.clone() 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 - */ -export class Api extends HttpClient {} diff --git a/tests/generated/v3.0/responses.ts b/tests/generated/v3.0/responses.ts deleted file mode 100644 index e192574f..00000000 --- a/tests/generated/v3.0/responses.ts +++ /dev/null @@ -1,249 +0,0 @@ -/* 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 = ""; - 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.clone() 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 Title - * @version latest - * - * Description - */ -export class Api extends HttpClient { - api = { - /** - * No description - * - * @name GetData - * @request GET:/api - */ - getData: (params: RequestParams = {}) => - this.request< - { - data?: string; - }, - any - >({ - path: `/api`, - method: "GET", - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/swaggerhub-template.ts b/tests/generated/v3.0/swaggerhub-template.ts deleted file mode 100644 index d84b0fbd..00000000 --- a/tests/generated/v3.0/swaggerhub-template.ts +++ /dev/null @@ -1,262 +0,0 @@ -/* 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://virtserver.swaggerhub.com/sdfsdfsffs/sdfff/1.0.0"; - 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.clone() 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 Sample Application Flow OAuth2 Project - * @version 1.0.0 - * @baseUrl https://virtserver.swaggerhub.com/sdfsdfsffs/sdfff/1.0.0 - * - * This is an example of using OAuth2 Application Flow in a specification to describe security to your API. - */ -export class Api extends HttpClient { - example = { - /** - * @description This is an example operation to show how security is applied to the call. - * - * @name ExampleList - * @summary Server example operation - * @request GET:/example - * @secure - */ - exampleList: (params: RequestParams = {}) => - this.request({ - path: `/example`, - method: "GET", - secure: true, - ...params, - }), - }; - ping = { - /** - * @description This operation shows how to override the global security defined above, as we want to open it up for all users. - * - * @name PingList - * @summary Server heartbeat operation - * @request GET:/ping - */ - pingList: (params: RequestParams = {}) => - this.request({ - path: `/ping`, - method: "GET", - ...params, - }), - }; -} 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 deleted file mode 100644 index f1b9f054..00000000 --- a/tests/generated/v3.0/tsoa-odd-types-3.0.2.ts +++ /dev/null @@ -1,627 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface AuthUser { - password: string; - username: string; -} - -export interface GetProfileBioDTO { - /** @format int32 */ - candidateId?: number; - cityName?: string | null; -} - -export interface Job { - address?: string | null; - github?: string | null; - id: string; - isTool?: boolean | null; - kind: Kind; - link?: string | null; - name?: string | null; - npm?: string | null; -} - -export type JobUpdate = OmitJobId | PickJobGithub | Record; - -export enum Kind { - COMPANY = "COMPANY", - PERSONAL = "PERSONAL", - FREELANCE = "FREELANCE", - OPEN_SOURCE = "OPEN_SOURCE", -} - -export type OmitJobId = PickJobExcludeKeysId; - -/** From T, pick a set of properties whose keys are in the union K */ -export interface PickJobExcludeKeysId { - address?: string; - github?: string; - isTool?: boolean; - kind: Kind; - link?: string; - name?: string; - 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; - name?: string; - notImportant?: boolean; - prefix?: string; - tags: string[]; - teamSize: string; - /** @format double */ - year: number; -} - -export interface Project { - description: string; - id: string; - job: Job; - name?: string | null; - notImportant?: boolean | null; - prefix?: string | null; - tags: string[]; - teamSize: string; - /** @format double */ - year: number; -} - -export interface ProjectUpdate { - description: string; - job: string; - name?: string | null; - notImportant?: boolean | null; - prefix?: string | null; - tags: string[]; - teamSize: string; - /** @format double */ - year: number; -} - -export type UpdatedJob = Job; - -export interface UpdatedProject { - description: string; - id: string; - job: string; - name?: string | null; - notImportant?: boolean | null; - prefix?: string | null; - tags: string[]; - teamSize: string; - /** @format double */ - year: number; -} - -export interface User { - id: string; - username: string; -} - -export interface UserUpdate { - id?: string | null; - username?: string | null; -} - -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 = "http://localhost:8080/api/v1"; - 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.clone() 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 http://localhost:8080/api/v1 - */ -export class Api extends HttpClient { - auth = { - /** - * No description - * - * @tags Auth - * @name Login - * @request POST:/auth - */ - login: (data?: AuthUser, params: RequestParams = {}) => - this.request({ - path: `/auth`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Auth - * @name Refresh - * @request POST:/auth/refresh - * @secure - */ - refresh: (params: RequestParams = {}) => - this.request({ - path: `/auth/refresh`, - method: "POST", - secure: true, - format: "json", - ...params, - }), - }; - jobs = { - /** - * No description - * - * @tags Jobs - * @name GetJobs - * @request GET:/jobs - * @secure - */ - getJobs: (params: RequestParams = {}) => - this.request({ - path: `/jobs`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name AddJob - * @request POST:/jobs - * @secure - */ - addJob: (data: PickJobGithub, params: RequestParams = {}) => - this.request({ - path: `/jobs`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name GetJob - * @request GET:/jobs/{id} - * @secure - */ - getJob: (id: string, params: RequestParams = {}) => - this.request({ - path: `/jobs/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name UpdateJob - * @request PATCH:/jobs/{id} - * @secure - */ - updateJob: (id: string, data: JobUpdate, params: RequestParams = {}) => - this.request({ - path: `/jobs/${id}`, - method: "PATCH", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name DeleteJob - * @request DELETE:/jobs/{id} - * @secure - */ - deleteJob: (id: string, params: RequestParams = {}) => - this.request({ - path: `/jobs/${id}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - }; - xRoute = { - /** - * No description - * - * @tags Jobs - * @name GetJobs - * @request GET:x-route - * @secure - */ - getJobs: (params: RequestParams = {}) => - this.request({ - path: `x-route`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name AddJob - * @request POST:x-route - * @secure - */ - addJob: (data: PickJobGithub, params: RequestParams = {}) => - this.request({ - path: `x-route`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - projects = { - /** - * No description - * - * @tags Projects - * @name GetProjects - * @request GET:/projects - */ - getProjects: (params: RequestParams = {}) => - this.request({ - path: `/projects`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Projects - * @name AddProjects - * @request POST:/projects - * @secure - */ - addProjects: (data: ProjectUpdate, params: RequestParams = {}) => - this.request({ - path: `/projects`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Projects - * @name UpdateProject - * @request PATCH:/projects/{id} - * @secure - */ - updateProject: (id: string, data: ProjectUpdate, params: RequestParams = {}) => - this.request({ - path: `/projects/${id}`, - method: "PATCH", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - users = { - /** - * No description - * - * @tags Users - * @name GetUsers - * @request GET:/users - * @secure - */ - getUsers: (params: RequestParams = {}) => - this.request({ - path: `/users`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Users - * @name AddUser - * @request POST:/users - * @secure - */ - addUser: (data: AuthUser, params: RequestParams = {}) => - this.request({ - path: `/users`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Users - * @name DeleteUser - * @request DELETE:/users/{id} - * @secure - */ - deleteUser: (id: string, params: RequestParams = {}) => - this.request({ - path: `/users/${id}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Users - * @name UpdateUser - * @request PATCH:/users/{id} - * @secure - */ - updateUser: (id: string, data: UserUpdate, params: RequestParams = {}) => - this.request({ - path: `/users/${id}`, - method: "PATCH", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/up-banking.ts b/tests/generated/v3.0/up-banking.ts deleted file mode 100644 index d4e8d26a..00000000 --- a/tests/generated/v3.0/up-banking.ts +++ /dev/null @@ -1,1443 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Provides information about an Up bank account. */ -export interface AccountResource { - attributes: { - /** The bank account type of this account. */ - accountType: AccountTypeEnum; - /** - * The available balance of the account, taking into account any amounts - * that are currently on hold. - */ - balance: MoneyObject; - /** - * The date-time at which this account was first opened. - * @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; - links?: { - /** The canonical link to this resource within the API. */ - self: string; - }; - relationships: { - transactions: { - links?: { - /** The link to retrieve the related resource(s) in this relationship. */ - related: string; - }; - }; - }; - /** The type of this resource: `accounts` */ - type: string; -} - -/** - * Specifies the type of bank account. Currently returned values are `SAVER` - * and `TRANSACTIONAL`. - */ -export enum AccountTypeEnum { - SAVER = "SAVER", - TRANSACTIONAL = "TRANSACTIONAL", -} - -/** - * Provides information about an instant reimbursement in the form of - * cashback. - */ -export interface CashbackObject { - /** The total amount of cashback paid, represented as a positive value. */ - amount: MoneyObject; - /** A brief description of why this cashback was paid. */ - description: string; -} - -/** Provides information about a category and its ancestry. */ -export interface CategoryResource { - attributes: { - /** The name of this category as seen in the Up application. */ - name: string; - }; - /** - * The unique identifier for this category. This is a human-readable but - * URL-safe value. - */ - id: string; - links?: { - /** The canonical link to this resource within the API. */ - self: string; - }; - relationships: { - children: { - data: { - /** The unique identifier of the resource within its type. */ - id: string; - /** The type of this resource: `categories` */ - type: string; - }[]; - links?: { - /** The link to retrieve the related resource(s) in this relationship. */ - related: string; - }; - }; - parent: { - data: { - /** 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; - }; - }; - }; - /** The type of this resource: `categories` */ - type: string; -} - -/** - * Request to create a new webhook. This currently only requires a `url` - * attribute. - */ -export interface CreateWebhookRequest { - /** The webhook resource to create. */ - data: WebhookInputResource; -} - -/** Successful response after creating a webhook. */ -export interface CreateWebhookResponse { - /** The webhook that was created. */ - data: WebhookResource; -} - -/** Provides information about an error processing a request. */ -export interface ErrorObject { - /** - * A detailed description of this error. This should be considered unique - * to individual occurrences of an error and subject to change. It is - * useful for debugging purposes. - */ - detail: string; - /** - * If applicable, location in the request that this error relates to. This - * may be a parameter in the query string, or a an attribute in the - * request body. - */ - source?: { - /** - * If this error relates to a query parameter, the name of the - * parameter. - */ - parameter?: string; - /** - * If this error relates to an attribute in the request body, a - * rfc-6901 JSON pointer to the attribute. - */ - pointer?: string; - }; - /** - * The HTTP status code associated with this error. This can also be - * obtained from the response headers. The status indicates the broad type - * of error according to HTTP semantics. - */ - status: string; - /** - * A short description of this error. This should be stable across - * multiple occurrences of this type of error and typically expands on the - * reason for the status code. - */ - title: string; -} - -/** Generic error response that returns one or more errors. */ -export interface ErrorResponse { - /** The list of errors returned in this response. */ - errors: ErrorObject[]; -} - -/** Successful response to get a single account. */ -export interface GetAccountResponse { - /** The account returned in this response. */ - data: AccountResource; -} - -/** Successful response to get a single category and its ancestry. */ -export interface GetCategoryResponse { - /** The category returned in this response. */ - data: CategoryResource; -} - -/** Successful response to get a single transaction. */ -export interface GetTransactionResponse { - /** The transaction returned in this response. */ - data: TransactionResource; -} - -/** Successful response to get a single webhook. */ -export interface GetWebhookResponse { - /** The webhook returned in this response. */ - data: WebhookResource; -} - -/** - * Provides information about the amount at which a transaction was in the - * `HELD` status. - */ -export interface HoldInfoObject { - /** - * The amount of this transaction while in the `HELD` status, in - * Australian dollars. - */ - amount: MoneyObject; - /** - * The foreign currency amount of this transaction while in the `HELD` - * status. This field will be `null` for domestic transactions. The amount - * was converted to the AUD amount reflected in the `amount` field. - */ - foreignAmount: MoneyObject | null; -} - -/** - * Successful response to get all accounts. This returns a paginated list of - * accounts, which can be scrolled by following the `prev` and `next` links - * if present. - */ -export interface ListAccountsResponse { - /** The list of accounts returned in this response. */ - data: AccountResource[]; - links: { - /** - * 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; - }; -} - -/** - * Successful response to get all categories and their ancestry. The - * returned list is not paginated. - */ -export interface ListCategoriesResponse { - /** The list of categories returned in this response. */ - data: CategoryResource[]; -} - -/** - * Successful response to get all tags. This returns a paginated list of - * tags, which can be scrolled by following the `prev` and `next` links if - * present. - */ -export interface ListTagsResponse { - /** The list of tags returned in this response. */ - data: TagResource[]; - links: { - /** - * 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; - }; -} - -/** - * Successful response to get all transactions. This returns a paginated - * list of transactions, which can be scrolled by following the `prev` and - * `next` links if present. - */ -export interface ListTransactionsResponse { - /** The list of transactions returned in this response. */ - data: TransactionResource[]; - links: { - /** - * 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; - }; -} - -/** - * Successful response to get all delivery logs for a webhook. This returns - * a paginated list of delivery logs, which can be scrolled by following the - * `next` and `prev` links if present. - */ -export interface ListWebhookDeliveryLogsResponse { - /** The list of delivery logs returned in this response. */ - data: WebhookDeliveryLogResource[]; - links: { - /** - * 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; - }; -} - -/** - * Successful response to get all webhooks. This returns a paginated list of - * webhooks, which can be scrolled by following the `prev` and `next` links - * if present. - */ -export interface ListWebhooksResponse { - /** The list of webhooks returned in this response. */ - data: WebhookResource[]; - links: { - /** - * 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; - }; -} - -/** Provides information about a value of money. */ -export interface MoneyObject { - /** The ISO 4217 currency code. */ - currencyCode: string; - /** - * The amount of money, formatted as a string in the relevant currency. - * For example, for an Australian dollar value of $10.56, this field will - * be `"10.56"`. The currency symbol is not included in the string. - */ - value: string; - /** - * The amount of money in the smallest denomination for the currency, as a - * 64-bit integer. For example, for an Australian dollar value of $10.56, - * this field will be `1056`. - */ - valueInBaseUnits: number; -} - -/** Basic ping response to verify authentication. */ -export interface PingResponse { - meta: { - /** The unique identifier of the authenticated customer. */ - id: string; - /** A cute emoji that represents the response status. */ - statusEmoji: string; - }; -} - -/** - * Provides information about how a Round Up was applied, such as whether or - * not a boost was included in the Round Up. - */ -export interface RoundUpObject { - /** - * The total amount of this Round Up, including any boosts, represented as - * a negative value. - */ - amount: MoneyObject; - /** - * The portion of the Round Up `amount` owing to boosted Round Ups, - * represented as a negative value. If no boost was added to the Round Up - * this field will be `null`. - */ - boostPortion: MoneyObject | null; -} - -/** Bla bla bla foo bar baz */ -export enum SomeEnumName { - Foo = "Foo", - Bar = "Bar", - Baz = "Baz", - Bad = "Bad", -} - -/** Uniquely identifies a single tag in the API. */ -export interface TagInputResourceIdentifier { - /** The label of the tag, which also acts as the tag’s unique identifier. */ - id: string; - /** The type of this resource: `tags` */ - type: string; -} - -/** Provides information about a tag. */ -export interface TagResource { - /** The label of the tag, which also acts as the tag’s unique identifier. */ - id: string; - relationships: { - transactions: { - links?: { - /** The link to retrieve the related resource(s) in this relationship. */ - related: string; - }; - }; - }; - /** The type of this resource: `tags` */ - type: string; -} - -export interface TransactionResource { - attributes: { - /** - * 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. - */ - amount: MoneyObject; - /** - * If all or part of this transaction was instantly reimbursed in the - * form of cashback, details of the reimbursement. - */ - 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; - /** - * 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. - */ - 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 - * transaction while `HELD`. - */ - holdInfo: HoldInfoObject | null; - /** - * Attached message for this transaction, such as a payment message, or a - * transfer note. - */ - message: string | null; - /** - * 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. - */ - rawText: string | null; - /** - * Details of how this transaction was rounded-up. If no Round Up was - * applied this field will be `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. - * @format date-time - */ - settledAt: string | null; - /** - * The current processing status of this transaction, according to - * whether or not this transaction has settled or is still held. - */ - status: TransactionStatusEnum; - }; - /** The unique identifier for this transaction. */ - id: string; - links?: { - /** The canonical link to this resource within the API. */ - self: string; - }; - relationships: { - account: { - data: { - /** 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. */ - related: string; - }; - }; - category: { - data: { - /** 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; - }; - }; - parentCategory: { - data: { - /** 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; - }; - }; - tags: { - data: { - /** 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?: { - /** - * The link to retrieve or modify linkage between this resources and the - * related resource(s) in this relationship. - */ - self: string; - }; - }; - }; - /** The type of this resource: `transactions` */ - type: string; -} - -/** - * Specifies which stage of processing a transaction is currently at. - * Currently returned values are `HELD` and `SETTLED`. When a transaction is - * held, its account’s `availableBalance` is affected. When a transaction is - * settled, its account’s `currentBalance` is affected. - */ -export enum TransactionStatusEnum { - HELD = "HELD", - SETTLED = "SETTLED", -} - -/** Request to add or remove tags associated with a transaction. */ -export interface UpdateTransactionTagsRequest { - /** The tags to add to or remove from the transaction. */ - data: TagInputResourceIdentifier[]; -} - -/** - * Provides historical webhook event delivery information for analysis and - * debugging purposes. - */ -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. */ - body: string; - }; - /** Information about the response that was received from the webhook URL. */ - response: { - /** The payload that was received in the response body. */ - body: string; - /** The HTTP status code received in the response. */ - statusCode: number; - } | null; - }; - /** The unique identifier for this log entry. */ - id: string; - relationships: { - webhookEvent: { - data: { - /** The unique identifier of the resource within its type. */ - id: string; - /** The type of this resource: `webhook-events` */ - type: string; - }; - }; - }; - /** The type of this resource: `webhook-delivery-logs` */ - type: string; -} - -/** - * Specifies the nature of the success or failure of a webhook delivery - * attempt to the subscribed webhook URL. The currently returned values are - * described below: - * - * - **`DELIVERED`**: The event was delivered to the webhook URL - * successfully and a `200` response was received. - * - **`UNDELIVERABLE`**: The webhook URL was not reachable, or timed out. - * - **`BAD_RESPONSE_CODE`**: The event was delivered to the webhook URL - * but a non-`200` response was received. - */ -export enum WebhookDeliveryStatusEnum { - DELIVERED = "DELIVERED", - UNDELIVERABLE = "UNDELIVERABLE", - BAD_RESPONSE_CODE = "BAD_RESPONSE_CODE", -} - -/** Asynchronous callback request used for webhook event delivery. */ -export interface WebhookEventCallback { - /** The webhook event data sent to the subscribed webhook. */ - data: WebhookEventResource; -} - -/** - * Provides the event data used in asynchronous webhook event callbacks to - * subscribed endpoints. Webhooks events have defined `eventType`s and may - * optionally relate to other resources within the Up API. - */ -export interface WebhookEventResource { - attributes: { - /** - * 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 - * delivery retries. - */ - id: string; - relationships: { - transaction?: { - data: { - /** 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; - }; - }; - webhook: { - data: { - /** 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. */ - related: string; - }; - }; - }; - /** The type of this resource: `webhook-events` */ - type: string; -} - -/** - * Specifies the type of a webhook event. This can be used to determine what - * action to take in response to the event, such as which relationships to - * expect. - */ -export enum WebhookEventTypeEnum { - TRANSACTION_CREATED = "TRANSACTION_CREATED", - TRANSACTION_SETTLED = "TRANSACTION_SETTLED", - TRANSACTION_DELETED = "TRANSACTION_DELETED", - PING = "PING", -} - -/** 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; - }; -} - -/** Provides information about a webhook. */ -export interface WebhookResource { - attributes: { - /** - * 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. - */ - description: string | null; - /** - * A shared secret key used to sign all webhook events sent to the - * configured webhook URL. This field is returned only once, upon the - * initial creation of the webhook. If lost, create a new webhook and - * delete this webhook. - * - * The webhook URL receives a request with a - * `X-Up-Authenticity-Signature` header, which is the SHA-256 HMAC of - * the entire raw request body signed using this `secretKey`. It is - * advised to compute and check this signature to verify the - * authenticity of requests sent to the webhook URL. See - * [Handling webhook events](#callback_post_webhookURL) for full - * details. - */ - secretKey?: string; - /** The URL that this webhook is configured to `POST` events to. */ - url: string; - }; - /** The unique identifier for this webhook. */ - id: string; - links?: { - /** The canonical link to this resource within the API. */ - self: string; - }; - relationships: { - logs: { - links?: { - /** The link to retrieve the related resource(s) in this relationship. */ - related: string; - }; - }; - }; - /** The type of this resource: `webhooks` */ - type: string; -} - -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://api.up.com.au/api/v1"; - 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.clone() 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 Up API - * @version v1 - * @baseUrl https://api.up.com.au/api/v1 - * @contact API Specification and Support (https://github.com/up-banking/api) - * - * The Up API gives you programmatic access to your balances and - * transaction data. You can request past transactions or set up - * webhooks to receive real-time events when new transactions hit your - * account. It’s new, it’s exciting and it’s just the beginning. - */ -export class Api extends HttpClient { - accounts = { - /** - * @description Retrieve a paginated list of all accounts for the currently authenticated user. The returned list is paginated and can be scrolled by following the `prev` and `next` links where present. - * - * @tags Accounts - * @name AccountsList - * @summary List accounts - * @request GET:/accounts - * @secure - */ - accountsList: ( - query?: { - /** - * The number of records to return in each page. - * @example 30 - */ - "page[size]"?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/accounts`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Retrieve a specific account by providing its unique identifier. - * - * @tags Accounts - * @name AccountsDetail - * @summary Retrieve account - * @request GET:/accounts/{id} - * @secure - */ - accountsDetail: (id: string, params: RequestParams = {}) => - this.request({ - path: `/accounts/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * @description Retrieve a list of all transactions for a specific account. The returned list is [paginated](#pagination) and can be scrolled by following the `next` and `prev` links where present. To narrow the results to a specific date range pass one or both of `filter[since]` and `filter[until]` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last. - * - * @tags Transactions - * @name TransactionsDetail - * @summary List transactions by account - * @request GET:/accounts/{accountId}/transactions - * @secure - */ - transactionsDetail: ( - accountId: string, - query?: { - /** - * The category identifier for which to filter transactions. - * Both parent and child categories can be filtered through - * this parameter. Providing an invalid category identifier - * results in a `404` response. - * @example "good-life" - */ - "filter[category]"?: string; - /** - * The start date-time from which to return records, - * formatted according to rfc-3339. Not to be used for - * pagination purposes. - * @format date-time - * @example "2020-01-01T01:02:03+10:00" - */ - "filter[since]"?: string; - /** - * The transaction status for which to return records. This - * can be used to filter `HELD` transactions from those - * that are `SETTLED`. - * @example "HELD" - */ - "filter[status]"?: TransactionStatusEnum; - /** - * A transaction tag to filter for which to return records. - * If the tag does not exist, zero records are returned and - * a success response is given. - * @example "Holiday" - */ - "filter[tag]"?: string; - /** - * The end date-time up to which to return records, - * formatted according to rfc-3339. Not to be used for - * pagination purposes. - * @format date-time - * @example "2020-02-01T01:02:03+10:00" - */ - "filter[until]"?: string; - /** - * The number of records to return in each page. - * @example 30 - */ - "page[size]"?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/accounts/${accountId}/transactions`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - }; - categories = { - /** - * @description Retrieve a list of all categories and their ancestry. The returned list is not paginated. - * - * @tags Categories - * @name CategoriesList - * @summary List categories - * @request GET:/categories - * @secure - */ - categoriesList: ( - query?: { - /** - * The unique identifier of a parent category for which to - * return only its children. Providing an invalid category - * identifier results in a `404` response. - * @example "good-life" - */ - "filter[parent]"?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/categories`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Retrieve a specific category by providing its unique identifier. - * - * @tags Categories - * @name CategoriesDetail - * @summary Retrieve category - * @request GET:/categories/{id} - * @secure - */ - categoriesDetail: (id: string, params: RequestParams = {}) => - this.request({ - path: `/categories/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - }; - util = { - /** - * @description Make a basic ping request to the API. This is useful to verify that authentication is functioning correctly. On authentication success an HTTP `200` status is returned. On failure an HTTP `401` error response is returned. - * - * @tags Utility endpoints - * @name PingList - * @summary Ping - * @request GET:/util/ping - * @secure - */ - pingList: (params: RequestParams = {}) => - this.request({ - path: `/util/ping`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - }; - tags = { - /** - * @description Retrieve a list of all tags currently in use. The returned list is [paginated](#pagination) and can be scrolled by following the `next` and `prev` links where present. Results are ordered lexicographically. The `transactions` relationship for each tag exposes a link to get the transactions with the given tag. - * - * @tags Tags - * @name TagsList - * @summary List tags - * @request GET:/tags - * @secure - */ - tagsList: ( - query?: { - /** - * The number of records to return in each page. - * @example 50 - */ - "page[size]"?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/tags`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - }; - transactions = { - /** - * @description Associates one or more tags with a specific transaction. No more than 6 tags may be present on any single transaction. Duplicate tags are silently ignored. An HTTP `204` is returned on success. The associated tags, along with this request URL, are also exposed via the `tags` relationship on the transaction resource returned from `/transactions/{id}`. - * - * @tags Tags - * @name RelationshipsTagsCreate - * @summary Add tags to transaction - * @request POST:/transactions/{transactionId}/relationships/tags - * @secure - */ - relationshipsTagsCreate: (transactionId: string, data: UpdateTransactionTagsRequest, params: RequestParams = {}) => - this.request({ - path: `/transactions/${transactionId}/relationships/tags`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * @description Disassociates one or more tags from a specific transaction. Tags that are not associated are silently ignored. An HTTP `204` is returned on success. The associated tags, along with this request URL, are also exposed via the `tags` relationship on the transaction resource returned from `/transactions/{id}`. - * - * @tags Tags - * @name RelationshipsTagsDelete - * @summary Remove tags from transaction - * @request DELETE:/transactions/{transactionId}/relationships/tags - * @secure - */ - relationshipsTagsDelete: (transactionId: string, data: UpdateTransactionTagsRequest, params: RequestParams = {}) => - this.request({ - path: `/transactions/${transactionId}/relationships/tags`, - method: "DELETE", - body: data, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * @description Retrieve a list of all transactions across all accounts for the currently authenticated user. The returned list is [paginated](#pagination) and can be scrolled by following the `next` and `prev` links where present. To narrow the results to a specific date range pass one or both of `filter[since]` and `filter[until]` in the query string. These filter parameters **should not** be used for pagination. Results are ordered newest first to oldest last. - * - * @tags Transactions - * @name TransactionsList - * @summary List transactions - * @request GET:/transactions - * @secure - */ - transactionsList: ( - query?: { - /** - * The category identifier for which to filter transactions. - * Both parent and child categories can be filtered through - * this parameter. Providing an invalid category identifier - * results in a `404` response. - * @example "good-life" - */ - "filter[category]"?: string; - /** - * The start date-time from which to return records, - * formatted according to rfc-3339. Not to be used for - * pagination purposes. - * @format date-time - * @example "2020-01-01T01:02:03+10:00" - */ - "filter[since]"?: string; - /** - * The transaction status for which to return records. This - * can be used to filter `HELD` transactions from those - * that are `SETTLED`. - * @example "HELD" - */ - "filter[status]"?: TransactionStatusEnum; - /** - * A transaction tag to filter for which to return records. - * If the tag does not exist, zero records are returned and - * a success response is given. - * @example "Holiday" - */ - "filter[tag]"?: string; - /** - * The end date-time up to which to return records, - * formatted according to rfc-3339. Not to be used for - * pagination purposes. - * @format date-time - * @example "2020-02-01T01:02:03+10:00" - */ - "filter[until]"?: string; - /** - * The number of records to return in each page. - * @example 30 - */ - "page[size]"?: number; - /** Blablabla bla */ - someEnumName?: SomeEnumName; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/transactions`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Retrieve a specific transaction by providing its unique identifier. - * - * @tags Transactions - * @name TransactionsDetail - * @summary Retrieve transaction - * @request GET:/transactions/{id} - * @secure - */ - transactionsDetail: (id: string, params: RequestParams = {}) => - this.request({ - path: `/transactions/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - }; - webhooks = { - /** - * @description Retrieve a list of configured webhooks. The returned list is [paginated](#pagination) and can be scrolled by following the `next` and `prev` links where present. Results are ordered oldest first to newest last. - * - * @tags Webhooks - * @name WebhooksList - * @summary List webhooks - * @request GET:/webhooks - * @secure - */ - webhooksList: ( - query?: { - /** - * The number of records to return in each page. - * @example 30 - */ - "page[size]"?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/webhooks`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Create a new webhook with a given URL. The URL will receive webhook events as JSON-encoded `POST` requests. The URL must respond with a HTTP `200` status on success. There is currently a limit of 10 webhooks at any given time. Once this limit is reached, existing webhooks will need to be deleted before new webhooks can be created. Event delivery is retried with exponential backoff if the URL is unreachable or it does not respond with a `200` status. The response includes a `secretKey` attribute, which is used to sign requests sent to the webhook URL. It will not be returned from any other endpoints within the Up API. If the `secretKey` is lost, simply create a new webhook with the same URL, capture its `secretKey` and then delete the original webhook. See [Handling webhook events](#callback_post_webhookURL) for details on how to process webhook events. It is probably a good idea to test the webhook by [sending it a `PING` event](#post_webhooks_webhookId_ping) after creating it. - * - * @tags Webhooks - * @name WebhooksCreate - * @summary Create webhook - * @request POST:/webhooks - * @secure - */ - webhooksCreate: (data: CreateWebhookRequest, params: RequestParams = {}) => - this.request({ - path: `/webhooks`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Retrieve a specific webhook by providing its unique identifier. - * - * @tags Webhooks - * @name WebhooksDetail - * @summary Retrieve webhook - * @request GET:/webhooks/{id} - * @secure - */ - webhooksDetail: (id: string, params: RequestParams = {}) => - this.request({ - path: `/webhooks/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * @description Delete a specific webhook by providing its unique identifier. Once deleted, webhook events will no longer be sent to the configured URL. - * - * @tags Webhooks - * @name WebhooksDelete - * @summary Delete webhook - * @request DELETE:/webhooks/{id} - * @secure - */ - webhooksDelete: (id: string, params: RequestParams = {}) => - this.request({ - path: `/webhooks/${id}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * @description Send a `PING` event to a webhook by providing its unique identifier. This is useful for testing and debugging purposes. The event is delivered asynchronously and its data is returned in the response to this request. - * - * @tags Webhooks - * @name PingCreate - * @summary Ping webhook - * @request POST:/webhooks/{webhookId}/ping - * @secure - */ - pingCreate: (webhookId: string, params: RequestParams = {}) => - this.request({ - path: `/webhooks/${webhookId}/ping`, - method: "POST", - secure: true, - format: "json", - ...params, - }), - - /** - * @description Retrieve a list of delivery logs for a webhook by providing its unique identifier. This is useful for analysis and debugging purposes. The returned list is [paginated](#pagination) and can be scrolled by following the `next` and `prev` links where present. Results are ordered newest first to oldest last. Logs may be automatically purged after a period of time. - * - * @tags Webhooks - * @name LogsDetail - * @summary List webhook logs - * @request GET:/webhooks/{webhookId}/logs - * @secure - */ - logsDetail: ( - webhookId: string, - query?: { - /** - * The number of records to return in each page. - * @example 30 - */ - "page[size]"?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/webhooks/${webhookId}/logs`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/uspto.ts b/tests/generated/v3.0/uspto.ts deleted file mode 100644 index e93ddeeb..00000000 --- a/tests/generated/v3.0/uspto.ts +++ /dev/null @@ -1,335 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -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; - /** - * The URL describing the dataset's fields - * @format uriref - */ - apiUrl?: string; - /** To be used as a version parameter value */ - apiVersionNumber?: string; - }[]; - total?: number; -} - -export enum SomeEnum { - Foo = "Foo", - Bar = "Bar", - FooBar = "Foo Bar", -} - -export enum Status { - Resolved = "resolved", - New = "new", - InProgress = "in progress", -} - -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 = "{scheme}://developer.uspto.gov/ds-api"; - 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.clone() 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 USPTO Data Set API - * @version 1.0.0 - * @baseUrl {scheme}://developer.uspto.gov/ds-api - * @contact Open Data Portal (https://developer.uspto.gov) - * - * The Data Set API (DSAPI) allows the public users to discover and search USPTO exported data sets. This is a generic API that allows USPTO users to make any CSV based data files searchable through API. With the help of GET call, it returns the list of data fields that are searchable. With the help of POST call, data can be fetched based on the filters on the field names. Please note that POST call is used to search the actual data. The reason for the POST call is that it allows users to specify any complex search criteria without worry about the GET size limitations as well as encoding of the input parameters. - */ -export class Api extends HttpClient { - /** - * No description - * - * @tags metadata - * @name ListDataSets - * @summary List available data sets - * @request GET:/ - */ - listDataSets = (params: RequestParams = {}) => - this.request({ - path: `/`, - method: "GET", - format: "json", - ...params, - }); - - dataset = { - /** - * @description This GET API returns the list of all the searchable field names that are in the oa_citations. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the syntax options shown below. - * - * @tags metadata - * @name ListSearchableFields - * @summary Provides the general information about the API and the list of fields that can be used to query the dataset. - * @request GET:/{dataset}/{version}/fields - */ - listSearchableFields: (dataset: string, version: string, params: RequestParams = {}) => - this.request({ - path: `/${dataset}/${version}/fields`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description This API is based on Solr/Lucense Search. The data is indexed using SOLR. This GET API returns the list of all the searchable field names that are in the Solr Index. Please see the 'fields' attribute which returns an array of field names. Each field or a combination of fields can be searched using the Solr/Lucene Syntax. Please refer https://lucene.apache.org/core/3_6_2/queryparsersyntax.html#Overview for the query syntax. List of field names that are searchable can be determined using above GET api. - * - * @tags search - * @name PerformSearch - * @summary Provides search capability for the data set with the given search criteria. - * @request POST:/{dataset}/{version}/records - */ - performSearch: ( - version: string, - dataset: string, - data: { - /** - * Uses Lucene Query Syntax in the format of propertyName:value, propertyName:[num1 TO num2] and date range format: propertyName:[yyyyMMdd TO yyyyMMdd]. In the response please see the 'docs' element which has the list of record objects. Each record structure would consist of all the fields and their corresponding values. - * @default "*:*" - */ - criteria: string; - /** - * Specify number of rows to be returned. If you run the search with default values, in the response you will see 'numFound' attribute which will tell the number of records available in the dataset. - * @default 100 - */ - rows?: number; - /** - * Starting record number. Default value is 0. - * @default 0 - */ - start?: number; - }, - params: RequestParams = {}, - ) => - this.request[], void>({ - path: `/${dataset}/${version}/records`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - format: "json", - ...params, - }), - }; -} diff --git a/tests/generated/v3.0/wrong-enum-subtypes.ts b/tests/generated/v3.0/wrong-enum-subtypes.ts deleted file mode 100644 index 8ce02cf0..00000000 --- a/tests/generated/v3.0/wrong-enum-subtypes.ts +++ /dev/null @@ -1,232 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type Test = { - x?: "A-B"[]; -} & { - y?: string; -}; - -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.clone() 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 Test - * @version test - */ -export class Api extends HttpClient {} diff --git a/tests/generated/v3.0/wrong-schema-names.ts b/tests/generated/v3.0/wrong-schema-names.ts deleted file mode 100644 index cb66d710..00000000 --- a/tests/generated/v3.0/wrong-schema-names.ts +++ /dev/null @@ -1,343 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** - * Not found response - * @example "Not found" - */ -export type DF = string; - -/** - * Not found response - * @example "Not found" - */ -export type Type404 = string; - -/** - * Not found response - * @example "Not found" - */ -export type Type405 = string; - -/** - * Not found response - * @example "Not found" - */ -export type TypeFF = string; - -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.clone() 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 Link Example - * @version 1.0.0 - */ -export class Api extends HttpClient { - v20 = { - /** - * No description - * - * @name GetUserByName - * @request GET:/2.0/users/{username} - */ - getUserByName: (username: string, params: RequestParams = {}) => - this.request({ - path: `/2.0/users/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name GetRepositoriesByOwner - * @request GET:/2.0/repositories/{username} - */ - getRepositoriesByOwner: (username: string, params: RequestParams = {}) => - this.request({ - path: `/2.0/repositories/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name GetRepository - * @request GET:/2.0/repositories/{username}/{slug} - */ - getRepository: (username: string, slug: string, params: RequestParams = {}) => - this.request({ - path: `/2.0/repositories/${username}/${slug}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name GetPullRequestsByRepository - * @request GET:/2.0/repositories/{username}/{slug}/pullrequests - */ - getPullRequestsByRepository: ( - username: string, - slug: string, - query?: { - state?: "open" | "merged" | "declined"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/2.0/repositories/${username}/${slug}/pullrequests`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @name GetPullRequestsById - * @request GET:/2.0/repositories/{username}/{slug}/pullrequests/{pid} - */ - getPullRequestsById: (username: string, slug: string, pid: string, params: RequestParams = {}) => - this.request({ - path: `/2.0/repositories/${username}/${slug}/pullrequests/${pid}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name MergePullRequest - * @request POST:/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge - */ - mergePullRequest: (username: string, slug: string, pid: string, params: RequestParams = {}) => - this.request({ - path: `/2.0/repositories/${username}/${slug}/pullrequests/${pid}/merge`, - method: "POST", - ...params, - }), - }; -} diff --git a/tests/helpers/assertGeneratedModule.js b/tests/helpers/assertGeneratedModule.js deleted file mode 100644 index 2e24e282..00000000 --- a/tests/helpers/assertGeneratedModule.js +++ /dev/null @@ -1,109 +0,0 @@ -const fs = require("node:fs"); -const gitDiff = require("git-diff"); -const _ = require("lodash"); - -const assertGeneratedModule = (pathToModule1, pathToModule2) => { - if (process.env.UPDATE_SNAPSHOTS) { - const output = fs.readFileSync(pathToModule1).toString("utf8"); - fs.writeFileSync(pathToModule2, output, { encoding: "utf8" }); - } else { - const output = fs.readFileSync(pathToModule1).toString("utf8"); - const expected = fs.readFileSync(pathToModule2).toString("utf8"); - - 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) { - 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); - } - } - - return void 0; -}; - -module.exports = assertGeneratedModule; diff --git a/tests/helpers/createGeneratedApiInfos.js b/tests/helpers/createGeneratedApiInfos.js deleted file mode 100644 index a3a22a5d..00000000 --- a/tests/helpers/createGeneratedApiInfos.js +++ /dev/null @@ -1,7 +0,0 @@ -const fs = require("node:fs"); -const { resolve } = require("node:path"); - -module.exports = (pathToApis) => - (fs.readdirSync(pathToApis) || []).map((fileName) => - resolve(pathToApis, fileName), - ); diff --git a/tests/helpers/createSchemaInfos.js b/tests/helpers/createSchemaInfos.js deleted file mode 100644 index a7ae4fd0..00000000 --- a/tests/helpers/createSchemaInfos.js +++ /dev/null @@ -1,70 +0,0 @@ -const _ = require("lodash"); -const fs = require("node:fs"); -const path = require("node:path"); - -/** - * - * @param {{ absolutePathToSchemas: string; absoluteOutputPath: string }} options - * @returns {{ - * absolutePath: string; - * schemaFileName: string; - * apiFileName: string; - * outputPath: string; - * Exception: typeof Error; - * }[]} - */ -const createSchemaInfos = ({ absolutePathToSchemas, absoluteOutputPath }) => { - return (fs.readdirSync(absolutePathToSchemas) || []).reduce( - (schemas, fileName) => { - if ( - fileName.endsWith(".yaml") || - fileName.endsWith(".json") || - fileName.endsWith(".yml") - ) { - const apiFileName = fileName.replace(/.(yaml|json|yml)/g, ".ts"); - const outputPath = absoluteOutputPath || path.resolve(__dirname, "./"); - - schemas.push({ - absolutePath: path.resolve(absolutePathToSchemas, fileName), - schemaFileName: fileName, - apiFileName: apiFileName, - outputPath: outputPath, - Exception: class TestError extends Error { - constructor(message, ...datas) { - super(message); - - const stackLines = _.split(this.stack, "\n"); - const realStack = stackLines.slice(1); - const stackLineExtraSpace = - (realStack[0] && realStack[0].split("at")[0]) || ""; - - this.stack = [ - stackLines[0], - `${stackLineExtraSpace}at ${path.resolve( - outputPath, - apiFileName, - )}`, - ...realStack, - ].join("\n"); - - console.error(stackLines[0], ...datas); - console.error( - `${stackLineExtraSpace}at ${path.resolve( - outputPath, - apiFileName, - )}`, - ); - console.error(realStack.join("\n")); - process.exit(1); - } - }, - }); - } - - return schemas; - }, - [], - ); -}; - -module.exports = createSchemaInfos; diff --git a/tests/helpers/generateApiForTest.js b/tests/helpers/generateApiForTest.js deleted file mode 100644 index 6109df3f..00000000 --- a/tests/helpers/generateApiForTest.js +++ /dev/null @@ -1,21 +0,0 @@ -const { generateApi } = require("../../src"); -const dotenv = require("dotenv"); - -dotenv.config(); - -/** - * - * @param options {import("../../index").GenerateApiParams & { testName?: string }} - * @returns {Promise} - */ -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/helpers/specGenerateOptions.js b/tests/helpers/specGenerateOptions.js deleted file mode 100644 index f57b2c9f..00000000 --- a/tests/helpers/specGenerateOptions.js +++ /dev/null @@ -1,6 +0,0 @@ -const path = require("node:path"); - -module.exports = { - name: "Api.ts", - input: path.resolve(__dirname, "../schemas/v2.0/petstore-simple.yaml"), -}; diff --git a/tests/helpers/validateGeneratedModule.js b/tests/helpers/validateGeneratedModule.js deleted file mode 100644 index 2e796a8e..00000000 --- a/tests/helpers/validateGeneratedModule.js +++ /dev/null @@ -1,87 +0,0 @@ -const ts = require("typescript"); -const tsconfig = require("../../tsconfig.json"); - -/** @type {ts.CompilerOptions} */ -const compilerOptions = { - allowJs: true, - noEmitOnError: true, - noImplicitAny: true, - target: ts.ScriptTarget.ES2018, - module: ts.ModuleKind.CommonJS, - strict: true, - alwaysStrict: true, - noEmit: true, -}; - -function compile(fileNames) { - console.log(`compiling ${fileNames.join(", ")}`); - - let program = ts.createProgram(fileNames, compilerOptions); - let emitResult = program.emit(); - - let allDiagnostics = ts - .getPreEmitDiagnostics(program) - .concat(emitResult.diagnostics); - - allDiagnostics.forEach((diagnostic) => { - if (diagnostic.file) { - let { line, character } = ts.getLineAndCharacterOfPosition( - diagnostic.file, - diagnostic.start, - ); - let message = ts.flattenDiagnosticMessageText( - diagnostic.messageText, - "\n", - ); - console.error( - `${diagnostic.file.fileName} (${line + 1},${ - character + 1 - }): ${message}`, - ); - } else { - console.error( - ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"), - ); - } - }); - - let exitCode = allDiagnostics.length || emitResult.emitSkipped ? 1 : 0; - - if (exitCode) { - console.error(`Process exiting with code '${exitCode}'.`); - process.exit(exitCode); - throw "TS validation failed"; - } - - return { - code: exitCode, - diagnostics: allDiagnostics, - }; -} - -module.exports = (pathToFile) => { - const { diagnostics, code } = compile([pathToFile]); - // const relativePathToFile = relative("", pathToFile); - - // console.log(`validating ${relativePathToFile}: errors ${diagnostics.length}`); - // diagnostics.forEach(({ messageText, file, start }) => { - // var message = ts.flattenDiagnosticMessageText(messageText, "\n"); - // if (!file) { - // console.error(`${relativePathToFile}\r\n`, message); - // return; - // } - // var { line, character } = file.getLineAndCharacterOfPosition(start); - // console.error( - // `${relativePathToFile}\r\n`, - // `${file.fileName} (${line + 1},${character + 1}): ${message}`, - // ); - // }); - - if (diagnostics.length) { - console.error(diagnostics); - console.error(new Error("Failed").stack); - process.exit(1); - } - - return diagnostics; -}; diff --git a/tests/schemas/v2.0/github-swagger.json b/tests/schemas/v2.0/github-swagger.json deleted file mode 100644 index a31a3b89..00000000 --- a/tests/schemas/v2.0/github-swagger.json +++ /dev/null @@ -1,23825 +0,0 @@ -{ - "swagger": "2.0", - "schemes": ["https"], - "host": "api.github.com", - "basePath": "/", - "info": { - "description": "Powerful collaboration, code review, and code management for open source and private projects.\n", - "termsOfService": "https://help.github.com/articles/github-terms-of-service/#b-api-terms", - "title": "GitHub", - "version": "v3", - "x-apisguru-categories": ["collaboration", "developer_tools"], - "x-logo": { - "url": "https://api.apis.guru/v2/cache/logo/https_twitter.com_github_profile_image.jpeg" - }, - "x-origin": [ - { - "format": "swagger", - "url": "https://raw.githubusercontent.com/APIs-guru/unofficial_openapi_specs/master/github.com/v3/swagger.yaml", - "version": "2.0" - } - ], - "x-preferred": false, - "x-providerName": "github.com", - "x-unofficialSpec": true - }, - "externalDocs": { - "url": "https://developer.github.com/v3/" - }, - "consumes": ["application/json"], - "produces": ["application/json"], - "securityDefinitions": { - "oauth_2_0": { - "authorizationUrl": "https://github.com/login/oauth/authorize", - "description": "OAuth2 is a protocol that lets external apps request authorization to private\ndetails in a user's GitHub account without getting their password. This is\npreferred over Basic Authentication because tokens can be limited to specific\ntypes of data, and can be revoked by users at any time.\n", - "flow": "accessCode", - "scopes": { - "admin:org": "", - "admin:org_hook": "", - "admin:public_key": "", - "admin:repo_hook": "", - "delete_repo": "", - "gist": "", - "notifications": "", - "public_repo": "", - "read:org": "", - "read:public_key": "", - "read:repo_hook": "", - "repo": "", - "repo:status": "", - "repo_deployment": "", - "user": "", - "user:email": "", - "user:follow": "", - "write:org": "", - "write:public_key": "", - "write:repo_hook": "" - }, - "tokenUrl": "https://github.com/login/oauth/access_token", - "type": "oauth2" - } - }, - "paths": { - "/someop": { - "post": { - "tags": ["someop"], - "operationId": "someOp_1", - "parameters": [ - { - "name": "queryParam1", - "in": "query", - "description": "description", - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "foo.bar.baz", - "in": "query", - "description": "description", - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "queryParam2", - "in": "query", - "description": "description", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "query.param.bar.3", - "in": "query", - "description": "description", - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "queryParam3", - "in": "query", - "description": "description", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/events" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/hal+json": { - "schema": { - "$ref": "#/definitions/events" - } - } - } - }, - "400": { - "description": "Bad Request" - } - } - } - }, - "/emojis": { - "get": { - "description": "Lists all the emojis available to use on GitHub.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/emojis" - } - }, - "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" - } - } - } - } - } - }, - "/someop/{fooId}/bars/bar-bar": { - "post": { - "tags": ["someop"], - "operationId": "someOp", - "parameters": [ - { - "name": "page", - "in": "query", - "description": "", - "schema": { - "type": "integer", - "default": 0 - } - }, - { - "name": "size", - "in": "query", - "description": "", - "schema": { - "type": "integer", - "default": 20 - } - }, - { - "name": "sort", - "in": "query", - "description": "", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/definitions/events" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "OK", - "content": { - "application/hal+json": { - "schema": { - "$ref": "#/definitions/events" - } - } - } - }, - "400": { - "description": "Bad Request" - } - } - } - }, - "/events": { - "get": { - "description": "List public events.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/events" - } - }, - "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" - } - } - } - } - } - }, - "/feeds": { - "get": { - "description": "List Feeds.\nGitHub provides several timeline resources in Atom format. The Feeds API\n lists all the feeds available to the authenticating user.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/feeds" - } - }, - "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" - } - } - } - } - } - }, - "/gists": { - "get": { - "description": "List the authenticated user's gists or if called anonymously, this will\nreturn all public gists.\n", - "parameters": [ - { - "description": "Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ.\nOnly gists updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gists" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a gist.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/postGist" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/gist" - } - }, - "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" - } - } - } - } - } - }, - "/gists/public": { - "get": { - "description": "List all public gists.", - "parameters": [ - { - "description": "Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ.\nOnly gists updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gists" - } - }, - "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" - } - } - } - } - } - }, - "/gists/starred": { - "get": { - "description": "List the authenticated user's starred gists.", - "parameters": [ - { - "description": "Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ.\nOnly gists updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gists" - } - }, - "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" - } - } - } - } - } - }, - "/gists/{id}": { - "delete": { - "description": "Delete a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gist" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/patchGist" - } - } - ], - "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/gist" - } - }, - "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" - } - } - } - } - } - }, - "/gists/{id}/comments": { - "get": { - "description": "List comments on a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/comments" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a commen", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commentBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/comment" - } - }, - "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" - } - } - } - } - } - }, - "/gists/{id}/comments/{commentId}": { - "delete": { - "description": "Delete a comment.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single comment.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/comment" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a comment.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/comment" - } - } - ], - "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/comment" - } - }, - "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" - } - } - } - } - } - }, - "/gists/{id}/forks": { - "post": { - "description": "Fork a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Exists.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Not exists.", - "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" - } - } - } - } - } - }, - "/gists/{id}/star": { - "delete": { - "description": "Unstar a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Item removed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if a gist is starred.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Exists.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Not exists.", - "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" - } - } - } - } - }, - "put": { - "description": "Star a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Starred.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/gitignore/templates": { - "get": { - "description": "Listing available templates.\nList all templates available to pass as an option when creating a repository.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - } - }, - "/gitignore/templates/{language}": { - "get": { - "description": "Get a single template.", - "parameters": [ - { - "in": "path", - "name": "language", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore-lang" - } - }, - "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" - } - } - } - } - } - }, - "/issues": { - "get": { - "description": "List issues.\nList all issues across all the authenticated user's visible repositories.\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" - }, - { - "description": "String list of comma separated Label names. Example - bug,ui,@high.", - "in": "query", - "name": "labels", - "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" - }, - { - "description": "Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nOnly issues updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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" - } - } - } - } - } - }, - "/legacy/issues/search/{owner}/{repository}/{state}/{keyword}": { - "get": { - "deprecated": true, - "description": "Find issues by state and keyword.", - "parameters": [ - { - "description": "The search term.", - "in": "path", - "name": "keyword", - "required": true, - "type": "string" - }, - { - "description": "Indicates the state of the issues to return. Can be either open or closed.", - "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" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-issues-by-keyword" - } - }, - "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" - } - } - } - } - } - }, - "/legacy/repos/search/{keyword}": { - "get": { - "deprecated": true, - "description": "Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter.", - "parameters": [ - { - "description": "The search term", - "in": "path", - "name": "keyword", - "required": true, - "type": "string" - }, - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "Filter results by language", - "in": "query", - "name": "language", - "type": "string" - }, - { - "description": "The page number to fetch", - "in": "query", - "name": "start_page", - "type": "string" - }, - { - "description": "The sort field. One of stars, forks, or updated. Default: results are sorted by best match.", - "enum": ["updated", "stars", "forks"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-repositories-by-keyword" - } - }, - "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" - } - } - } - } - } - }, - "/legacy/user/email/{email}": { - "get": { - "deprecated": true, - "description": "This API call is added for compatibility reasons only.", - "parameters": [ - { - "description": "The email address", - "in": "path", - "name": "email", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-user-by-email" - } - }, - "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" - } - } - } - } - } - }, - "/legacy/user/search/{keyword}": { - "get": { - "deprecated": true, - "description": "Find users by keyword.", - "parameters": [ - { - "description": "The search term", - "in": "path", - "name": "keyword", - "required": true, - "type": "string" - }, - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "The page number to fetch", - "in": "query", - "name": "start_page", - "type": "string" - }, - { - "description": "The sort field. One of stars, forks, or updated. Default: results are sorted by best match.", - "enum": ["updated", "stars", "forks"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-users-by-keyword" - } - }, - "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" - } - } - } - } - } - }, - "/markdown": { - "post": { - "description": "Render an arbitrary Markdown document", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/markdown" - } - } - ], - "produces": ["text/html"], - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/markdown/raw": { - "post": { - "consumes": ["text/plain"], - "description": "Render a Markdown document in raw mode", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "produces": ["text/html"], - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/meta": { - "get": { - "description": "This gives some information about GitHub.com, the service.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/meta" - } - }, - "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" - } - } - } - } - } - }, - "/networks/{owner}/{repo}/events": { - "get": { - "description": "List public events for a network of repositories.", - "parameters": [ - { - "description": "Name of the owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/events" - } - }, - "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" - } - } - } - } - } - }, - "/notifications": { - "get": { - "description": "List your notifications.\nList all notifications for the current user, grouped by repository.\n", - "parameters": [ - { - "description": "True to show notifications marked as read.", - "in": "query", - "name": "all", - "type": "boolean" - }, - { - "description": "True to show only notifications in which the user is directly participating\nor mentioned.\n", - "in": "query", - "name": "participating", - "type": "boolean" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/notifications" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Mark as read.\nMarking a notification as \"read\" removes it from the default view on GitHub.com.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/notificationMarkRead" - } - } - ], - "responses": { - "205": { - "description": "Marked as read.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/notifications/threads/{id}": { - "get": { - "description": "View a single thread.", - "parameters": [ - { - "description": "Id of thread.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/notifications" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Mark a thread as read", - "parameters": [ - { - "description": "Id of thread.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "205": { - "description": "Thread marked as read.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/notifications/threads/{id}/subscription": { - "delete": { - "description": "Delete a Thread Subscription.", - "parameters": [ - { - "description": "Id of thread.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No Content\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a Thread Subscription.", - "parameters": [ - { - "description": "Id of thread.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/subscription" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Set a Thread Subscription.\nThis lets you subscribe to a thread, or ignore it. Subscribing to a thread\nis unnecessary if the user is already subscribed to the repository. Ignoring\na thread will mute all future notifications (until you comment or get @mentioned).\n", - "parameters": [ - { - "description": "Id of thread.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putSubscription" - } - } - ], - "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/subscription" - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}": { - "get": { - "description": "Get an Organization.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/organization" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit an Organization.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/patchOrg" - } - } - ], - "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/organization" - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/events": { - "get": { - "description": "List public events for an organization.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/events" - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/issues": { - "get": { - "description": "List issues.\nList all issues for a given organization for the authenticated user.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "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" - }, - { - "description": "String list of comma separated Label names. Example - bug,ui,@high.", - "in": "query", - "name": "labels", - "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" - }, - { - "description": "Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nOnly issues updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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" - } - } - } - } - } - }, - "/orgs/{org}/members": { - "get": { - "description": "Members list.\nList all users who are members of an organization. A member is a user tha\nbelongs to at least 1 team in the organization. If the authenticated user\nis also an owner of this organization then both concealed and public members\nwill be returned. If the requester is not an owner of the organization the\nquery will be redirected to the public members list.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "302": { - "description": "Response if requester is not an organization member.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/members/{username}": { - "delete": { - "description": "Remove a member.\nRemoving a user from this list will remove them from all teams and they\nwill no longer have any access to the organization's repositories.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Name of the user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if a user is, publicly or privately, a member of the organization.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Name of the user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content. Response if requester is an organization member and user is a member\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" - } - } - }, - "302": { - "description": "Found. Response if requester is not an organization member\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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Not Found.\na. Response if requester is an organization member and user is not a member\nb. Response if requester is not an organization member and is inquiring about themselves\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" - } - } - } - } - } - }, - "/orgs/{org}/public_members": { - "get": { - "description": "Public members list.\nMembers of an organization can choose to have their membership publicized\nor not.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/public_members/{username}": { - "delete": { - "description": "Conceal a user's membership.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Name of the user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Concealed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check public membership.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Name of the user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "User is a public member.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "User is not a public member.", - "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" - } - } - } - } - }, - "put": { - "description": "Publicize a user's membership.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Name of the user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Publicized.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/repos": { - "get": { - "description": "List repositories for the specified org.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "default": "all", - "enum": ["all", "public", "private", "forks", "sources", "member"], - "in": "query", - "name": "type", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repos" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a new repository for the authenticated user. OAuth users must supply\nrepo scope.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/postRepo" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/repos" - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/teams": { - "get": { - "description": "List teams.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/teams" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create team.\nIn order to create a team, the authenticated user must be an owner of organization.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/orgTeamsPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/team" - } - }, - "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" - } - } - } - } - } - }, - "/rate_limit": { - "get": { - "description": "Get your current rate limit status\nNote: Accessing this endpoint does not count against your rate limit.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/rate_limit" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}": { - "delete": { - "description": "Delete a Repository.\nDeleting a repository requires admin access. If OAuth is used, the delete_repo\nscope is required.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Item removed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repo" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/repoEdit" - } - } - ], - "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/repo" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/assignees": { - "get": { - "description": "List assignees.\nThis call lists all the available assignees (owner + collaborators) to which\nissues may be assigned.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/assignees" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/assignees/{assignee}": { - "get": { - "description": "Check assignee.\nYou may also check to see if a particular user is an assignee for a repository.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Login of the assignee.", - "in": "path", - "name": "assignee", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "User is an assignee.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "User isn't an assignee.", - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/branches": { - "get": { - "description": "Get list of branches", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/branches" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/branches/{branch}": { - "get": { - "description": "Get Branch", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Name of the branch.", - "in": "path", - "name": "branch", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/branch" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/collaborators": { - "get": { - "description": "List.\nWhen authenticating as an organization owner of an organization-owned\nrepository, all organization owners are included in the list of\ncollaborators. Otherwise, only users with access to the repository are\nreturned in the collaborators list.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/collaborators/{user}": { - "delete": { - "description": "Remove collaborator.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Login of the user.", - "in": "path", - "name": "user", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Collaborator removed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if user is a collaborator", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Login of the user.", - "in": "path", - "name": "user", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "User is a collaborator.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "User is not a collaborator.", - "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" - } - } - } - } - }, - "put": { - "description": "Add collaborator.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Login of the user.", - "in": "path", - "name": "user", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Collaborator added.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/comments": { - "get": { - "description": "List commit comments for a repository.\nComments are ordered by ascending ID.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repoComments" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/comments/{commentId}": { - "delete": { - "description": "Delete a commit comment", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single commit comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/commitComment" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update a commit comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commentBody" - } - } - ], - "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/commitComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/commits": { - "get": { - "description": "List commits on a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Sha or branch to start listing commits from.", - "in": "query", - "name": "sha", - "type": "string" - }, - { - "description": "Only commits containing this file path will be returned.", - "in": "query", - "name": "path", - "type": "string" - }, - { - "description": "GitHub login, name, or email by which to filter by commit author.", - "in": "query", - "name": "author", - "type": "string" - }, - { - "description": "ISO 8601 Date - Only commits before this date will be returned.", - "in": "query", - "name": "until", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/commits" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/commits/{ref}/status": { - "get": { - "description": "Get the combined Status for a specific Ref\nThe Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details.\nTo access this endpoint during the preview period, you must provide a custom media type in the Accept header:\napplication/vnd.github.she-hulk-preview+json\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/refStatus" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/commits/{shaCode}": { - "get": { - "description": "Get a single commit.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "SHA-1 code of the commit.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/commit" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/commits/{shaCode}/comments": { - "get": { - "description": "List comments for a single commitList comments for a single commit.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "SHA-1 code of the commit.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repoComments" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a commit comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "SHA-1 code of the commit.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commitCommentBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/commitComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/compare/{baseId}...{headId}": { - "get": { - "description": "Compare two commits", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "baseId", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "headId", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/compare-commits" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/contents/{path}": { - "delete": { - "description": "Delete a file.\nThis method deletes a file in a repository.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "path", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/deleteFileBody" - } - } - ], - "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/deleteFile" - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get contents.\nThis method returns the contents of a file or directory in a repository.\nFiles and symlinks support a custom media type for getting the raw content.\nDirectories and submodules do not support custom media types.\nNote: This API supports files up to 1 megabyte in size.\nHere can be many outcomes. For details see \"http://developer.github.com/v3/repos/contents/\"\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "path", - "required": true, - "type": "string" - }, - { - "description": "The content path.", - "in": "query", - "name": "path", - "type": "string" - }, - { - "description": "The String name of the Commit/Branch/Tag. Defaults to 'master'.", - "in": "query", - "name": "ref", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/contents-path" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Create a file.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "path", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/createFileBody" - } - } - ], - "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/createFile" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/contributors": { - "get": { - "description": "Get list of contributors.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Set to 1 or true to include anonymous contributors in results.", - "in": "query", - "name": "anon", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/deployments": { - "get": { - "description": "Users with pull access can view deployments for a repository", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repo-deployments" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Users with push access can create a deployment for a given ref", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/deployment" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/deployment-resp" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/deployments/{id}/statuses": { - "get": { - "description": "Users with pull access can view deployment statuses for a deployment", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "The Deployment ID to list the statuses from.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/deployment-statuses" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a Deployment Status\nUsers with push access can create deployment statuses for a given deployment:\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "The Deployment ID to list the statuses from.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/deployment-statuses-create" - } - } - ], - "responses": { - "201": { - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/downloads": { - "get": { - "deprecated": true, - "description": "Deprecated. List downloads for a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/downloads" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/downloads/{downloadId}": { - "delete": { - "deprecated": true, - "description": "Deprecated. Delete a download.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of download.", - "in": "path", - "name": "downloadId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "deprecated": true, - "description": "Deprecated. Get a single download.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of download.", - "in": "path", - "name": "downloadId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/download" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/events": { - "get": { - "description": "Get list of repository events.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/events" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/forks": { - "get": { - "description": "List forks.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "default": "newes", - "enum": ["newes", "oldes", "watchers"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/forks" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a fork.\nForking a Repository happens asynchronously. Therefore, you may have to wai\na short period before accessing the git objects. If this takes longer than 5\nminutes, be sure to contact Support.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/forkBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/repo" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/blobs": { - "post": { - "description": "Create a Blob.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/blob" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/blobs" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/blobs/{shaCode}": { - "get": { - "description": "Get a Blob.\nSince blobs can be any arbitrary binary data, the input and responses for\nthe blob API takes an encoding parameter that can be either utf-8 or\nbase64. If your data cannot be losslessly sent as a UTF-8 string, you can\nbase64 encode it.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "SHA-1 code.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/blob" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/commits": { - "post": { - "description": "Create a Commit.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/repoCommitBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/gitCommit" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/commits/{shaCode}": { - "get": { - "description": "Get a Commit.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "SHA-1 code.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repoCommit" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/refs": { - "get": { - "description": "Get all References", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/refs" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a Reference", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/refsBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/headBranch" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/refs/{ref}": { - "delete": { - "description": "Delete a Reference\nExample: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a\nExample: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No Content", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a Reference", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/headBranch" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update a Reference", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/gitRefPatch" - } - } - ], - "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/headBranch" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/tags": { - "post": { - "description": "Create a Tag Object.\nNote that creating a tag object does not create the reference that makes a\ntag in Git. If you want to create an annotated tag in Git, you have to do\nthis call to create the tag object, and then create the refs/tags/[tag]\nreference. If you want to create a lightweight tag, you only have to create\nthe tag reference - this call would be unnecessary.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tagBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/tag" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/tags/{shaCode}": { - "get": { - "description": "Get a Tag.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/tag" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/trees": { - "post": { - "description": "Create a Tree.\nThe tree creation API will take nested entries as well. If both a tree and\na nested path modifying that tree are specified, it will overwrite the\ncontents of that tree with the new path contents and write a new tree out.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tree" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/trees" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/trees/{shaCode}": { - "get": { - "description": "Get a Tree.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Tree SHA.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Get a Tree Recursively. (0 or 1)", - "in": "query", - "name": "recursive", - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/tree" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/hooks": { - "get": { - "description": "Get list of hooks.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/hook" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a hook.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/hookBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/hook" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/hooks/{hookId}": { - "delete": { - "description": "Delete a hook.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of hook.", - "in": "path", - "name": "hookId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get single hook.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of hook.", - "in": "path", - "name": "hookId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/hook" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a hook.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of hook.", - "in": "path", - "name": "hookId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/hookBody" - } - } - ], - "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/hook" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/hooks/{hookId}/tests": { - "post": { - "description": "Test a push hook.\nThis will trigger the hook with the latest push to the current repository\nif the hook is subscribed to push events. If the hook is not subscribed\nto push events, the server will respond with 204 but no test POST will\nbe generated.\nNote: Previously /repos/:owner/:repo/hooks/:id/tes\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of hook.", - "in": "path", - "name": "hookId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Hook is triggered.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues": { - "get": { - "description": "List issues for a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "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" - }, - { - "description": "String list of comma separated Label names. Example - bug,ui,@high.", - "in": "query", - "name": "labels", - "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" - }, - { - "description": "Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nOnly issues updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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" - } - } - } - } - }, - "post": { - "description": "Create an issue.\nAny user with pull access to a repository can create an issue.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/issue" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/issue" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/comments": { - "get": { - "description": "List comments in a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Ignored without 'sort' parameter.", - "in": "query", - "name": "direction", - "type": "string" - }, - { - "description": "", - "enum": ["created", "updated"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issuesComments" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/comments/{commentId}": { - "delete": { - "description": "Delete a comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "ID of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "ID of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issuesComment" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "ID of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commentBody" - } - } - ], - "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/issuesComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/events": { - "get": { - "description": "List issue events for a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issueEvents" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/events/{eventId}": { - "get": { - "description": "Get a single event.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of the event.", - "in": "path", - "name": "eventId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issueEvent" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/{number}": { - "get": { - "description": "Get a single issue", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issue" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit an issue.\nIssue owners and users with push access can edit an issue.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/issue" - } - } - ], - "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/issue" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/{number}/comments": { - "get": { - "description": "List comments on an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issuesComments" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commentBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/issuesComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/{number}/events": { - "get": { - "description": "List events for an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issueEvents" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/{number}/labels": { - "delete": { - "description": "Remove all labels from an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "List labels on an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/labels" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Add labels to an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/emailsPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/label" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Replace all labels for an issue.\nSending an empty array ([]) will remove all Labels from the Issue.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/emailsPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/label" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/{number}/labels/{name}": { - "delete": { - "description": "Remove a label from an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Name of the label.", - "in": "path", - "name": "name", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Item removed.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/keys": { - "get": { - "description": "Get list of keys.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/keys" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a key.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/user-keys-post" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/user-keys-keyId" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/keys/{keyId}": { - "delete": { - "description": "Delete a key.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of key.", - "in": "path", - "name": "keyId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a key", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of key.", - "in": "path", - "name": "keyId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/user-keys-keyId" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/labels": { - "get": { - "description": "List all labels for this repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/labels" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a label.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/emailsPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/label" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/labels/{name}": { - "delete": { - "description": "Delete a label.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Name of the label.", - "in": "path", - "name": "name", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single label.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Name of the label.", - "in": "path", - "name": "name", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/label" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update a label.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Name of the label.", - "in": "path", - "name": "name", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/emailsPost" - } - } - ], - "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/label" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/languages": { - "get": { - "description": "List languages.\nList languages for the specified repository. The value on the right of a\nlanguage is the number of bytes of code written in that language.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/languages" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/merges": { - "post": { - "description": "Perform a merge.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/mergesBody" - } - } - ], - "responses": { - "201": { - "description": "Successful Response (The resulting merge commit)", - "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/mergesSuccessful" - } - }, - "204": { - "description": "No-op response (base already contains the head, nothing to merge)", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Missing base response or missing head response", - "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/mergesConflict" - } - }, - "409": { - "description": "Merge conflict response.", - "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/mergesConflict" - } - } - } - } - }, - "/repos/{owner}/{repo}/milestones": { - "get": { - "description": "List milestones for a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "default": "open", - "description": "String to filter by state.", - "enum": ["open", "closed"], - "in": "query", - "name": "state", - "type": "string" - }, - { - "description": "Ignored without 'sort' parameter.", - "in": "query", - "name": "direction", - "type": "string" - }, - { - "default": "due_date", - "description": "", - "enum": ["due_date", "completeness"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/milestone" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a milestone.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/milestoneUpdate" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/milestone" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/milestones/{number}": { - "delete": { - "description": "Delete a milestone.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of milestone.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single milestone.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of milestone.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/milestone" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update a milestone.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of milestone.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/milestoneUpdate" - } - } - ], - "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/milestone" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/milestones/{number}/labels": { - "get": { - "description": "Get labels for every issue in a milestone.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of milestone.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/labels" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/notifications": { - "get": { - "description": "List your notifications in a repository\nList all notifications for the current user.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "True to show notifications marked as read.", - "in": "query", - "name": "all", - "type": "boolean" - }, - { - "description": "True to show only notifications in which the user is directly participating\nor mentioned.\n", - "in": "query", - "name": "participating", - "type": "boolean" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/notifications" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Mark notifications as read in a repository.\nMarking all notifications in a repository as \"read\" removes them from the\ndefault view on GitHub.com.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/notificationMarkRead" - } - } - ], - "responses": { - "205": { - "description": "Marked as read.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls": { - "get": { - "description": "List pull requests.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "default": "open", - "description": "String to filter by state.", - "enum": ["open", "closed"], - "in": "query", - "name": "state", - "type": "string" - }, - { - "description": "Filter pulls by head user and branch name in the format of 'user:ref-name'.\nExample: github:new-script-format.\n", - "in": "query", - "name": "head", - "type": "string" - }, - { - "description": "Filter pulls by base branch name. Example - gh-pages.", - "in": "query", - "name": "base", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/pulls" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a pull request.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/pullsPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/pulls" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/comments": { - "get": { - "description": "List comments in a repository.\nBy default, Review Comments are ordered by ascending ID.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Ignored without 'sort' parameter.", - "in": "query", - "name": "direction", - "type": "string" - }, - { - "description": "", - "enum": ["created", "updated"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issuesComments" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/comments/{commentId}": { - "delete": { - "description": "Delete a comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/pullsComment" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commentBody" - } - } - ], - "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/pullsComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/{number}": { - "get": { - "description": "Get a single pull request.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/pullRequest" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update a pull request.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/pullUpdate" - } - } - ], - "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/repo" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/{number}/comments": { - "get": { - "description": "List comments on a pull request.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/pullsComment" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a comment.\n #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ )\n description: |\n Alternative Input.\n Instead of passing commit_id, path, and position you can reply to an\n existing Pull Request Comment like this:\n\n body\n Required string\n in_reply_to\n Required number - Comment id to reply to.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/pullsCommentPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/pullsComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/{number}/commits": { - "get": { - "description": "List commits on a pull request.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/commits" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/{number}/files": { - "get": { - "description": "List pull requests files.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/pulls" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/{number}/merge": { - "get": { - "description": "Get if a pull request has been merged.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Pull request has been merged.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Pull request has not been merged.", - "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" - } - } - } - } - }, - "put": { - "description": "Merge a pull request (Merge Button's)", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/mergePullBody" - } - } - ], - "responses": { - "200": { - "description": "Response if merge was successful.", - "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/merge" - } - }, - "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" - } - } - }, - "405": { - "description": "Response if merge cannot be performed.", - "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/merge" - } - } - } - } - }, - "/repos/{owner}/{repo}/readme": { - "get": { - "description": "Get the README.\nThis method returns the preferred README for a repository.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "The String name of the Commit/Branch/Tag. Defaults to master.", - "in": "query", - "name": "ref", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/contents-path" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/releases": { - "get": { - "description": "Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/releases" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a release\nUsers with push access to the repository can create a release.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/release-create" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/release" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/releases/assets/{id}": { - "delete": { - "description": "Delete a release asset", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No Content", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single release asset", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/asset" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a release asset\nUsers with push access to the repository can edit a release asset.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/assetPatch" - } - } - ], - "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/asset" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/releases/{id}": { - "delete": { - "description": "Users with push access to the repository can delete a release.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No Content", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single release", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/release" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Users with push access to the repository can edit a release", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/release-create" - } - } - ], - "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/release" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/releases/{id}/assets": { - "get": { - "description": "List assets for a release", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/assets" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stargazers": { - "get": { - "description": "List Stargazers.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stats/code_frequency": { - "get": { - "description": "Get the number of additions and deletions per week.\nReturns a weekly aggregate of the number of additions and deletions pushed\nto a repository.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/codeFrequencyStats" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stats/commit_activity": { - "get": { - "description": "Get the last year of commit activity data.\nReturns the last year of commit activity grouped by week. The days array\nis a group of commits per day, starting on Sunday.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/commitActivityStats" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stats/contributors": { - "get": { - "description": "Get contributors list with additions, deletions, and commit counts.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/contributorsStats" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stats/participation": { - "get": { - "description": "Get the weekly commit count for the repo owner and everyone else.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/participationStats" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stats/punch_card": { - "get": { - "description": "Get the number of commits per hour in each day.\nEach array contains the day number, hour number, and number of commits\n0-6 Sunday - Saturday\n0-23 Hour of day\nNumber of commits\n\nFor example, [2, 14, 25] indicates that there were 25 total commits, during\nthe 2.00pm hour on Tuesdays. All times are based on the time zone of\nindividual commits.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/codeFrequencyStats" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/statuses/{ref}": { - "get": { - "description": "List Statuses for a specific Ref.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Ref to list the statuses from. It can be a SHA, a branch name, or a tag name.\n", - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/ref" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a Status.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Ref to list the statuses from. It can be a SHA, a branch name, or a tag name.\n", - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/headBranch" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/ref" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/subscribers": { - "get": { - "description": "List watchers.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/subscription": { - "delete": { - "description": "Delete a Repository Subscription.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a Repository Subscription.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/subscription" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Set a Repository Subscription", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/subscriptionBody" - } - } - ], - "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/subscription" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/tags": { - "get": { - "description": "Get list of tags.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/tags" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/teams": { - "get": { - "description": "Get list of teams", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/teams" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/watchers": { - "get": { - "description": "List Stargazers. New implementation.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/{archive_format}/{path}": { - "get": { - "description": "Get archive link.\nThis method will return a 302 to a URL to download a tarball or zipball\narchive for a repository. Please make sure your HTTP framework is\nconfigured to follow redirects or you will need to use the Location header\nto make a second GET request.\nNote: For private repositories, these links are temporary and expire quickly.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "enum": ["tarball", "zipball"], - "in": "path", - "name": "archive_format", - "required": true, - "type": "string" - }, - { - "description": "Valid Git reference, defaults to 'master'.", - "in": "path", - "name": "path", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "302": { - "description": "Found.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repositories": { - "get": { - "description": "List all public repositories.\nThis provides a dump of every public repository, in the order that they\nwere created.\nNote: Pagination is powered exclusively by the since parameter. is the\nLink header to get the URL for the next page of repositories.\n", - "parameters": [ - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repos" - } - }, - "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" - } - } - } - } - } - }, - "/search/code": { - "get": { - "description": "Search code.", - "parameters": [ - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "The search terms. This can be any combination of the supported code\nsearch parameters:\n'Search In' Qualifies which fields are searched. With this qualifier\nyou can restrict the search to just the file contents, the file path,\nor both.\n'Languages' Searches code based on the language it's written in.\n'Forks' Filters repositories based on the number of forks, and/or\nwhether code from forked repositories should be included in the results\nat all.\n'Size' Finds files that match a certain size (in bytes).\n'Path' Specifies the path that the resulting file must be at.\n'Extension' Matches files with a certain extension.\n'Users' or 'Repositories' Limits searches to a specific user or repository.\n", - "in": "query", - "name": "q", - "required": true, - "type": "string" - }, - { - "description": "Can only be 'indexed', which indicates how recently a file has been indexed\nby the GitHub search infrastructure. If not provided, results are sorted\nby best match.\n", - "enum": ["indexed"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-code" - } - }, - "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" - } - } - } - } - } - }, - "/search/issues": { - "get": { - "description": "Find issues by state and keyword. (This method returns up to 100 results per page.)", - "parameters": [ - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "The q search term can also contain any combination of the supported issue search qualifiers:", - "in": "query", - "name": "q", - "required": true, - "type": "string" - }, - { - "description": "The sort field. Can be comments, created, or updated. Default: results are sorted by best match.", - "enum": ["updated", "created", "comments"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-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" - } - } - } - } - } - }, - "/search/repositories": { - "get": { - "description": "Search repositories.", - "parameters": [ - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "The search terms. This can be any combination of the supported repository\nsearch parameters:\n'Search In' Qualifies which fields are searched. With this qualifier you\ncan restrict the search to just the repository name, description, readme,\nor any combination of these.\n'Size' Finds repositories that match a certain size (in kilobytes).\n'Forks' Filters repositories based on the number of forks, and/or whether\nforked repositories should be included in the results at all.\n'Created' and 'Last Updated' Filters repositories based on times of\ncreation, or when they were last updated.\n'Users or Repositories' Limits searches to a specific user or repository.\n'Languages' Searches repositories based on the language they are written in.\n'Stars' Searches repositories based on the number of stars.\n", - "in": "query", - "name": "q", - "required": true, - "type": "string" - }, - { - "description": "If not provided, results are sorted by best match.", - "enum": ["stars", "forks", "updated"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-repositories" - } - }, - "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" - } - } - } - } - } - }, - "/search/users": { - "get": { - "description": "Search users.", - "parameters": [ - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "The search terms. This can be any combination of the supported user\nsearch parameters:\n'Search In' Qualifies which fields are searched. With this qualifier you\ncan restrict the search to just the username, public email, full name,\nlocation, or any combination of these.\n'Repository count' Filters users based on the number of repositories they\nhave.\n'Location' Filter users by the location indicated in their profile.\n'Language' Search for users that have repositories that match a certain\nlanguage.\n'Created' Filter users based on when they joined.\n'Followers' Filter users based on the number of followers they have.\n", - "in": "query", - "name": "q", - "required": true, - "type": "string" - }, - { - "description": "If not provided, results are sorted by best match.", - "enum": ["followers", "repositories", "joined"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-users" - } - }, - "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" - } - } - } - } - } - }, - "/teams/{teamId}": { - "delete": { - "description": "Delete team.\nIn order to delete a team, the authenticated user must be an owner of the\norg that the team is associated with.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get team.", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/team" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit team.\nIn order to edit a team, the authenticated user must be an owner of the org\nthat the team is associated with.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/editTeam" - } - } - ], - "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/team" - } - }, - "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" - } - } - } - } - } - }, - "/teams/{teamId}/members": { - "get": { - "description": "List team members.\nIn order to list members in a team, the authenticated user must be a member\nof the team.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/teams/{teamId}/members/{username}": { - "delete": { - "deprecated": true, - "description": "The \"Remove team member\" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships.\n\nRemove team member.\nIn order to remove a user from a team, the authenticated user must have 'admin'\npermissions to the team or be an owner of the org that the team is associated\nwith.\nNOTE This does not delete the user, it just remove them from the team.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Team member removed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "deprecated": true, - "description": "The \"Get team member\" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships.\n\nGet team member.\nIn order to get if a user is a member of a team, the authenticated user mus\nbe a member of the team.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "User is a member.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "User is not a member.", - "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" - } - } - } - } - }, - "put": { - "deprecated": true, - "description": "The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams.\n\nAdd team member.\nIn order to add a user to a team, the authenticated user must have 'admin'\npermissions to the team or be an owner of the org that the team is associated\nwith.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Team member added.", - "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" - } - } - }, - "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" - } - } - }, - "422": { - "description": "If you attempt to add an organization to a team, you will get this.", - "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/organizationAsTeamMember" - } - } - } - } - }, - "/teams/{teamId}/memberships/{username}": { - "delete": { - "description": "Remove team membership.\nIn order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Team member removed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get team membership.\nIn order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "200": { - "description": "User is a member.", - "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/teamMembership" - } - }, - "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" - } - } - }, - "404": { - "description": "User has no membership with team", - "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" - } - } - } - } - }, - "put": { - "description": "Add team membership.\nIn order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with.\n\nIf the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team.\n\nIf the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the 'pending' state until the user accepts the invitation, at which point the membership will transition to the 'active' state and the user will be added as a member of the team.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "200": { - "description": "Team member added.", - "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/teamMembership" - } - }, - "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" - } - } - }, - "422": { - "description": "If you attempt to add an organization to a team, you will get this.", - "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/organizationAsTeamMember" - } - } - } - } - }, - "/teams/{teamId}/repos": { - "get": { - "description": "List team repos", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/teamRepos" - } - }, - "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" - } - } - } - } - } - }, - "/teams/{teamId}/repos/{owner}/{repo}": { - "delete": { - "description": "In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team.", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if a team manages a repository", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - }, - "put": { - "description": "In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization.", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a organization.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/user": { - "get": { - "description": "Get the authenticated user.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/user" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update the authenticated user.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/user-update" - } - } - ], - "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/user" - } - }, - "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" - } - } - } - } - } - }, - "/user/emails": { - "delete": { - "description": "Delete email address(es).\nYou can include a single email address or an array of addresses.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/user-emails" - } - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "List email addresses for a user.\nIn the final version of the API, this method will return an array of hashes\nwith extended information for each email address indicating if the address\nhas been verified and if it's primary email address for GitHub.\nUntil API v3 is finalized, use the application/vnd.github.v3 media type to\nget other response format.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "produces": ["application/vnd.github.v3"], - "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/user-emails" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Add email address(es).\nYou can post a single email address or an array of addresses.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/emailsPost" - } - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/user/followers": { - "get": { - "description": "List the authenticated user's followers", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/user/following": { - "get": { - "description": "List who the authenticated user is following.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/user/following/{username}": { - "delete": { - "description": "Unfollow a user.\nUnfollowing a user requires the user to be logged in and authenticated with\nbasic auth or OAuth with the user:follow scope.\n", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "User unfollowed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if you are following a user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Response if you are following this user.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Response if you are not following this user.", - "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" - } - } - } - } - }, - "put": { - "description": "Follow a user.\nFollowing a user requires the user to be logged in and authenticated with\nbasic auth or OAuth with the user:follow scope.\n", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "You are now following the user.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/user/issues": { - "get": { - "description": "List issues.\nList all issues across owned and member repositories for the authenticated\nuser.\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" - }, - { - "description": "String list of comma separated Label names. Example - bug,ui,@high.", - "in": "query", - "name": "labels", - "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" - }, - { - "description": "Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nOnly issues updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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" - } - } - } - } - } - }, - "/user/keys": { - "get": { - "description": "List your public keys.\nLists the current user's keys. Management of public keys via the API requires\nthat you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a public key.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/user-keys-post" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/user-keys-keyId" - } - }, - "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" - } - } - } - } - } - }, - "/user/keys/{keyId}": { - "delete": { - "description": "Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope.", - "parameters": [ - { - "description": "ID of key.", - "in": "path", - "name": "keyId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single public key.", - "parameters": [ - { - "description": "ID of key.", - "in": "path", - "name": "keyId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/user-keys-keyId" - } - }, - "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" - } - } - } - } - } - }, - "/user/orgs": { - "get": { - "description": "List public and private organizations for the authenticated user.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - } - }, - "/user/repos": { - "get": { - "description": "List repositories for the authenticated user. Note that this does not include\nrepositories owned by organizations which the user can access. You can lis\nuser organizations and list organization repositories separately.\n", - "parameters": [ - { - "default": "all", - "enum": ["all", "public", "private", "forks", "sources", "member"], - "in": "query", - "name": "type", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repos" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a new repository for the authenticated user. OAuth users must supply\nrepo scope.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/postRepo" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/repos" - } - }, - "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" - } - } - } - } - } - }, - "/user/starred": { - "get": { - "description": "List repositories being starred by the authenticated user.", - "parameters": [ - { - "description": "Ignored without 'sort' parameter.", - "in": "query", - "name": "direction", - "type": "string" - }, - { - "default": "created", - "description": "", - "enum": ["created", "updated"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - } - }, - "/user/starred/{owner}/{repo}": { - "delete": { - "description": "Unstar a repository", - "parameters": [ - { - "description": "Name of a repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Unstarred.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if you are starring a repository.", - "parameters": [ - { - "description": "Name of a repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "This repository is starred by you.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "This repository is not starred by you.", - "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" - } - } - } - } - }, - "put": { - "description": "Star a repository.", - "parameters": [ - { - "description": "Name of a repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Repository starred.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/user/subscriptions": { - "get": { - "description": "List repositories being watched by the authenticated user.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repos" - } - }, - "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" - } - } - } - } - } - }, - "/user/subscriptions/{owner}/{repo}": { - "delete": { - "deprecated": true, - "description": "Stop watching a repository", - "parameters": [ - { - "description": "Name of the owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Unwatched.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "deprecated": true, - "description": "Check if you are watching a repository.", - "parameters": [ - { - "description": "Name of the owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Repository is watched by you.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Repository is not watched by you.", - "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" - } - } - } - } - }, - "put": { - "deprecated": true, - "description": "Watch a repository.", - "parameters": [ - { - "description": "Name of the owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Repository is watched.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/user/teams": { - "get": { - "description": "List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/teams-list" - } - }, - "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" - } - } - } - } - } - }, - "/users": { - "get": { - "description": "Get all users.\nThis provides a dump of every user, in the order that they signed up for GitHub.\nNote: Pagination is powered exclusively by the since parameter. Use the Link\nheader to get the URL for the next page of users.\n", - "parameters": [ - { - "description": "The integer ID of the last user that you've seen.", - "in": "query", - "name": "since", - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}": { - "get": { - "description": "Get a single user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/user" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/events": { - "get": { - "description": "If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/users/{username}/events/orgs/{org}": { - "get": { - "description": "This is the user's organization dashboard. You must be authenticated as the user to view this.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/users/{username}/followers": { - "get": { - "description": "List a user's followers", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/following/{targetUser}": { - "get": { - "description": "Check if one user follows another.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Name of user.", - "in": "path", - "name": "targetUser", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Response if user follows target user.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Response if user does not follow target user.", - "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" - } - } - } - } - } - }, - "/users/{username}/gists": { - "get": { - "description": "List a users gists.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gists" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/keys": { - "get": { - "description": "List public keys for a user.\nLists the verified public keys for a user. This is accessible by anyone.\n", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/orgs": { - "get": { - "description": "List all public organizations for a user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/received_events": { - "get": { - "description": "These are events that you'll only see public events.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/users/{username}/received_events/public": { - "get": { - "description": "List public events that a user has received", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/users/{username}/repos": { - "get": { - "description": "List public repositories for the specified user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "default": "all", - "enum": ["all", "public", "private", "forks", "sources", "member"], - "in": "query", - "name": "type", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repos" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/starred": { - "get": { - "description": "List repositories being starred by a user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/users/{username}/subscriptions": { - "get": { - "description": "List repositories being watched by a user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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": { - "actor": { - "description": "A user or organization", - "properties": { - "avatar_url": { - "type": "string" - }, - "bio": { - "type": "string" - }, - "blog": { - "description": "The website URL from the profile page", - "type": "string" - }, - "collaborators": { - "type": "integer" - }, - "company": { - "type": "string" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "disk_usage": { - "type": "integer" - }, - "email": { - "description": "Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile).", - "type": "string" - }, - "followers": { - "type": "integer" - }, - "followers_url": { - "type": "string" - }, - "following": { - "type": "integer" - }, - "following_url": { - "type": "string" - }, - "gists_url": { - "type": "string" - }, - "gravatar_id": { - "type": "string" - }, - "hireable": { - "type": "boolean" - }, - "html_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "location": { - "type": "string" - }, - "login": { - "description": "The account username", - "type": "string" - }, - "name": { - "description": "The full account name", - "type": "string" - }, - "organizations_url": { - "type": "string" - }, - "owned_private_repos": { - "type": "integer" - }, - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "committer": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601.", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "committer": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "html_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "line": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "url": { - "type": "string" - }, - "user": { - "$ref": "#/definitions/user" - } - }, - "type": "object" - }, - "commitCommentBody": { - "properties": { - "body": { - "type": "string" - }, - "line": { - "description": "Deprecated - Use position parameter instead.", - "type": "string" - }, - "number": { - "description": "Line number in the file to comment on. Defaults to null.", - "type": "string" - }, - "path": { - "description": "Relative path of the file to comment on.", - "type": "string" - }, - "position": { - "description": "Line index in the diff to comment on.", - "type": "integer" - }, - "sha": { - "description": "SHA of the commit to comment on.", - "type": "string" - } - }, - "required": ["sha", "body"], - "type": "object" - }, - "commits": { - "items": { - "properties": { - "author": { - "$ref": "#/definitions/user" - }, - "commit": { - "properties": { - "author": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "committer": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "The Total number of commits authored by the contributor.", - "type": "integer" - }, - "weeks": { - "items": { - "properties": { - "a": { - "description": "Number of additions.", - "type": "integer" - }, - "c": { - "description": "Number of commits.", - "type": "integer" - }, - "d": { - "description": "Number of deletions.", - "type": "integer" - }, - "w": { - "description": "Start of the week.", - "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": { - "description": "A URL for an image representing this emoji", - "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": { - "description": "Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.", - "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": { - "description": "Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.", - "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": { - "description": "Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "event": { - "type": "string" - }, - "issue": { - "properties": { - "assignee": { - "$ref": "#/definitions/user" - }, - "body": { - "type": "string" - }, - "closed_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "comments": { - "type": "integer" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "creator": { - "$ref": "#/definitions/user" - }, - "description": { - "type": "string" - }, - "due_on": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "comments": { - "type": "integer" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "creator": { - "$ref": "#/definitions/user" - }, - "description": { - "type": "string" - }, - "due_on": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "url": { - "type": "string" - }, - "user": { - "$ref": "#/definitions/user" - } - }, - "type": "object" - }, - "type": "array" - }, - "issuesComment": { - "properties": { - "body": { - "type": "string" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "html_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "id": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "Error 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": { - "description": "An Array of IP addresses in CIDR format specifying the Git servers at GitHub.", - "type": "string" - }, - "type": "array" - }, - "hooks": { - "items": { - "description": "An Array of IP addresses in CIDR format specifying the addresses that incoming service hooks will originate from.", - "type": "string" - }, - "type": "array" - } - }, - "type": "object" - }, - "milestone": { - "properties": { - "closed_issues": { - "type": "integer" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "creator": { - "$ref": "#/definitions/user" - }, - "description": { - "type": "string" - }, - "due_on": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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" - }, - { - "description": "A GitHub organization" - } - ], - "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": { - "description": "Billing email address. This address is not publicized.", - "type": "string" - }, - "company": { - "type": "string" - }, - "email": { - "description": "Publicly visible email address.", - "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": { - "description": "True to create an initial commit with empty README. Default is false.", - "type": "boolean" - }, - "description": { - "type": "string" - }, - "gitignore_template": { - "description": "Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, \"Haskell\" Ignored if auto_init parameter is not provided. ", - "type": "string" - }, - "has_downloads": { - "description": "True to enable downloads for this repository, false to disable them. Default is true.", - "type": "boolean" - }, - "has_issues": { - "description": "True to enable issues for this repository, false to disable them. Default is true.", - "type": "boolean" - }, - "has_wiki": { - "description": "True to enable the wiki for this repository, false to disable it. Default is true.", - "type": "boolean" - }, - "homepage": { - "type": "string" - }, - "name": { - "type": "string" - }, - "private": { - "description": "True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account.", - "type": "boolean" - }, - "team_id": { - "description": "The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization.", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "number": { - "type": "integer" - }, - "patch_url": { - "type": "string" - }, - "state": { - "enum": ["open", "closed"] - }, - "title": { - "type": "string" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "id": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "id": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "limit": { - "type": "integer" - }, - "remaining": { - "type": "integer" - }, - "reset": { - "type": "integer" - } - } - } - }, - "type": "object" - }, - "ref": { - "items": { - "properties": { - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "creator": { - "properties": { - "avatar_url": { - "type": "string" - }, - "gravatar_id": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "login": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "description": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "state": { - "type": "string" - }, - "target_url": { - "type": "string" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "refStatus": { - "items": { - "properties": { - "commit_url": { - "type": "string" - }, - "name": { - "type": "string" - }, - "repository_url": { - "type": "string" - }, - "sha": { - "type": "string" - }, - "state": { - "type": "string" - }, - "statuses": { - "items": { - "properties": { - "context": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "description": { - "type": "string" - }, - "id": { - "type": "number" - }, - "state": { - "type": "string" - }, - "target_url": { - "type": "string" - }, - "updated_at": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - } - }, - "type": "object" - }, - "type": "array" - }, - "refs": { - "items": { - "properties": { - "object": { - "properties": { - "sha": { - "type": "string" - }, - "type": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "ref": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "refsBody": { - "properties": { - "ref": { - "type": "string" - }, - "sha": { - "type": "string" - } - }, - "type": "object" - }, - "release": { - "properties": { - "assets": { - "items": { - "properties": { - "content_type": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "download_count": { - "type": "integer" - }, - "id": { - "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" - }, - "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" - }, - "tarball_url": { - "type": "string" - }, - "target_commitish": { - "type": "string" - }, - "upload_url": { - "type": "string" - }, - "url": { - "type": "string" - }, - "zipball_url": { - "type": "string" - } - }, - "type": "object" - }, - "release-create": { - "properties": { - "body": { - "type": "string" - }, - "draft": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "prerelease": { - "type": "boolean" - }, - "tag_name": { - "type": "string" - }, - "target_commitish": { - "type": "string" - } - }, - "type": "object" - }, - "releases": { - "items": { - "properties": { - "assets": { - "items": { - "properties": { - "content_type": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "download_count": { - "type": "integer" - }, - "id": { - "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" - }, - "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" - }, - "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": { - "clone_url": { - "type": "string" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "description": { - "type": "string" - }, - "fork": { - "type": "boolean" - }, - "forks": { - "type": "integer" - }, - "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" - }, - "organization": { - "$ref": "#/definitions/organization" - }, - "owner": { - "$ref": "#/definitions/actor" - }, - "parent": { - "allOf": [ - { - "$ref": "#/definitions/repo" - }, - { - "description": "Is present when the repo is a fork. Parent is the repo this repo was forked from." - } - ] - }, - "private": { - "type": "boolean" - }, - "pushed_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "size": { - "type": "integer" - }, - "source": { - "allOf": [ - { - "$ref": "#/definitions/repo" - }, - { - "description": "Is present when the repo is a fork. Source is the ultimate source for the network." - } - ] - }, - "ssh_url": { - "type": "string" - }, - "svn_url": { - "type": "string" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "html_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "line": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "url": { - "type": "string" - }, - "user": { - "$ref": "#/definitions/user" - } - }, - "type": "object" - }, - "type": "array" - }, - "repoCommit": { - "properties": { - "author": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "committer": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "message": { - "type": "string" - }, - "parents": { - "items": { - "properties": { - "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" - }, - "repoCommitBody": { - "properties": { - "author": { - "properties": { - "date": { - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "message": { - "type": "string" - }, - "parents": { - "items": { - "type": "string" - }, - "type": "array" - }, - "tree": { - "type": "string" - } - }, - "required": ["message", "parents", "tree"], - "type": "object" - }, - "repoEdit": { - "properties": { - "description": { - "type": "string" - }, - "has_downloads": { - "type": "boolean" - }, - "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": { - "git_url": { - "type": "string" - }, - "html_url": { - "type": "string" - }, - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "repository": { - "properties": { - "archive_url": { - "type": "string" - }, - "assignees_url": { - "type": "string" - }, - "blobs_url": { - "type": "string" - }, - "branches_url": { - "type": "string" - }, - "collaborators_url": { - "type": "string" - }, - "comments_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": { - "items": { - "items": { - "properties": { - "assignee": { - "type": "null" - }, - "body": { - "type": "string" - }, - "closed_at": { - "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" - }, - "total_count": { - "type": "integer" - } - }, - "type": "object" - }, - "search-issues-by-keyword": { - "properties": { - "issues": { - "items": { - "properties": { - "body": { - "type": "string" - }, - "comments": { - "type": "integer" - }, - "created_at": { - "type": "string" - }, - "gravatar_id": { - "type": "string" - }, - "html_url": { - "type": "string" - }, - "labels": { - "items": { - "type": "string" - }, - "type": "array" - }, - "number": { - "type": "integer" - }, - "position": { - "type": "integer" - }, - "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": { - "items": { - "$ref": "#/definitions/users" - }, - "total_count": { - "type": "integer" - } - }, - "type": "object" - }, - "search-users-by-keyword": { - "properties": { - "users": { - "$ref": "#/definitions/users" - } - }, - "type": "object" - }, - "subscription": { - "properties": { - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "ignored": { - "type": "boolean" - }, - "reason": { - "type": "string" - }, - "repository_url": { - "type": "string" - }, - "subscribed": { - "type": "boolean" - }, - "thread_url": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "subscriptionBody": { - "properties": { - "ignored": { - "type": "boolean" - }, - "subscribed": { - "type": "boolean" - } - }, - "type": "object" - }, - "tag": { - "properties": { - "message": { - "description": "String of the tag message.", - "type": "string" - }, - "object": { - "properties": { - "sha": { - "type": "string" - }, - "type": { - "description": "String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob.", - "enum": ["commit", "tree", "blob"] - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "sha": { - "type": "string" - }, - "tag": { - "description": "The tag's name. This is typically a version (e.g., \"v0.0.1\").", - "type": "string" - }, - "tagger": { - "properties": { - "date": { - "description": "Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "description": "String of the email of the author of the tag.", - "type": "string" - }, - "name": { - "description": "String of the name of the author of the tag.", - "type": "string" - } - }, - "type": "object" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "tagBody": { - "properties": { - "message": { - "description": "String of the tag message.", - "type": "string" - }, - "object": { - "description": "String of the SHA of the git object this is tagging.", - "type": "string" - }, - "tag": { - "description": "The tag's name. This is typically a version (e.g., \"v0.0.1\").", - "type": "string" - }, - "tagger": { - "properties": { - "date": { - "description": "Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "description": "String of the email of the author of the tag.", - "type": "string" - }, - "name": { - "description": "String of the name of the author of the tag.", - "type": "string" - } - }, - "type": "object" - }, - "type": { - "description": "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.", - "enum": ["commit", "tree", "blob"] - } - }, - "required": ["tag", "message", "object", "type", "tagger"], - "type": "object" - }, - "tags": { - "items": { - "$ref": "#/definitions/tag" - }, - "type": "array" - }, - "team": { - "properties": { - "id": { - "type": "integer" - }, - "members_count": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "permission": { - "type": "string" - }, - "repos_count": { - "type": "integer" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "teamMembership": { - "properties": { - "state": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "teamRepos": { - "$ref": "#/definitions/repos" - }, - "teams": { - "items": { - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "teams-list": { - "items": { - "properties": { - "id": { - "type": "integer" - }, - "members_count": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "organization": { - "properties": { - "avatar_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "login": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "permission": { - "type": "string" - }, - "repos_count": { - "type": "integer" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "tree": { - "properties": { - "sha": { - "type": "string" - }, - "tree": { - "items": { - "properties": { - "mode": { - "description": "One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink.", - "enum": ["100644", "100755", "040000", "160000", "120000"], - "type": "string" - }, - "path": { - "type": "string" - }, - "sha": { - "description": "SHA1 checksum ID of the object in the tree.", - "type": "string" - }, - "size": { - "type": "integer" - }, - "type": { - "enum": ["blob", "tree", "commit"], - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "trees": { - "properties": { - "base_tree": { - "type": "string" - }, - "sha": { - "description": "SHA1 checksum ID of the object in the tree.", - "type": "string" - }, - "tree": { - "items": { - "$ref": "#/definitions/tree" - }, - "type": "array" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "user": { - "allOf": [ - { - "$ref": "#/definitions/actor" - }, - { - "description": "A GitHub user" - } - ], - "type": "object" - }, - "user-emails": { - "items": { - "type": "string" - }, - "type": "array" - }, - "user-keys-keyId": { - "properties": { - "id": { - "type": "integer" - }, - "key": { - "type": "string" - }, - "title": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "user-keys-post": { - "properties": { - "key": { - "type": "string" - }, - "title": { - "type": "string" - } - }, - "type": "object" - }, - "user-update": { - "properties": { - "bio": { - "type": "string" - }, - "blog": { - "type": "string" - }, - "company": { - "type": "string" - }, - "email": { - "type": "string" - }, - "hireable": { - "type": "boolean" - }, - "location": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "users": { - "items": { - "$ref": "#/definitions/user" - }, - "type": "array" - } - } -} diff --git a/tests/simple.test.ts b/tests/simple.test.ts new file mode 100644 index 00000000..71d8b32e --- /dev/null +++ b/tests/simple.test.ts @@ -0,0 +1,41 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../src/index.js"; +import { collectAllSchemas } from "./utils.js"; + +describe("simple", async () => { + let tmpdir: string; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + const schemas = await collectAllSchemas(); + + test.each(schemas)("$name", async (schema) => { + // @ts-expect-error + await generateApi({ + name: schema.name, + input: schema.filePath, + output: tmpdir, + silent: true, + generateClient: true, + generateRouteTypes: false, + sortTypes: true, + }); + + const content = await fs.readFile(path.join(tmpdir, `${schema.name}.ts`), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/additional-properties-2.0/schema.ts b/tests/spec/additional-properties-2.0/__snapshots__/basic.test.ts.snap similarity index 84% rename from tests/spec/additional-properties-2.0/schema.ts rename to tests/spec/additional-properties-2.0/__snapshots__/basic.test.ts.snap index b4d1b105..e7fe4e5c 100644 --- a/tests/spec/additional-properties-2.0/schema.ts +++ b/tests/spec/additional-properties-2.0/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > additional properties 2.0 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -31,3 +34,5 @@ export type MyObject4 = Record< filename?: string | null; } >; +" +`; diff --git a/tests/spec/additional-properties-2.0/basic.test.ts b/tests/spec/additional-properties-2.0/basic.test.ts new file mode 100644 index 00000000..c301edc6 --- /dev/null +++ b/tests/spec/additional-properties-2.0/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("additional properties 2.0", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + addReadonly: true, + generateClient: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/additional-properties-2.0/expected.ts b/tests/spec/additional-properties-2.0/expected.ts deleted file mode 100644 index b4d1b105..00000000 --- a/tests/spec/additional-properties-2.0/expected.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface MyObject1 { - id?: string; - [key: string]: any; -} - -export interface MyObject2 { - id?: string; - [key: string]: any; -} - -export interface MyObject3 { - id?: string; - [key: string]: any; -} - -export type MyObject4 = Record< - string, - { - content?: string; - filename?: string | null; - } ->; diff --git a/tests/spec/additional-properties-2.0/test.js b/tests/spec/additional-properties-2.0/test.js deleted file mode 100644 index b4702dc7..00000000 --- a/tests/spec/additional-properties-2.0/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "additional properties 2.0 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/another-array-type/expected.ts b/tests/spec/another-array-type/__snapshots__/basic.test.ts.snap similarity index 79% rename from tests/spec/another-array-type/expected.ts rename to tests/spec/another-array-type/__snapshots__/basic.test.ts.snap index f48c920c..a18ee3ef 100644 --- a/tests/spec/another-array-type/expected.ts +++ b/tests/spec/another-array-type/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --another-array-type 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -12,3 +15,5 @@ export type AnotherArrayType1 = Array; export type AnotherArrayType2 = Array; +" +`; diff --git a/tests/spec/another-array-type/basic.test.ts b/tests/spec/another-array-type/basic.test.ts new file mode 100644 index 00000000..269b1119 --- /dev/null +++ b/tests/spec/another-array-type/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--another-array-type", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + anotherArrayType: true, + generateClient: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/another-array-type/schema.ts b/tests/spec/another-array-type/schema.ts deleted file mode 100644 index f48c920c..00000000 --- a/tests/spec/another-array-type/schema.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type AnotherArrayType1 = Array; - -export type AnotherArrayType2 = Array; diff --git a/tests/spec/another-array-type/test.js b/tests/spec/another-array-type/test.js deleted file mode 100644 index 3ae98179..00000000 --- a/tests/spec/another-array-type/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--another-array-type option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - generateClient: false, - anotherArrayType: true, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/another-query-params/expected.ts b/tests/spec/another-query-params/__snapshots__/basic.test.ts.snap similarity index 94% rename from tests/spec/another-query-params/expected.ts rename to tests/spec/another-query-params/__snapshots__/basic.test.ts.snap index 52df16d0..a7e14867 100644 --- a/tests/spec/another-query-params/expected.ts +++ b/tests/spec/another-query-params/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > another-query-params 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -41,7 +44,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -106,7 +109,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -128,7 +131,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -144,7 +147,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -208,7 +211,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -301,10 +304,12 @@ export class Api extends HttpClient this.request({ - path: `/api/sys/department`, + path: \`/api/sys/department\`, method: "GET", query: query, ...params, }), }; } +" +`; diff --git a/tests/spec/another-query-params/basic.test.ts b/tests/spec/another-query-params/basic.test.ts new file mode 100644 index 00000000..87eefd1e --- /dev/null +++ b/tests/spec/another-query-params/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("another-query-params", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/another-query-params/schema.ts b/tests/spec/another-query-params/schema.ts deleted file mode 100644 index 52df16d0..00000000 --- a/tests/spec/another-query-params/schema.ts +++ /dev/null @@ -1,310 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Sort */ -export interface Sort { - empty?: boolean; - sorted?: boolean; - unsorted?: boolean; -} - -/** - * R«object» - * 统一的api返回格式 - */ -export interface RObject { - /** - * 响应码 - * @format int32 - * @example 0 - */ - code: number; - /** 返回数据 */ - data: object; - /** - * 说明信息 - * @example "用户名或密码错误" - */ - msg: string; - success?: boolean; -} - -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 = "//localhost:8083"; - 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.clone() 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 系统 - * @version 1.6.3 - * @baseUrl //localhost:8083 - */ -export class Api extends HttpClient { - api = { - /** - * No description - * - * @tags 部门 - * @name List2 - * @summary 部门列表 - * @request GET:/api/sys/department{?children,createdTime,description,id,name,page,parent,size,sort,updatedTime,customField} - */ - list2: ( - query: { - /** - * 第page页,从0开始计数 - * @format int32 - */ - page?: number; - /** - * 每页数据数量 - * @format int32 - */ - size?: number; - /** 按属性排序,格式:属性,[asc|desc] */ - sort?: string[]; - /** querydsl自动生成 */ - children?: object[]; - /** - * querydsl自动生成 - * @format date-time - */ - createdTime?: string; - /** querydsl自动生成 */ - description?: string; - /** querydsl自动生成 */ - id?: string; - /** querydsl自动生成 */ - name?: string; - /** querydsl自动生成 */ - parent?: string; - /** - * querydsl自动生成 - * @format date-time - */ - updatedTime?: string; - customField: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/api/sys/department`, - method: "GET", - query: query, - ...params, - }), - }; -} diff --git a/tests/spec/another-query-params/test.js b/tests/spec/another-query-params/test.js deleted file mode 100644 index 4dda1565..00000000 --- a/tests/spec/another-query-params/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "another-query-params test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - generateClient: true, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/axios/expected.ts b/tests/spec/axios/__snapshots__/basic.test.ts.snap similarity index 92% rename from tests/spec/axios/expected.ts rename to tests/spec/axios/__snapshots__/basic.test.ts.snap index 3be81f8e..d08e8ad8 100644 --- a/tests/spec/axios/expected.ts +++ b/tests/spec/axios/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --axios option 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -1913,7 +1916,7 @@ import axios from "axios"; export type QueryParamsType = Record; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -1981,7 +1984,7 @@ export class HttpClient { if (typeof formItem === "object" && formItem !== null) { return JSON.stringify(formItem); } else { - return `${formItem}`; + return \`\${formItem}\`; } } @@ -2091,7 +2094,7 @@ export class Api extends HttpClient({ - path: `/some-test`, + path: \`/some-test\`, method: "GET", format: "json", ...params, @@ -2106,7 +2109,7 @@ export class Api extends HttpClient this.request({ - path: `/path-params`, + path: \`/path-params\`, method: "GET", format: "json", ...params, @@ -2121,7 +2124,7 @@ export class Api extends HttpClient this.request({ - path: `/events`, + path: \`/events\`, method: "GET", format: "json", ...params, @@ -2136,7 +2139,7 @@ export class Api extends HttpClient this.request({ - path: `/feeds`, + path: \`/feeds\`, method: "GET", format: "json", ...params, @@ -2160,7 +2163,7 @@ export class Api extends HttpClient this.request({ - path: `/gists`, + path: \`/gists\`, method: "GET", query: query, format: "json", @@ -2175,7 +2178,7 @@ export class Api extends HttpClient this.request({ - path: `/gists`, + path: \`/gists\`, method: "POST", body: body, type: ContentType.Json, @@ -2200,7 +2203,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/public`, + path: \`/gists/public\`, method: "GET", query: query, format: "json", @@ -2224,7 +2227,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/starred`, + path: \`/gists/starred\`, method: "GET", query: query, format: "json", @@ -2239,7 +2242,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "DELETE", ...params, }), @@ -2252,7 +2255,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "GET", format: "json", ...params, @@ -2266,7 +2269,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2282,7 +2285,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "GET", format: "json", ...params, @@ -2296,7 +2299,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "POST", body: body, format: "json", @@ -2311,7 +2314,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -2326,7 +2329,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -2340,7 +2343,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2356,7 +2359,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/forks`, + path: \`/gists/\${id}/forks\`, method: "POST", ...params, }), @@ -2369,7 +2372,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "DELETE", ...params, }), @@ -2382,7 +2385,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "GET", ...params, }), @@ -2395,7 +2398,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "PUT", ...params, }), @@ -2409,7 +2412,7 @@ export class Api extends HttpClient this.request({ - path: `/gitignore/templates`, + path: \`/gitignore/templates\`, method: "GET", format: "json", ...params, @@ -2423,7 +2426,7 @@ export class Api extends HttpClient this.request({ - path: `/gitignore/templates/${language}`, + path: \`/gitignore/templates/\${language}\`, method: "GET", format: "json", ...params, @@ -2461,7 +2464,7 @@ export class Api extends HttpClient this.request({ - path: `/issues`, + path: \`/issues\`, method: "GET", query: query, format: "json", @@ -2484,7 +2487,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + path: \`/legacy/issues/search/\${owner}/\${repository}/\${state}/\${keyword}\`, method: "GET", format: "json", ...params, @@ -2515,7 +2518,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/repos/search/${keyword}`, + path: \`/legacy/repos/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2531,7 +2534,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/user/email/${email}`, + path: \`/legacy/user/email/\${email}\`, method: "GET", format: "json", ...params, @@ -2560,7 +2563,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/user/search/${keyword}`, + path: \`/legacy/user/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2576,7 +2579,7 @@ export class Api extends HttpClient this.request({ - path: `/markdown`, + path: \`/markdown\`, method: "POST", body: body, type: ContentType.Json, @@ -2591,7 +2594,7 @@ export class Api extends HttpClient this.request({ - path: `/markdown/raw`, + path: \`/markdown/raw\`, method: "POST", type: ContentType.Text, ...params, @@ -2606,7 +2609,7 @@ export class Api extends HttpClient this.request({ - path: `/meta`, + path: \`/meta\`, method: "GET", format: "json", ...params, @@ -2621,7 +2624,7 @@ export class Api extends HttpClient this.request({ - path: `/networks/${owner}/${repo}/events`, + path: \`/networks/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -2652,7 +2655,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "GET", query: query, format: "json", @@ -2667,7 +2670,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "PUT", body: body, ...params, @@ -2681,7 +2684,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "GET", format: "json", ...params, @@ -2695,7 +2698,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "PATCH", ...params, }), @@ -2708,7 +2711,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "DELETE", ...params, }), @@ -2721,7 +2724,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "GET", format: "json", ...params, @@ -2735,7 +2738,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -2752,7 +2755,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "GET", format: "json", ...params, @@ -2766,7 +2769,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2782,7 +2785,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/events`, + path: \`/orgs/\${org}/events\`, method: "GET", format: "json", ...params, @@ -2820,7 +2823,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/issues`, + path: \`/orgs/\${org}/issues\`, method: "GET", query: query, format: "json", @@ -2835,7 +2838,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members`, + path: \`/orgs/\${org}/members\`, method: "GET", format: "json", ...params, @@ -2849,7 +2852,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "DELETE", ...params, }), @@ -2864,7 +2867,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "GET", ...params, }), @@ -2877,7 +2880,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members`, + path: \`/orgs/\${org}/public_members\`, method: "GET", format: "json", ...params, @@ -2891,7 +2894,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "DELETE", ...params, }), @@ -2906,7 +2909,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "GET", ...params, }), @@ -2919,7 +2922,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "PUT", ...params, }), @@ -2939,7 +2942,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "GET", query: query, format: "json", @@ -2954,7 +2957,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "POST", body: body, format: "json", @@ -2969,7 +2972,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "GET", format: "json", ...params, @@ -2983,7 +2986,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "POST", body: body, type: ContentType.Json, @@ -3000,7 +3003,7 @@ export class Api extends HttpClient this.request({ - path: `/rate_limit`, + path: \`/rate_limit\`, method: "GET", format: "json", ...params, @@ -3015,7 +3018,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -3028,7 +3031,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "GET", format: "json", ...params, @@ -3042,7 +3045,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -3058,7 +3061,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/assignees`, + path: \`/repos/\${owner}/\${repo}/assignees\`, method: "GET", format: "json", ...params, @@ -3074,7 +3077,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/assignees/${assignee}`, + path: \`/repos/\${owner}/\${repo}/assignees/\${assignee}\`, method: "GET", ...params, }), @@ -3087,7 +3090,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/branches`, + path: \`/repos/\${owner}/\${repo}/branches\`, method: "GET", format: "json", ...params, @@ -3103,7 +3106,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}`, + path: \`/repos/\${owner}/\${repo}/branches/\${branch}\`, method: "GET", format: "json", ...params, @@ -3117,7 +3120,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators`, + path: \`/repos/\${owner}/\${repo}/collaborators\`, method: "GET", format: "json", ...params, @@ -3131,7 +3134,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "DELETE", ...params, }), @@ -3146,7 +3149,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "GET", ...params, }), @@ -3159,7 +3162,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "PUT", ...params, }), @@ -3172,7 +3175,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments`, + path: \`/repos/\${owner}/\${repo}/comments\`, method: "GET", format: "json", ...params, @@ -3186,7 +3189,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3201,7 +3204,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -3221,7 +3224,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -3255,7 +3258,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits`, + path: \`/repos/\${owner}/\${repo}/commits\`, method: "GET", query: query, format: "json", @@ -3270,7 +3273,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/status`, + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/status\`, method: "GET", format: "json", ...params, @@ -3286,7 +3289,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3300,7 +3303,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "GET", format: "json", ...params, @@ -3320,7 +3323,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -3336,7 +3339,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + path: \`/repos/\${owner}/\${repo}/compare/\${baseId}...\${headId}\`, method: "GET", format: "json", ...params, @@ -3350,7 +3353,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "DELETE", body: body, type: ContentType.Json, @@ -3377,7 +3380,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "GET", query: query, format: "json", @@ -3392,7 +3395,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "PUT", body: body, type: ContentType.Json, @@ -3416,7 +3419,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contributors`, + path: \`/repos/\${owner}/\${repo}/contributors\`, method: "GET", query: query, format: "json", @@ -3431,7 +3434,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "GET", format: "json", ...params, @@ -3445,7 +3448,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "POST", body: body, type: ContentType.Json, @@ -3461,7 +3464,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "GET", format: "json", ...params, @@ -3481,7 +3484,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "POST", body: body, type: ContentType.Json, @@ -3497,7 +3500,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads`, + path: \`/repos/\${owner}/\${repo}/downloads\`, method: "GET", format: "json", ...params, @@ -3512,7 +3515,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "DELETE", ...params, }), @@ -3528,7 +3531,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "GET", format: "json", ...params, @@ -3542,7 +3545,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/events`, + path: \`/repos/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -3564,7 +3567,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "GET", query: query, format: "json", @@ -3579,7 +3582,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "POST", body: body, type: ContentType.Json, @@ -3595,7 +3598,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/blobs`, + path: \`/repos/\${owner}/\${repo}/git/blobs\`, method: "POST", body: body, type: ContentType.Json, @@ -3611,7 +3614,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/blobs/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3625,7 +3628,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/commits`, + path: \`/repos/\${owner}/\${repo}/git/commits\`, method: "POST", body: body, type: ContentType.Json, @@ -3641,7 +3644,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3655,7 +3658,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "GET", format: "json", ...params, @@ -3669,7 +3672,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "POST", body: body, type: ContentType.Json, @@ -3685,7 +3688,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "DELETE", ...params, }), @@ -3700,7 +3703,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "GET", format: "json", ...params, @@ -3714,7 +3717,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -3730,7 +3733,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/tags`, + path: \`/repos/\${owner}/\${repo}/git/tags\`, method: "POST", body: body, type: ContentType.Json, @@ -3746,7 +3749,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/tags/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3760,7 +3763,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/trees`, + path: \`/repos/\${owner}/\${repo}/git/trees\`, method: "POST", body: body, type: ContentType.Json, @@ -3785,7 +3788,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/trees/\${shaCode}\`, method: "GET", query: query, format: "json", @@ -3800,7 +3803,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "GET", format: "json", ...params, @@ -3814,7 +3817,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "POST", body: body, format: "json", @@ -3829,7 +3832,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "DELETE", ...params, }), @@ -3844,7 +3847,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "GET", format: "json", ...params, @@ -3858,7 +3861,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "PATCH", body: body, format: "json", @@ -3873,7 +3876,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/tests\`, method: "POST", ...params, }), @@ -3911,7 +3914,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "GET", query: query, format: "json", @@ -3926,7 +3929,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "POST", body: body, format: "json", @@ -3955,7 +3958,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, + path: \`/repos/\${owner}/\${repo}/issues/comments\`, method: "GET", query: query, format: "json", @@ -3970,7 +3973,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3985,7 +3988,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -4005,7 +4008,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -4020,7 +4023,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/events`, + path: \`/repos/\${owner}/\${repo}/issues/events\`, method: "GET", format: "json", ...params, @@ -4036,7 +4039,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + path: \`/repos/\${owner}/\${repo}/issues/events/\${eventId}\`, method: "GET", format: "json", ...params, @@ -4052,7 +4055,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "GET", format: "json", ...params, @@ -4066,7 +4069,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "PATCH", body: body, format: "json", @@ -4083,7 +4086,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -4103,7 +4106,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "POST", body: body, format: "json", @@ -4120,7 +4123,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/events`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/events\`, method: "GET", format: "json", ...params, @@ -4134,7 +4137,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "DELETE", ...params, }), @@ -4147,7 +4150,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4161,7 +4164,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "POST", body: body, format: "json", @@ -4176,7 +4179,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "PUT", body: body, format: "json", @@ -4193,7 +4196,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4206,7 +4209,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "GET", format: "json", ...params, @@ -4220,7 +4223,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "POST", body: body, format: "json", @@ -4235,7 +4238,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -4250,7 +4253,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -4264,7 +4267,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "GET", format: "json", ...params, @@ -4278,7 +4281,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "POST", body: body, format: "json", @@ -4293,7 +4296,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4308,7 +4311,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "GET", format: "json", ...params, @@ -4322,7 +4325,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "PATCH", body: body, format: "json", @@ -4337,7 +4340,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/languages`, + path: \`/repos/\${owner}/\${repo}/languages\`, method: "GET", format: "json", ...params, @@ -4351,7 +4354,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/merges`, + path: \`/repos/\${owner}/\${repo}/merges\`, method: "POST", body: body, type: ContentType.Json, @@ -4382,7 +4385,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "GET", query: query, format: "json", @@ -4397,7 +4400,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "POST", body: body, format: "json", @@ -4412,7 +4415,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "DELETE", ...params, }), @@ -4427,7 +4430,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "GET", format: "json", ...params, @@ -4447,7 +4450,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "PATCH", body: body, format: "json", @@ -4462,7 +4465,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4494,7 +4497,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "GET", query: query, format: "json", @@ -4509,7 +4512,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "PUT", body: body, ...params, @@ -4541,7 +4544,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "GET", query: query, format: "json", @@ -4556,7 +4559,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "POST", body: body, type: ContentType.Json, @@ -4586,7 +4589,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/comments\`, method: "GET", query: query, format: "json", @@ -4601,7 +4604,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -4616,7 +4619,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -4636,7 +4639,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -4653,7 +4656,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "GET", format: "json", ...params, @@ -4667,7 +4670,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -4685,7 +4688,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -4705,7 +4708,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -4721,7 +4724,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/commits\`, method: "GET", format: "json", ...params, @@ -4735,7 +4738,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/files`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/files\`, method: "GET", format: "json", ...params, @@ -4749,7 +4752,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "GET", ...params, }), @@ -4762,7 +4765,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "PUT", body: body, type: ContentType.Json, @@ -4786,7 +4789,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/readme`, + path: \`/repos/\${owner}/\${repo}/readme\`, method: "GET", query: query, format: "json", @@ -4801,7 +4804,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "GET", format: "json", ...params, @@ -4815,7 +4818,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "POST", body: body, format: "json", @@ -4830,7 +4833,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "DELETE", ...params, }), @@ -4843,7 +4846,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "GET", format: "json", ...params, @@ -4863,7 +4866,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -4879,7 +4882,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "DELETE", ...params, }), @@ -4894,7 +4897,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "GET", format: "json", ...params, @@ -4908,7 +4911,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "PATCH", body: body, format: "json", @@ -4925,7 +4928,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}/assets`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}/assets\`, method: "GET", format: "json", ...params, @@ -4939,7 +4942,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stargazers`, + path: \`/repos/\${owner}/\${repo}/stargazers\`, method: "GET", format: "json", ...params, @@ -4953,7 +4956,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/code_frequency`, + path: \`/repos/\${owner}/\${repo}/stats/code_frequency\`, method: "GET", format: "json", ...params, @@ -4967,7 +4970,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/commit_activity`, + path: \`/repos/\${owner}/\${repo}/stats/commit_activity\`, method: "GET", format: "json", ...params, @@ -4981,7 +4984,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/contributors`, + path: \`/repos/\${owner}/\${repo}/stats/contributors\`, method: "GET", format: "json", ...params, @@ -4995,7 +4998,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/participation`, + path: \`/repos/\${owner}/\${repo}/stats/participation\`, method: "GET", format: "json", ...params, @@ -5009,7 +5012,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/punch_card`, + path: \`/repos/\${owner}/\${repo}/stats/punch_card\`, method: "GET", format: "json", ...params, @@ -5023,7 +5026,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "GET", format: "json", ...params, @@ -5037,7 +5040,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "POST", body: body, type: ContentType.Json, @@ -5053,7 +5056,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscribers`, + path: \`/repos/\${owner}/\${repo}/subscribers\`, method: "GET", format: "json", ...params, @@ -5067,7 +5070,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "DELETE", ...params, }), @@ -5080,7 +5083,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "GET", format: "json", ...params, @@ -5094,7 +5097,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -5110,7 +5113,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/tags`, + path: \`/repos/\${owner}/\${repo}/tags\`, method: "GET", format: "json", ...params, @@ -5124,7 +5127,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/teams`, + path: \`/repos/\${owner}/\${repo}/teams\`, method: "GET", format: "json", ...params, @@ -5138,7 +5141,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/watchers`, + path: \`/repos/\${owner}/\${repo}/watchers\`, method: "GET", format: "json", ...params, @@ -5160,7 +5163,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + path: \`/repos/\${owner}/\${repo}/\${archiveFormat}/\${path}\`, method: "GET", ...params, }), @@ -5183,7 +5186,7 @@ export class Api extends HttpClient this.request({ - path: `/repositories`, + path: \`/repositories\`, method: "GET", query: query, format: "json", @@ -5230,7 +5233,7 @@ export class Api extends HttpClient this.request({ - path: `/search/code`, + path: \`/search/code\`, method: "GET", query: query, format: "json", @@ -5258,7 +5261,7 @@ export class Api extends HttpClient this.request({ - path: `/search/issues`, + path: \`/search/issues\`, method: "GET", query: query, format: "json", @@ -5300,7 +5303,7 @@ export class Api extends HttpClient this.request({ - path: `/search/repositories`, + path: \`/search/repositories\`, method: "GET", query: query, format: "json", @@ -5341,7 +5344,7 @@ export class Api extends HttpClient this.request({ - path: `/search/users`, + path: \`/search/users\`, method: "GET", query: query, format: "json", @@ -5357,7 +5360,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "DELETE", ...params, }), @@ -5370,7 +5373,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "GET", format: "json", ...params, @@ -5384,7 +5387,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5400,7 +5403,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members`, + path: \`/teams/\${teamId}/members\`, method: "GET", format: "json", ...params, @@ -5415,7 +5418,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "DELETE", ...params, }), @@ -5431,7 +5434,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "GET", ...params, }), @@ -5445,7 +5448,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "PUT", ...params, }), @@ -5458,7 +5461,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "DELETE", ...params, }), @@ -5471,7 +5474,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "GET", format: "json", ...params, @@ -5485,7 +5488,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "PUT", format: "json", ...params, @@ -5499,7 +5502,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos`, + path: \`/teams/\${teamId}/repos\`, method: "GET", format: "json", ...params, @@ -5513,7 +5516,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5528,7 +5531,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5541,7 +5544,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5555,7 +5558,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "GET", format: "json", ...params, @@ -5569,7 +5572,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5585,7 +5588,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "DELETE", body: body, type: ContentType.Json, @@ -5600,7 +5603,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "GET", ...params, }), @@ -5613,7 +5616,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "POST", body: body, ...params, @@ -5627,7 +5630,7 @@ export class Api extends HttpClient this.request({ - path: `/user/followers`, + path: \`/user/followers\`, method: "GET", format: "json", ...params, @@ -5641,7 +5644,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following`, + path: \`/user/following\`, method: "GET", format: "json", ...params, @@ -5655,7 +5658,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "DELETE", ...params, }), @@ -5668,7 +5671,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "GET", ...params, }), @@ -5681,7 +5684,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "PUT", ...params, }), @@ -5717,7 +5720,7 @@ export class Api extends HttpClient this.request({ - path: `/user/issues`, + path: \`/user/issues\`, method: "GET", query: query, format: "json", @@ -5732,7 +5735,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "GET", format: "json", ...params, @@ -5746,7 +5749,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "POST", body: body, format: "json", @@ -5761,7 +5764,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -5774,7 +5777,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -5788,7 +5791,7 @@ export class Api extends HttpClient this.request({ - path: `/user/orgs`, + path: \`/user/orgs\`, method: "GET", format: "json", ...params, @@ -5808,7 +5811,7 @@ export class Api extends HttpClient this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "GET", query: query, format: "json", @@ -5823,7 +5826,7 @@ export class Api extends HttpClient this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "POST", body: body, format: "json", @@ -5846,7 +5849,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred`, + path: \`/user/starred\`, method: "GET", query: query, format: "json", @@ -5861,7 +5864,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5874,7 +5877,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5887,7 +5890,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5900,7 +5903,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions`, + path: \`/user/subscriptions\`, method: "GET", format: "json", ...params, @@ -5915,7 +5918,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5929,7 +5932,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5943,7 +5946,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5956,7 +5959,7 @@ export class Api extends HttpClient this.request({ - path: `/user/teams`, + path: \`/user/teams\`, method: "GET", format: "json", ...params, @@ -5977,7 +5980,7 @@ export class Api extends HttpClient this.request({ - path: `/users`, + path: \`/users\`, method: "GET", query: query, format: "json", @@ -5992,7 +5995,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}`, + path: \`/users/\${username}\`, method: "GET", format: "json", ...params, @@ -6006,7 +6009,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/events`, + path: \`/users/\${username}/events\`, method: "GET", ...params, }), @@ -6019,7 +6022,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/events/orgs/${org}`, + path: \`/users/\${username}/events/orgs/\${org}\`, method: "GET", ...params, }), @@ -6032,7 +6035,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/followers`, + path: \`/users/\${username}/followers\`, method: "GET", format: "json", ...params, @@ -6046,7 +6049,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/following/${targetUser}`, + path: \`/users/\${username}/following/\${targetUser}\`, method: "GET", ...params, }), @@ -6069,7 +6072,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/gists`, + path: \`/users/\${username}/gists\`, method: "GET", query: query, format: "json", @@ -6084,7 +6087,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/keys`, + path: \`/users/\${username}/keys\`, method: "GET", format: "json", ...params, @@ -6098,7 +6101,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/orgs`, + path: \`/users/\${username}/orgs\`, method: "GET", format: "json", ...params, @@ -6112,7 +6115,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/received_events`, + path: \`/users/\${username}/received_events\`, method: "GET", ...params, }), @@ -6125,7 +6128,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/received_events/public`, + path: \`/users/\${username}/received_events/public\`, method: "GET", ...params, }), @@ -6145,7 +6148,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/repos`, + path: \`/users/\${username}/repos\`, method: "GET", query: query, format: "json", @@ -6160,7 +6163,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/starred`, + path: \`/users/\${username}/starred\`, method: "GET", ...params, }), @@ -6173,9 +6176,11 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/subscriptions`, + path: \`/users/\${username}/subscriptions\`, method: "GET", ...params, }), }; } +" +`; diff --git a/tests/spec/axios/basic.test.ts b/tests/spec/axios/basic.test.ts new file mode 100644 index 00000000..9f470706 --- /dev/null +++ b/tests/spec/axios/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--axios option", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: true, + httpClientType: "axios", + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/axios/schema.ts b/tests/spec/axios/schema.ts deleted file mode 100644 index 3be81f8e..00000000 --- a/tests/spec/axios/schema.ts +++ /dev/null @@ -1,6181 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** A user or organization */ -export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - 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; - /** The account username */ - login?: string; - /** The full account name */ - 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"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - 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?: { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601. */ - created_at?: string; - id?: number; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface Commit { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export interface CommitCommentBody { - body: string; - /** Deprecated - Use position parameter instead. */ - line?: string; - /** Line number in the file to comment on. Defaults to null. */ - number?: string; - /** Relative path of the file to comment on. */ - path?: string; - /** Line index in the diff to comment on. */ - position?: number; - /** SHA of the commit to comment on. */ - sha: string; -} - -export type Commits = { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -}[]; - -export interface CompareCommits { - ahead_by?: number; - base_commit?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - behind_by?: number; - commits?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - }; - /** The Total number of commits authored by the contributor. */ - total?: number; - weeks?: { - /** Number of additions. */ - a?: number; - /** Number of commits. */ - c?: number; - /** Number of deletions. */ - d?: number; - /** Start of the week. */ - 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; - /** A GitHub user */ - creator?: User; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -} - -export type DeploymentStatuses = { - created_at?: string; - /** A GitHub user */ - 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 { - /** A user or organization */ - actor?: Actor; - created_at?: object; - id?: number; - /** A GitHub organization */ - 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; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - description?: string; - files?: { - "ring.erl"?: { - filename?: string; - raw_url?: string; - size?: number; - }; - }; - forks?: { - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }[]; - git_pull_url?: string; - git_push_url?: string; - history?: { - change_status?: { - additions?: number; - deletions?: number; - total?: number; - }; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - committed_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - version?: string; - }[]; - html_url?: string; - id?: string; - public?: boolean; - url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - 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; - }; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** A user or organization */ - actor?: Actor; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - event?: string; - issue?: { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }; - url?: string; -} - -export type IssueEvents = IssueEvent[]; - -export type Issues = { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface IssuesComment { - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export type IssuesComments = { - _links?: { - html?: { - href?: string; - }; - pull_request?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - body?: string; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - 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 { - /** Error message */ - message?: string; -} - -export interface MergesSuccessful { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A user or organization */ - 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[]; -} - -/** A GitHub organization */ -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 address. This address is not publicized. */ - billing_email?: string; - company?: string; - /** Publicly visible email address. */ - email?: string; - location?: string; - name?: string; -} - -export interface PostGist { - description?: string; - files?: { - "file1.txt"?: { - content?: string; - }; - }; - public?: boolean; -} - -export interface PostRepo { - /** True to create an initial commit with empty README. Default is false. */ - auto_init?: boolean; - description?: string; - /** Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell" Ignored if auto_init parameter is not provided. */ - gitignore_template?: string; - /** True to enable downloads for this repository, false to disable them. Default is true. */ - has_downloads?: boolean; - /** True to enable issues for this repository, false to disable them. Default is true. */ - has_issues?: boolean; - /** True to enable the wiki for this repository, false to disable it. Default is true. */ - has_wiki?: boolean; - homepage?: string; - name: string; - /** True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. */ - private?: boolean; - /** The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization. */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - merged_at?: string; - number?: number; - patch_url?: string; - state?: "open" | "closed"; - title?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 = { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub organization */ - organization?: Organization; - /** A user or organization */ - owner?: Actor; - /** Is present when the repo is a fork. Parent is the repo this repo was forked from. */ - parent?: Repo; - private?: boolean; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - pushed_at?: string; - size?: number; - /** Is present when the repo is a fork. Source is the ultimate source for the network. */ - source?: Repo; - ssh_url?: string; - svn_url?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - watchers?: number; - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface RepoCommit { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 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; - /** A user or organization */ - 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; - /** A GitHub user */ - 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 { - /** A GitHub user */ - user?: User; -} - -export interface SearchUsers { - items?: Users; - total_count?: number; -} - -export interface SearchUsersByKeyword { - users?: Users; -} - -export interface Subscription { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** String of the tag message. */ - message?: string; - object?: { - sha?: string; - /** String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob. */ - type?: "commit" | "tree" | "blob"; - url?: string; - }; - sha?: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag?: string; - tagger?: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - url?: string; -} - -export interface TagBody { - /** String of the tag message. */ - message: string; - /** String of the SHA of the git object this is tagging. */ - object: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag: string; - tagger: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - /** 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 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?: { - /** One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink. */ - mode?: "100644" | "100755" | "040000" | "160000" | "120000"; - path?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - size?: number; - type?: "blob" | "tree" | "commit"; - url?: string; - }[]; - url?: string; -} - -export interface Trees { - base_tree?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - tree?: Tree[]; - url?: string; -} - -/** A GitHub user */ -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[]; - -import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios"; -import axios from "axios"; - -export type QueryParamsType = Record; - -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?: ResponseType; - /** request body */ - body?: unknown; -} - -export type RequestParams = Omit; - -export interface ApiConfig extends Omit { - securityWorker?: ( - securityData: SecurityDataType | null, - ) => Promise | AxiosRequestConfig | void; - secure?: boolean; - format?: ResponseType; -} - -export enum ContentType { - Json = "application/json", - FormData = "multipart/form-data", - UrlEncoded = "application/x-www-form-urlencoded", - Text = "text/plain", -} - -export class HttpClient { - public instance: AxiosInstance; - private securityData: SecurityDataType | null = null; - private securityWorker?: ApiConfig["securityWorker"]; - private secure?: boolean; - private format?: ResponseType; - - constructor({ securityWorker, secure, format, ...axiosConfig }: ApiConfig = {}) { - this.instance = axios.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || "https://api.github.com" }); - this.secure = secure; - this.format = format; - this.securityWorker = securityWorker; - } - - public setSecurityData = (data: SecurityDataType | null) => { - this.securityData = data; - }; - - protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig { - const method = params1.method || (params2 && params2.method); - - return { - ...this.instance.defaults, - ...params1, - ...(params2 || {}), - headers: { - ...((method && this.instance.defaults.headers[method.toLowerCase() as keyof HeadersDefaults]) || {}), - ...(params1.headers || {}), - ...((params2 && params2.headers) || {}), - }, - }; - } - - protected stringifyFormItem(formItem: unknown) { - if (typeof formItem === "object" && formItem !== null) { - return JSON.stringify(formItem); - } else { - return `${formItem}`; - } - } - - protected createFormData(input: Record): FormData { - return Object.keys(input || {}).reduce((formData, key) => { - const property = input[key]; - const propertyContent: any[] = property instanceof Array ? property : [property]; - - for (const formItem of propertyContent) { - const isFileType = formItem instanceof Blob || formItem instanceof File; - formData.append(key, isFileType ? formItem : this.stringifyFormItem(formItem)); - } - - return formData; - }, new FormData()); - } - - public request = async ({ - secure, - path, - type, - query, - format, - body, - ...params - }: FullRequestParams): Promise> => { - const secureParams = - ((typeof secure === "boolean" ? secure : this.secure) && - this.securityWorker && - (await this.securityWorker(this.securityData))) || - {}; - const requestParams = this.mergeRequestParams(params, secureParams); - const responseFormat = format || this.format || undefined; - - if (type === ContentType.FormData && body && body !== null && typeof body === "object") { - body = this.createFormData(body as Record); - } - - if (type === ContentType.Text && body && body !== null && typeof body !== "string") { - body = JSON.stringify(body); - } - - return this.instance.request({ - ...requestParams, - headers: { - ...(requestParams.headers || {}), - ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), - }, - params: query, - responseType: responseFormat, - data: body, - url: path, - }); - }; -} - -/** - * @title GitHub - * @version v3 - * @termsOfService https://help.github.com/articles/github-terms-of-service/#b-api-terms - * @baseUrl https://api.github.com - * @externalDocs https://developer.github.com/v3/ - * - * Powerful collaboration, code review, and code management for open source and private projects. - */ -export class Api extends HttpClient { - someTest = { - /** - * @description This type should test bug https://github.com/acacode/swagger-typescript-api/issues/156 NOTE: all properties should be required - * - * @name SomeTestList - * @request GET:/some-test - */ - someTestList: (params: RequestParams = {}) => - this.request< - { - user: { - foo: number; - extra: { - id: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - }; - }; - }; - }; - }; - }; - }, - any - >({ - path: `/some-test`, - method: "GET", - format: "json", - ...params, - }), - }; - pathParams = { - /** - * @description Lists all the emojis available to use on GitHub. - * - * @name PathParamsList - * @request GET:/path-params - */ - pathParamsList: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/path-params`, - method: "GET", - format: "json", - ...params, - }), - }; - events = { - /** - * @description List public events. - * - * @name EventsList - * @request GET:/events - */ - eventsList: (params: RequestParams = {}) => - this.request({ - path: `/events`, - method: "GET", - format: "json", - ...params, - }), - }; - feeds = { - /** - * @description List Feeds. GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticating user. - * - * @name FeedsList - * @request GET:/feeds - */ - feedsList: (params: RequestParams = {}) => - this.request({ - path: `/feeds`, - method: "GET", - format: "json", - ...params, - }), - }; - gists = { - /** - * @description List the authenticated user's gists or if called anonymously, this will return all public gists. - * - * @name GistsList - * @request GET:/gists - */ - gistsList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a gist. - * - * @name GistsCreate - * @request POST:/gists - */ - gistsCreate: (body: PostGist, params: RequestParams = {}) => - this.request({ - path: `/gists`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List all public gists. - * - * @name PublicList - * @request GET:/gists/public - */ - publicList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists/public`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List the authenticated user's starred gists. - * - * @name StarredList - * @request GET:/gists/starred - */ - starredList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists/starred`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Delete a gist. - * - * @name GistsDelete - * @request DELETE:/gists/{id} - */ - gistsDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single gist. - * - * @name GistsDetail - * @request GET:/gists/{id} - */ - gistsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit a gist. - * - * @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, - }), - - /** - * @description List comments on a gist. - * - * @name CommentsDetail - * @request GET:/gists/{id}/comments - */ - commentsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/comments`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a commen - * - * @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, - }), - - /** - * @description Delete a comment. - * - * @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, - }), - - /** - * @description Get a single comment. - * - * @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, - }), - - /** - * @description Edit a comment. - * - * @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, - }), - - /** - * @description Fork a gist. - * - * @name ForksCreate - * @request POST:/gists/{id}/forks - */ - forksCreate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/forks`, - method: "POST", - ...params, - }), - - /** - * @description Unstar a gist. - * - * @name StarDelete - * @request DELETE:/gists/{id}/star - */ - starDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if a gist is starred. - * - * @name StarDetail - * @request GET:/gists/{id}/star - */ - starDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "GET", - ...params, - }), - - /** - * @description Star a gist. - * - * @name StarUpdate - * @request PUT:/gists/{id}/star - */ - starUpdate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "PUT", - ...params, - }), - }; - gitignore = { - /** - * @description Listing available templates. List all templates available to pass as an option when creating a repository. - * - * @name TemplatesList - * @request GET:/gitignore/templates - */ - templatesList: (params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get a single template. - * - * @name TemplatesDetail - * @request GET:/gitignore/templates/{language} - */ - templatesDetail: (language: string, params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates/${language}`, - method: "GET", - format: "json", - ...params, - }), - }; - issues = { - /** - * @description List issues. List all issues across all the authenticated user's visible repositories. - * - * @name IssuesList - * @request GET:/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - legacy = { - /** - * @description Find issues by state and keyword. - * - * @name IssuesSearchDetail - * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} - * @deprecated - */ - 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, - }), - - /** - * @description Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter. - * - * @name ReposSearchDetail - * @request GET:/legacy/repos/search/{keyword} - * @deprecated - */ - reposSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** Filter results by language */ - language?: string; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/legacy/repos/search/${keyword}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description This API call is added for compatibility reasons only. - * - * @name UserEmailDetail - * @request GET:/legacy/user/email/{email} - * @deprecated - */ - userEmailDetail: (email: string, params: RequestParams = {}) => - this.request({ - path: `/legacy/user/email/${email}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Find users by keyword. - * - * @name UserSearchDetail - * @request GET:/legacy/user/search/{keyword} - * @deprecated - */ - userSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/legacy/user/search/${keyword}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - markdown = { - /** - * @description Render an arbitrary Markdown document - * - * @name MarkdownCreate - * @request POST:/markdown - */ - markdownCreate: (body: Markdown, params: RequestParams = {}) => - this.request({ - path: `/markdown`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description Render a Markdown document in raw mode - * - * @name PostMarkdown - * @request POST:/markdown/raw - */ - postMarkdown: (params: RequestParams = {}) => - this.request({ - path: `/markdown/raw`, - method: "POST", - type: ContentType.Text, - ...params, - }), - }; - meta = { - /** - * @description This gives some information about GitHub.com, the service. - * - * @name MetaList - * @request GET:/meta - */ - metaList: (params: RequestParams = {}) => - this.request({ - path: `/meta`, - method: "GET", - format: "json", - ...params, - }), - }; - networks = { - /** - * @description List public events for a network of repositories. - * - * @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 = { - /** - * @description List your notifications. List all notifications for the current user, grouped by repository. - * - * @name NotificationsList - * @request GET:/notifications - */ - notificationsList: ( - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/notifications`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Mark as read. Marking a notification as "read" removes it from the default view on GitHub.com. - * - * @name NotificationsUpdate - * @request PUT:/notifications - */ - notificationsUpdate: (body: NotificationMarkRead, params: RequestParams = {}) => - this.request({ - path: `/notifications`, - method: "PUT", - body: body, - ...params, - }), - - /** - * @description View a single thread. - * - * @name ThreadsDetail - * @request GET:/notifications/threads/{id} - */ - threadsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Mark a thread as read - * - * @name ThreadsPartialUpdate - * @request PATCH:/notifications/threads/{id} - */ - threadsPartialUpdate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}`, - method: "PATCH", - ...params, - }), - - /** - * @description Delete a Thread Subscription. - * - * @name ThreadsSubscriptionDelete - * @request DELETE:/notifications/threads/{id}/subscription - */ - threadsSubscriptionDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}/subscription`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a Thread Subscription. - * - * @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, - }), - - /** - * @description Set a Thread Subscription. This lets you subscribe to a thread, or ignore it. Subscribing to a thread is unnecessary if the user is already subscribed to the repository. Ignoring a thread will mute all future notifications (until you comment or get @mentioned). - * - * @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 = { - /** - * @description Get an Organization. - * - * @name OrgsDetail - * @request GET:/orgs/{org} - */ - orgsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit an Organization. - * - * @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, - }), - - /** - * @description List public events for an organization. - * - * @name EventsDetail - * @request GET:/orgs/{org}/events - */ - eventsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/events`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List issues. List all issues for a given organization for the authenticated user. - * - * @name IssuesDetail - * @request GET:/orgs/{org}/issues - */ - issuesDetail: ( - org: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Members list. List all users who are members of an organization. A member is a user tha belongs to at least 1 team in the organization. If the authenticated user is also an owner of this organization then both concealed and public members will be returned. If the requester is not an owner of the organization the query will be redirected to the public members list. - * - * @name MembersDetail - * @request GET:/orgs/{org}/members - */ - membersDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/members`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Remove a member. Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. - * - * @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, - }), - - /** - * @description Check if a user is, publicly or privately, a member of the organization. - * - * @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, - }), - - /** - * @description Public members list. Members of an organization can choose to have their membership publicized or not. - * - * @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, - }), - - /** - * @description Conceal a user's membership. - * - * @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, - }), - - /** - * @description Check public membership. - * - * @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, - }), - - /** - * @description Publicize a user's membership. - * - * @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, - }), - - /** - * @description List repositories for the specified org. - * - * @name ReposDetail - * @request GET:/orgs/{org}/repos - */ - reposDetail: ( - org: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @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, - }), - - /** - * @description List teams. - * - * @name TeamsDetail - * @request GET:/orgs/{org}/teams - */ - teamsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/teams`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create team. In order to create a team, the authenticated user must be an owner of organization. - * - * @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 = { - /** - * @description Get your current rate limit status Note: Accessing this endpoint does not count against your rate limit. - * - * @name RateLimitList - * @request GET:/rate_limit - */ - rateLimitList: (params: RequestParams = {}) => - this.request({ - path: `/rate_limit`, - method: "GET", - format: "json", - ...params, - }), - }; - repos = { - /** - * @description Delete a Repository. Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required. - * - * @name ReposDelete - * @request DELETE:/repos/{owner}/{repo} - */ - reposDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get repository. - * - * @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, - }), - - /** - * @description Edit repository. - * - * @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, - }), - - /** - * @description List assignees. This call lists all the available assignees (owner + collaborators) to which issues may be assigned. - * - * @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, - }), - - /** - * @description Check assignee. You may also check to see if a particular user is an assignee for a repository. - * - * @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, - }), - - /** - * @description Get list of branches - * - * @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, - }), - - /** - * @description Get Branch - * - * @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, - }), - - /** - * @description List. When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list. - * - * @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, - }), - - /** - * @description Remove collaborator. - * - * @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, - }), - - /** - * @description Check if user is a collaborator - * - * @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, - }), - - /** - * @description Add collaborator. - * - * @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, - }), - - /** - * @description List commit comments for a repository. Comments are ordered by ascending ID. - * - * @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, - }), - - /** - * @description Delete a commit comment - * - * @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, - }), - - /** - * @description Get a single commit comment. - * - * @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, - }), - - /** - * @description Update a commit comment. - * - * @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, - }), - - /** - * @description List commits on a repository. - * - * @name CommitsDetail - * @request GET:/repos/{owner}/{repo}/commits - */ - commitsDetail: ( - owner: string, - repo: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - /** Sha or branch to start listing commits from. */ - sha?: string; - /** Only commits containing this file path will be returned. */ - path?: string; - /** GitHub login, name, or email by which to filter by commit author. */ - author?: string; - /** ISO 8601 Date - Only commits before this date will be returned. */ - until?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/commits`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get the combined Status for a specific Ref The Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access this endpoint during the preview period, you must provide a custom media type in the Accept header: application/vnd.github.she-hulk-preview+json - * - * @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, - }), - - /** - * @description Get a single commit. - * - * @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, - }), - - /** - * @description List comments for a single commitList comments for a single commit. - * - * @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, - }), - - /** - * @description Create a commit comment. - * - * @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, - }), - - /** - * @description Compare two commits - * - * @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, - }), - - /** - * @description Delete a file. This method deletes a file in a repository. - * - * @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, - }), - - /** - * @description Get contents. This method returns the contents of a file or directory in a repository. Files and symlinks support a custom media type for getting the raw content. Directories and submodules do not support custom media types. Note: This API supports files up to 1 megabyte in size. Here can be many outcomes. For details see "http://developer.github.com/v3/repos/contents/" - * - * @name ContentsDetail - * @request GET:/repos/{owner}/{repo}/contents/{path} - */ - contentsDetail: ( - owner: string, - repo: string, - path: string, - query?: { - /** The content path. */ - path?: string; - /** The String name of the Commit/Branch/Tag. Defaults to 'master'. */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a file. - * - * @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, - }), - - /** - * @description Get list of contributors. - * - * @name ContributorsDetail - * @request GET:/repos/{owner}/{repo}/contributors - */ - contributorsDetail: ( - owner: string, - repo: string, - query: { - /** Set to 1 or true to include anonymous contributors in results. */ - anon: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/contributors`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Users with pull access can view deployments for a repository - * - * @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, - }), - - /** - * @description Users with push access can create a deployment for a given ref - * - * @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, - }), - - /** - * @description Users with pull access can view deployment statuses for a deployment - * - * @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, - }), - - /** - * @description Create a Deployment Status Users with push access can create deployment statuses for a given deployment: - * - * @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, - }), - - /** - * @description Deprecated. List downloads for a repository. - * - * @name DownloadsDetail - * @request GET:/repos/{owner}/{repo}/downloads - * @deprecated - */ - downloadsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/downloads`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Deprecated. Delete a download. - * - * @name DownloadsDelete - * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - */ - downloadsDelete: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Deprecated. Get a single download. - * - * @name DownloadsDetail2 - * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - * @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, - }), - - /** - * @description Get list of repository events. - * - * @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, - }), - - /** - * @description List forks. - * - * @name ForksDetail - * @request GET:/repos/{owner}/{repo}/forks - */ - forksDetail: ( - owner: string, - repo: string, - query?: { - /** @default "newes" */ - sort?: "newes" | "oldes" | "watchers"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/forks`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a fork. Forking a Repository happens asynchronously. Therefore, you may have to wai a short period before accessing the git objects. If this takes longer than 5 minutes, be sure to contact Support. - * - * @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, - }), - - /** - * @description Create a Blob. - * - * @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, - }), - - /** - * @description Get a Blob. Since blobs can be any arbitrary binary data, the input and responses for the blob API takes an encoding parameter that can be either utf-8 or base64. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it. - * - * @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, - }), - - /** - * @description Create a Commit. - * - * @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, - }), - - /** - * @description Get a Commit. - * - * @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, - }), - - /** - * @description Get all References - * - * @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, - }), - - /** - * @description Create a Reference - * - * @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, - }), - - /** - * @description Delete a Reference Example: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a Example: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0 - * - * @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, - }), - - /** - * @description Get a Reference - * - * @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, - }), - - /** - * @description Update a Reference - * - * @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, - }), - - /** - * @description Create a Tag Object. Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary. - * - * @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, - }), - - /** - * @description Get a Tag. - * - * @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, - }), - - /** - * @description Create a Tree. The tree creation API will take nested entries as well. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out. - * - * @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, - }), - - /** - * @description Get a Tree. - * - * @name GitTreesDetail - * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} - */ - gitTreesDetail: ( - owner: string, - repo: string, - shaCode: string, - query?: { - /** Get a Tree Recursively. (0 or 1) */ - recursive?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get list of hooks. - * - * @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, - }), - - /** - * @description Create a hook. - * - * @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, - }), - - /** - * @description Delete a hook. - * - * @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, - }), - - /** - * @description Get single hook. - * - * @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, - }), - - /** - * @description Edit a hook. - * - * @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, - }), - - /** - * @description Test a push hook. This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated. Note: Previously /repos/:owner/:repo/hooks/:id/tes - * - * @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, - }), - - /** - * @description List issues for a repository. - * - * @name IssuesDetail - * @request GET:/repos/{owner}/{repo}/issues - */ - issuesDetail: ( - owner: string, - repo: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create an issue. Any user with pull access to a repository can create an issue. - * - * @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, - }), - - /** - * @description List comments in a repository. - * - * @name IssuesCommentsDetail - * @request GET:/repos/{owner}/{repo}/issues/comments - */ - issuesCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Delete a comment. - * - * @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, - }), - - /** - * @description Get a single comment. - * - * @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, - }), - - /** - * @description Edit a comment. - * - * @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, - }), - - /** - * @description List issue events for a repository. - * - * @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, - }), - - /** - * @description Get a single event. - * - * @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, - }), - - /** - * @description Get a single issue - * - * @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, - }), - - /** - * @description Edit an issue. Issue owners and users with push access can edit an issue. - * - * @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, - }), - - /** - * @description List comments on an issue. - * - * @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, - }), - - /** - * @description Create a comment. - * - * @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, - }), - - /** - * @description List events for an issue. - * - * @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, - }), - - /** - * @description Remove all labels from an issue. - * - * @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, - }), - - /** - * @description List labels on an issue. - * - * @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, - }), - - /** - * @description Add labels to an issue. - * - * @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, - }), - - /** - * @description Replace all labels for an issue. Sending an empty array ([]) will remove all Labels from the Issue. - * - * @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, - }), - - /** - * @description Remove a label from an issue. - * - * @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, - }), - - /** - * @description Get list of keys. - * - * @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, - }), - - /** - * @description Create a key. - * - * @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, - }), - - /** - * @description Delete a key. - * - * @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, - }), - - /** - * @description Get a key - * - * @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, - }), - - /** - * @description List all labels for this repository. - * - * @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, - }), - - /** - * @description Create a label. - * - * @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, - }), - - /** - * @description Delete a label. - * - * @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, - }), - - /** - * @description Get a single label. - * - * @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, - }), - - /** - * @description Update a label. - * - * @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, - }), - - /** - * @description List languages. List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language. - * - * @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, - }), - - /** - * @description Perform a merge. - * - * @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, - }), - - /** - * @description List milestones for a repository. - * - * @name MilestonesDetail - * @request GET:/repos/{owner}/{repo}/milestones - */ - milestonesDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "due_date" */ - sort?: "due_date" | "completeness"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/milestones`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a milestone. - * - * @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, - }), - - /** - * @description Delete a milestone. - * - * @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, - }), - - /** - * @description Get a single milestone. - * - * @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, - }), - - /** - * @description Update a milestone. - * - * @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, - }), - - /** - * @description Get labels for every issue in a milestone. - * - * @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, - }), - - /** - * @description List your notifications in a repository List all notifications for the current user. - * - * @name NotificationsDetail - * @request GET:/repos/{owner}/{repo}/notifications - */ - notificationsDetail: ( - owner: string, - repo: string, - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/notifications`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Mark notifications as read in a repository. Marking all notifications in a repository as "read" removes them from the default view on GitHub.com. - * - * @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, - }), - - /** - * @description List pull requests. - * - * @name PullsDetail - * @request GET:/repos/{owner}/{repo}/pulls - */ - pullsDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** - * Filter pulls by head user and branch name in the format of 'user:ref-name'. - * Example: github:new-script-format. - */ - head?: string; - /** Filter pulls by base branch name. Example - gh-pages. */ - base?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a pull request. - * - * @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, - }), - - /** - * @description List comments in a repository. By default, Review Comments are ordered by ascending ID. - * - * @name PullsCommentsDetail - * @request GET:/repos/{owner}/{repo}/pulls/comments - */ - pullsCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Delete a comment. - * - * @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, - }), - - /** - * @description Get a single comment. - * - * @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, - }), - - /** - * @description Edit a comment. - * - * @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, - }), - - /** - * @description Get a single pull request. - * - * @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, - }), - - /** - * @description Update a pull request. - * - * @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, - }), - - /** - * @description List comments on a pull request. - * - * @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, - }), - - /** - * @description Create a comment. #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ ) description: | Alternative Input. Instead of passing commit_id, path, and position you can reply to an existing Pull Request Comment like this: body Required string in_reply_to Required number - Comment id to reply to. - * - * @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, - }), - - /** - * @description List commits on a pull request. - * - * @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, - }), - - /** - * @description List pull requests files. - * - * @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, - }), - - /** - * @description Get if a pull request has been merged. - * - * @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, - }), - - /** - * @description Merge a pull request (Merge Button's) - * - * @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, - }), - - /** - * @description Get the README. This method returns the preferred README for a repository. - * - * @name ReadmeDetail - * @request GET:/repos/{owner}/{repo}/readme - */ - readmeDetail: ( - owner: string, - repo: string, - query?: { - /** The String name of the Commit/Branch/Tag. Defaults to master. */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/readme`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only - * - * @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, - }), - - /** - * @description Create a release Users with push access to the repository can create a release. - * - * @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, - }), - - /** - * @description Delete a release asset - * - * @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, - }), - - /** - * @description Get a single release asset - * - * @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, - }), - - /** - * @description Edit a release asset Users with push access to the repository can edit a release asset. - * - * @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, - }), - - /** - * @description Users with push access to the repository can delete a release. - * - * @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, - }), - - /** - * @description Get a single release - * - * @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, - }), - - /** - * @description Users with push access to the repository can edit a release - * - * @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, - }), - - /** - * @description List assets for a release - * - * @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, - }), - - /** - * @description List Stargazers. - * - * @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, - }), - - /** - * @description Get the number of additions and deletions per week. Returns a weekly aggregate of the number of additions and deletions pushed to a repository. - * - * @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, - }), - - /** - * @description Get the last year of commit activity data. Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday. - * - * @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, - }), - - /** - * @description Get contributors list with additions, deletions, and commit counts. - * - * @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, - }), - - /** - * @description Get the weekly commit count for the repo owner and everyone else. - * - * @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, - }), - - /** - * @description Get the number of commits per hour in each day. Each array contains the day number, hour number, and number of commits 0-6 Sunday - Saturday 0-23 Hour of day Number of commits For example, [2, 14, 25] indicates that there were 25 total commits, during the 2.00pm hour on Tuesdays. All times are based on the time zone of individual commits. - * - * @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, - }), - - /** - * @description List Statuses for a specific Ref. - * - * @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, - }), - - /** - * @description Create a Status. - * - * @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, - }), - - /** - * @description List watchers. - * - * @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, - }), - - /** - * @description Delete a Repository Subscription. - * - * @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, - }), - - /** - * @description Get a Repository Subscription. - * - * @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, - }), - - /** - * @description Set a Repository Subscription - * - * @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, - }), - - /** - * @description Get list of tags. - * - * @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, - }), - - /** - * @description Get list of teams - * - * @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, - }), - - /** - * @description List Stargazers. New implementation. - * - * @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, - }), - - /** - * @description Get archive link. This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. Note: For private repositories, these links are temporary and expire quickly. - * - * @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 = { - /** - * @description List all public repositories. This provides a dump of every public repository, in the order that they were created. Note: Pagination is powered exclusively by the since parameter. is the Link header to get the URL for the next page of repositories. - * - * @name RepositoriesList - * @request GET:/repositories - */ - repositoriesList: ( - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - search = { - /** - * @description Search code. - * - * @name CodeList - * @request GET:/search/code - */ - codeList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported code - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier - * you can restrict the search to just the file contents, the file path, - * or both. - * 'Languages' Searches code based on the language it's written in. - * 'Forks' Filters repositories based on the number of forks, and/or - * whether code from forked repositories should be included in the results - * at all. - * 'Size' Finds files that match a certain size (in bytes). - * 'Path' Specifies the path that the resulting file must be at. - * 'Extension' Matches files with a certain extension. - * 'Users' or 'Repositories' Limits searches to a specific user or repository. - */ - q: string; - /** - * Can only be 'indexed', which indicates how recently a file has been indexed - * by the GitHub search infrastructure. If not provided, results are sorted - * by best match. - */ - sort?: "indexed"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/code`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Find issues by state and keyword. (This method returns up to 100 results per page.) - * - * @name IssuesList - * @request GET:/search/issues - */ - issuesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The q search term can also contain any combination of the supported issue search qualifiers: */ - q: string; - /** The sort field. Can be comments, created, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "created" | "comments"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Search repositories. - * - * @name RepositoriesList - * @request GET:/search/repositories - */ - repositoriesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported repository - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the repository name, description, readme, - * or any combination of these. - * 'Size' Finds repositories that match a certain size (in kilobytes). - * 'Forks' Filters repositories based on the number of forks, and/or whether - * forked repositories should be included in the results at all. - * 'Created' and 'Last Updated' Filters repositories based on times of - * creation, or when they were last updated. - * 'Users or Repositories' Limits searches to a specific user or repository. - * 'Languages' Searches repositories based on the language they are written in. - * 'Stars' Searches repositories based on the number of stars. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "stars" | "forks" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Search users. - * - * @name UsersList - * @request GET:/search/users - */ - usersList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported user - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the username, public email, full name, - * location, or any combination of these. - * 'Repository count' Filters users based on the number of repositories they - * have. - * 'Location' Filter users by the location indicated in their profile. - * 'Language' Search for users that have repositories that match a certain - * language. - * 'Created' Filter users based on when they joined. - * 'Followers' Filter users based on the number of followers they have. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "followers" | "repositories" | "joined"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - teams = { - /** - * @description Delete team. In order to delete a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @name TeamsDelete - * @request DELETE:/teams/{teamId} - */ - teamsDelete: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get team. - * - * @name TeamsDetail - * @request GET:/teams/{teamId} - */ - teamsDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit team. In order to edit a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @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, - }), - - /** - * @description List team members. In order to list members in a team, the authenticated user must be a member of the team. - * - * @name MembersDetail - * @request GET:/teams/{teamId}/members - */ - membersDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description The "Remove team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships. Remove team member. In order to remove a user from a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. NOTE This does not delete the user, it just remove them from the team. - * - * @name MembersDelete - * @request DELETE:/teams/{teamId}/members/{username} - * @deprecated - */ - membersDelete: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description The "Get team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships. Get team member. In order to get if a user is a member of a team, the authenticated user mus be a member of the team. - * - * @name MembersDetail2 - * @request GET:/teams/{teamId}/members/{username} - * @deprecated - * @originalName membersDetail - * @duplicate - */ - membersDetail2: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "GET", - ...params, - }), - - /** - * @description The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams. Add team member. In order to add a user to a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. - * - * @name MembersUpdate - * @request PUT:/teams/{teamId}/members/{username} - * @deprecated - */ - membersUpdate: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "PUT", - ...params, - }), - - /** - * @description Remove team membership. In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team. - * - * @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, - }), - - /** - * @description Get team membership. In order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization. - * - * @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, - }), - - /** - * @description Add team membership. In order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. If the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team. If the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the 'pending' state until the user accepts the invitation, at which point the membership will transition to the 'active' state and the user will be added as a member of the team. - * - * @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, - }), - - /** - * @description List team repos - * - * @name ReposDetail - * @request GET:/teams/{teamId}/repos - */ - reposDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/repos`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team. - * - * @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, - }), - - /** - * @description Check if a team manages a repository - * - * @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, - }), - - /** - * @description In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization. - * - * @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 = { - /** - * @description Get the authenticated user. - * - * @name UserList - * @request GET:/user - */ - userList: (params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Update the authenticated user. - * - * @name UserPartialUpdate - * @request PATCH:/user - */ - userPartialUpdate: (body: UserUpdate, params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Delete email address(es). You can include a single email address or an array of addresses. - * - * @name EmailsDelete - * @request DELETE:/user/emails - */ - emailsDelete: (body: UserEmails, params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "DELETE", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description List email addresses for a user. In the final version of the API, this method will return an array of hashes with extended information for each email address indicating if the address has been verified and if it's primary email address for GitHub. Until API v3 is finalized, use the application/vnd.github.v3 media type to get other response format. - * - * @name EmailsList - * @request GET:/user/emails - */ - emailsList: (params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "GET", - ...params, - }), - - /** - * @description Add email address(es). You can post a single email address or an array of addresses. - * - * @name EmailsCreate - * @request POST:/user/emails - */ - emailsCreate: (body: EmailsPost, params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "POST", - body: body, - ...params, - }), - - /** - * @description List the authenticated user's followers - * - * @name FollowersList - * @request GET:/user/followers - */ - followersList: (params: RequestParams = {}) => - this.request({ - path: `/user/followers`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List who the authenticated user is following. - * - * @name FollowingList - * @request GET:/user/following - */ - followingList: (params: RequestParams = {}) => - this.request({ - path: `/user/following`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Unfollow a user. Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingDelete - * @request DELETE:/user/following/{username} - */ - followingDelete: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if you are following a user. - * - * @name FollowingDetail - * @request GET:/user/following/{username} - */ - followingDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "GET", - ...params, - }), - - /** - * @description Follow a user. Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingUpdate - * @request PUT:/user/following/{username} - */ - followingUpdate: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "PUT", - ...params, - }), - - /** - * @description List issues. List all issues across owned and member repositories for the authenticated user. - * - * @name IssuesList - * @request GET:/user/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List your public keys. Lists the current user's keys. Management of public keys via the API requires that you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes. - * - * @name KeysList - * @request GET:/user/keys - */ - keysList: (params: RequestParams = {}) => - this.request({ - path: `/user/keys`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a public key. - * - * @name KeysCreate - * @request POST:/user/keys - */ - keysCreate: (body: UserKeysPost, params: RequestParams = {}) => - this.request({ - path: `/user/keys`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope. - * - * @name KeysDelete - * @request DELETE:/user/keys/{keyId} - */ - keysDelete: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single public key. - * - * @name KeysDetail - * @request GET:/user/keys/{keyId} - */ - keysDetail: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List public and private organizations for the authenticated user. - * - * @name OrgsList - * @request GET:/user/orgs - */ - orgsList: (params: RequestParams = {}) => - this.request({ - path: `/user/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List repositories for the authenticated user. Note that this does not include repositories owned by organizations which the user can access. You can lis user organizations and list organization repositories separately. - * - * @name ReposList - * @request GET:/user/repos - */ - reposList: ( - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @name ReposCreate - * @request POST:/user/repos - */ - reposCreate: (body: PostRepo, params: RequestParams = {}) => - this.request({ - path: `/user/repos`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description List repositories being starred by the authenticated user. - * - * @name StarredList - * @request GET:/user/starred - */ - starredList: ( - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "created" */ - sort?: "created" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/starred`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Unstar a repository - * - * @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, - }), - - /** - * @description Check if you are starring a repository. - * - * @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, - }), - - /** - * @description Star a repository. - * - * @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, - }), - - /** - * @description List repositories being watched by the authenticated user. - * - * @name SubscriptionsList - * @request GET:/user/subscriptions - */ - subscriptionsList: (params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Stop watching a repository - * - * @name SubscriptionsDelete - * @request DELETE:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if you are watching a repository. - * - * @name SubscriptionsDetail - * @request GET:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "GET", - ...params, - }), - - /** - * @description Watch a repository. - * - * @name SubscriptionsUpdate - * @request PUT:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsUpdate: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "PUT", - ...params, - }), - - /** - * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth. - * - * @name TeamsList - * @request GET:/user/teams - */ - teamsList: (params: RequestParams = {}) => - this.request({ - path: `/user/teams`, - method: "GET", - format: "json", - ...params, - }), - }; - users = { - /** - * @description Get all users. This provides a dump of every user, in the order that they signed up for GitHub. Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users. - * - * @name UsersList - * @request GET:/users - */ - usersList: ( - query?: { - /** The integer ID of the last user that you've seen. */ - since?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get a single user. - * - * @name UsersDetail - * @request GET:/users/{username} - */ - usersDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. - * - * @name EventsDetail - * @request GET:/users/{username}/events - */ - eventsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/events`, - method: "GET", - ...params, - }), - - /** - * @description This is the user's organization dashboard. You must be authenticated as the user to view this. - * - * @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, - }), - - /** - * @description List a user's followers - * - * @name FollowersDetail - * @request GET:/users/{username}/followers - */ - followersDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/followers`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Check if one user follows another. - * - * @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, - }), - - /** - * @description List a users gists. - * - * @name GistsDetail - * @request GET:/users/{username}/gists - */ - gistsDetail: ( - username: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List public keys for a user. Lists the verified public keys for a user. This is accessible by anyone. - * - * @name KeysDetail - * @request GET:/users/{username}/keys - */ - keysDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/keys`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List all public organizations for a user. - * - * @name OrgsDetail - * @request GET:/users/{username}/orgs - */ - orgsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description These are events that you'll only see public events. - * - * @name ReceivedEventsDetail - * @request GET:/users/{username}/received_events - */ - receivedEventsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/received_events`, - method: "GET", - ...params, - }), - - /** - * @description List public events that a user has received - * - * @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, - }), - - /** - * @description List public repositories for the specified user. - * - * @name ReposDetail - * @request GET:/users/{username}/repos - */ - reposDetail: ( - username: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List repositories being starred by a user. - * - * @name StarredDetail - * @request GET:/users/{username}/starred - */ - starredDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/starred`, - method: "GET", - ...params, - }), - - /** - * @description List repositories being watched by a user. - * - * @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/axios/test.js b/tests/spec/axios/test.js deleted file mode 100644 index 8e84da14..00000000 --- a/tests/spec/axios/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { resolve } = require("node:path"); -const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); -const createSchemaInfos = require("../../helpers/createSchemaInfos"); -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const assertGeneratedModule = require("../../helpers/assertGeneratedModule"); - -const schemas = createSchemaInfos({ - absolutePathToSchemas: resolve(__dirname, "./"), -}); - -schemas.forEach(({ absolutePath, apiFileName }) => { - generateApiForTest({ - testName: "--axios option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - generateClient: true, - httpClientType: "axios", - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/axiosSingleHttpClient/schema.ts b/tests/spec/axiosSingleHttpClient/__snapshots__/basic.test.ts.snap similarity index 92% rename from tests/spec/axiosSingleHttpClient/schema.ts rename to tests/spec/axiosSingleHttpClient/__snapshots__/basic.test.ts.snap index 882da26b..1cda891f 100644 --- a/tests/spec/axiosSingleHttpClient/schema.ts +++ b/tests/spec/axiosSingleHttpClient/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --axios --single-http-client 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -1913,7 +1916,7 @@ import axios from "axios"; export type QueryParamsType = Record; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -1981,7 +1984,7 @@ export class HttpClient { if (typeof formItem === "object" && formItem !== null) { return JSON.stringify(formItem); } else { - return `${formItem}`; + return \`\${formItem}\`; } } @@ -2097,7 +2100,7 @@ export class Api { }, any >({ - path: `/some-test`, + path: \`/some-test\`, method: "GET", format: "json", ...params, @@ -2112,7 +2115,7 @@ export class Api { */ pathParamsList: (petId: number, params: RequestParams = {}) => this.http.request({ - path: `/path-params`, + path: \`/path-params\`, method: "GET", format: "json", ...params, @@ -2127,7 +2130,7 @@ export class Api { */ eventsList: (params: RequestParams = {}) => this.http.request({ - path: `/events`, + path: \`/events\`, method: "GET", format: "json", ...params, @@ -2142,7 +2145,7 @@ export class Api { */ feedsList: (params: RequestParams = {}) => this.http.request({ - path: `/feeds`, + path: \`/feeds\`, method: "GET", format: "json", ...params, @@ -2166,7 +2169,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/gists`, + path: \`/gists\`, method: "GET", query: query, format: "json", @@ -2181,7 +2184,7 @@ export class Api { */ gistsCreate: (body: PostGist, params: RequestParams = {}) => this.http.request({ - path: `/gists`, + path: \`/gists\`, method: "POST", body: body, type: ContentType.Json, @@ -2206,7 +2209,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/gists/public`, + path: \`/gists/public\`, method: "GET", query: query, format: "json", @@ -2230,7 +2233,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/gists/starred`, + path: \`/gists/starred\`, method: "GET", query: query, format: "json", @@ -2245,7 +2248,7 @@ export class Api { */ gistsDelete: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "DELETE", ...params, }), @@ -2258,7 +2261,7 @@ export class Api { */ gistsDetail: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "GET", format: "json", ...params, @@ -2272,7 +2275,7 @@ export class Api { */ gistsPartialUpdate: (id: number, body: PatchGist, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2288,7 +2291,7 @@ export class Api { */ commentsDetail: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "GET", format: "json", ...params, @@ -2302,7 +2305,7 @@ export class Api { */ commentsCreate: (id: number, body: CommentBody, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "POST", body: body, format: "json", @@ -2317,7 +2320,7 @@ export class Api { */ commentsDelete: (id: number, commentId: number, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -2332,7 +2335,7 @@ export class Api { */ commentsDetail2: (id: number, commentId: number, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -2346,7 +2349,7 @@ export class Api { */ commentsPartialUpdate: (id: number, commentId: number, body: Comment, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2362,7 +2365,7 @@ export class Api { */ forksCreate: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}/forks`, + path: \`/gists/\${id}/forks\`, method: "POST", ...params, }), @@ -2375,7 +2378,7 @@ export class Api { */ starDelete: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "DELETE", ...params, }), @@ -2388,7 +2391,7 @@ export class Api { */ starDetail: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "GET", ...params, }), @@ -2401,7 +2404,7 @@ export class Api { */ starUpdate: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "PUT", ...params, }), @@ -2415,7 +2418,7 @@ export class Api { */ templatesList: (params: RequestParams = {}) => this.http.request({ - path: `/gitignore/templates`, + path: \`/gitignore/templates\`, method: "GET", format: "json", ...params, @@ -2429,7 +2432,7 @@ export class Api { */ templatesDetail: (language: string, params: RequestParams = {}) => this.http.request({ - path: `/gitignore/templates/${language}`, + path: \`/gitignore/templates/\${language}\`, method: "GET", format: "json", ...params, @@ -2467,7 +2470,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/issues`, + path: \`/issues\`, method: "GET", query: query, format: "json", @@ -2490,7 +2493,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + path: \`/legacy/issues/search/\${owner}/\${repository}/\${state}/\${keyword}\`, method: "GET", format: "json", ...params, @@ -2521,7 +2524,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/legacy/repos/search/${keyword}`, + path: \`/legacy/repos/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2537,7 +2540,7 @@ export class Api { */ userEmailDetail: (email: string, params: RequestParams = {}) => this.http.request({ - path: `/legacy/user/email/${email}`, + path: \`/legacy/user/email/\${email}\`, method: "GET", format: "json", ...params, @@ -2566,7 +2569,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/legacy/user/search/${keyword}`, + path: \`/legacy/user/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2582,7 +2585,7 @@ export class Api { */ markdownCreate: (body: Markdown, params: RequestParams = {}) => this.http.request({ - path: `/markdown`, + path: \`/markdown\`, method: "POST", body: body, type: ContentType.Json, @@ -2597,7 +2600,7 @@ export class Api { */ postMarkdown: (params: RequestParams = {}) => this.http.request({ - path: `/markdown/raw`, + path: \`/markdown/raw\`, method: "POST", type: ContentType.Text, ...params, @@ -2612,7 +2615,7 @@ export class Api { */ metaList: (params: RequestParams = {}) => this.http.request({ - path: `/meta`, + path: \`/meta\`, method: "GET", format: "json", ...params, @@ -2627,7 +2630,7 @@ export class Api { */ eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/networks/${owner}/${repo}/events`, + path: \`/networks/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -2658,7 +2661,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/notifications`, + path: \`/notifications\`, method: "GET", query: query, format: "json", @@ -2673,7 +2676,7 @@ export class Api { */ notificationsUpdate: (body: NotificationMarkRead, params: RequestParams = {}) => this.http.request({ - path: `/notifications`, + path: \`/notifications\`, method: "PUT", body: body, ...params, @@ -2687,7 +2690,7 @@ export class Api { */ threadsDetail: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "GET", format: "json", ...params, @@ -2701,7 +2704,7 @@ export class Api { */ threadsPartialUpdate: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "PATCH", ...params, }), @@ -2714,7 +2717,7 @@ export class Api { */ threadsSubscriptionDelete: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "DELETE", ...params, }), @@ -2727,7 +2730,7 @@ export class Api { */ threadsSubscriptionDetail: (id: number, params: RequestParams = {}) => this.http.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "GET", format: "json", ...params, @@ -2741,7 +2744,7 @@ export class Api { */ threadsSubscriptionUpdate: (id: number, body: PutSubscription, params: RequestParams = {}) => this.http.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -2758,7 +2761,7 @@ export class Api { */ orgsDetail: (org: string, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "GET", format: "json", ...params, @@ -2772,7 +2775,7 @@ export class Api { */ orgsPartialUpdate: (org: string, body: PatchOrg, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2788,7 +2791,7 @@ export class Api { */ eventsDetail: (org: string, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/events`, + path: \`/orgs/\${org}/events\`, method: "GET", format: "json", ...params, @@ -2826,7 +2829,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/orgs/${org}/issues`, + path: \`/orgs/\${org}/issues\`, method: "GET", query: query, format: "json", @@ -2841,7 +2844,7 @@ export class Api { */ membersDetail: (org: string, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/members`, + path: \`/orgs/\${org}/members\`, method: "GET", format: "json", ...params, @@ -2855,7 +2858,7 @@ export class Api { */ membersDelete: (org: string, username: string, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "DELETE", ...params, }), @@ -2870,7 +2873,7 @@ export class Api { */ membersDetail2: (org: string, username: string, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "GET", ...params, }), @@ -2883,7 +2886,7 @@ export class Api { */ publicMembersDetail: (org: string, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/public_members`, + path: \`/orgs/\${org}/public_members\`, method: "GET", format: "json", ...params, @@ -2897,7 +2900,7 @@ export class Api { */ publicMembersDelete: (org: string, username: string, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "DELETE", ...params, }), @@ -2912,7 +2915,7 @@ export class Api { */ publicMembersDetail2: (org: string, username: string, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "GET", ...params, }), @@ -2925,7 +2928,7 @@ export class Api { */ publicMembersUpdate: (org: string, username: string, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "PUT", ...params, }), @@ -2945,7 +2948,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "GET", query: query, format: "json", @@ -2960,7 +2963,7 @@ export class Api { */ reposCreate: (org: string, body: PostRepo, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "POST", body: body, format: "json", @@ -2975,7 +2978,7 @@ export class Api { */ teamsDetail: (org: string, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "GET", format: "json", ...params, @@ -2989,7 +2992,7 @@ export class Api { */ teamsCreate: (org: string, body: OrgTeamsPost, params: RequestParams = {}) => this.http.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "POST", body: body, type: ContentType.Json, @@ -3006,7 +3009,7 @@ export class Api { */ rateLimitList: (params: RequestParams = {}) => this.http.request({ - path: `/rate_limit`, + path: \`/rate_limit\`, method: "GET", format: "json", ...params, @@ -3021,7 +3024,7 @@ export class Api { */ reposDelete: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -3034,7 +3037,7 @@ export class Api { */ reposDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "GET", format: "json", ...params, @@ -3048,7 +3051,7 @@ export class Api { */ reposPartialUpdate: (owner: string, repo: string, body: RepoEdit, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -3064,7 +3067,7 @@ export class Api { */ assigneesDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/assignees`, + path: \`/repos/\${owner}/\${repo}/assignees\`, method: "GET", format: "json", ...params, @@ -3080,7 +3083,7 @@ export class Api { */ assigneesDetail2: (owner: string, repo: string, assignee: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/assignees/${assignee}`, + path: \`/repos/\${owner}/\${repo}/assignees/\${assignee}\`, method: "GET", ...params, }), @@ -3093,7 +3096,7 @@ export class Api { */ branchesDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/branches`, + path: \`/repos/\${owner}/\${repo}/branches\`, method: "GET", format: "json", ...params, @@ -3109,7 +3112,7 @@ export class Api { */ branchesDetail2: (owner: string, repo: string, branch: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/branches/${branch}`, + path: \`/repos/\${owner}/\${repo}/branches/\${branch}\`, method: "GET", format: "json", ...params, @@ -3123,7 +3126,7 @@ export class Api { */ collaboratorsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/collaborators`, + path: \`/repos/\${owner}/\${repo}/collaborators\`, method: "GET", format: "json", ...params, @@ -3137,7 +3140,7 @@ export class Api { */ collaboratorsDelete: (owner: string, repo: string, user: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "DELETE", ...params, }), @@ -3152,7 +3155,7 @@ export class Api { */ collaboratorsDetail2: (owner: string, repo: string, user: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "GET", ...params, }), @@ -3165,7 +3168,7 @@ export class Api { */ collaboratorsUpdate: (owner: string, repo: string, user: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "PUT", ...params, }), @@ -3178,7 +3181,7 @@ export class Api { */ commentsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/comments`, + path: \`/repos/\${owner}/\${repo}/comments\`, method: "GET", format: "json", ...params, @@ -3192,7 +3195,7 @@ export class Api { */ commentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3207,7 +3210,7 @@ export class Api { */ commentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -3227,7 +3230,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -3261,7 +3264,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/commits`, + path: \`/repos/\${owner}/\${repo}/commits\`, method: "GET", query: query, format: "json", @@ -3276,7 +3279,7 @@ export class Api { */ commitsStatusDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/status`, + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/status\`, method: "GET", format: "json", ...params, @@ -3292,7 +3295,7 @@ export class Api { */ commitsDetail2: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3306,7 +3309,7 @@ export class Api { */ commitsCommentsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "GET", format: "json", ...params, @@ -3326,7 +3329,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -3342,7 +3345,7 @@ export class Api { */ compareDetail: (owner: string, repo: string, baseId: string, headId: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + path: \`/repos/\${owner}/\${repo}/compare/\${baseId}...\${headId}\`, method: "GET", format: "json", ...params, @@ -3356,7 +3359,7 @@ export class Api { */ contentsDelete: (owner: string, repo: string, path: string, body: DeleteFileBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "DELETE", body: body, type: ContentType.Json, @@ -3383,7 +3386,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "GET", query: query, format: "json", @@ -3398,7 +3401,7 @@ export class Api { */ contentsUpdate: (owner: string, repo: string, path: string, body: CreateFileBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "PUT", body: body, type: ContentType.Json, @@ -3422,7 +3425,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/contributors`, + path: \`/repos/\${owner}/\${repo}/contributors\`, method: "GET", query: query, format: "json", @@ -3437,7 +3440,7 @@ export class Api { */ deploymentsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "GET", format: "json", ...params, @@ -3451,7 +3454,7 @@ export class Api { */ deploymentsCreate: (owner: string, repo: string, body: Deployment, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "POST", body: body, type: ContentType.Json, @@ -3467,7 +3470,7 @@ export class Api { */ deploymentsStatusesDetail: (owner: string, repo: string, id: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "GET", format: "json", ...params, @@ -3487,7 +3490,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "POST", body: body, type: ContentType.Json, @@ -3503,7 +3506,7 @@ export class Api { */ downloadsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/downloads`, + path: \`/repos/\${owner}/\${repo}/downloads\`, method: "GET", format: "json", ...params, @@ -3518,7 +3521,7 @@ export class Api { */ downloadsDelete: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "DELETE", ...params, }), @@ -3534,7 +3537,7 @@ export class Api { */ downloadsDetail2: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "GET", format: "json", ...params, @@ -3548,7 +3551,7 @@ export class Api { */ eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/events`, + path: \`/repos/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -3570,7 +3573,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "GET", query: query, format: "json", @@ -3585,7 +3588,7 @@ export class Api { */ forksCreate: (owner: string, repo: string, body: ForkBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "POST", body: body, type: ContentType.Json, @@ -3601,7 +3604,7 @@ export class Api { */ gitBlobsCreate: (owner: string, repo: string, body: Blob, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/blobs`, + path: \`/repos/\${owner}/\${repo}/git/blobs\`, method: "POST", body: body, type: ContentType.Json, @@ -3617,7 +3620,7 @@ export class Api { */ gitBlobsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/blobs/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3631,7 +3634,7 @@ export class Api { */ gitCommitsCreate: (owner: string, repo: string, body: RepoCommitBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/commits`, + path: \`/repos/\${owner}/\${repo}/git/commits\`, method: "POST", body: body, type: ContentType.Json, @@ -3647,7 +3650,7 @@ export class Api { */ gitCommitsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3661,7 +3664,7 @@ export class Api { */ gitRefsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "GET", format: "json", ...params, @@ -3675,7 +3678,7 @@ export class Api { */ gitRefsCreate: (owner: string, repo: string, body: RefsBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "POST", body: body, type: ContentType.Json, @@ -3691,7 +3694,7 @@ export class Api { */ gitRefsDelete: (owner: string, repo: string, ref: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "DELETE", ...params, }), @@ -3706,7 +3709,7 @@ export class Api { */ gitRefsDetail2: (owner: string, repo: string, ref: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "GET", format: "json", ...params, @@ -3720,7 +3723,7 @@ export class Api { */ gitRefsPartialUpdate: (owner: string, repo: string, ref: string, body: GitRefPatch, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -3736,7 +3739,7 @@ export class Api { */ gitTagsCreate: (owner: string, repo: string, body: TagBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/tags`, + path: \`/repos/\${owner}/\${repo}/git/tags\`, method: "POST", body: body, type: ContentType.Json, @@ -3752,7 +3755,7 @@ export class Api { */ gitTagsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/tags/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3766,7 +3769,7 @@ export class Api { */ gitTreesCreate: (owner: string, repo: string, body: Tree, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/git/trees`, + path: \`/repos/\${owner}/\${repo}/git/trees\`, method: "POST", body: body, type: ContentType.Json, @@ -3791,7 +3794,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/trees/\${shaCode}\`, method: "GET", query: query, format: "json", @@ -3806,7 +3809,7 @@ export class Api { */ hooksDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "GET", format: "json", ...params, @@ -3820,7 +3823,7 @@ export class Api { */ hooksCreate: (owner: string, repo: string, body: HookBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "POST", body: body, format: "json", @@ -3835,7 +3838,7 @@ export class Api { */ hooksDelete: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "DELETE", ...params, }), @@ -3850,7 +3853,7 @@ export class Api { */ hooksDetail2: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "GET", format: "json", ...params, @@ -3864,7 +3867,7 @@ export class Api { */ hooksPartialUpdate: (owner: string, repo: string, hookId: number, body: HookBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "PATCH", body: body, format: "json", @@ -3879,7 +3882,7 @@ export class Api { */ hooksTestsCreate: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/tests\`, method: "POST", ...params, }), @@ -3917,7 +3920,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "GET", query: query, format: "json", @@ -3932,7 +3935,7 @@ export class Api { */ issuesCreate: (owner: string, repo: string, body: Issue, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "POST", body: body, format: "json", @@ -3961,7 +3964,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/comments`, + path: \`/repos/\${owner}/\${repo}/issues/comments\`, method: "GET", query: query, format: "json", @@ -3976,7 +3979,7 @@ export class Api { */ issuesCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3991,7 +3994,7 @@ export class Api { */ issuesCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -4011,7 +4014,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -4026,7 +4029,7 @@ export class Api { */ issuesEventsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/events`, + path: \`/repos/\${owner}/\${repo}/issues/events\`, method: "GET", format: "json", ...params, @@ -4042,7 +4045,7 @@ export class Api { */ issuesEventsDetail2: (owner: string, repo: string, eventId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + path: \`/repos/\${owner}/\${repo}/issues/events/\${eventId}\`, method: "GET", format: "json", ...params, @@ -4058,7 +4061,7 @@ export class Api { */ issuesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "GET", format: "json", ...params, @@ -4072,7 +4075,7 @@ export class Api { */ issuesPartialUpdate: (owner: string, repo: string, number: number, body: Issue, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "PATCH", body: body, format: "json", @@ -4089,7 +4092,7 @@ export class Api { */ issuesCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -4109,7 +4112,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "POST", body: body, format: "json", @@ -4126,7 +4129,7 @@ export class Api { */ issuesEventsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/events`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/events\`, method: "GET", format: "json", ...params, @@ -4140,7 +4143,7 @@ export class Api { */ issuesLabelsDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "DELETE", ...params, }), @@ -4153,7 +4156,7 @@ export class Api { */ issuesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4167,7 +4170,7 @@ export class Api { */ issuesLabelsCreate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "POST", body: body, format: "json", @@ -4182,7 +4185,7 @@ export class Api { */ issuesLabelsUpdate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "PUT", body: body, format: "json", @@ -4199,7 +4202,7 @@ export class Api { */ issuesLabelsDelete2: (owner: string, repo: string, number: number, name: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4212,7 +4215,7 @@ export class Api { */ keysDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "GET", format: "json", ...params, @@ -4226,7 +4229,7 @@ export class Api { */ keysCreate: (owner: string, repo: string, body: UserKeysPost, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "POST", body: body, format: "json", @@ -4241,7 +4244,7 @@ export class Api { */ keysDelete: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -4256,7 +4259,7 @@ export class Api { */ keysDetail2: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -4270,7 +4273,7 @@ export class Api { */ labelsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "GET", format: "json", ...params, @@ -4284,7 +4287,7 @@ export class Api { */ labelsCreate: (owner: string, repo: string, body: EmailsPost, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "POST", body: body, format: "json", @@ -4299,7 +4302,7 @@ export class Api { */ labelsDelete: (owner: string, repo: string, name: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4314,7 +4317,7 @@ export class Api { */ labelsDetail2: (owner: string, repo: string, name: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "GET", format: "json", ...params, @@ -4328,7 +4331,7 @@ export class Api { */ labelsPartialUpdate: (owner: string, repo: string, name: string, body: EmailsPost, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "PATCH", body: body, format: "json", @@ -4343,7 +4346,7 @@ export class Api { */ languagesDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/languages`, + path: \`/repos/\${owner}/\${repo}/languages\`, method: "GET", format: "json", ...params, @@ -4357,7 +4360,7 @@ export class Api { */ mergesCreate: (owner: string, repo: string, body: MergesBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/merges`, + path: \`/repos/\${owner}/\${repo}/merges\`, method: "POST", body: body, type: ContentType.Json, @@ -4388,7 +4391,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "GET", query: query, format: "json", @@ -4403,7 +4406,7 @@ export class Api { */ milestonesCreate: (owner: string, repo: string, body: MilestoneUpdate, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "POST", body: body, format: "json", @@ -4418,7 +4421,7 @@ export class Api { */ milestonesDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "DELETE", ...params, }), @@ -4433,7 +4436,7 @@ export class Api { */ milestonesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "GET", format: "json", ...params, @@ -4453,7 +4456,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "PATCH", body: body, format: "json", @@ -4468,7 +4471,7 @@ export class Api { */ milestonesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4500,7 +4503,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "GET", query: query, format: "json", @@ -4515,7 +4518,7 @@ export class Api { */ notificationsUpdate: (owner: string, repo: string, body: NotificationMarkRead, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "PUT", body: body, ...params, @@ -4547,7 +4550,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "GET", query: query, format: "json", @@ -4562,7 +4565,7 @@ export class Api { */ pullsCreate: (owner: string, repo: string, body: PullsPost, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "POST", body: body, type: ContentType.Json, @@ -4592,7 +4595,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/comments\`, method: "GET", query: query, format: "json", @@ -4607,7 +4610,7 @@ export class Api { */ pullsCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -4622,7 +4625,7 @@ export class Api { */ pullsCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -4642,7 +4645,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -4659,7 +4662,7 @@ export class Api { */ pullsDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "GET", format: "json", ...params, @@ -4673,7 +4676,7 @@ export class Api { */ pullsPartialUpdate: (owner: string, repo: string, number: number, body: PullUpdate, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -4691,7 +4694,7 @@ export class Api { */ pullsCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -4711,7 +4714,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -4727,7 +4730,7 @@ export class Api { */ pullsCommitsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/commits\`, method: "GET", format: "json", ...params, @@ -4741,7 +4744,7 @@ export class Api { */ pullsFilesDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/files`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/files\`, method: "GET", format: "json", ...params, @@ -4755,7 +4758,7 @@ export class Api { */ pullsMergeDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "GET", ...params, }), @@ -4768,7 +4771,7 @@ export class Api { */ pullsMergeUpdate: (owner: string, repo: string, number: number, body: MergePullBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "PUT", body: body, type: ContentType.Json, @@ -4792,7 +4795,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/readme`, + path: \`/repos/\${owner}/\${repo}/readme\`, method: "GET", query: query, format: "json", @@ -4807,7 +4810,7 @@ export class Api { */ releasesDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "GET", format: "json", ...params, @@ -4821,7 +4824,7 @@ export class Api { */ releasesCreate: (owner: string, repo: string, body: ReleaseCreate, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "POST", body: body, format: "json", @@ -4836,7 +4839,7 @@ export class Api { */ releasesAssetsDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "DELETE", ...params, }), @@ -4849,7 +4852,7 @@ export class Api { */ releasesAssetsDetail: (owner: string, repo: string, id: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "GET", format: "json", ...params, @@ -4869,7 +4872,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -4885,7 +4888,7 @@ export class Api { */ releasesDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "DELETE", ...params, }), @@ -4900,7 +4903,7 @@ export class Api { */ releasesDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "GET", format: "json", ...params, @@ -4914,7 +4917,7 @@ export class Api { */ releasesPartialUpdate: (owner: string, repo: string, id: string, body: ReleaseCreate, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "PATCH", body: body, format: "json", @@ -4931,7 +4934,7 @@ export class Api { */ releasesAssetsDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/releases/${id}/assets`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}/assets\`, method: "GET", format: "json", ...params, @@ -4945,7 +4948,7 @@ export class Api { */ stargazersDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/stargazers`, + path: \`/repos/\${owner}/\${repo}/stargazers\`, method: "GET", format: "json", ...params, @@ -4959,7 +4962,7 @@ export class Api { */ statsCodeFrequencyDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/stats/code_frequency`, + path: \`/repos/\${owner}/\${repo}/stats/code_frequency\`, method: "GET", format: "json", ...params, @@ -4973,7 +4976,7 @@ export class Api { */ statsCommitActivityDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/stats/commit_activity`, + path: \`/repos/\${owner}/\${repo}/stats/commit_activity\`, method: "GET", format: "json", ...params, @@ -4987,7 +4990,7 @@ export class Api { */ statsContributorsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/stats/contributors`, + path: \`/repos/\${owner}/\${repo}/stats/contributors\`, method: "GET", format: "json", ...params, @@ -5001,7 +5004,7 @@ export class Api { */ statsParticipationDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/stats/participation`, + path: \`/repos/\${owner}/\${repo}/stats/participation\`, method: "GET", format: "json", ...params, @@ -5015,7 +5018,7 @@ export class Api { */ statsPunchCardDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/stats/punch_card`, + path: \`/repos/\${owner}/\${repo}/stats/punch_card\`, method: "GET", format: "json", ...params, @@ -5029,7 +5032,7 @@ export class Api { */ statusesDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "GET", format: "json", ...params, @@ -5043,7 +5046,7 @@ export class Api { */ statusesCreate: (owner: string, repo: string, ref: string, body: HeadBranch, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "POST", body: body, type: ContentType.Json, @@ -5059,7 +5062,7 @@ export class Api { */ subscribersDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/subscribers`, + path: \`/repos/\${owner}/\${repo}/subscribers\`, method: "GET", format: "json", ...params, @@ -5073,7 +5076,7 @@ export class Api { */ subscriptionDelete: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "DELETE", ...params, }), @@ -5086,7 +5089,7 @@ export class Api { */ subscriptionDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "GET", format: "json", ...params, @@ -5100,7 +5103,7 @@ export class Api { */ subscriptionUpdate: (owner: string, repo: string, body: SubscriptionBody, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -5116,7 +5119,7 @@ export class Api { */ tagsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/tags`, + path: \`/repos/\${owner}/\${repo}/tags\`, method: "GET", format: "json", ...params, @@ -5130,7 +5133,7 @@ export class Api { */ teamsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/teams`, + path: \`/repos/\${owner}/\${repo}/teams\`, method: "GET", format: "json", ...params, @@ -5144,7 +5147,7 @@ export class Api { */ watchersDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/repos/${owner}/${repo}/watchers`, + path: \`/repos/\${owner}/\${repo}/watchers\`, method: "GET", format: "json", ...params, @@ -5166,7 +5169,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + path: \`/repos/\${owner}/\${repo}/\${archiveFormat}/\${path}\`, method: "GET", ...params, }), @@ -5189,7 +5192,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/repositories`, + path: \`/repositories\`, method: "GET", query: query, format: "json", @@ -5236,7 +5239,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/search/code`, + path: \`/search/code\`, method: "GET", query: query, format: "json", @@ -5264,7 +5267,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/search/issues`, + path: \`/search/issues\`, method: "GET", query: query, format: "json", @@ -5306,7 +5309,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/search/repositories`, + path: \`/search/repositories\`, method: "GET", query: query, format: "json", @@ -5347,7 +5350,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/search/users`, + path: \`/search/users\`, method: "GET", query: query, format: "json", @@ -5363,7 +5366,7 @@ export class Api { */ teamsDelete: (teamId: number, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "DELETE", ...params, }), @@ -5376,7 +5379,7 @@ export class Api { */ teamsDetail: (teamId: number, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "GET", format: "json", ...params, @@ -5390,7 +5393,7 @@ export class Api { */ teamsPartialUpdate: (teamId: number, body: EditTeam, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5406,7 +5409,7 @@ export class Api { */ membersDetail: (teamId: number, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/members`, + path: \`/teams/\${teamId}/members\`, method: "GET", format: "json", ...params, @@ -5421,7 +5424,7 @@ export class Api { */ membersDelete: (teamId: number, username: string, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "DELETE", ...params, }), @@ -5437,7 +5440,7 @@ export class Api { */ membersDetail2: (teamId: number, username: string, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "GET", ...params, }), @@ -5451,7 +5454,7 @@ export class Api { */ membersUpdate: (teamId: number, username: string, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "PUT", ...params, }), @@ -5464,7 +5467,7 @@ export class Api { */ membershipsDelete: (teamId: number, username: string, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "DELETE", ...params, }), @@ -5477,7 +5480,7 @@ export class Api { */ membershipsDetail: (teamId: number, username: string, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "GET", format: "json", ...params, @@ -5491,7 +5494,7 @@ export class Api { */ membershipsUpdate: (teamId: number, username: string, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "PUT", format: "json", ...params, @@ -5505,7 +5508,7 @@ export class Api { */ reposDetail: (teamId: number, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/repos`, + path: \`/teams/\${teamId}/repos\`, method: "GET", format: "json", ...params, @@ -5519,7 +5522,7 @@ export class Api { */ reposDelete: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5534,7 +5537,7 @@ export class Api { */ reposDetail2: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5547,7 +5550,7 @@ export class Api { */ reposUpdate: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5561,7 +5564,7 @@ export class Api { */ userList: (params: RequestParams = {}) => this.http.request({ - path: `/user`, + path: \`/user\`, method: "GET", format: "json", ...params, @@ -5575,7 +5578,7 @@ export class Api { */ userPartialUpdate: (body: UserUpdate, params: RequestParams = {}) => this.http.request({ - path: `/user`, + path: \`/user\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5591,7 +5594,7 @@ export class Api { */ emailsDelete: (body: UserEmails, params: RequestParams = {}) => this.http.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "DELETE", body: body, type: ContentType.Json, @@ -5606,7 +5609,7 @@ export class Api { */ emailsList: (params: RequestParams = {}) => this.http.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "GET", ...params, }), @@ -5619,7 +5622,7 @@ export class Api { */ emailsCreate: (body: EmailsPost, params: RequestParams = {}) => this.http.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "POST", body: body, ...params, @@ -5633,7 +5636,7 @@ export class Api { */ followersList: (params: RequestParams = {}) => this.http.request({ - path: `/user/followers`, + path: \`/user/followers\`, method: "GET", format: "json", ...params, @@ -5647,7 +5650,7 @@ export class Api { */ followingList: (params: RequestParams = {}) => this.http.request({ - path: `/user/following`, + path: \`/user/following\`, method: "GET", format: "json", ...params, @@ -5661,7 +5664,7 @@ export class Api { */ followingDelete: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "DELETE", ...params, }), @@ -5674,7 +5677,7 @@ export class Api { */ followingDetail: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "GET", ...params, }), @@ -5687,7 +5690,7 @@ export class Api { */ followingUpdate: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "PUT", ...params, }), @@ -5723,7 +5726,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/user/issues`, + path: \`/user/issues\`, method: "GET", query: query, format: "json", @@ -5738,7 +5741,7 @@ export class Api { */ keysList: (params: RequestParams = {}) => this.http.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "GET", format: "json", ...params, @@ -5752,7 +5755,7 @@ export class Api { */ keysCreate: (body: UserKeysPost, params: RequestParams = {}) => this.http.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "POST", body: body, format: "json", @@ -5767,7 +5770,7 @@ export class Api { */ keysDelete: (keyId: number, params: RequestParams = {}) => this.http.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -5780,7 +5783,7 @@ export class Api { */ keysDetail: (keyId: number, params: RequestParams = {}) => this.http.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -5794,7 +5797,7 @@ export class Api { */ orgsList: (params: RequestParams = {}) => this.http.request({ - path: `/user/orgs`, + path: \`/user/orgs\`, method: "GET", format: "json", ...params, @@ -5814,7 +5817,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "GET", query: query, format: "json", @@ -5829,7 +5832,7 @@ export class Api { */ reposCreate: (body: PostRepo, params: RequestParams = {}) => this.http.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "POST", body: body, format: "json", @@ -5852,7 +5855,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/user/starred`, + path: \`/user/starred\`, method: "GET", query: query, format: "json", @@ -5867,7 +5870,7 @@ export class Api { */ starredDelete: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5880,7 +5883,7 @@ export class Api { */ starredDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5893,7 +5896,7 @@ export class Api { */ starredUpdate: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5906,7 +5909,7 @@ export class Api { */ subscriptionsList: (params: RequestParams = {}) => this.http.request({ - path: `/user/subscriptions`, + path: \`/user/subscriptions\`, method: "GET", format: "json", ...params, @@ -5921,7 +5924,7 @@ export class Api { */ subscriptionsDelete: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5935,7 +5938,7 @@ export class Api { */ subscriptionsDetail: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5949,7 +5952,7 @@ export class Api { */ subscriptionsUpdate: (owner: string, repo: string, params: RequestParams = {}) => this.http.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5962,7 +5965,7 @@ export class Api { */ teamsList: (params: RequestParams = {}) => this.http.request({ - path: `/user/teams`, + path: \`/user/teams\`, method: "GET", format: "json", ...params, @@ -5983,7 +5986,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/users`, + path: \`/users\`, method: "GET", query: query, format: "json", @@ -5998,7 +6001,7 @@ export class Api { */ usersDetail: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}`, + path: \`/users/\${username}\`, method: "GET", format: "json", ...params, @@ -6012,7 +6015,7 @@ export class Api { */ eventsDetail: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}/events`, + path: \`/users/\${username}/events\`, method: "GET", ...params, }), @@ -6025,7 +6028,7 @@ export class Api { */ eventsOrgsDetail: (username: string, org: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}/events/orgs/${org}`, + path: \`/users/\${username}/events/orgs/\${org}\`, method: "GET", ...params, }), @@ -6038,7 +6041,7 @@ export class Api { */ followersDetail: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}/followers`, + path: \`/users/\${username}/followers\`, method: "GET", format: "json", ...params, @@ -6052,7 +6055,7 @@ export class Api { */ followingDetail: (username: string, targetUser: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}/following/${targetUser}`, + path: \`/users/\${username}/following/\${targetUser}\`, method: "GET", ...params, }), @@ -6075,7 +6078,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/users/${username}/gists`, + path: \`/users/\${username}/gists\`, method: "GET", query: query, format: "json", @@ -6090,7 +6093,7 @@ export class Api { */ keysDetail: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}/keys`, + path: \`/users/\${username}/keys\`, method: "GET", format: "json", ...params, @@ -6104,7 +6107,7 @@ export class Api { */ orgsDetail: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}/orgs`, + path: \`/users/\${username}/orgs\`, method: "GET", format: "json", ...params, @@ -6118,7 +6121,7 @@ export class Api { */ receivedEventsDetail: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}/received_events`, + path: \`/users/\${username}/received_events\`, method: "GET", ...params, }), @@ -6131,7 +6134,7 @@ export class Api { */ receivedEventsPublicDetail: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}/received_events/public`, + path: \`/users/\${username}/received_events/public\`, method: "GET", ...params, }), @@ -6151,7 +6154,7 @@ export class Api { params: RequestParams = {}, ) => this.http.request({ - path: `/users/${username}/repos`, + path: \`/users/\${username}/repos\`, method: "GET", query: query, format: "json", @@ -6166,7 +6169,7 @@ export class Api { */ starredDetail: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}/starred`, + path: \`/users/\${username}/starred\`, method: "GET", ...params, }), @@ -6179,9 +6182,11 @@ export class Api { */ subscriptionsDetail: (username: string, params: RequestParams = {}) => this.http.request({ - path: `/users/${username}/subscriptions`, + path: \`/users/\${username}/subscriptions\`, method: "GET", ...params, }), }; } +" +`; diff --git a/tests/spec/axiosSingleHttpClient/basic.test.ts b/tests/spec/axiosSingleHttpClient/basic.test.ts new file mode 100644 index 00000000..935fc376 --- /dev/null +++ b/tests/spec/axiosSingleHttpClient/basic.test.ts @@ -0,0 +1,38 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--axios --single-http-client", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: true, + httpClientType: "axios", + singleHttpClient: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/axiosSingleHttpClient/expected.ts b/tests/spec/axiosSingleHttpClient/expected.ts deleted file mode 100644 index 882da26b..00000000 --- a/tests/spec/axiosSingleHttpClient/expected.ts +++ /dev/null @@ -1,6187 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** A user or organization */ -export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - 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; - /** The account username */ - login?: string; - /** The full account name */ - 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"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - 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?: { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601. */ - created_at?: string; - id?: number; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface Commit { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export interface CommitCommentBody { - body: string; - /** Deprecated - Use position parameter instead. */ - line?: string; - /** Line number in the file to comment on. Defaults to null. */ - number?: string; - /** Relative path of the file to comment on. */ - path?: string; - /** Line index in the diff to comment on. */ - position?: number; - /** SHA of the commit to comment on. */ - sha: string; -} - -export type Commits = { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -}[]; - -export interface CompareCommits { - ahead_by?: number; - base_commit?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - behind_by?: number; - commits?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - }; - /** The Total number of commits authored by the contributor. */ - total?: number; - weeks?: { - /** Number of additions. */ - a?: number; - /** Number of commits. */ - c?: number; - /** Number of deletions. */ - d?: number; - /** Start of the week. */ - 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; - /** A GitHub user */ - creator?: User; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -} - -export type DeploymentStatuses = { - created_at?: string; - /** A GitHub user */ - 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 { - /** A user or organization */ - actor?: Actor; - created_at?: object; - id?: number; - /** A GitHub organization */ - 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; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - description?: string; - files?: { - "ring.erl"?: { - filename?: string; - raw_url?: string; - size?: number; - }; - }; - forks?: { - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }[]; - git_pull_url?: string; - git_push_url?: string; - history?: { - change_status?: { - additions?: number; - deletions?: number; - total?: number; - }; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - committed_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - version?: string; - }[]; - html_url?: string; - id?: string; - public?: boolean; - url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - 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; - }; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** A user or organization */ - actor?: Actor; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - event?: string; - issue?: { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }; - url?: string; -} - -export type IssueEvents = IssueEvent[]; - -export type Issues = { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface IssuesComment { - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export type IssuesComments = { - _links?: { - html?: { - href?: string; - }; - pull_request?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - body?: string; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - 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 { - /** Error message */ - message?: string; -} - -export interface MergesSuccessful { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A user or organization */ - 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[]; -} - -/** A GitHub organization */ -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 address. This address is not publicized. */ - billing_email?: string; - company?: string; - /** Publicly visible email address. */ - email?: string; - location?: string; - name?: string; -} - -export interface PostGist { - description?: string; - files?: { - "file1.txt"?: { - content?: string; - }; - }; - public?: boolean; -} - -export interface PostRepo { - /** True to create an initial commit with empty README. Default is false. */ - auto_init?: boolean; - description?: string; - /** Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell" Ignored if auto_init parameter is not provided. */ - gitignore_template?: string; - /** True to enable downloads for this repository, false to disable them. Default is true. */ - has_downloads?: boolean; - /** True to enable issues for this repository, false to disable them. Default is true. */ - has_issues?: boolean; - /** True to enable the wiki for this repository, false to disable it. Default is true. */ - has_wiki?: boolean; - homepage?: string; - name: string; - /** True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. */ - private?: boolean; - /** The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization. */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - merged_at?: string; - number?: number; - patch_url?: string; - state?: "open" | "closed"; - title?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 = { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub organization */ - organization?: Organization; - /** A user or organization */ - owner?: Actor; - /** Is present when the repo is a fork. Parent is the repo this repo was forked from. */ - parent?: Repo; - private?: boolean; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - pushed_at?: string; - size?: number; - /** Is present when the repo is a fork. Source is the ultimate source for the network. */ - source?: Repo; - ssh_url?: string; - svn_url?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - watchers?: number; - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface RepoCommit { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 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; - /** A user or organization */ - 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; - /** A GitHub user */ - 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 { - /** A GitHub user */ - user?: User; -} - -export interface SearchUsers { - items?: Users; - total_count?: number; -} - -export interface SearchUsersByKeyword { - users?: Users; -} - -export interface Subscription { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** String of the tag message. */ - message?: string; - object?: { - sha?: string; - /** String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob. */ - type?: "commit" | "tree" | "blob"; - url?: string; - }; - sha?: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag?: string; - tagger?: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - url?: string; -} - -export interface TagBody { - /** String of the tag message. */ - message: string; - /** String of the SHA of the git object this is tagging. */ - object: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag: string; - tagger: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - /** 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 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?: { - /** One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink. */ - mode?: "100644" | "100755" | "040000" | "160000" | "120000"; - path?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - size?: number; - type?: "blob" | "tree" | "commit"; - url?: string; - }[]; - url?: string; -} - -export interface Trees { - base_tree?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - tree?: Tree[]; - url?: string; -} - -/** A GitHub user */ -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[]; - -import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios"; -import axios from "axios"; - -export type QueryParamsType = Record; - -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?: ResponseType; - /** request body */ - body?: unknown; -} - -export type RequestParams = Omit; - -export interface ApiConfig extends Omit { - securityWorker?: ( - securityData: SecurityDataType | null, - ) => Promise | AxiosRequestConfig | void; - secure?: boolean; - format?: ResponseType; -} - -export enum ContentType { - Json = "application/json", - FormData = "multipart/form-data", - UrlEncoded = "application/x-www-form-urlencoded", - Text = "text/plain", -} - -export class HttpClient { - public instance: AxiosInstance; - private securityData: SecurityDataType | null = null; - private securityWorker?: ApiConfig["securityWorker"]; - private secure?: boolean; - private format?: ResponseType; - - constructor({ securityWorker, secure, format, ...axiosConfig }: ApiConfig = {}) { - this.instance = axios.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || "https://api.github.com" }); - this.secure = secure; - this.format = format; - this.securityWorker = securityWorker; - } - - public setSecurityData = (data: SecurityDataType | null) => { - this.securityData = data; - }; - - protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig { - const method = params1.method || (params2 && params2.method); - - return { - ...this.instance.defaults, - ...params1, - ...(params2 || {}), - headers: { - ...((method && this.instance.defaults.headers[method.toLowerCase() as keyof HeadersDefaults]) || {}), - ...(params1.headers || {}), - ...((params2 && params2.headers) || {}), - }, - }; - } - - protected stringifyFormItem(formItem: unknown) { - if (typeof formItem === "object" && formItem !== null) { - return JSON.stringify(formItem); - } else { - return `${formItem}`; - } - } - - protected createFormData(input: Record): FormData { - return Object.keys(input || {}).reduce((formData, key) => { - const property = input[key]; - const propertyContent: any[] = property instanceof Array ? property : [property]; - - for (const formItem of propertyContent) { - const isFileType = formItem instanceof Blob || formItem instanceof File; - formData.append(key, isFileType ? formItem : this.stringifyFormItem(formItem)); - } - - return formData; - }, new FormData()); - } - - public request = async ({ - secure, - path, - type, - query, - format, - body, - ...params - }: FullRequestParams): Promise> => { - const secureParams = - ((typeof secure === "boolean" ? secure : this.secure) && - this.securityWorker && - (await this.securityWorker(this.securityData))) || - {}; - const requestParams = this.mergeRequestParams(params, secureParams); - const responseFormat = format || this.format || undefined; - - if (type === ContentType.FormData && body && body !== null && typeof body === "object") { - body = this.createFormData(body as Record); - } - - if (type === ContentType.Text && body && body !== null && typeof body !== "string") { - body = JSON.stringify(body); - } - - return this.instance.request({ - ...requestParams, - headers: { - ...(requestParams.headers || {}), - ...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}), - }, - params: query, - responseType: responseFormat, - data: body, - url: path, - }); - }; -} - -/** - * @title GitHub - * @version v3 - * @termsOfService https://help.github.com/articles/github-terms-of-service/#b-api-terms - * @baseUrl https://api.github.com - * @externalDocs https://developer.github.com/v3/ - * - * Powerful collaboration, code review, and code management for open source and private projects. - */ -export class Api { - http: HttpClient; - - constructor(http: HttpClient) { - this.http = http; - } - - someTest = { - /** - * @description This type should test bug https://github.com/acacode/swagger-typescript-api/issues/156 NOTE: all properties should be required - * - * @name SomeTestList - * @request GET:/some-test - */ - someTestList: (params: RequestParams = {}) => - this.http.request< - { - user: { - foo: number; - extra: { - id: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - }; - }; - }; - }; - }; - }; - }, - any - >({ - path: `/some-test`, - method: "GET", - format: "json", - ...params, - }), - }; - pathParams = { - /** - * @description Lists all the emojis available to use on GitHub. - * - * @name PathParamsList - * @request GET:/path-params - */ - pathParamsList: (petId: number, params: RequestParams = {}) => - this.http.request({ - path: `/path-params`, - method: "GET", - format: "json", - ...params, - }), - }; - events = { - /** - * @description List public events. - * - * @name EventsList - * @request GET:/events - */ - eventsList: (params: RequestParams = {}) => - this.http.request({ - path: `/events`, - method: "GET", - format: "json", - ...params, - }), - }; - feeds = { - /** - * @description List Feeds. GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticating user. - * - * @name FeedsList - * @request GET:/feeds - */ - feedsList: (params: RequestParams = {}) => - this.http.request({ - path: `/feeds`, - method: "GET", - format: "json", - ...params, - }), - }; - gists = { - /** - * @description List the authenticated user's gists or if called anonymously, this will return all public gists. - * - * @name GistsList - * @request GET:/gists - */ - gistsList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a gist. - * - * @name GistsCreate - * @request POST:/gists - */ - gistsCreate: (body: PostGist, params: RequestParams = {}) => - this.http.request({ - path: `/gists`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List all public gists. - * - * @name PublicList - * @request GET:/gists/public - */ - publicList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/gists/public`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List the authenticated user's starred gists. - * - * @name StarredList - * @request GET:/gists/starred - */ - starredList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/gists/starred`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Delete a gist. - * - * @name GistsDelete - * @request DELETE:/gists/{id} - */ - gistsDelete: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single gist. - * - * @name GistsDetail - * @request GET:/gists/{id} - */ - gistsDetail: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit a gist. - * - * @name GistsPartialUpdate - * @request PATCH:/gists/{id} - */ - gistsPartialUpdate: (id: number, body: PatchGist, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List comments on a gist. - * - * @name CommentsDetail - * @request GET:/gists/{id}/comments - */ - commentsDetail: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}/comments`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a commen - * - * @name CommentsCreate - * @request POST:/gists/{id}/comments - */ - commentsCreate: (id: number, body: CommentBody, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}/comments`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Delete a comment. - * - * @name CommentsDelete - * @request DELETE:/gists/{id}/comments/{commentId} - */ - commentsDelete: (id: number, commentId: number, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}/comments/${commentId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single comment. - * - * @name CommentsDetail2 - * @request GET:/gists/{id}/comments/{commentId} - * @originalName commentsDetail - * @duplicate - */ - commentsDetail2: (id: number, commentId: number, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}/comments/${commentId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit a comment. - * - * @name CommentsPartialUpdate - * @request PATCH:/gists/{id}/comments/{commentId} - */ - commentsPartialUpdate: (id: number, commentId: number, body: Comment, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}/comments/${commentId}`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Fork a gist. - * - * @name ForksCreate - * @request POST:/gists/{id}/forks - */ - forksCreate: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}/forks`, - method: "POST", - ...params, - }), - - /** - * @description Unstar a gist. - * - * @name StarDelete - * @request DELETE:/gists/{id}/star - */ - starDelete: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}/star`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if a gist is starred. - * - * @name StarDetail - * @request GET:/gists/{id}/star - */ - starDetail: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}/star`, - method: "GET", - ...params, - }), - - /** - * @description Star a gist. - * - * @name StarUpdate - * @request PUT:/gists/{id}/star - */ - starUpdate: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/gists/${id}/star`, - method: "PUT", - ...params, - }), - }; - gitignore = { - /** - * @description Listing available templates. List all templates available to pass as an option when creating a repository. - * - * @name TemplatesList - * @request GET:/gitignore/templates - */ - templatesList: (params: RequestParams = {}) => - this.http.request({ - path: `/gitignore/templates`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get a single template. - * - * @name TemplatesDetail - * @request GET:/gitignore/templates/{language} - */ - templatesDetail: (language: string, params: RequestParams = {}) => - this.http.request({ - path: `/gitignore/templates/${language}`, - method: "GET", - format: "json", - ...params, - }), - }; - issues = { - /** - * @description List issues. List all issues across all the authenticated user's visible repositories. - * - * @name IssuesList - * @request GET:/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - legacy = { - /** - * @description Find issues by state and keyword. - * - * @name IssuesSearchDetail - * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} - * @deprecated - */ - issuesSearchDetail: ( - keyword: string, - state: "open" | "closed", - owner: string, - repository: string, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter. - * - * @name ReposSearchDetail - * @request GET:/legacy/repos/search/{keyword} - * @deprecated - */ - reposSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** Filter results by language */ - language?: string; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/legacy/repos/search/${keyword}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description This API call is added for compatibility reasons only. - * - * @name UserEmailDetail - * @request GET:/legacy/user/email/{email} - * @deprecated - */ - userEmailDetail: (email: string, params: RequestParams = {}) => - this.http.request({ - path: `/legacy/user/email/${email}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Find users by keyword. - * - * @name UserSearchDetail - * @request GET:/legacy/user/search/{keyword} - * @deprecated - */ - userSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/legacy/user/search/${keyword}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - markdown = { - /** - * @description Render an arbitrary Markdown document - * - * @name MarkdownCreate - * @request POST:/markdown - */ - markdownCreate: (body: Markdown, params: RequestParams = {}) => - this.http.request({ - path: `/markdown`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description Render a Markdown document in raw mode - * - * @name PostMarkdown - * @request POST:/markdown/raw - */ - postMarkdown: (params: RequestParams = {}) => - this.http.request({ - path: `/markdown/raw`, - method: "POST", - type: ContentType.Text, - ...params, - }), - }; - meta = { - /** - * @description This gives some information about GitHub.com, the service. - * - * @name MetaList - * @request GET:/meta - */ - metaList: (params: RequestParams = {}) => - this.http.request({ - path: `/meta`, - method: "GET", - format: "json", - ...params, - }), - }; - networks = { - /** - * @description List public events for a network of repositories. - * - * @name EventsDetail - * @request GET:/networks/{owner}/{repo}/events - */ - eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/networks/${owner}/${repo}/events`, - method: "GET", - format: "json", - ...params, - }), - }; - notifications = { - /** - * @description List your notifications. List all notifications for the current user, grouped by repository. - * - * @name NotificationsList - * @request GET:/notifications - */ - notificationsList: ( - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/notifications`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Mark as read. Marking a notification as "read" removes it from the default view on GitHub.com. - * - * @name NotificationsUpdate - * @request PUT:/notifications - */ - notificationsUpdate: (body: NotificationMarkRead, params: RequestParams = {}) => - this.http.request({ - path: `/notifications`, - method: "PUT", - body: body, - ...params, - }), - - /** - * @description View a single thread. - * - * @name ThreadsDetail - * @request GET:/notifications/threads/{id} - */ - threadsDetail: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/notifications/threads/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Mark a thread as read - * - * @name ThreadsPartialUpdate - * @request PATCH:/notifications/threads/{id} - */ - threadsPartialUpdate: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/notifications/threads/${id}`, - method: "PATCH", - ...params, - }), - - /** - * @description Delete a Thread Subscription. - * - * @name ThreadsSubscriptionDelete - * @request DELETE:/notifications/threads/{id}/subscription - */ - threadsSubscriptionDelete: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/notifications/threads/${id}/subscription`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a Thread Subscription. - * - * @name ThreadsSubscriptionDetail - * @request GET:/notifications/threads/{id}/subscription - */ - threadsSubscriptionDetail: (id: number, params: RequestParams = {}) => - this.http.request({ - path: `/notifications/threads/${id}/subscription`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Set a Thread Subscription. This lets you subscribe to a thread, or ignore it. Subscribing to a thread is unnecessary if the user is already subscribed to the repository. Ignoring a thread will mute all future notifications (until you comment or get @mentioned). - * - * @name ThreadsSubscriptionUpdate - * @request PUT:/notifications/threads/{id}/subscription - */ - threadsSubscriptionUpdate: (id: number, body: PutSubscription, params: RequestParams = {}) => - this.http.request({ - path: `/notifications/threads/${id}/subscription`, - method: "PUT", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - orgs = { - /** - * @description Get an Organization. - * - * @name OrgsDetail - * @request GET:/orgs/{org} - */ - orgsDetail: (org: string, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit an Organization. - * - * @name OrgsPartialUpdate - * @request PATCH:/orgs/{org} - */ - orgsPartialUpdate: (org: string, body: PatchOrg, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List public events for an organization. - * - * @name EventsDetail - * @request GET:/orgs/{org}/events - */ - eventsDetail: (org: string, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/events`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List issues. List all issues for a given organization for the authenticated user. - * - * @name IssuesDetail - * @request GET:/orgs/{org}/issues - */ - issuesDetail: ( - org: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/orgs/${org}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Members list. List all users who are members of an organization. A member is a user tha belongs to at least 1 team in the organization. If the authenticated user is also an owner of this organization then both concealed and public members will be returned. If the requester is not an owner of the organization the query will be redirected to the public members list. - * - * @name MembersDetail - * @request GET:/orgs/{org}/members - */ - membersDetail: (org: string, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/members`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Remove a member. Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. - * - * @name MembersDelete - * @request DELETE:/orgs/{org}/members/{username} - */ - membersDelete: (org: string, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/members/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if a user is, publicly or privately, a member of the organization. - * - * @name MembersDetail2 - * @request GET:/orgs/{org}/members/{username} - * @originalName membersDetail - * @duplicate - */ - membersDetail2: (org: string, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/members/${username}`, - method: "GET", - ...params, - }), - - /** - * @description Public members list. Members of an organization can choose to have their membership publicized or not. - * - * @name PublicMembersDetail - * @request GET:/orgs/{org}/public_members - */ - publicMembersDetail: (org: string, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/public_members`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Conceal a user's membership. - * - * @name PublicMembersDelete - * @request DELETE:/orgs/{org}/public_members/{username} - */ - publicMembersDelete: (org: string, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/public_members/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check public membership. - * - * @name PublicMembersDetail2 - * @request GET:/orgs/{org}/public_members/{username} - * @originalName publicMembersDetail - * @duplicate - */ - publicMembersDetail2: (org: string, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/public_members/${username}`, - method: "GET", - ...params, - }), - - /** - * @description Publicize a user's membership. - * - * @name PublicMembersUpdate - * @request PUT:/orgs/{org}/public_members/{username} - */ - publicMembersUpdate: (org: string, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/public_members/${username}`, - method: "PUT", - ...params, - }), - - /** - * @description List repositories for the specified org. - * - * @name ReposDetail - * @request GET:/orgs/{org}/repos - */ - reposDetail: ( - org: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/orgs/${org}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @name ReposCreate - * @request POST:/orgs/{org}/repos - */ - reposCreate: (org: string, body: PostRepo, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/repos`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description List teams. - * - * @name TeamsDetail - * @request GET:/orgs/{org}/teams - */ - teamsDetail: (org: string, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/teams`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create team. In order to create a team, the authenticated user must be an owner of organization. - * - * @name TeamsCreate - * @request POST:/orgs/{org}/teams - */ - teamsCreate: (org: string, body: OrgTeamsPost, params: RequestParams = {}) => - this.http.request({ - path: `/orgs/${org}/teams`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - }; - rateLimit = { - /** - * @description Get your current rate limit status Note: Accessing this endpoint does not count against your rate limit. - * - * @name RateLimitList - * @request GET:/rate_limit - */ - rateLimitList: (params: RequestParams = {}) => - this.http.request({ - path: `/rate_limit`, - method: "GET", - format: "json", - ...params, - }), - }; - repos = { - /** - * @description Delete a Repository. Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required. - * - * @name ReposDelete - * @request DELETE:/repos/{owner}/{repo} - */ - reposDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get repository. - * - * @name ReposDetail - * @request GET:/repos/{owner}/{repo} - */ - reposDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit repository. - * - * @name ReposPartialUpdate - * @request PATCH:/repos/{owner}/{repo} - */ - reposPartialUpdate: (owner: string, repo: string, body: RepoEdit, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List assignees. This call lists all the available assignees (owner + collaborators) to which issues may be assigned. - * - * @name AssigneesDetail - * @request GET:/repos/{owner}/{repo}/assignees - */ - assigneesDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/assignees`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Check assignee. You may also check to see if a particular user is an assignee for a repository. - * - * @name AssigneesDetail2 - * @request GET:/repos/{owner}/{repo}/assignees/{assignee} - * @originalName assigneesDetail - * @duplicate - */ - assigneesDetail2: (owner: string, repo: string, assignee: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/assignees/${assignee}`, - method: "GET", - ...params, - }), - - /** - * @description Get list of branches - * - * @name BranchesDetail - * @request GET:/repos/{owner}/{repo}/branches - */ - branchesDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/branches`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get Branch - * - * @name BranchesDetail2 - * @request GET:/repos/{owner}/{repo}/branches/{branch} - * @originalName branchesDetail - * @duplicate - */ - branchesDetail2: (owner: string, repo: string, branch: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/branches/${branch}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List. When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list. - * - * @name CollaboratorsDetail - * @request GET:/repos/{owner}/{repo}/collaborators - */ - collaboratorsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/collaborators`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Remove collaborator. - * - * @name CollaboratorsDelete - * @request DELETE:/repos/{owner}/{repo}/collaborators/{user} - */ - collaboratorsDelete: (owner: string, repo: string, user: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if user is a collaborator - * - * @name CollaboratorsDetail2 - * @request GET:/repos/{owner}/{repo}/collaborators/{user} - * @originalName collaboratorsDetail - * @duplicate - */ - collaboratorsDetail2: (owner: string, repo: string, user: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, - method: "GET", - ...params, - }), - - /** - * @description Add collaborator. - * - * @name CollaboratorsUpdate - * @request PUT:/repos/{owner}/{repo}/collaborators/{user} - */ - collaboratorsUpdate: (owner: string, repo: string, user: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, - method: "PUT", - ...params, - }), - - /** - * @description List commit comments for a repository. Comments are ordered by ascending ID. - * - * @name CommentsDetail - * @request GET:/repos/{owner}/{repo}/comments - */ - commentsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/comments`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Delete a commit comment - * - * @name CommentsDelete - * @request DELETE:/repos/{owner}/{repo}/comments/{commentId} - */ - commentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single commit comment. - * - * @name CommentsDetail2 - * @request GET:/repos/{owner}/{repo}/comments/{commentId} - * @originalName commentsDetail - * @duplicate - */ - commentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Update a commit comment. - * - * @name CommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/comments/{commentId} - */ - commentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: CommentBody, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, - method: "PATCH", - body: body, - format: "json", - ...params, - }), - - /** - * @description List commits on a repository. - * - * @name CommitsDetail - * @request GET:/repos/{owner}/{repo}/commits - */ - commitsDetail: ( - owner: string, - repo: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - /** Sha or branch to start listing commits from. */ - sha?: string; - /** Only commits containing this file path will be returned. */ - path?: string; - /** GitHub login, name, or email by which to filter by commit author. */ - author?: string; - /** ISO 8601 Date - Only commits before this date will be returned. */ - until?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/commits`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get the combined Status for a specific Ref The Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access this endpoint during the preview period, you must provide a custom media type in the Accept header: application/vnd.github.she-hulk-preview+json - * - * @name CommitsStatusDetail - * @request GET:/repos/{owner}/{repo}/commits/{ref}/status - */ - commitsStatusDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/status`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get a single commit. - * - * @name CommitsDetail2 - * @request GET:/repos/{owner}/{repo}/commits/{shaCode} - * @originalName commitsDetail - * @duplicate - */ - commitsDetail2: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List comments for a single commitList comments for a single commit. - * - * @name CommitsCommentsDetail - * @request GET:/repos/{owner}/{repo}/commits/{shaCode}/comments - */ - commitsCommentsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a commit comment. - * - * @name CommitsCommentsCreate - * @request POST:/repos/{owner}/{repo}/commits/{shaCode}/comments - */ - commitsCommentsCreate: ( - owner: string, - repo: string, - shaCode: string, - body: CommitCommentBody, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Compare two commits - * - * @name CompareDetail - * @request GET:/repos/{owner}/{repo}/compare/{baseId}...{headId} - */ - compareDetail: (owner: string, repo: string, baseId: string, headId: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Delete a file. This method deletes a file in a repository. - * - * @name ContentsDelete - * @request DELETE:/repos/{owner}/{repo}/contents/{path} - */ - contentsDelete: (owner: string, repo: string, path: string, body: DeleteFileBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, - method: "DELETE", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get contents. This method returns the contents of a file or directory in a repository. Files and symlinks support a custom media type for getting the raw content. Directories and submodules do not support custom media types. Note: This API supports files up to 1 megabyte in size. Here can be many outcomes. For details see "http://developer.github.com/v3/repos/contents/" - * - * @name ContentsDetail - * @request GET:/repos/{owner}/{repo}/contents/{path} - */ - contentsDetail: ( - owner: string, - repo: string, - path: string, - query?: { - /** The content path. */ - path?: string; - /** The String name of the Commit/Branch/Tag. Defaults to 'master'. */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a file. - * - * @name ContentsUpdate - * @request PUT:/repos/{owner}/{repo}/contents/{path} - */ - contentsUpdate: (owner: string, repo: string, path: string, body: CreateFileBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, - method: "PUT", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get list of contributors. - * - * @name ContributorsDetail - * @request GET:/repos/{owner}/{repo}/contributors - */ - contributorsDetail: ( - owner: string, - repo: string, - query: { - /** Set to 1 or true to include anonymous contributors in results. */ - anon: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/contributors`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Users with pull access can view deployments for a repository - * - * @name DeploymentsDetail - * @request GET:/repos/{owner}/{repo}/deployments - */ - deploymentsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/deployments`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Users with push access can create a deployment for a given ref - * - * @name DeploymentsCreate - * @request POST:/repos/{owner}/{repo}/deployments - */ - deploymentsCreate: (owner: string, repo: string, body: Deployment, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/deployments`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Users with pull access can view deployment statuses for a deployment - * - * @name DeploymentsStatusesDetail - * @request GET:/repos/{owner}/{repo}/deployments/{id}/statuses - */ - deploymentsStatusesDetail: (owner: string, repo: string, id: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a Deployment Status Users with push access can create deployment statuses for a given deployment: - * - * @name DeploymentsStatusesCreate - * @request POST:/repos/{owner}/{repo}/deployments/{id}/statuses - */ - deploymentsStatusesCreate: ( - owner: string, - repo: string, - id: number, - body: DeploymentStatusesCreate, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description Deprecated. List downloads for a repository. - * - * @name DownloadsDetail - * @request GET:/repos/{owner}/{repo}/downloads - * @deprecated - */ - downloadsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/downloads`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Deprecated. Delete a download. - * - * @name DownloadsDelete - * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - */ - downloadsDelete: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Deprecated. Get a single download. - * - * @name DownloadsDetail2 - * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - * @originalName downloadsDetail - * @duplicate - */ - downloadsDetail2: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get list of repository events. - * - * @name EventsDetail - * @request GET:/repos/{owner}/{repo}/events - */ - eventsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/events`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List forks. - * - * @name ForksDetail - * @request GET:/repos/{owner}/{repo}/forks - */ - forksDetail: ( - owner: string, - repo: string, - query?: { - /** @default "newes" */ - sort?: "newes" | "oldes" | "watchers"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/forks`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a fork. Forking a Repository happens asynchronously. Therefore, you may have to wai a short period before accessing the git objects. If this takes longer than 5 minutes, be sure to contact Support. - * - * @name ForksCreate - * @request POST:/repos/{owner}/{repo}/forks - */ - forksCreate: (owner: string, repo: string, body: ForkBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/forks`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Create a Blob. - * - * @name GitBlobsCreate - * @request POST:/repos/{owner}/{repo}/git/blobs - */ - gitBlobsCreate: (owner: string, repo: string, body: Blob, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/blobs`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get a Blob. Since blobs can be any arbitrary binary data, the input and responses for the blob API takes an encoding parameter that can be either utf-8 or base64. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it. - * - * @name GitBlobsDetail - * @request GET:/repos/{owner}/{repo}/git/blobs/{shaCode} - */ - gitBlobsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a Commit. - * - * @name GitCommitsCreate - * @request POST:/repos/{owner}/{repo}/git/commits - */ - gitCommitsCreate: (owner: string, repo: string, body: RepoCommitBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/commits`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get a Commit. - * - * @name GitCommitsDetail - * @request GET:/repos/{owner}/{repo}/git/commits/{shaCode} - */ - gitCommitsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get all References - * - * @name GitRefsDetail - * @request GET:/repos/{owner}/{repo}/git/refs - */ - gitRefsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/refs`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a Reference - * - * @name GitRefsCreate - * @request POST:/repos/{owner}/{repo}/git/refs - */ - gitRefsCreate: (owner: string, repo: string, body: RefsBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/refs`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Delete a Reference Example: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a Example: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0 - * - * @name GitRefsDelete - * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} - */ - gitRefsDelete: (owner: string, repo: string, ref: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a Reference - * - * @name GitRefsDetail2 - * @request GET:/repos/{owner}/{repo}/git/refs/{ref} - * @originalName gitRefsDetail - * @duplicate - */ - gitRefsDetail2: (owner: string, repo: string, ref: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Update a Reference - * - * @name GitRefsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} - */ - gitRefsPartialUpdate: (owner: string, repo: string, ref: string, body: GitRefPatch, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Create a Tag Object. Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary. - * - * @name GitTagsCreate - * @request POST:/repos/{owner}/{repo}/git/tags - */ - gitTagsCreate: (owner: string, repo: string, body: TagBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/tags`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get a Tag. - * - * @name GitTagsDetail - * @request GET:/repos/{owner}/{repo}/git/tags/{shaCode} - */ - gitTagsDetail: (owner: string, repo: string, shaCode: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a Tree. The tree creation API will take nested entries as well. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out. - * - * @name GitTreesCreate - * @request POST:/repos/{owner}/{repo}/git/trees - */ - gitTreesCreate: (owner: string, repo: string, body: Tree, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/trees`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get a Tree. - * - * @name GitTreesDetail - * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} - */ - gitTreesDetail: ( - owner: string, - repo: string, - shaCode: string, - query?: { - /** Get a Tree Recursively. (0 or 1) */ - recursive?: number; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get list of hooks. - * - * @name HooksDetail - * @request GET:/repos/{owner}/{repo}/hooks - */ - hooksDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/hooks`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a hook. - * - * @name HooksCreate - * @request POST:/repos/{owner}/{repo}/hooks - */ - hooksCreate: (owner: string, repo: string, body: HookBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/hooks`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Delete a hook. - * - * @name HooksDelete - * @request DELETE:/repos/{owner}/{repo}/hooks/{hookId} - */ - hooksDelete: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get single hook. - * - * @name HooksDetail2 - * @request GET:/repos/{owner}/{repo}/hooks/{hookId} - * @originalName hooksDetail - * @duplicate - */ - hooksDetail2: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit a hook. - * - * @name HooksPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/hooks/{hookId} - */ - hooksPartialUpdate: (owner: string, repo: string, hookId: number, body: HookBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, - method: "PATCH", - body: body, - format: "json", - ...params, - }), - - /** - * @description Test a push hook. This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated. Note: Previously /repos/:owner/:repo/hooks/:id/tes - * - * @name HooksTestsCreate - * @request POST:/repos/{owner}/{repo}/hooks/{hookId}/tests - */ - hooksTestsCreate: (owner: string, repo: string, hookId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, - method: "POST", - ...params, - }), - - /** - * @description List issues for a repository. - * - * @name IssuesDetail - * @request GET:/repos/{owner}/{repo}/issues - */ - issuesDetail: ( - owner: string, - repo: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create an issue. Any user with pull access to a repository can create an issue. - * - * @name IssuesCreate - * @request POST:/repos/{owner}/{repo}/issues - */ - issuesCreate: (owner: string, repo: string, body: Issue, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description List comments in a repository. - * - * @name IssuesCommentsDetail - * @request GET:/repos/{owner}/{repo}/issues/comments - */ - issuesCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Delete a comment. - * - * @name IssuesCommentsDelete - * @request DELETE:/repos/{owner}/{repo}/issues/comments/{commentId} - */ - issuesCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single comment. - * - * @name IssuesCommentsDetail2 - * @request GET:/repos/{owner}/{repo}/issues/comments/{commentId} - * @originalName issuesCommentsDetail - * @duplicate - */ - issuesCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit a comment. - * - * @name IssuesCommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/issues/comments/{commentId} - */ - issuesCommentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: CommentBody, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, - method: "PATCH", - body: body, - format: "json", - ...params, - }), - - /** - * @description List issue events for a repository. - * - * @name IssuesEventsDetail - * @request GET:/repos/{owner}/{repo}/issues/events - */ - issuesEventsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/events`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get a single event. - * - * @name IssuesEventsDetail2 - * @request GET:/repos/{owner}/{repo}/issues/events/{eventId} - * @originalName issuesEventsDetail - * @duplicate - */ - issuesEventsDetail2: (owner: string, repo: string, eventId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/events/${eventId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get a single issue - * - * @name IssuesDetail2 - * @request GET:/repos/{owner}/{repo}/issues/{number} - * @originalName issuesDetail - * @duplicate - */ - issuesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit an issue. Issue owners and users with push access can edit an issue. - * - * @name IssuesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/issues/{number} - */ - issuesPartialUpdate: (owner: string, repo: string, number: number, body: Issue, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, - method: "PATCH", - body: body, - format: "json", - ...params, - }), - - /** - * @description List comments on an issue. - * - * @name IssuesCommentsDetail3 - * @request GET:/repos/{owner}/{repo}/issues/{number}/comments - * @originalName issuesCommentsDetail - * @duplicate - */ - issuesCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a comment. - * - * @name IssuesCommentsCreate - * @request POST:/repos/{owner}/{repo}/issues/{number}/comments - */ - issuesCommentsCreate: ( - owner: string, - repo: string, - number: number, - body: CommentBody, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description List events for an issue. - * - * @name IssuesEventsDetail3 - * @request GET:/repos/{owner}/{repo}/issues/{number}/events - * @originalName issuesEventsDetail - * @duplicate - */ - issuesEventsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/events`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Remove all labels from an issue. - * - * @name IssuesLabelsDelete - * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, - method: "DELETE", - ...params, - }), - - /** - * @description List labels on an issue. - * - * @name IssuesLabelsDetail - * @request GET:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Add labels to an issue. - * - * @name IssuesLabelsCreate - * @request POST:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsCreate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Replace all labels for an issue. Sending an empty array ([]) will remove all Labels from the Issue. - * - * @name IssuesLabelsUpdate - * @request PUT:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsUpdate: (owner: string, repo: string, number: number, body: EmailsPost, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, - method: "PUT", - body: body, - format: "json", - ...params, - }), - - /** - * @description Remove a label from an issue. - * - * @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.http.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get list of keys. - * - * @name KeysDetail - * @request GET:/repos/{owner}/{repo}/keys - */ - keysDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/keys`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a key. - * - * @name KeysCreate - * @request POST:/repos/{owner}/{repo}/keys - */ - keysCreate: (owner: string, repo: string, body: UserKeysPost, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/keys`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Delete a key. - * - * @name KeysDelete - * @request DELETE:/repos/{owner}/{repo}/keys/{keyId} - */ - keysDelete: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a key - * - * @name KeysDetail2 - * @request GET:/repos/{owner}/{repo}/keys/{keyId} - * @originalName keysDetail - * @duplicate - */ - keysDetail2: (owner: string, repo: string, keyId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List all labels for this repository. - * - * @name LabelsDetail - * @request GET:/repos/{owner}/{repo}/labels - */ - labelsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/labels`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a label. - * - * @name LabelsCreate - * @request POST:/repos/{owner}/{repo}/labels - */ - labelsCreate: (owner: string, repo: string, body: EmailsPost, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/labels`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Delete a label. - * - * @name LabelsDelete - * @request DELETE:/repos/{owner}/{repo}/labels/{name} - */ - labelsDelete: (owner: string, repo: string, name: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single label. - * - * @name LabelsDetail2 - * @request GET:/repos/{owner}/{repo}/labels/{name} - * @originalName labelsDetail - * @duplicate - */ - labelsDetail2: (owner: string, repo: string, name: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Update a label. - * - * @name LabelsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/labels/{name} - */ - labelsPartialUpdate: (owner: string, repo: string, name: string, body: EmailsPost, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, - method: "PATCH", - body: body, - format: "json", - ...params, - }), - - /** - * @description List languages. List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language. - * - * @name LanguagesDetail - * @request GET:/repos/{owner}/{repo}/languages - */ - languagesDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/languages`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Perform a merge. - * - * @name MergesCreate - * @request POST:/repos/{owner}/{repo}/merges - */ - mergesCreate: (owner: string, repo: string, body: MergesBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/merges`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List milestones for a repository. - * - * @name MilestonesDetail - * @request GET:/repos/{owner}/{repo}/milestones - */ - milestonesDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "due_date" */ - sort?: "due_date" | "completeness"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/milestones`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a milestone. - * - * @name MilestonesCreate - * @request POST:/repos/{owner}/{repo}/milestones - */ - milestonesCreate: (owner: string, repo: string, body: MilestoneUpdate, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/milestones`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Delete a milestone. - * - * @name MilestonesDelete - * @request DELETE:/repos/{owner}/{repo}/milestones/{number} - */ - milestonesDelete: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single milestone. - * - * @name MilestonesDetail2 - * @request GET:/repos/{owner}/{repo}/milestones/{number} - * @originalName milestonesDetail - * @duplicate - */ - milestonesDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Update a milestone. - * - * @name MilestonesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/milestones/{number} - */ - milestonesPartialUpdate: ( - owner: string, - repo: string, - number: number, - body: MilestoneUpdate, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, - method: "PATCH", - body: body, - format: "json", - ...params, - }), - - /** - * @description Get labels for every issue in a milestone. - * - * @name MilestonesLabelsDetail - * @request GET:/repos/{owner}/{repo}/milestones/{number}/labels - */ - milestonesLabelsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/milestones/${number}/labels`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List your notifications in a repository List all notifications for the current user. - * - * @name NotificationsDetail - * @request GET:/repos/{owner}/{repo}/notifications - */ - notificationsDetail: ( - owner: string, - repo: string, - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/notifications`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Mark notifications as read in a repository. Marking all notifications in a repository as "read" removes them from the default view on GitHub.com. - * - * @name NotificationsUpdate - * @request PUT:/repos/{owner}/{repo}/notifications - */ - notificationsUpdate: (owner: string, repo: string, body: NotificationMarkRead, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/notifications`, - method: "PUT", - body: body, - ...params, - }), - - /** - * @description List pull requests. - * - * @name PullsDetail - * @request GET:/repos/{owner}/{repo}/pulls - */ - pullsDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** - * Filter pulls by head user and branch name in the format of 'user:ref-name'. - * Example: github:new-script-format. - */ - head?: string; - /** Filter pulls by base branch name. Example - gh-pages. */ - base?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a pull request. - * - * @name PullsCreate - * @request POST:/repos/{owner}/{repo}/pulls - */ - pullsCreate: (owner: string, repo: string, body: PullsPost, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List comments in a repository. By default, Review Comments are ordered by ascending ID. - * - * @name PullsCommentsDetail - * @request GET:/repos/{owner}/{repo}/pulls/comments - */ - pullsCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Delete a comment. - * - * @name PullsCommentsDelete - * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{commentId} - */ - pullsCommentsDelete: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single comment. - * - * @name PullsCommentsDetail2 - * @request GET:/repos/{owner}/{repo}/pulls/comments/{commentId} - * @originalName pullsCommentsDetail - * @duplicate - */ - pullsCommentsDetail2: (owner: string, repo: string, commentId: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit a comment. - * - * @name PullsCommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{commentId} - */ - pullsCommentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: CommentBody, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, - method: "PATCH", - body: body, - format: "json", - ...params, - }), - - /** - * @description Get a single pull request. - * - * @name PullsDetail2 - * @request GET:/repos/{owner}/{repo}/pulls/{number} - * @originalName pullsDetail - * @duplicate - */ - pullsDetail2: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Update a pull request. - * - * @name PullsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/pulls/{number} - */ - pullsPartialUpdate: (owner: string, repo: string, number: number, body: PullUpdate, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List comments on a pull request. - * - * @name PullsCommentsDetail3 - * @request GET:/repos/{owner}/{repo}/pulls/{number}/comments - * @originalName pullsCommentsDetail - * @duplicate - */ - pullsCommentsDetail3: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a comment. #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ ) description: | Alternative Input. Instead of passing commit_id, path, and position you can reply to an existing Pull Request Comment like this: body Required string in_reply_to Required number - Comment id to reply to. - * - * @name PullsCommentsCreate - * @request POST:/repos/{owner}/{repo}/pulls/{number}/comments - */ - pullsCommentsCreate: ( - owner: string, - repo: string, - number: number, - body: PullsCommentPost, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List commits on a pull request. - * - * @name PullsCommitsDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/commits - */ - pullsCommitsDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/commits`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List pull requests files. - * - * @name PullsFilesDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/files - */ - pullsFilesDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/files`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get if a pull request has been merged. - * - * @name PullsMergeDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/merge - */ - pullsMergeDetail: (owner: string, repo: string, number: number, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, - method: "GET", - ...params, - }), - - /** - * @description Merge a pull request (Merge Button's) - * - * @name PullsMergeUpdate - * @request PUT:/repos/{owner}/{repo}/pulls/{number}/merge - */ - pullsMergeUpdate: (owner: string, repo: string, number: number, body: MergePullBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, - method: "PUT", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get the README. This method returns the preferred README for a repository. - * - * @name ReadmeDetail - * @request GET:/repos/{owner}/{repo}/readme - */ - readmeDetail: ( - owner: string, - repo: string, - query?: { - /** The String name of the Commit/Branch/Tag. Defaults to master. */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/readme`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only - * - * @name ReleasesDetail - * @request GET:/repos/{owner}/{repo}/releases - */ - releasesDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/releases`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a release Users with push access to the repository can create a release. - * - * @name ReleasesCreate - * @request POST:/repos/{owner}/{repo}/releases - */ - releasesCreate: (owner: string, repo: string, body: ReleaseCreate, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/releases`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Delete a release asset - * - * @name ReleasesAssetsDelete - * @request DELETE:/repos/{owner}/{repo}/releases/assets/{id} - */ - releasesAssetsDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single release asset - * - * @name ReleasesAssetsDetail - * @request GET:/repos/{owner}/{repo}/releases/assets/{id} - */ - releasesAssetsDetail: (owner: string, repo: string, id: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit a release asset Users with push access to the repository can edit a release asset. - * - * @name ReleasesAssetsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/releases/assets/{id} - */ - releasesAssetsPartialUpdate: ( - owner: string, - repo: string, - id: string, - body: AssetPatch, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Users with push access to the repository can delete a release. - * - * @name ReleasesDelete - * @request DELETE:/repos/{owner}/{repo}/releases/{id} - */ - releasesDelete: (owner: string, repo: string, id: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single release - * - * @name ReleasesDetail2 - * @request GET:/repos/{owner}/{repo}/releases/{id} - * @originalName releasesDetail - * @duplicate - */ - releasesDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Users with push access to the repository can edit a release - * - * @name ReleasesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/releases/{id} - */ - releasesPartialUpdate: (owner: string, repo: string, id: string, body: ReleaseCreate, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, - method: "PATCH", - body: body, - format: "json", - ...params, - }), - - /** - * @description List assets for a release - * - * @name ReleasesAssetsDetail2 - * @request GET:/repos/{owner}/{repo}/releases/{id}/assets - * @originalName releasesAssetsDetail - * @duplicate - */ - releasesAssetsDetail2: (owner: string, repo: string, id: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/releases/${id}/assets`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List Stargazers. - * - * @name StargazersDetail - * @request GET:/repos/{owner}/{repo}/stargazers - */ - stargazersDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/stargazers`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get the number of additions and deletions per week. Returns a weekly aggregate of the number of additions and deletions pushed to a repository. - * - * @name StatsCodeFrequencyDetail - * @request GET:/repos/{owner}/{repo}/stats/code_frequency - */ - statsCodeFrequencyDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/stats/code_frequency`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get the last year of commit activity data. Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday. - * - * @name StatsCommitActivityDetail - * @request GET:/repos/{owner}/{repo}/stats/commit_activity - */ - statsCommitActivityDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/stats/commit_activity`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get contributors list with additions, deletions, and commit counts. - * - * @name StatsContributorsDetail - * @request GET:/repos/{owner}/{repo}/stats/contributors - */ - statsContributorsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/stats/contributors`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get the weekly commit count for the repo owner and everyone else. - * - * @name StatsParticipationDetail - * @request GET:/repos/{owner}/{repo}/stats/participation - */ - statsParticipationDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/stats/participation`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get the number of commits per hour in each day. Each array contains the day number, hour number, and number of commits 0-6 Sunday - Saturday 0-23 Hour of day Number of commits For example, [2, 14, 25] indicates that there were 25 total commits, during the 2.00pm hour on Tuesdays. All times are based on the time zone of individual commits. - * - * @name StatsPunchCardDetail - * @request GET:/repos/{owner}/{repo}/stats/punch_card - */ - statsPunchCardDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/stats/punch_card`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List Statuses for a specific Ref. - * - * @name StatusesDetail - * @request GET:/repos/{owner}/{repo}/statuses/{ref} - */ - statusesDetail: (owner: string, repo: string, ref: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a Status. - * - * @name StatusesCreate - * @request POST:/repos/{owner}/{repo}/statuses/{ref} - */ - statusesCreate: (owner: string, repo: string, ref: string, body: HeadBranch, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List watchers. - * - * @name SubscribersDetail - * @request GET:/repos/{owner}/{repo}/subscribers - */ - subscribersDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/subscribers`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Delete a Repository Subscription. - * - * @name SubscriptionDelete - * @request DELETE:/repos/{owner}/{repo}/subscription - */ - subscriptionDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/subscription`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a Repository Subscription. - * - * @name SubscriptionDetail - * @request GET:/repos/{owner}/{repo}/subscription - */ - subscriptionDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/subscription`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Set a Repository Subscription - * - * @name SubscriptionUpdate - * @request PUT:/repos/{owner}/{repo}/subscription - */ - subscriptionUpdate: (owner: string, repo: string, body: SubscriptionBody, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/subscription`, - method: "PUT", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Get list of tags. - * - * @name TagsDetail - * @request GET:/repos/{owner}/{repo}/tags - */ - tagsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/tags`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get list of teams - * - * @name TeamsDetail - * @request GET:/repos/{owner}/{repo}/teams - */ - teamsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/teams`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List Stargazers. New implementation. - * - * @name WatchersDetail - * @request GET:/repos/{owner}/{repo}/watchers - */ - watchersDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/repos/${owner}/${repo}/watchers`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Get archive link. This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. Note: For private repositories, these links are temporary and expire quickly. - * - * @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.http.request({ - path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, - method: "GET", - ...params, - }), - }; - repositories = { - /** - * @description List all public repositories. This provides a dump of every public repository, in the order that they were created. Note: Pagination is powered exclusively by the since parameter. is the Link header to get the URL for the next page of repositories. - * - * @name RepositoriesList - * @request GET:/repositories - */ - repositoriesList: ( - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - search = { - /** - * @description Search code. - * - * @name CodeList - * @request GET:/search/code - */ - codeList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported code - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier - * you can restrict the search to just the file contents, the file path, - * or both. - * 'Languages' Searches code based on the language it's written in. - * 'Forks' Filters repositories based on the number of forks, and/or - * whether code from forked repositories should be included in the results - * at all. - * 'Size' Finds files that match a certain size (in bytes). - * 'Path' Specifies the path that the resulting file must be at. - * 'Extension' Matches files with a certain extension. - * 'Users' or 'Repositories' Limits searches to a specific user or repository. - */ - q: string; - /** - * Can only be 'indexed', which indicates how recently a file has been indexed - * by the GitHub search infrastructure. If not provided, results are sorted - * by best match. - */ - sort?: "indexed"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/search/code`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Find issues by state and keyword. (This method returns up to 100 results per page.) - * - * @name IssuesList - * @request GET:/search/issues - */ - issuesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The q search term can also contain any combination of the supported issue search qualifiers: */ - q: string; - /** The sort field. Can be comments, created, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "created" | "comments"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/search/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Search repositories. - * - * @name RepositoriesList - * @request GET:/search/repositories - */ - repositoriesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported repository - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the repository name, description, readme, - * or any combination of these. - * 'Size' Finds repositories that match a certain size (in kilobytes). - * 'Forks' Filters repositories based on the number of forks, and/or whether - * forked repositories should be included in the results at all. - * 'Created' and 'Last Updated' Filters repositories based on times of - * creation, or when they were last updated. - * 'Users or Repositories' Limits searches to a specific user or repository. - * 'Languages' Searches repositories based on the language they are written in. - * 'Stars' Searches repositories based on the number of stars. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "stars" | "forks" | "updated"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/search/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Search users. - * - * @name UsersList - * @request GET:/search/users - */ - usersList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported user - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the username, public email, full name, - * location, or any combination of these. - * 'Repository count' Filters users based on the number of repositories they - * have. - * 'Location' Filter users by the location indicated in their profile. - * 'Language' Search for users that have repositories that match a certain - * language. - * 'Created' Filter users based on when they joined. - * 'Followers' Filter users based on the number of followers they have. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "followers" | "repositories" | "joined"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/search/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), - }; - teams = { - /** - * @description Delete team. In order to delete a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @name TeamsDelete - * @request DELETE:/teams/{teamId} - */ - teamsDelete: (teamId: number, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get team. - * - * @name TeamsDetail - * @request GET:/teams/{teamId} - */ - teamsDetail: (teamId: number, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Edit team. In order to edit a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @name TeamsPartialUpdate - * @request PATCH:/teams/{teamId} - */ - teamsPartialUpdate: (teamId: number, body: EditTeam, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description List team members. In order to list members in a team, the authenticated user must be a member of the team. - * - * @name MembersDetail - * @request GET:/teams/{teamId}/members - */ - membersDetail: (teamId: number, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/members`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description The "Remove team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships. Remove team member. In order to remove a user from a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. NOTE This does not delete the user, it just remove them from the team. - * - * @name MembersDelete - * @request DELETE:/teams/{teamId}/members/{username} - * @deprecated - */ - membersDelete: (teamId: number, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/members/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description The "Get team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships. Get team member. In order to get if a user is a member of a team, the authenticated user mus be a member of the team. - * - * @name MembersDetail2 - * @request GET:/teams/{teamId}/members/{username} - * @deprecated - * @originalName membersDetail - * @duplicate - */ - membersDetail2: (teamId: number, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/members/${username}`, - method: "GET", - ...params, - }), - - /** - * @description The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams. Add team member. In order to add a user to a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. - * - * @name MembersUpdate - * @request PUT:/teams/{teamId}/members/{username} - * @deprecated - */ - membersUpdate: (teamId: number, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/members/${username}`, - method: "PUT", - ...params, - }), - - /** - * @description Remove team membership. In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team. - * - * @name MembershipsDelete - * @request DELETE:/teams/{teamId}/memberships/{username} - */ - membershipsDelete: (teamId: number, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/memberships/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get team membership. In order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization. - * - * @name MembershipsDetail - * @request GET:/teams/{teamId}/memberships/{username} - */ - membershipsDetail: (teamId: number, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/memberships/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Add team membership. In order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. If the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team. If the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the 'pending' state until the user accepts the invitation, at which point the membership will transition to the 'active' state and the user will be added as a member of the team. - * - * @name MembershipsUpdate - * @request PUT:/teams/{teamId}/memberships/{username} - */ - membershipsUpdate: (teamId: number, username: string, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/memberships/${username}`, - method: "PUT", - format: "json", - ...params, - }), - - /** - * @description List team repos - * - * @name ReposDetail - * @request GET:/teams/{teamId}/repos - */ - reposDetail: (teamId: number, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/repos`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team. - * - * @name ReposDelete - * @request DELETE:/teams/{teamId}/repos/{owner}/{repo} - */ - reposDelete: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if a team manages a repository - * - * @name ReposDetail2 - * @request GET:/teams/{teamId}/repos/{owner}/{repo} - * @originalName reposDetail - * @duplicate - */ - reposDetail2: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, - method: "GET", - ...params, - }), - - /** - * @description In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization. - * - * @name ReposUpdate - * @request PUT:/teams/{teamId}/repos/{owner}/{repo} - */ - reposUpdate: (teamId: number, owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, - method: "PUT", - ...params, - }), - }; - user = { - /** - * @description Get the authenticated user. - * - * @name UserList - * @request GET:/user - */ - userList: (params: RequestParams = {}) => - this.http.request({ - path: `/user`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Update the authenticated user. - * - * @name UserPartialUpdate - * @request PATCH:/user - */ - userPartialUpdate: (body: UserUpdate, params: RequestParams = {}) => - this.http.request({ - path: `/user`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description Delete email address(es). You can include a single email address or an array of addresses. - * - * @name EmailsDelete - * @request DELETE:/user/emails - */ - emailsDelete: (body: UserEmails, params: RequestParams = {}) => - this.http.request({ - path: `/user/emails`, - method: "DELETE", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description List email addresses for a user. In the final version of the API, this method will return an array of hashes with extended information for each email address indicating if the address has been verified and if it's primary email address for GitHub. Until API v3 is finalized, use the application/vnd.github.v3 media type to get other response format. - * - * @name EmailsList - * @request GET:/user/emails - */ - emailsList: (params: RequestParams = {}) => - this.http.request({ - path: `/user/emails`, - method: "GET", - ...params, - }), - - /** - * @description Add email address(es). You can post a single email address or an array of addresses. - * - * @name EmailsCreate - * @request POST:/user/emails - */ - emailsCreate: (body: EmailsPost, params: RequestParams = {}) => - this.http.request({ - path: `/user/emails`, - method: "POST", - body: body, - ...params, - }), - - /** - * @description List the authenticated user's followers - * - * @name FollowersList - * @request GET:/user/followers - */ - followersList: (params: RequestParams = {}) => - this.http.request({ - path: `/user/followers`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List who the authenticated user is following. - * - * @name FollowingList - * @request GET:/user/following - */ - followingList: (params: RequestParams = {}) => - this.http.request({ - path: `/user/following`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Unfollow a user. Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingDelete - * @request DELETE:/user/following/{username} - */ - followingDelete: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/user/following/${username}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if you are following a user. - * - * @name FollowingDetail - * @request GET:/user/following/{username} - */ - followingDetail: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/user/following/${username}`, - method: "GET", - ...params, - }), - - /** - * @description Follow a user. Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingUpdate - * @request PUT:/user/following/{username} - */ - followingUpdate: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/user/following/${username}`, - method: "PUT", - ...params, - }), - - /** - * @description List issues. List all issues across owned and member repositories for the authenticated user. - * - * @name IssuesList - * @request GET:/user/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/user/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List your public keys. Lists the current user's keys. Management of public keys via the API requires that you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes. - * - * @name KeysList - * @request GET:/user/keys - */ - keysList: (params: RequestParams = {}) => - this.http.request({ - path: `/user/keys`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Create a public key. - * - * @name KeysCreate - * @request POST:/user/keys - */ - keysCreate: (body: UserKeysPost, params: RequestParams = {}) => - this.http.request({ - path: `/user/keys`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope. - * - * @name KeysDelete - * @request DELETE:/user/keys/{keyId} - */ - keysDelete: (keyId: number, params: RequestParams = {}) => - this.http.request({ - path: `/user/keys/${keyId}`, - method: "DELETE", - ...params, - }), - - /** - * @description Get a single public key. - * - * @name KeysDetail - * @request GET:/user/keys/{keyId} - */ - keysDetail: (keyId: number, params: RequestParams = {}) => - this.http.request({ - path: `/user/keys/${keyId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List public and private organizations for the authenticated user. - * - * @name OrgsList - * @request GET:/user/orgs - */ - orgsList: (params: RequestParams = {}) => - this.http.request({ - path: `/user/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List repositories for the authenticated user. Note that this does not include repositories owned by organizations which the user can access. You can lis user organizations and list organization repositories separately. - * - * @name ReposList - * @request GET:/user/repos - */ - reposList: ( - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/user/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @name ReposCreate - * @request POST:/user/repos - */ - reposCreate: (body: PostRepo, params: RequestParams = {}) => - this.http.request({ - path: `/user/repos`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description List repositories being starred by the authenticated user. - * - * @name StarredList - * @request GET:/user/starred - */ - starredList: ( - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "created" */ - sort?: "created" | "updated"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/user/starred`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Unstar a repository - * - * @name StarredDelete - * @request DELETE:/user/starred/{owner}/{repo} - */ - starredDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/user/starred/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if you are starring a repository. - * - * @name StarredDetail - * @request GET:/user/starred/{owner}/{repo} - */ - starredDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/user/starred/${owner}/${repo}`, - method: "GET", - ...params, - }), - - /** - * @description Star a repository. - * - * @name StarredUpdate - * @request PUT:/user/starred/{owner}/{repo} - */ - starredUpdate: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/user/starred/${owner}/${repo}`, - method: "PUT", - ...params, - }), - - /** - * @description List repositories being watched by the authenticated user. - * - * @name SubscriptionsList - * @request GET:/user/subscriptions - */ - subscriptionsList: (params: RequestParams = {}) => - this.http.request({ - path: `/user/subscriptions`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Stop watching a repository - * - * @name SubscriptionsDelete - * @request DELETE:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /** - * @description Check if you are watching a repository. - * - * @name SubscriptionsDetail - * @request GET:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "GET", - ...params, - }), - - /** - * @description Watch a repository. - * - * @name SubscriptionsUpdate - * @request PUT:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsUpdate: (owner: string, repo: string, params: RequestParams = {}) => - this.http.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "PUT", - ...params, - }), - - /** - * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth. - * - * @name TeamsList - * @request GET:/user/teams - */ - teamsList: (params: RequestParams = {}) => - this.http.request({ - path: `/user/teams`, - method: "GET", - format: "json", - ...params, - }), - }; - users = { - /** - * @description Get all users. This provides a dump of every user, in the order that they signed up for GitHub. Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users. - * - * @name UsersList - * @request GET:/users - */ - usersList: ( - query?: { - /** The integer ID of the last user that you've seen. */ - since?: number; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get a single user. - * - * @name UsersDetail - * @request GET:/users/{username} - */ - usersDetail: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. - * - * @name EventsDetail - * @request GET:/users/{username}/events - */ - eventsDetail: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}/events`, - method: "GET", - ...params, - }), - - /** - * @description This is the user's organization dashboard. You must be authenticated as the user to view this. - * - * @name EventsOrgsDetail - * @request GET:/users/{username}/events/orgs/{org} - */ - eventsOrgsDetail: (username: string, org: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}/events/orgs/${org}`, - method: "GET", - ...params, - }), - - /** - * @description List a user's followers - * - * @name FollowersDetail - * @request GET:/users/{username}/followers - */ - followersDetail: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}/followers`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description Check if one user follows another. - * - * @name FollowingDetail - * @request GET:/users/{username}/following/{targetUser} - */ - followingDetail: (username: string, targetUser: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}/following/${targetUser}`, - method: "GET", - ...params, - }), - - /** - * @description List a users gists. - * - * @name GistsDetail - * @request GET:/users/{username}/gists - */ - gistsDetail: ( - username: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/users/${username}/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List public keys for a user. Lists the verified public keys for a user. This is accessible by anyone. - * - * @name KeysDetail - * @request GET:/users/{username}/keys - */ - keysDetail: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}/keys`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description List all public organizations for a user. - * - * @name OrgsDetail - * @request GET:/users/{username}/orgs - */ - orgsDetail: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description These are events that you'll only see public events. - * - * @name ReceivedEventsDetail - * @request GET:/users/{username}/received_events - */ - receivedEventsDetail: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}/received_events`, - method: "GET", - ...params, - }), - - /** - * @description List public events that a user has received - * - * @name ReceivedEventsPublicDetail - * @request GET:/users/{username}/received_events/public - */ - receivedEventsPublicDetail: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}/received_events/public`, - method: "GET", - ...params, - }), - - /** - * @description List public repositories for the specified user. - * - * @name ReposDetail - * @request GET:/users/{username}/repos - */ - reposDetail: ( - username: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.http.request({ - path: `/users/${username}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * @description List repositories being starred by a user. - * - * @name StarredDetail - * @request GET:/users/{username}/starred - */ - starredDetail: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}/starred`, - method: "GET", - ...params, - }), - - /** - * @description List repositories being watched by a user. - * - * @name SubscriptionsDetail - * @request GET:/users/{username}/subscriptions - */ - subscriptionsDetail: (username: string, params: RequestParams = {}) => - this.http.request({ - path: `/users/${username}/subscriptions`, - method: "GET", - ...params, - }), - }; -} diff --git a/tests/spec/axiosSingleHttpClient/test.js b/tests/spec/axiosSingleHttpClient/test.js deleted file mode 100644 index dce152fa..00000000 --- a/tests/spec/axiosSingleHttpClient/test.js +++ /dev/null @@ -1,28 +0,0 @@ -const { resolve } = require("node:path"); -const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); -const createSchemaInfos = require("../../helpers/createSchemaInfos"); -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const assertGeneratedModule = require("../../helpers/assertGeneratedModule"); - -const schemas = createSchemaInfos({ - absolutePathToSchemas: resolve(__dirname, "./"), -}); - -schemas.forEach(({ absolutePath, apiFileName }) => { - generateApiForTest({ - testName: "--axios --single-http-client test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - generateClient: true, - singleHttpClient: true, - httpClientType: "axios", - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/cli/expected.ts b/tests/spec/cli/expected.ts deleted file mode 100644 index 1b0dcb52..00000000 --- a/tests/spec/cli/expected.ts +++ /dev/null @@ -1,618 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Authentiq ID in JWT format, self-signed. */ -export interface PrefixAuthentiqID { - /** device token for push messages */ - devtoken?: string; - /** UUID and public signing key */ - sub: string; -} - -/** Claim in JWT format, self- or issuer-signed. */ -export interface PrefixClaims { - email?: string; - phone?: string; - /** claim scope */ - scope: string; - /** UUID */ - sub: string; - type?: string; -} - -export interface PrefixError { - detail?: string; - error: number; - title?: string; - /** unique uri for this error */ - type?: string; -} - -/** PushToken in JWT format, self-signed. */ -export interface PrefixPushToken { - /** audience (URI) */ - aud: string; - exp?: number; - iat?: number; - /** issuer (URI) */ - iss: string; - nbf?: number; - /** UUID and public signing key */ - sub: string; -} - -export interface PrefixKeyRevokeNosecretData { - /** pending or done */ - status?: string; -} - -export type PrefixKeyRevokeNosecretError = PrefixError; - -export interface PrefixKeyRegisterData { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; -} - -export type PrefixKeyRegisterError = PrefixError; - -export interface PrefixKeyRevokeData { - /** done */ - status?: string; -} - -export type PrefixKeyRevokeError = PrefixError; - -/** JWT */ -export interface PrefixGetKeyData { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; -} - -export type PrefixGetKeyError = PrefixError; - -export type PrefixHeadKeyData = any; - -export type PrefixHeadKeyError = PrefixError; - -export interface PrefixKeyUpdateData { - /** confirmed */ - status?: string; -} - -export type PrefixKeyUpdateError = PrefixError; - -export interface PrefixKeyBindData { - /** confirmed */ - status?: string; -} - -export type PrefixKeyBindError = PrefixError; - -export interface PrefixPushLoginRequestData { - /** sent */ - status?: string; -} - -export type PrefixPushLoginRequestError = PrefixError; - -export interface PrefixSignRequestData { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; -} - -export type PrefixSignRequestError = PrefixError; - -export interface PrefixSignDeleteData { - /** done */ - status?: string; -} - -export type PrefixSignDeleteError = PrefixError; - -/** JWT */ -export interface PrefixSignRetrieveData { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; -} - -export type PrefixSignRetrieveError = PrefixError; - -export type PrefixSignRetrieveHeadData = any; - -export type PrefixSignRetrieveHeadError = PrefixError; - -export interface PrefixSignConfirmData { - /** confirmed */ - status?: string; -} - -export type PrefixSignConfirmError = PrefixError; - -export interface PrefixSignUpdateData { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; -} - -export type PrefixSignUpdateError = PrefixError; - -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://6-dot-authentiqio.appspot.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 Authentiq - * @version 6 - * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://authentiq.com/terms/ - * @baseUrl https://6-dot-authentiqio.appspot.com - * @contact Authentiq team (http://authentiq.io/support) - * - * Strong authentication, without the passwords. - */ -export class MySuperApi extends HttpClient { - key = { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret: ( - query: { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/key`, - method: "DELETE", - query: query, - ...params, - }), - - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister: (body: PrefixAuthentiqID, params: RequestParams = {}) => - this.request({ - path: `/key`, - method: "POST", - body: body, - ...params, - }), - - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - keyRevoke: ( - pk: string, - query: { - /** revokation secret */ - secret: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/key/${pk}`, - method: "DELETE", - query: query, - ...params, - }), - - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey: (pk: string, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "GET", - ...params, - }), - - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey: (pk: string, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "HEAD", - ...params, - }), - - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate: (pk: string, body: PrefixAuthentiqID, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "POST", - body: body, - ...params, - }), - - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind: (pk: string, body: PrefixAuthentiqID, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "PUT", - body: body, - ...params, - }), - }; - login = { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest: ( - query: { - /** URI App will connect to */ - callback: string; - }, - body: PrefixPushToken, - params: RequestParams = {}, - ) => - this.request({ - path: `/login`, - method: "POST", - query: query, - body: body, - ...params, - }), - }; - scope = { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest: ( - body: PrefixClaims, - query?: { - /** test only mode, using test issuer */ - test?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scope`, - method: "POST", - query: query, - body: body, - ...params, - }), - - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "DELETE", - ...params, - }), - - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "GET", - ...params, - }), - - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "HEAD", - ...params, - }), - - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "POST", - type: ContentType.Json, - ...params, - }), - - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "PUT", - ...params, - }), - }; -} diff --git a/tests/spec/cli/schema.ts b/tests/spec/cli/schema.ts deleted file mode 100644 index 1b0dcb52..00000000 --- a/tests/spec/cli/schema.ts +++ /dev/null @@ -1,618 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Authentiq ID in JWT format, self-signed. */ -export interface PrefixAuthentiqID { - /** device token for push messages */ - devtoken?: string; - /** UUID and public signing key */ - sub: string; -} - -/** Claim in JWT format, self- or issuer-signed. */ -export interface PrefixClaims { - email?: string; - phone?: string; - /** claim scope */ - scope: string; - /** UUID */ - sub: string; - type?: string; -} - -export interface PrefixError { - detail?: string; - error: number; - title?: string; - /** unique uri for this error */ - type?: string; -} - -/** PushToken in JWT format, self-signed. */ -export interface PrefixPushToken { - /** audience (URI) */ - aud: string; - exp?: number; - iat?: number; - /** issuer (URI) */ - iss: string; - nbf?: number; - /** UUID and public signing key */ - sub: string; -} - -export interface PrefixKeyRevokeNosecretData { - /** pending or done */ - status?: string; -} - -export type PrefixKeyRevokeNosecretError = PrefixError; - -export interface PrefixKeyRegisterData { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; -} - -export type PrefixKeyRegisterError = PrefixError; - -export interface PrefixKeyRevokeData { - /** done */ - status?: string; -} - -export type PrefixKeyRevokeError = PrefixError; - -/** JWT */ -export interface PrefixGetKeyData { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; -} - -export type PrefixGetKeyError = PrefixError; - -export type PrefixHeadKeyData = any; - -export type PrefixHeadKeyError = PrefixError; - -export interface PrefixKeyUpdateData { - /** confirmed */ - status?: string; -} - -export type PrefixKeyUpdateError = PrefixError; - -export interface PrefixKeyBindData { - /** confirmed */ - status?: string; -} - -export type PrefixKeyBindError = PrefixError; - -export interface PrefixPushLoginRequestData { - /** sent */ - status?: string; -} - -export type PrefixPushLoginRequestError = PrefixError; - -export interface PrefixSignRequestData { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; -} - -export type PrefixSignRequestError = PrefixError; - -export interface PrefixSignDeleteData { - /** done */ - status?: string; -} - -export type PrefixSignDeleteError = PrefixError; - -/** JWT */ -export interface PrefixSignRetrieveData { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; -} - -export type PrefixSignRetrieveError = PrefixError; - -export type PrefixSignRetrieveHeadData = any; - -export type PrefixSignRetrieveHeadError = PrefixError; - -export interface PrefixSignConfirmData { - /** confirmed */ - status?: string; -} - -export type PrefixSignConfirmError = PrefixError; - -export interface PrefixSignUpdateData { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; -} - -export type PrefixSignUpdateError = PrefixError; - -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://6-dot-authentiqio.appspot.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 Authentiq - * @version 6 - * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://authentiq.com/terms/ - * @baseUrl https://6-dot-authentiqio.appspot.com - * @contact Authentiq team (http://authentiq.io/support) - * - * Strong authentication, without the passwords. - */ -export class MySuperApi extends HttpClient { - key = { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret: ( - query: { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/key`, - method: "DELETE", - query: query, - ...params, - }), - - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister: (body: PrefixAuthentiqID, params: RequestParams = {}) => - this.request({ - path: `/key`, - method: "POST", - body: body, - ...params, - }), - - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - keyRevoke: ( - pk: string, - query: { - /** revokation secret */ - secret: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/key/${pk}`, - method: "DELETE", - query: query, - ...params, - }), - - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey: (pk: string, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "GET", - ...params, - }), - - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey: (pk: string, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "HEAD", - ...params, - }), - - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate: (pk: string, body: PrefixAuthentiqID, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "POST", - body: body, - ...params, - }), - - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind: (pk: string, body: PrefixAuthentiqID, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "PUT", - body: body, - ...params, - }), - }; - login = { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest: ( - query: { - /** URI App will connect to */ - callback: string; - }, - body: PrefixPushToken, - params: RequestParams = {}, - ) => - this.request({ - path: `/login`, - method: "POST", - query: query, - body: body, - ...params, - }), - }; - scope = { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest: ( - body: PrefixClaims, - query?: { - /** test only mode, using test issuer */ - test?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/scope`, - method: "POST", - query: query, - body: body, - ...params, - }), - - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "DELETE", - ...params, - }), - - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "GET", - ...params, - }), - - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "HEAD", - ...params, - }), - - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "POST", - type: ContentType.Json, - ...params, - }), - - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "PUT", - ...params, - }), - }; -} diff --git a/tests/spec/const-keyword/schema.ts b/tests/spec/const-keyword/__snapshots__/basic.test.ts.snap similarity index 91% rename from tests/spec/const-keyword/schema.ts rename to tests/spec/const-keyword/__snapshots__/basic.test.ts.snap index d22e7c78..ce0ac325 100644 --- a/tests/spec/const-keyword/schema.ts +++ b/tests/spec/const-keyword/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > const-keyword 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -89,3 +92,5 @@ export type TestNumber10 = 10; * @default null */ export type TestNull = null; +" +`; diff --git a/tests/spec/const-keyword/basic.test.ts b/tests/spec/const-keyword/basic.test.ts new file mode 100644 index 00000000..90d839bf --- /dev/null +++ b/tests/spec/const-keyword/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("const-keyword", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + addReadonly: true, + generateClient: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/const-keyword/expected.ts b/tests/spec/const-keyword/expected.ts deleted file mode 100644 index d22e7c78..00000000 --- a/tests/spec/const-keyword/expected.ts +++ /dev/null @@ -1,91 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface ObjTest { - /** - * title - * description - * @default "main" - */ - page_type?: "main"; - /** - * title - * description - */ - page_type_nullable?: "main" | null; -} - -/** - * title - * description - * @default "string" - */ -export type TestString = "string"; - -/** - * title - * description - */ -export type TestStringNullable = "string" | null; - -/** - * title - * description - */ -export type TestBooleanNullable = false | null; - -/** - * title - * description - * @default false - */ -export type TestBooleanFalse = false; - -/** - * title - * description - * @default true - */ -export type TestBooleanTrue = true; - -/** - * title - * description - * @default 5 - */ -export type TestNumber5 = 5; - -/** - * title - * description - */ -export type TestNumberNullable = 666 | null; - -/** - * title - * description - * @default 0 - */ -export type TestNumber0 = 0; - -/** - * title - * description - * @default 10 - */ -export type TestNumber10 = 10; - -/** - * title - * description - * @default null - */ -export type TestNull = null; diff --git a/tests/spec/const-keyword/test.js b/tests/spec/const-keyword/test.js deleted file mode 100644 index a46e7796..00000000 --- a/tests/spec/const-keyword/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "const-keyword 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/custom-extensions/schema.ts b/tests/spec/custom-extensions/__snapshots__/basic.test.ts.snap similarity index 90% rename from tests/spec/custom-extensions/schema.ts rename to tests/spec/custom-extensions/__snapshots__/basic.test.ts.snap index 068638bb..2debf655 100644 --- a/tests/spec/custom-extensions/schema.ts +++ b/tests/spec/custom-extensions/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > custom extensions 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -13,7 +16,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -78,7 +81,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -100,7 +103,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -115,8 +118,8 @@ export class HttpClient { property instanceof Blob ? property : typeof property === "object" && property !== null - ? JSON.stringify(property) - : `${property}`, + ? JSON.stringify(property) + : \`\${property}\`, ); return formData; }, new FormData()), @@ -180,16 +183,16 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + 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, + 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; + const r = response.clone() as HttpResponse; r.data = null as unknown as T; r.error = null as unknown as E; @@ -233,9 +236,11 @@ export class Api extends HttpClient this.request({ - path: `/test`, + path: \`/test\`, method: "GET", ...params, }), }; } +" +`; diff --git a/tests/spec/custom-extensions/basic.test.ts b/tests/spec/custom-extensions/basic.test.ts new file mode 100644 index 00000000..2c3279f9 --- /dev/null +++ b/tests/spec/custom-extensions/basic.test.ts @@ -0,0 +1,35 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("custom extensions", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/custom-extensions/expected.ts b/tests/spec/custom-extensions/expected.ts deleted file mode 100644 index 068638bb..00000000 --- a/tests/spec/custom-extensions/expected.ts +++ /dev/null @@ -1,241 +0,0 @@ -/* 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 deleted file mode 100644 index 2dc72722..00000000 --- a/tests/spec/custom-extensions/test.js +++ /dev/null @@ -1,25 +0,0 @@ -const createSchemaInfos = require("../../helpers/createSchemaInfos"); -const { resolve } = require("node: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/__snapshots__/basic.test.ts.snap similarity index 91% rename from tests/spec/defaultAsSuccess/expected.ts rename to tests/spec/defaultAsSuccess/__snapshots__/basic.test.ts.snap index 682abf15..a246f891 100644 --- a/tests/spec/defaultAsSuccess/expected.ts +++ b/tests/spec/defaultAsSuccess/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --default-as-success 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -53,7 +56,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -118,7 +121,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -140,7 +143,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -156,7 +159,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -220,7 +223,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -272,7 +275,7 @@ export class HttpClient { export class Api extends HttpClient { key = { /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. + * @description Revoke an Authentiq ID using email & phone. If called with \`email\` and \`phone\` only, a verification code will be sent by email. Do a second call adding \`code\` to complete the revocation. * * @tags key, delete * @name KeyRevokeNosecret @@ -296,7 +299,7 @@ export class Api extends HttpClient({ - path: `/key`, + path: \`/key\`, method: "DELETE", query: query, format: "json", @@ -304,7 +307,7 @@ export class Api extends HttpClient extends HttpClient({ - path: `/key`, + path: \`/key\`, method: "POST", body: body, format: "json", @@ -349,7 +352,7 @@ export class Api extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "DELETE", query: query, format: "json", @@ -374,7 +377,7 @@ export class Api extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "GET", format: "json", ...params, @@ -389,7 +392,7 @@ export class Api extends HttpClient this.request({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "HEAD", ...params, }), @@ -409,7 +412,7 @@ export class Api extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "POST", body: body, format: "json", @@ -417,7 +420,7 @@ export class Api extends HttpClient extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "PUT", body: body, format: "json", @@ -461,7 +464,7 @@ export class Api extends HttpClient({ - path: `/login`, + path: \`/login\`, method: "POST", query: query, body: body, @@ -494,7 +497,7 @@ export class Api extends HttpClient({ - path: `/scope`, + path: \`/scope\`, method: "POST", query: query, body: body, @@ -517,7 +520,7 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "DELETE", format: "json", ...params, @@ -540,7 +543,7 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "GET", format: "json", ...params, @@ -555,7 +558,7 @@ export class Api extends HttpClient this.request({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "HEAD", ...params, }), @@ -575,7 +578,7 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "POST", type: ContentType.Json, format: "json", @@ -599,9 +602,11 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "PUT", ...params, }), }; } +" +`; diff --git a/tests/spec/defaultAsSuccess/basic.test.ts b/tests/spec/defaultAsSuccess/basic.test.ts new file mode 100644 index 00000000..0369fc0d --- /dev/null +++ b/tests/spec/defaultAsSuccess/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--default-as-success", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + defaultResponseAsSuccess: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/defaultAsSuccess/schema.ts b/tests/spec/defaultAsSuccess/schema.ts deleted file mode 100644 index 682abf15..00000000 --- a/tests/spec/defaultAsSuccess/schema.ts +++ /dev/null @@ -1,607 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Authentiq ID in JWT format, self-signed. */ -export interface AuthentiqID { - /** device token for push messages */ - devtoken?: string; - /** UUID and public signing key */ - sub: string; -} - -/** Claim in JWT format, self- or issuer-signed. */ -export interface Claims { - email?: string; - phone?: string; - /** claim scope */ - scope: string; - /** UUID */ - sub: string; - type?: string; -} - -export interface Error { - detail?: string; - error: number; - title?: string; - /** unique uri for this error */ - type?: string; -} - -/** PushToken in JWT format, self-signed. */ -export interface PushToken { - /** audience (URI) */ - aud: string; - exp?: number; - iat?: number; - /** issuer (URI) */ - iss: string; - nbf?: number; - /** UUID and public signing key */ - sub: string; -} - -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://6-dot-authentiqio.appspot.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 Authentiq - * @version 6 - * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://authentiq.com/terms/ - * @baseUrl https://6-dot-authentiqio.appspot.com - * @contact Authentiq team (http://authentiq.io/support) - * - * Strong authentication, without the passwords. - */ -export class Api extends HttpClient { - key = { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret: ( - query: { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** pending or done */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "DELETE", - query: query, - format: "json", - ...params, - }), - - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister: (body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - keyRevoke: ( - pk: string, - query: { - /** revokation secret */ - secret: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "DELETE", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey: (pk: string, params: RequestParams = {}) => - this.request< - { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey: (pk: string, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "HEAD", - ...params, - }), - - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate: (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind: (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "PUT", - body: body, - format: "json", - ...params, - }), - }; - login = { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest: ( - query: { - /** URI App will connect to */ - callback: string; - }, - body: PushToken, - params: RequestParams = {}, - ) => - this.request< - { - /** sent */ - status?: string; - }, - Error - >({ - path: `/login`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }), - }; - scope = { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest: ( - body: Claims, - query?: { - /** test only mode, using test issuer */ - test?: number; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }, - Error - >({ - path: `/scope`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }), - - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete: (job: string, params: RequestParams = {}) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "DELETE", - format: "json", - ...params, - }), - - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve: (job: string, params: RequestParams = {}) => - this.request< - { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "HEAD", - ...params, - }), - - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm: (job: string, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "POST", - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate: (job: string, params: RequestParams = {}) => - this.request< - { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "PUT", - ...params, - }), - }; -} diff --git a/tests/spec/defaultAsSuccess/test.js b/tests/spec/defaultAsSuccess/test.js deleted file mode 100644 index b8f5b182..00000000 --- a/tests/spec/defaultAsSuccess/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--default-as-success option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - defaultResponseAsSuccess: true, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/defaultResponse/expected.ts b/tests/spec/defaultResponse/__snapshots__/basic.test.ts.snap similarity index 94% rename from tests/spec/defaultResponse/expected.ts rename to tests/spec/defaultResponse/__snapshots__/basic.test.ts.snap index 4962293d..3286c88a 100644 --- a/tests/spec/defaultResponse/expected.ts +++ b/tests/spec/defaultResponse/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --default-response 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -13,7 +16,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -78,7 +81,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -100,7 +103,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -116,7 +119,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -180,7 +183,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -250,10 +253,12 @@ export class Api extends HttpClient this.request({ - path: `/pets`, + path: \`/pets\`, method: "GET", query: query, ...params, }), }; } +" +`; diff --git a/tests/spec/defaultResponse/basic.test.ts b/tests/spec/defaultResponse/basic.test.ts new file mode 100644 index 00000000..a6cd8a56 --- /dev/null +++ b/tests/spec/defaultResponse/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--default-response", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + defaultResponseType: "unknown", + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/defaultResponse/schema.ts b/tests/spec/defaultResponse/schema.ts deleted file mode 100644 index 4962293d..00000000 --- a/tests/spec/defaultResponse/schema.ts +++ /dev/null @@ -1,259 +0,0 @@ -/* 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 = "http://petstore.swagger.io/api"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/api - * @contact Swagger API Team (http://swagger.io) - * - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - pets = { - /** - * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. - * - * @name FindPets - * @request GET:/pets - */ - findPets: ( - query?: { - /** tags to filter by */ - tags?: string[]; - /** - * maximum number of results to return - * @format int32 - */ - limit?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pets`, - method: "GET", - query: query, - ...params, - }), - }; -} diff --git a/tests/spec/defaultResponse/test.js b/tests/spec/defaultResponse/test.js deleted file mode 100644 index 255e03c3..00000000 --- a/tests/spec/defaultResponse/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--default-response option test", - silent: true, - name: apiFileName, - spec: require(absolutePath), - output: resolve(__dirname, "./"), - defaultResponseType: "unknown", - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/deprecated/expected.ts b/tests/spec/deprecated/__snapshots__/basic.test.ts.snap similarity index 95% rename from tests/spec/deprecated/expected.ts rename to tests/spec/deprecated/__snapshots__/basic.test.ts.snap index 22767595..d8ca8953 100644 --- a/tests/spec/deprecated/expected.ts +++ b/tests/spec/deprecated/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > @deprecated 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -13,7 +16,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -78,7 +81,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -100,7 +103,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -116,7 +119,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -180,7 +183,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -258,7 +261,7 @@ export class Api extends HttpClient this.request({ - path: `/pets`, + path: \`/pets\`, method: "GET", query: query, ...params, @@ -274,7 +277,7 @@ export class Api extends HttpClient this.request({ - path: `/pets-deprecated-true`, + path: \`/pets-deprecated-true\`, method: "GET", ...params, }), @@ -288,9 +291,11 @@ export class Api extends HttpClient this.request({ - path: `/pets-deprecated-false`, + path: \`/pets-deprecated-false\`, method: "GET", ...params, }), }; } +" +`; diff --git a/tests/spec/deprecated/basic.test.ts b/tests/spec/deprecated/basic.test.ts new file mode 100644 index 00000000..f05b2375 --- /dev/null +++ b/tests/spec/deprecated/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("@deprecated", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + queryParamsWithBrackets: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/deprecated/schema.ts b/tests/spec/deprecated/schema.ts deleted file mode 100644 index 22767595..00000000 --- a/tests/spec/deprecated/schema.ts +++ /dev/null @@ -1,296 +0,0 @@ -/* 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 = "http://petstore.swagger.io/api"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/api - * @contact Swagger API Team (http://swagger.io) - * - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - pets = { - /** - * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. - * - * @name FindPets - * @request GET:/pets - */ - findPets: ( - query?: { - /** - * tags to filter by - * @deprecated - */ - tags?: string[]; - /** - * maximum number of results to return - * @format int32 - */ - limit?: number; - /** - * collection page number - * @default 1 - */ - page?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pets`, - method: "GET", - query: query, - ...params, - }), - }; - petsDeprecatedTrue = { - /** - * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. - * - * @name FindPets - * @request GET:/pets-deprecated-true - * @deprecated - */ - findPets: (params: RequestParams = {}) => - this.request({ - path: `/pets-deprecated-true`, - method: "GET", - ...params, - }), - }; - petsDeprecatedFalse = { - /** - * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. - * - * @name FindPets - * @request GET:/pets-deprecated-false - */ - findPets: (params: RequestParams = {}) => - this.request({ - path: `/pets-deprecated-false`, - method: "GET", - ...params, - }), - }; -} diff --git a/tests/spec/deprecated/test.js b/tests/spec/deprecated/test.js deleted file mode 100644 index fab46f43..00000000 --- a/tests/spec/deprecated/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "@deprecated test", - silent: true, - name: apiFileName, - spec: require(absolutePath), - output: resolve(__dirname, "./"), - queryParamsWithBrackets: true, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/discriminator/schema.ts b/tests/spec/discriminator/__snapshots__/basic.test.ts.snap similarity index 97% rename from tests/spec/discriminator/schema.ts rename to tests/spec/discriminator/__snapshots__/basic.test.ts.snap index 92ca7e37..45913264 100644 --- a/tests/spec/discriminator/schema.ts +++ b/tests/spec/discriminator/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > discriminator 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -222,3 +225,5 @@ type BaseInvalidDiscriminatorPropertyName = object; type BaseInvalidDiscriminatorPropertyNameTypeMapping = { "@type": Key; } & Type; +" +`; diff --git a/tests/spec/discriminator/basic.test.ts b/tests/spec/discriminator/basic.test.ts new file mode 100644 index 00000000..b2acb7a2 --- /dev/null +++ b/tests/spec/discriminator/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("discriminator", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + addReadonly: true, + generateClient: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/discriminator/expected.ts b/tests/spec/discriminator/expected.ts deleted file mode 100644 index 92ca7e37..00000000 --- a/tests/spec/discriminator/expected.ts +++ /dev/null @@ -1,224 +0,0 @@ -/* 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; -}; - -export type InvalidDiscriminatorPropertyName = BaseInvalidDiscriminatorPropertyName & - ( - | BaseInvalidDiscriminatorPropertyNameTypeMapping<"num", number> - | BaseInvalidDiscriminatorPropertyNameTypeMapping<"str", string> - ); - -/** kek pek */ -export type Variant = - | ({ - type: "update"; - } & VariantUpdate) - | ({ - type: "undo"; - } & VariantUndo) - | ({ - type: "rollback"; - } & VariantRollback) - | ({ - type: "scale"; - } & VariantScale) - | ({ - type: "resources"; - } & VariantResources) - | ({ - type: "firewall"; - } & VariantFirewall) - | ({ - type: "gateway"; - } & VariantGateway); - -/** Proposal to change firewall rules for deployment. */ -export interface VariantFirewall { - /** asdasdasdasdasdsad added to deployment. If not set, no rules are added. */ - rules_added?: string[]; - /** asdasdasdasdasdsad removed from deployment. If not set, no rules were removed. */ - rules_removed?: string[]; -} - -/** asdasdasdasdasd */ -export interface VariantScale { - /** - * asdasdasdasdasdsad - * @example 3 - */ - replicas: number; -} - -/** asdasdasdasdasd */ -export interface VariantResources { - resources: string; -} - -/** asdasdasdasdasd */ -export interface VariantGateway { - /** asdasdasdasdasdsad */ - port?: string; - /** asdasdasdasdasdsad */ - name?: string; - /** asdasdasdasdasdsad */ - domain?: string; -} - -/** Pasdasdasdasdasd. */ -export type VariantUpdate = object; - -/** asdasdasdasdasd */ -export interface VariantRollback { - /** - * asdasdasdasdasdsad - * @example 42 - */ - revision_id: number; -} - -/** asdasdasdasdasdn */ -export type VariantUndo = object; - -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; - -type BaseInvalidDiscriminatorPropertyName = object; - -type BaseInvalidDiscriminatorPropertyNameTypeMapping = { - "@type": Key; -} & Type; diff --git a/tests/spec/discriminator/test.js b/tests/spec/discriminator/test.js deleted file mode 100644 index 3f98388e..00000000 --- a/tests/spec/discriminator/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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/__snapshots__/basic.test.ts.snap similarity index 93% rename from tests/spec/dot-path-params/expected.ts rename to tests/spec/dot-path-params/__snapshots__/basic.test.ts.snap index fc274dd7..e4aad5ec 100644 --- a/tests/spec/dot-path-params/expected.ts +++ b/tests/spec/dot-path-params/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --dot-path-params 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -15,7 +18,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -80,7 +83,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -102,7 +105,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -118,7 +121,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -182,7 +185,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -242,10 +245,12 @@ export class Api extends HttpClient this.request({ - path: `/foobar/${truckId}/item`, + path: \`/foobar/\${truckId}/item\`, method: "POST", query: query, ...params, }), }; } +" +`; diff --git a/tests/spec/dot-path-params/basic.test.ts b/tests/spec/dot-path-params/basic.test.ts new file mode 100644 index 00000000..ec04f00e --- /dev/null +++ b/tests/spec/dot-path-params/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--dot-path-params", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/dot-path-params/schema.ts b/tests/spec/dot-path-params/schema.ts deleted file mode 100644 index fc274dd7..00000000 --- a/tests/spec/dot-path-params/schema.ts +++ /dev/null @@ -1,251 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type MyResponse = object; - -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.clone() 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 unset - * @version unset - */ -export class Api extends HttpClient { - foobar = { - /** - * No description - * - * @name ReproFunc - * @summary Repros an issue - * @request POST:/foobar/{truck.id}/item - */ - 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/test.js b/tests/spec/dot-path-params/test.js deleted file mode 100644 index 34c5c833..00000000 --- a/tests/spec/dot-path-params/test.js +++ /dev/null @@ -1,28 +0,0 @@ -const _ = require("lodash"); -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node:path"); -const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); -const createSchemaInfos = require("../../helpers/createSchemaInfos"); -const assertGeneratedModule = require("../../helpers/assertGeneratedModule"); - -const schemas = createSchemaInfos({ - absolutePathToSchemas: resolve(__dirname, "./"), - absoluteOutputPath: resolve(__dirname, "./"), -}); - -schemas.forEach(({ absolutePath, apiFileName, Exception }) => { - generateApiForTest({ - testName: "--dot-path-params options test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - generateClient: true, - }).then((output) => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/enumNamesAsValues/expected.ts b/tests/spec/enumNamesAsValues/__snapshots__/basic.test.ts.snap similarity index 93% rename from tests/spec/enumNamesAsValues/expected.ts rename to tests/spec/enumNamesAsValues/__snapshots__/basic.test.ts.snap index b08dca68..4a857127 100644 --- a/tests/spec/enumNamesAsValues/expected.ts +++ b/tests/spec/enumNamesAsValues/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --enum-names-as-values 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -102,12 +105,12 @@ export interface JobType { link?: string; /** * Exist only in open source jobs - * Format: `${username}/${projectName}` + * Format: \`\${username}/\${projectName}\` */ github?: string; /** * Exist only in open source jobs - * Format: `${orgname}/${projectName}` + * Format: \`\${orgname}/\${projectName}\` */ npm?: string; /** @@ -126,12 +129,12 @@ export interface PickJobTypeExcludeKeysIdOrId { link?: string; /** * Exist only in open source jobs - * Format: `${username}/${projectName}` + * Format: \`\${username}/\${projectName}\` */ github?: string; /** * Exist only in open source jobs - * Format: `${orgname}/${projectName}` + * Format: \`\${orgname}/\${projectName}\` */ npm?: string; /** @@ -205,7 +208,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -270,7 +273,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -292,7 +295,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -308,7 +311,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -372,7 +375,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -426,7 +429,7 @@ export class Api extends HttpClient this.request({ - path: `/auth`, + path: \`/auth\`, method: "POST", body: data, type: ContentType.Json, @@ -444,7 +447,7 @@ export class Api extends HttpClient this.request({ - path: `/auth/refresh`, + path: \`/auth/refresh\`, method: "POST", secure: true, format: "json", @@ -462,7 +465,7 @@ export class Api extends HttpClient this.request({ - path: `/jobs`, + path: \`/jobs\`, method: "GET", secure: true, format: "json", @@ -479,7 +482,7 @@ export class Api extends HttpClient this.request({ - path: `/jobs`, + path: \`/jobs\`, method: "POST", body: data, secure: true, @@ -498,7 +501,7 @@ export class Api extends HttpClient this.request({ - path: `/jobs/${id}`, + path: \`/jobs/\${id}\`, method: "GET", secure: true, format: "json", @@ -515,7 +518,7 @@ export class Api extends HttpClient this.request({ - path: `/jobs/${id}`, + path: \`/jobs/\${id}\`, method: "PATCH", body: data, secure: true, @@ -534,7 +537,7 @@ export class Api extends HttpClient this.request({ - path: `/jobs/${id}`, + path: \`/jobs/\${id}\`, method: "DELETE", secure: true, format: "json", @@ -551,7 +554,7 @@ export class Api extends HttpClient this.request({ - path: `/projects`, + path: \`/projects\`, method: "GET", format: "json", ...params, @@ -567,7 +570,7 @@ export class Api extends HttpClient this.request({ - path: `/projects`, + path: \`/projects\`, method: "POST", body: data, secure: true, @@ -586,7 +589,7 @@ export class Api extends HttpClient this.request({ - path: `/projects/${id}`, + path: \`/projects/\${id}\`, method: "PATCH", body: data, secure: true, @@ -604,10 +607,12 @@ export class Api extends HttpClient this.request({ - path: `/projects/${id}`, + path: \`/projects/\${id}\`, method: "DELETE", format: "json", ...params, }), }; } +" +`; diff --git a/tests/spec/enumNamesAsValues/basic.test.ts b/tests/spec/enumNamesAsValues/basic.test.ts new file mode 100644 index 00000000..76a7e323 --- /dev/null +++ b/tests/spec/enumNamesAsValues/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--enum-names-as-values", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + enumNamesAsValues: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/enumNamesAsValues/schema.ts b/tests/spec/enumNamesAsValues/schema.ts deleted file mode 100644 index b08dca68..00000000 --- a/tests/spec/enumNamesAsValues/schema.ts +++ /dev/null @@ -1,613 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type TestAllOfDc = (FooBarBaz & FooBar) & { - prop?: string; -}; - -export type TestAllOfDc2 = FooBarBaz & { - prop?: string; -}; - -export type TestAnyOfDc = (FooBarBaz | FooBar) & { - prop?: string; -}; - -export type TestOneOfDc = (FooBarBaz | FooBar) & { - prop?: string; -}; - -/** - * FooBar - * @format int32 - */ -export enum IntEnumWithNames { - Unknown = "Unknown", - String = "String", - Int32 = "Int32", - Int64 = "Int64", - Double = "Double", - DateTime = "DateTime", - Test2 = "Test2", - Test23 = "Test23", - Tess44 = "Tess44", - BooFar = "BooFar", -} - -export enum PetIds { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -export enum PetIdsWithWrongEnum { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -/** Information about job */ -export interface FooBarBaz { - id?: string; - kind?: JobKind; - name?: string; - link?: string; -} - -/** Information about job */ -export interface FooBar { - kind?: JobKind; -} - -/** Information about job */ -export interface FooBaz { - name?: string; - link?: string; -} - -/** From T, pick a set of properties whose keys are in the union K */ -export interface PickUserTypeExcludeKeysIdOrId { - username: string; - password: string; -} - -export type OmitUserTypeIdOrId = PickUserTypeExcludeKeysIdOrId; - -export type OmitIdUserType = OmitUserTypeIdOrId; - -export type AuthUserType = OmitIdUserType; - -export enum JobKind { - COMPANY = "COMPANY", - PERSONAL = "PERSONAL", - FREELANCE = "FREELANCE", - OPEN_SOURCE = "OPEN_SOURCE", -} - -/** Information about job */ -export interface JobType { - id: string; - kind: JobKind; - name?: string; - link?: string; - /** - * Exist only in open source jobs - * Format: `${username}/${projectName}` - */ - github?: string; - /** - * Exist only in open source jobs - * Format: `${orgname}/${projectName}` - */ - npm?: string; - /** - * Exist only in open source jobs - * Means project is dev. tool (like swagger code generator) - */ - isTool?: boolean; - /** web site address */ - address?: string; -} - -/** From T, pick a set of properties whose keys are in the union K */ -export interface PickJobTypeExcludeKeysIdOrId { - kind: JobKind; - name?: string; - link?: string; - /** - * Exist only in open source jobs - * Format: `${username}/${projectName}` - */ - github?: string; - /** - * Exist only in open source jobs - * Format: `${orgname}/${projectName}` - */ - npm?: string; - /** - * Exist only in open source jobs - * Means project is dev. tool (like swagger code generator) - */ - isTool?: boolean; - /** web site address */ - address?: string; -} - -export type OmitJobTypeIdOrId = PickJobTypeExcludeKeysIdOrId; - -export type OmitIdJobType = OmitJobTypeIdOrId; - -export type JobUpdateType = OmitIdJobType; - -/** From T, pick a set of properties whose keys are in the union K */ -export interface PickProjectTypeExcludeKeysJob { - id: string; - name?: string; - /** @format double */ - year: number; - description: string; - notImportant?: boolean; - prefix?: string; - tags: string[]; - teamSize: string; -} - -export type OmitProjectTypeJob = PickProjectTypeExcludeKeysJob; - -export type ExtractedProjectType = OmitProjectTypeJob & { - /** Information about job */ - job: JobType; -}; - -/** From T, pick a set of properties whose keys are in the union K */ -export interface PickProjectTypeExcludeKeysIdOrId { - name?: string; - job: string; - /** @format double */ - year: number; - description: string; - notImportant?: boolean; - prefix?: string; - tags: string[]; - teamSize: string; -} - -export type OmitProjectTypeIdOrId = PickProjectTypeExcludeKeysIdOrId; - -export type OmitIdProjectType = OmitProjectTypeIdOrId; - -export type ProjectUpdateType = OmitIdProjectType; - -export interface ProjectType { - id: string; - /** @format double */ - year: number; - description: string; - job: string; - name?: string; - notImportant?: boolean; - prefix?: string; - tags: string[]; - teamSize: string; -} - -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 = "http://localhost:8080/api/v1"; - 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.clone() 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 http://localhost:8080/api/v1 - */ -export class Api extends HttpClient { - auth = { - /** - * No description - * - * @tags Auth - * @name Login - * @request POST:/auth - */ - login: (data: AuthUserType, params: RequestParams = {}) => - this.request({ - path: `/auth`, - method: "POST", - body: data, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Auth - * @name Refresh - * @request POST:/auth/refresh - * @secure - */ - refresh: (params: RequestParams = {}) => - this.request({ - path: `/auth/refresh`, - method: "POST", - secure: true, - format: "json", - ...params, - }), - }; - jobs = { - /** - * No description - * - * @tags Jobs - * @name GetJobs - * @request GET:/jobs - * @secure - */ - getJobs: (params: RequestParams = {}) => - this.request({ - path: `/jobs`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name AddJob - * @request POST:/jobs - * @secure - */ - addJob: (data: JobUpdateType, params: RequestParams = {}) => - this.request({ - path: `/jobs`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name GetJob - * @request GET:/jobs/{id} - * @secure - */ - getJob: (id: string, params: RequestParams = {}) => - this.request({ - path: `/jobs/${id}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name UpdateJob - * @request PATCH:/jobs/{id} - * @secure - */ - updateJob: (id: string, data: JobUpdateType, params: RequestParams = {}) => - this.request({ - path: `/jobs/${id}`, - method: "PATCH", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Jobs - * @name DeleteJob - * @request DELETE:/jobs/{id} - * @secure - */ - deleteJob: (id: string, params: RequestParams = {}) => - this.request({ - path: `/jobs/${id}`, - method: "DELETE", - secure: true, - format: "json", - ...params, - }), - }; - projects = { - /** - * No description - * - * @tags Projects - * @name GetProjects - * @request GET:/projects - */ - getProjects: (params: RequestParams = {}) => - this.request({ - path: `/projects`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Projects - * @name AddProjects - * @request POST:/projects - * @secure - */ - addProjects: (data: ProjectUpdateType, params: RequestParams = {}) => - this.request({ - path: `/projects`, - method: "POST", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Projects - * @name UpdateProject - * @request PATCH:/projects/{id} - * @secure - */ - updateProject: (id: string, data: ProjectUpdateType, params: RequestParams = {}) => - this.request({ - path: `/projects/${id}`, - method: "PATCH", - body: data, - secure: true, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags Projects - * @name DeleteProject - * @request DELETE:/projects/{id} - */ - deleteProject: (id: string, params: RequestParams = {}) => - this.request({ - path: `/projects/${id}`, - method: "DELETE", - format: "json", - ...params, - }), - }; -} diff --git a/tests/spec/enumNamesAsValues/test.js b/tests/spec/enumNamesAsValues/test.js deleted file mode 100644 index 5433d3d1..00000000 --- a/tests/spec/enumNamesAsValues/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--enum-names-as-values option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - enumNamesAsValues: true, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/enums-2.0/schema.ts b/tests/spec/enums-2.0/__snapshots__/basic.test.ts.snap similarity index 93% rename from tests/spec/enums-2.0/schema.ts rename to tests/spec/enums-2.0/__snapshots__/basic.test.ts.snap index 4fa5c9ad..dcbb2c54 100644 --- a/tests/spec/enums-2.0/schema.ts +++ b/tests/spec/enums-2.0/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > enums-2.0 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -98,3 +101,5 @@ export interface PostFooPayload { export interface PostFooParams { testKek: 1 | 2 | 3 | 4 | 5; } +" +`; diff --git a/tests/spec/enums-2.0/basic.test.ts b/tests/spec/enums-2.0/basic.test.ts new file mode 100644 index 00000000..ebe7396e --- /dev/null +++ b/tests/spec/enums-2.0/basic.test.ts @@ -0,0 +1,40 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("enums-2.0", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + extractRequestParams: true, + extractRequestBody: true, + extractResponseBody: true, + extractResponseError: true, + generateClient: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/enums-2.0/expected.ts b/tests/spec/enums-2.0/expected.ts deleted file mode 100644 index 4fa5c9ad..00000000 --- a/tests/spec/enums-2.0/expected.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -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", - Boiler = "Boiler", -} - -export enum StringOnlyEnumNames { - Bla = "Bla", - Blabla = "Blabla", - Boiler = "Boiler", -} - -export enum StringEnums { - Bla = "foo", - Blabla = "bar", - Boiler = "Boiler", -} - -export enum StringCompleteEnums { - Bla = "foo", - Blabla = "bar", - Boiler = "baz", -} - -/** @format int32 */ -export enum EmptyEnum { - Bla = "Bla", - Blabla = "Blabla", - Boiler = "Boiler", -} - -/** @format int32 */ -export enum EnumWithMoreNames { - Bla = 1, - Blabla = "Blabla", - Boiler = "Boiler", -} - -/** @format int32 */ -export enum SomeInterestEnum { - Bla = 6, - Blabla = 2, - Boiler = 1, - Bbabab = 67, - Nowadays = 88, - FAIL = 122, - Vvvvv = 88, - ASdasAS = 0, - ASDsacZX = 213, - Zook = 12378, - EnumMm = 123125, - VCsa = 32452, - Yuuu = 1111, - ASddd = 66666, - ASdsdsa = "ASdsdsa", - 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 deleted file mode 100644 index 802558e7..00000000 --- a/tests/spec/enums-2.0/test.js +++ /dev/null @@ -1,30 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "enums-2.0 option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - extractRequestParams: true, - extractRequestBody: true, - extractResponseBody: true, - extractResponseError: true, - generateClient: false, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/extra-templates/expected.ts b/tests/spec/extra-templates/expected.ts deleted file mode 100644 index cd2bfe71..00000000 --- a/tests/spec/extra-templates/expected.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** - Swagger Petstore - 1.0.0 - A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification -*/ -export class Api { - private request(params: Record) { - return fetch(params as any); - } -} diff --git a/tests/spec/extract-enums/v2.0/expected.ts b/tests/spec/extract-enums/v2.0/expected.ts deleted file mode 100644 index 7d56cc7a..00000000 --- a/tests/spec/extract-enums/v2.0/expected.ts +++ /dev/null @@ -1,238 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export enum TypeNamePrefixEnumRootTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", - EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", - EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", - EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", - EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", - EnumKeyPrefixTest1EnumKeySuffix = "test1", - EnumKeyPrefixTest2EnumKeySuffix = "test2", -} - -export interface TypeNamePrefixTreeTypeNameSuffix { - tree?: { - mode?: TypeNamePrefixTreeModeEnumTypeNameSuffix; - "mode-num"?: TypeNamePrefixTreeModeNumEnumTypeNameSuffix; - type?: TypeNamePrefixTreeTypeEnumTypeNameSuffix; - bereke?: TypeNamePrefixTreeBerekeEnumTypeNameSuffix; - }[]; -} - -export enum TypeNamePrefixOnlyEnumNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringOnlyEnumNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringEnumsTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "foo", - EnumKeyPrefixBlablaEnumKeySuffix = "bar", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringCompleteEnumsTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "foo", - EnumKeyPrefixBlablaEnumKeySuffix = "bar", - EnumKeyPrefixBoilerEnumKeySuffix = "baz", -} - -/** @format int32 */ -export enum TypeNamePrefixEmptyEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -/** @format int32 */ -export enum TypeNamePrefixEnumWithMoreNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = 1, - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -/** @format int32 */ -export enum TypeNamePrefixSomeInterestEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = 6, - EnumKeyPrefixBlablaEnumKeySuffix = 2, - EnumKeyPrefixBoilerEnumKeySuffix = 1, - EnumKeyPrefixBbababEnumKeySuffix = 67, - EnumKeyPrefixNowadaysEnumKeySuffix = 88, - EnumKeyPrefix_FAIL_EnumKeySuffix = 122, - EnumKeyPrefixVvvvvEnumKeySuffix = 88, - EnumKeyPrefixASdasASEnumKeySuffix = 0, - EnumKeyPrefixASDsacZXEnumKeySuffix = 213, - EnumKeyPrefixZookEnumKeySuffix = 12378, - EnumKeyPrefixEnumMmEnumKeySuffix = 123125, - EnumKeyPrefixVCsaEnumKeySuffix = 32452, - EnumKeyPrefixYuuuEnumKeySuffix = 1111, - EnumKeyPrefixASdddEnumKeySuffix = 66666, - EnumKeyPrefixASdsdsaEnumKeySuffix = "ASdsdsa", - EnumKeyPrefixASDdsEnumKeySuffix = "ASDds", - EnumKeyPrefix_HSDFDS_EnumKeySuffix = "HSDFDS", -} - -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", - EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", - EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", -} - -export enum TypeNamePrefixTreeModeNumEnumTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, - EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, - EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, - EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, - EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, -} - -export enum TypeNamePrefixTreeTypeEnumTypeNameSuffix { - EnumKeyPrefixBlobEnumKeySuffix = "blob", - EnumKeyPrefixTreeEnumKeySuffix = "tree", - EnumKeyPrefixCommitEnumKeySuffix = "commit", -} - -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.ts b/tests/spec/extract-enums/v2.0/schema.ts deleted file mode 100644 index 7d56cc7a..00000000 --- a/tests/spec/extract-enums/v2.0/schema.ts +++ /dev/null @@ -1,238 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export enum TypeNamePrefixEnumRootTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", - EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", - EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", - EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", - EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", - EnumKeyPrefixTest1EnumKeySuffix = "test1", - EnumKeyPrefixTest2EnumKeySuffix = "test2", -} - -export interface TypeNamePrefixTreeTypeNameSuffix { - tree?: { - mode?: TypeNamePrefixTreeModeEnumTypeNameSuffix; - "mode-num"?: TypeNamePrefixTreeModeNumEnumTypeNameSuffix; - type?: TypeNamePrefixTreeTypeEnumTypeNameSuffix; - bereke?: TypeNamePrefixTreeBerekeEnumTypeNameSuffix; - }[]; -} - -export enum TypeNamePrefixOnlyEnumNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringOnlyEnumNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringEnumsTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "foo", - EnumKeyPrefixBlablaEnumKeySuffix = "bar", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringCompleteEnumsTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "foo", - EnumKeyPrefixBlablaEnumKeySuffix = "bar", - EnumKeyPrefixBoilerEnumKeySuffix = "baz", -} - -/** @format int32 */ -export enum TypeNamePrefixEmptyEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -/** @format int32 */ -export enum TypeNamePrefixEnumWithMoreNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = 1, - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -/** @format int32 */ -export enum TypeNamePrefixSomeInterestEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = 6, - EnumKeyPrefixBlablaEnumKeySuffix = 2, - EnumKeyPrefixBoilerEnumKeySuffix = 1, - EnumKeyPrefixBbababEnumKeySuffix = 67, - EnumKeyPrefixNowadaysEnumKeySuffix = 88, - EnumKeyPrefix_FAIL_EnumKeySuffix = 122, - EnumKeyPrefixVvvvvEnumKeySuffix = 88, - EnumKeyPrefixASdasASEnumKeySuffix = 0, - EnumKeyPrefixASDsacZXEnumKeySuffix = 213, - EnumKeyPrefixZookEnumKeySuffix = 12378, - EnumKeyPrefixEnumMmEnumKeySuffix = 123125, - EnumKeyPrefixVCsaEnumKeySuffix = 32452, - EnumKeyPrefixYuuuEnumKeySuffix = 1111, - EnumKeyPrefixASdddEnumKeySuffix = 66666, - EnumKeyPrefixASdsdsaEnumKeySuffix = "ASdsdsa", - EnumKeyPrefixASDdsEnumKeySuffix = "ASDds", - EnumKeyPrefix_HSDFDS_EnumKeySuffix = "HSDFDS", -} - -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", - EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", - EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", -} - -export enum TypeNamePrefixTreeModeNumEnumTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, - EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, - EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, - EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, - EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, -} - -export enum TypeNamePrefixTreeTypeEnumTypeNameSuffix { - EnumKeyPrefixBlobEnumKeySuffix = "blob", - EnumKeyPrefixTreeEnumKeySuffix = "tree", - EnumKeyPrefixCommitEnumKeySuffix = "commit", -} - -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 deleted file mode 100644 index 95414617..00000000 --- a/tests/spec/extract-enums/v3.0/expected.ts +++ /dev/null @@ -1,400 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export enum TypeNamePrefixEnumRootTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", - EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", - EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", - EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", - EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", - EnumKeyPrefixTest1EnumKeySuffix = "test1", - EnumKeyPrefixTest2EnumKeySuffix = "test2", -} - -export interface TypeNamePrefixTreeTypeNameSuffix { - tree?: { - mode?: TypeNamePrefixTreeModeEnumTypeNameSuffix; - "mode-num"?: TypeNamePrefixTreeModeNumEnumTypeNameSuffix; - type?: TypeNamePrefixTreeTypeEnumTypeNameSuffix; - bereke?: TypeNamePrefixTreeBerekeEnumTypeNameSuffix; - }[]; -} - -export enum TypeNamePrefixOnlyEnumNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringOnlyEnumNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringEnumsTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "foo", - EnumKeyPrefixBlablaEnumKeySuffix = "bar", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringCompleteEnumsTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "foo", - EnumKeyPrefixBlablaEnumKeySuffix = "bar", - EnumKeyPrefixBoilerEnumKeySuffix = "baz", -} - -/** @format int32 */ -export enum TypeNamePrefixEmptyEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -/** @format int32 */ -export enum TypeNamePrefixEnumWithMoreNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = 1, - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -/** @format int32 */ -export enum TypeNamePrefixSomeInterestEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = 6, - EnumKeyPrefixBlablaEnumKeySuffix = 2, - EnumKeyPrefixBoilerEnumKeySuffix = 1, - EnumKeyPrefixBbababEnumKeySuffix = 67, - EnumKeyPrefixNowadaysEnumKeySuffix = 88, - EnumKeyPrefix_FAIL_EnumKeySuffix = 122, - EnumKeyPrefixVvvvvEnumKeySuffix = 88, - EnumKeyPrefixASdasASEnumKeySuffix = 0, - EnumKeyPrefixASDsacZXEnumKeySuffix = 213, - EnumKeyPrefixZookEnumKeySuffix = 12378, - EnumKeyPrefixEnumMmEnumKeySuffix = 123125, - EnumKeyPrefixVCsaEnumKeySuffix = 32452, - EnumKeyPrefixYuuuEnumKeySuffix = 1111, - EnumKeyPrefixASdddEnumKeySuffix = 66666, - EnumKeyPrefixASdsdsaEnumKeySuffix = "ASdsdsa", - EnumKeyPrefixASDdsEnumKeySuffix = "ASDds", - EnumKeyPrefix_HSDFDS_EnumKeySuffix = "HSDFDS", -} - -export enum TypeNamePrefixTreeModeEnumTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", - EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", - EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", - EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", - EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", -} - -export enum TypeNamePrefixTreeModeNumEnumTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, - EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, - EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, - EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, - EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, -} - -export enum TypeNamePrefixTreeTypeEnumTypeNameSuffix { - EnumKeyPrefixBlobEnumKeySuffix = "blob", - EnumKeyPrefixTreeEnumKeySuffix = "tree", - EnumKeyPrefixCommitEnumKeySuffix = "commit", -} - -export enum TypeNamePrefixTreeBerekeEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export interface TypeNamePrefixGetAbcGetParamsTypeNameSuffix { - statuses?: any[]; - /** - * Order By - * @default "created_time" - */ - order_by?: TypeNamePrefixOrderByEnumTypeNameSuffix; - statusesPath?: any[]; - /** - * Order By - * @default "created_time" - */ - orderPathBy?: TypeNamePrefixOrderPathByEnumTypeNameSuffix; - /** Tag Ids */ - tagPathIds?: string[]; -} - -/** - * Order By - * @default "created_time" - */ -export enum TypeNamePrefixOrderByEnumTypeNameSuffix { - EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", -} - -/** - * Order By - * @default "created_time" - */ -export enum TypeNamePrefixOrderPathByEnumTypeNameSuffix { - EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", -} - -/** - * Order By - * @default "created_time" - */ -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", -} - -export interface TypeNamePrefixGetCdeGetParamsTypeNameSuffix { - /** Tag Ids */ - tag_ids?: string[]; - SHOULD_NOT_BE_ANY?: { - tree?: { - mode?: TypeNamePrefixShouldNotBeAnyModeEnumTypeNameSuffix; - "mode-num"?: TypeNamePrefixShouldNotBeAnyModeNumEnumTypeNameSuffix; - type?: TypeNamePrefixShouldNotBeAnyTypeEnumTypeNameSuffix; - bereke?: TypeNamePrefixShouldNotBeAnyBerekeEnumTypeNameSuffix; - }[]; - }; - /** - * Order By - * @default "created_time" - */ - order_by?: TypeNamePrefixOrderByEnum1TypeNameSuffix; - shouldNotBeAnyPath?: { - tree?: { - mode?: TypeNamePrefixShouldNotBeAnyPathModeEnumTypeNameSuffix; - "mode-num"?: TypeNamePrefixShouldNotBeAnyPathModeNumEnumTypeNameSuffix; - type?: TypeNamePrefixShouldNotBeAnyPathTypeEnumTypeNameSuffix; - bereke?: TypeNamePrefixShouldNotBeAnyPathBerekeEnumTypeNameSuffix; - }[]; - }; - /** - * Order By - * @default "created_time" - */ - 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 TypeNamePrefixGetCdeGetParams1ModeEnumTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", - EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", - EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", - EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", - EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", -} - -export enum TypeNamePrefixGetCdeGetParams1ModeNumEnumTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, - EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, - EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, - EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, - EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, -} - -export enum TypeNamePrefixGetCdeGetParams1TypeEnumTypeNameSuffix { - EnumKeyPrefixBlobEnumKeySuffix = "blob", - EnumKeyPrefixTreeEnumKeySuffix = "tree", - EnumKeyPrefixCommitEnumKeySuffix = "commit", -} - -export enum TypeNamePrefixGetCdeGetParams1BerekeEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -/** - * Order By - * @default "created_time" - */ -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 TypeNamePrefixGetCdeGetParams1OrderByHeaderEnumTypeNameSuffix { - EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", -} - -/** - * Order By - * @default "created_time" - */ -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 deleted file mode 100644 index 95414617..00000000 --- a/tests/spec/extract-enums/v3.0/schema.ts +++ /dev/null @@ -1,400 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export enum TypeNamePrefixEnumRootTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", - EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", - EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", - EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", - EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", - EnumKeyPrefixTest1EnumKeySuffix = "test1", - EnumKeyPrefixTest2EnumKeySuffix = "test2", -} - -export interface TypeNamePrefixTreeTypeNameSuffix { - tree?: { - mode?: TypeNamePrefixTreeModeEnumTypeNameSuffix; - "mode-num"?: TypeNamePrefixTreeModeNumEnumTypeNameSuffix; - type?: TypeNamePrefixTreeTypeEnumTypeNameSuffix; - bereke?: TypeNamePrefixTreeBerekeEnumTypeNameSuffix; - }[]; -} - -export enum TypeNamePrefixOnlyEnumNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringOnlyEnumNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringEnumsTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "foo", - EnumKeyPrefixBlablaEnumKeySuffix = "bar", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export enum TypeNamePrefixStringCompleteEnumsTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "foo", - EnumKeyPrefixBlablaEnumKeySuffix = "bar", - EnumKeyPrefixBoilerEnumKeySuffix = "baz", -} - -/** @format int32 */ -export enum TypeNamePrefixEmptyEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -/** @format int32 */ -export enum TypeNamePrefixEnumWithMoreNamesTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = 1, - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -/** @format int32 */ -export enum TypeNamePrefixSomeInterestEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = 6, - EnumKeyPrefixBlablaEnumKeySuffix = 2, - EnumKeyPrefixBoilerEnumKeySuffix = 1, - EnumKeyPrefixBbababEnumKeySuffix = 67, - EnumKeyPrefixNowadaysEnumKeySuffix = 88, - EnumKeyPrefix_FAIL_EnumKeySuffix = 122, - EnumKeyPrefixVvvvvEnumKeySuffix = 88, - EnumKeyPrefixASdasASEnumKeySuffix = 0, - EnumKeyPrefixASDsacZXEnumKeySuffix = 213, - EnumKeyPrefixZookEnumKeySuffix = 12378, - EnumKeyPrefixEnumMmEnumKeySuffix = 123125, - EnumKeyPrefixVCsaEnumKeySuffix = 32452, - EnumKeyPrefixYuuuEnumKeySuffix = 1111, - EnumKeyPrefixASdddEnumKeySuffix = 66666, - EnumKeyPrefixASdsdsaEnumKeySuffix = "ASdsdsa", - EnumKeyPrefixASDdsEnumKeySuffix = "ASDds", - EnumKeyPrefix_HSDFDS_EnumKeySuffix = "HSDFDS", -} - -export enum TypeNamePrefixTreeModeEnumTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", - EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", - EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", - EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", - EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", -} - -export enum TypeNamePrefixTreeModeNumEnumTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, - EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, - EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, - EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, - EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, -} - -export enum TypeNamePrefixTreeTypeEnumTypeNameSuffix { - EnumKeyPrefixBlobEnumKeySuffix = "blob", - EnumKeyPrefixTreeEnumKeySuffix = "tree", - EnumKeyPrefixCommitEnumKeySuffix = "commit", -} - -export enum TypeNamePrefixTreeBerekeEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -export interface TypeNamePrefixGetAbcGetParamsTypeNameSuffix { - statuses?: any[]; - /** - * Order By - * @default "created_time" - */ - order_by?: TypeNamePrefixOrderByEnumTypeNameSuffix; - statusesPath?: any[]; - /** - * Order By - * @default "created_time" - */ - orderPathBy?: TypeNamePrefixOrderPathByEnumTypeNameSuffix; - /** Tag Ids */ - tagPathIds?: string[]; -} - -/** - * Order By - * @default "created_time" - */ -export enum TypeNamePrefixOrderByEnumTypeNameSuffix { - EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", -} - -/** - * Order By - * @default "created_time" - */ -export enum TypeNamePrefixOrderPathByEnumTypeNameSuffix { - EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", -} - -/** - * Order By - * @default "created_time" - */ -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", -} - -export interface TypeNamePrefixGetCdeGetParamsTypeNameSuffix { - /** Tag Ids */ - tag_ids?: string[]; - SHOULD_NOT_BE_ANY?: { - tree?: { - mode?: TypeNamePrefixShouldNotBeAnyModeEnumTypeNameSuffix; - "mode-num"?: TypeNamePrefixShouldNotBeAnyModeNumEnumTypeNameSuffix; - type?: TypeNamePrefixShouldNotBeAnyTypeEnumTypeNameSuffix; - bereke?: TypeNamePrefixShouldNotBeAnyBerekeEnumTypeNameSuffix; - }[]; - }; - /** - * Order By - * @default "created_time" - */ - order_by?: TypeNamePrefixOrderByEnum1TypeNameSuffix; - shouldNotBeAnyPath?: { - tree?: { - mode?: TypeNamePrefixShouldNotBeAnyPathModeEnumTypeNameSuffix; - "mode-num"?: TypeNamePrefixShouldNotBeAnyPathModeNumEnumTypeNameSuffix; - type?: TypeNamePrefixShouldNotBeAnyPathTypeEnumTypeNameSuffix; - bereke?: TypeNamePrefixShouldNotBeAnyPathBerekeEnumTypeNameSuffix; - }[]; - }; - /** - * Order By - * @default "created_time" - */ - 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 TypeNamePrefixGetCdeGetParams1ModeEnumTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = "100644", - EnumKeyPrefixInvalidKey100755EnumKeySuffix = "100755", - EnumKeyPrefixInvalidKey040000EnumKeySuffix = "040000", - EnumKeyPrefixInvalidKey160000EnumKeySuffix = "160000", - EnumKeyPrefixInvalidKey120000EnumKeySuffix = "120000", -} - -export enum TypeNamePrefixGetCdeGetParams1ModeNumEnumTypeNameSuffix { - EnumKeyPrefixInvalidKey100644EnumKeySuffix = 100644, - EnumKeyPrefixInvalidKey100755EnumKeySuffix = 100755, - EnumKeyPrefixInvalidKey40000EnumKeySuffix = 40000, - EnumKeyPrefixInvalidKey160000EnumKeySuffix = 160000, - EnumKeyPrefixInvalidKey120000EnumKeySuffix = 120000, -} - -export enum TypeNamePrefixGetCdeGetParams1TypeEnumTypeNameSuffix { - EnumKeyPrefixBlobEnumKeySuffix = "blob", - EnumKeyPrefixTreeEnumKeySuffix = "tree", - EnumKeyPrefixCommitEnumKeySuffix = "commit", -} - -export enum TypeNamePrefixGetCdeGetParams1BerekeEnumTypeNameSuffix { - EnumKeyPrefixBlaEnumKeySuffix = "Bla", - EnumKeyPrefixBlablaEnumKeySuffix = "Blabla", - EnumKeyPrefixBoilerEnumKeySuffix = "Boiler", -} - -/** - * Order By - * @default "created_time" - */ -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 TypeNamePrefixGetCdeGetParams1OrderByHeaderEnumTypeNameSuffix { - EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", -} - -/** - * Order By - * @default "created_time" - */ -export enum TypeNamePrefixGetCdeGetParams1EnumTypeNameSuffix { - EnumKeyPrefixCreatedTimeEnumKeySuffix = "created_time", -} diff --git a/tests/spec/extractRequestBody/schema.ts b/tests/spec/extractRequestBody/__snapshots__/basic.test.ts.snap similarity index 93% rename from tests/spec/extractRequestBody/schema.ts rename to tests/spec/extractRequestBody/__snapshots__/basic.test.ts.snap index 2a26c8e7..88abe76a 100644 --- a/tests/spec/extractRequestBody/schema.ts +++ b/tests/spec/extractRequestBody/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --extract-request-body 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -166,7 +169,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -231,7 +234,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -253,7 +256,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -269,7 +272,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -333,7 +336,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -381,7 +384,7 @@ export class HttpClient { * @externalDocs http://swagger.io * @contact * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key \`special-key\` to test the authorization filters. */ export class Api extends HttpClient { pet = { @@ -396,7 +399,7 @@ export class Api extends HttpClient this.request({ - path: `/pet`, + path: \`/pet\`, method: "POST", body: body, secure: true, @@ -415,7 +418,7 @@ export class Api extends HttpClient this.request({ - path: `/pet`, + path: \`/pet\`, method: "PUT", body: body, secure: true, @@ -440,7 +443,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/findByStatus`, + path: \`/pet/findByStatus\`, method: "GET", query: query, secure: true, @@ -458,7 +461,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/single-form-url-encoded`, + path: \`/pet/single-form-url-encoded\`, method: "POST", body: data, type: ContentType.UrlEncoded, @@ -482,7 +485,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/form-url-encoded`, + path: \`/pet/form-url-encoded\`, method: "POST", body: data, type: ContentType.UrlEncoded, @@ -508,7 +511,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/end-form-url-encoded`, + path: \`/pet/end-form-url-encoded\`, method: "POST", body: data, type: ContentType.UrlEncoded, @@ -533,7 +536,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/findByTags`, + path: \`/pet/findByTags\`, method: "GET", query: query, secure: true, @@ -552,7 +555,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}`, + path: \`/pet/\${petId}\`, method: "GET", secure: true, format: "json", @@ -570,7 +573,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}`, + path: \`/pet/\${petId}\`, method: "POST", body: data, secure: true, @@ -589,7 +592,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}`, + path: \`/pet/\${petId}\`, method: "DELETE", secure: true, ...params, @@ -606,7 +609,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}/uploadImage`, + path: \`/pet/\${petId}/uploadImage\`, method: "POST", body: data, secure: true, @@ -627,7 +630,7 @@ export class Api extends HttpClient this.request, any>({ - path: `/store/inventory`, + path: \`/store/inventory\`, method: "GET", secure: true, format: "json", @@ -644,7 +647,7 @@ export class Api extends HttpClient this.request({ - path: `/store/order`, + path: \`/store/order\`, method: "POST", body: body, type: ContentType.Json, @@ -662,7 +665,7 @@ export class Api extends HttpClient this.request({ - path: `/store/order/${orderId}`, + path: \`/store/order/\${orderId}\`, method: "GET", format: "json", ...params, @@ -678,7 +681,7 @@ export class Api extends HttpClient this.request({ - path: `/store/order/${orderId}`, + path: \`/store/order/\${orderId}\`, method: "DELETE", ...params, }), @@ -694,7 +697,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "POST", body: body, type: ContentType.Json, @@ -711,7 +714,7 @@ export class Api extends HttpClient this.request({ - path: `/user/createWithArray`, + path: \`/user/createWithArray\`, method: "POST", body: body, type: ContentType.Json, @@ -728,7 +731,7 @@ export class Api extends HttpClient this.request({ - path: `/user/createWithList`, + path: \`/user/createWithList\`, method: "POST", body: body, type: ContentType.Json, @@ -753,7 +756,7 @@ export class Api extends HttpClient this.request({ - path: `/user/login`, + path: \`/user/login\`, method: "GET", query: query, format: "json", @@ -770,7 +773,7 @@ export class Api extends HttpClient this.request({ - path: `/user/logout`, + path: \`/user/logout\`, method: "GET", ...params, }), @@ -785,7 +788,7 @@ export class Api extends HttpClient this.request({ - path: `/user/${username}`, + path: \`/user/\${username}\`, method: "GET", format: "json", ...params, @@ -801,7 +804,7 @@ export class Api extends HttpClient this.request({ - path: `/user/${username}`, + path: \`/user/\${username}\`, method: "PUT", body: body, type: ContentType.Json, @@ -818,9 +821,11 @@ export class Api extends HttpClient this.request({ - path: `/user/${username}`, + path: \`/user/\${username}\`, method: "DELETE", ...params, }), }; } +" +`; diff --git a/tests/spec/extractRequestBody/basic.test.ts b/tests/spec/extractRequestBody/basic.test.ts new file mode 100644 index 00000000..734bd017 --- /dev/null +++ b/tests/spec/extractRequestBody/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--extract-request-body", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + extractRequestBody: true, + typeSuffix: "TTT", + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/extractRequestBody/expected.ts b/tests/spec/extractRequestBody/expected.ts deleted file mode 100644 index 2a26c8e7..00000000 --- a/tests/spec/extractRequestBody/expected.ts +++ /dev/null @@ -1,826 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** - * Pet Order - * An order for a pets from the pet store - * @example {"petId":6,"quantity":1,"id":0,"shipDate":"2000-01-23T04:56:07.000+00:00","complete":false,"status":"placed"} - */ -export interface OrderTTT { - /** @format int64 */ - id?: number; - /** @format int64 */ - petId?: number; - /** @format int32 */ - quantity?: number; - /** @format date-time */ - shipDate?: string; - /** Order Status */ - status?: "placed" | "approved" | "delivered" | null; - /** @default false */ - complete?: boolean; -} - -/** - * Pet category - * A category for a pet - * @example {"name":"name","id":6} - */ -export interface CategoryTTT { - /** @format int64 */ - id?: number; - name?: string; -} - -/** - * a User - * A User who is purchasing from the pet store - * @example {"firstName":"firstName","lastName":"lastName","password":"password","userStatus":6,"phone":"phone","id":0,"email":"email","username":"username"} - */ -export interface UserTTT { - /** @format int64 */ - id?: number; - username?: string; - firstName?: string; - lastName?: string; - email?: string; - password?: string; - phone?: string; - /** - * User Status - * @format int32 - */ - userStatus?: number; -} - -/** - * Pet Tag - * A tag for a pet - * @example {"name":"name","id":1} - */ -export interface TagTTT { - /** @format int64 */ - id?: number; - name?: string; -} - -export enum PetNamesTTT { - FluffyHero = "Fluffy Hero", - PiggyPo = "Piggy Po", - SwaggerTypescriptApi = "Swagger Typescript Api", - UPPER_CASE = "UPPER_CASE", -} - -export enum PetIdsTTT { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -export enum PetIdsWithWrongEnumTTT { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -/** - * a Pet - * A pet for sale in the pet store - * @example {"photoUrls":["photoUrls","photoUrls"],"name":"doggie","id":0,"category":{"name":"name","id":6},"tags":[{"name":"name","id":1},{"name":"name","id":1}],"status":"available"} - */ -export interface PetTTT { - /** @format int64 */ - id?: number; - /** A category for a pet */ - category?: CategoryTTT; - /** @example "doggie" */ - name: string; - photoUrls: string[]; - tags?: TagTTT[]; - /** pet status in the store */ - status?: "available" | "pending" | "sold"; -} - -/** - * An uploaded response - * Describes the result of uploading an image resource - * @example {"code":0,"type":"type","message":"message"} - */ -export interface ApiResponseTTT { - /** @format int32 */ - code?: number; - type?: string; - message?: string; -} - -/** some description */ -export interface AmountTTT { - /** - * some description - * @format double - * @min 0.01 - * @max 1000000000000000 - */ - value: number; - /** some description */ - currency: CurrencyTTT; -} - -/** - * some description - * @pattern ^[A-Z]{3,3}$ - */ -export type CurrencyTTT = string; - -export interface SingleFormUrlEncodedRequestPayloadTTT { - /** @format string */ - param1: string; - param2: string; -} - -export interface UpdatePetWithFormPayloadTTT { - /** Updated name of the pet */ - name?: string; - /** Updated status of the pet */ - status?: string; -} - -export interface UploadFilePayloadTTT { - /** Additional data to pass to server */ - additionalMetadata?: string; - /** file to upload */ - file?: File; -} - -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 = "http://petstore.swagger.io/v2"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/v2 - * @externalDocs http://swagger.io - * @contact - * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - */ -export class Api extends HttpClient { - pet = { - /** - * No description - * - * @tags pet - * @name AddPet - * @summary Add a new pet to the store - * @request POST:/pet - * @secure - */ - addPet: (body: PetTTT, params: RequestParams = {}) => - this.request({ - path: `/pet`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePet - * @summary Update an existing pet - * @request PUT:/pet - * @secure - */ - updatePet: (body: PetTTT, params: RequestParams = {}) => - this.request({ - path: `/pet`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * @description Multiple status values can be provided with comma separated strings - * - * @tags pet - * @name FindPetsByStatus - * @summary Finds Pets by status - * @request GET:/pet/findByStatus - * @secure - */ - findPetsByStatus: ( - query: { - /** Status values that need to be considered for filter */ - status: ("available" | "pending" | "sold")[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/findByStatus`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pet - * @name SingleFormUrlEncodedRequest - * @summary summary - * @request POST:/pet/single-form-url-encoded - */ - singleFormUrlEncodedRequest: (data: SingleFormUrlEncodedRequestPayloadTTT, params: RequestParams = {}) => - this.request({ - path: `/pet/single-form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name FormUrlEncodedRequest - * @summary summary - * @request POST:/pet/form-url-encoded - */ - formUrlEncodedRequest: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name FormUrlEncodedRequest2 - * @summary summary - * @request POST:/pet/end-form-url-encoded - * @originalName formUrlEncodedRequest - * @duplicate - */ - formUrlEncodedRequest2: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/end-form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @tags pet - * @name FindPetsByTags - * @summary Finds Pets by tags - * @request GET:/pet/findByTags - * @deprecated - * @secure - */ - findPetsByTags: ( - query: { - /** Tags to filter by */ - tags: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/findByTags`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Returns a single pet - * - * @tags pet - * @name GetPetById - * @summary Find pet by ID - * @request GET:/pet/{petId} - * @secure - */ - getPetById: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePetWithForm - * @summary Updates a pet in the store with form data - * @request POST:/pet/{petId} - * @secure - */ - updatePetWithForm: (petId: number, data: UpdatePetWithFormPayloadTTT, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name DeletePet - * @summary Deletes a pet - * @request DELETE:/pet/{petId} - * @secure - */ - deletePet: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UploadFile - * @summary uploads an image - * @request POST:/pet/{petId}/uploadImage - * @secure - */ - uploadFile: (petId: number, data: UploadFilePayloadTTT, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}/uploadImage`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - format: "json", - ...params, - }), - }; - store = { - /** - * @description Returns a map of status codes to quantities - * - * @tags store - * @name GetInventory - * @summary Returns pet inventories by status - * @request GET:/store/inventory - * @secure - */ - getInventory: (params: RequestParams = {}) => - this.request, any>({ - path: `/store/inventory`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags store - * @name PlaceOrder - * @summary Place an order for a pet - * @request POST:/store/order - */ - placeOrder: (body: OrderTTT, params: RequestParams = {}) => - this.request({ - path: `/store/order`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @tags store - * @name GetOrderById - * @summary Find purchase order by ID - * @request GET:/store/order/{orderId} - */ - getOrderById: (orderId: number, params: RequestParams = {}) => - this.request({ - path: `/store/order/${orderId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @tags store - * @name DeleteOrder - * @summary Delete purchase order by ID - * @request DELETE:/store/order/{orderId} - */ - deleteOrder: (orderId: string, params: RequestParams = {}) => - this.request({ - path: `/store/order/${orderId}`, - method: "DELETE", - ...params, - }), - }; - user = { - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name CreateUser - * @summary Create user - * @request POST:/user - */ - createUser: (body: UserTTT, params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithArrayInput - * @summary Creates list of users with given input array - * @request POST:/user/createWithArray - */ - createUsersWithArrayInput: (body: UserTTT[], params: RequestParams = {}) => - this.request({ - path: `/user/createWithArray`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithListInput - * @summary Creates list of users with given input array - * @request POST:/user/createWithList - */ - createUsersWithListInput: (body: UserTTT[], params: RequestParams = {}) => - this.request({ - path: `/user/createWithList`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name LoginUser - * @summary Logs user into the system - * @request GET:/user/login - */ - loginUser: ( - query: { - /** The user name for login */ - username: string; - /** The password for login in clear text */ - password: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/login`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags user - * @name LogoutUser - * @summary Logs out current logged in user session - * @request GET:/user/logout - */ - logoutUser: (params: RequestParams = {}) => - this.request({ - path: `/user/logout`, - method: "GET", - ...params, - }), - - /** - * No description - * - * @tags user - * @name GetUserByName - * @summary Get user by user name - * @request GET:/user/{username} - */ - getUserByName: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name UpdateUser - * @summary Updated user - * @request PUT:/user/{username} - */ - updateUser: (username: string, body: UserTTT, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "PUT", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name DeleteUser - * @summary Delete user - * @request DELETE:/user/{username} - */ - deleteUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "DELETE", - ...params, - }), - }; -} diff --git a/tests/spec/extractRequestBody/test.js b/tests/spec/extractRequestBody/test.js deleted file mode 100644 index 96cd716b..00000000 --- a/tests/spec/extractRequestBody/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--extract-request-body option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - extractRequestBody: true, - typeSuffix: "TTT", - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/extractRequestParams/schema.ts b/tests/spec/extractRequestParams/__snapshots__/basic.test.ts.snap similarity index 91% rename from tests/spec/extractRequestParams/schema.ts rename to tests/spec/extractRequestParams/__snapshots__/basic.test.ts.snap index 08b222e0..ffbbe4ed 100644 --- a/tests/spec/extractRequestParams/schema.ts +++ b/tests/spec/extractRequestParams/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --extract-request-params 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -88,7 +91,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -153,7 +156,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -175,7 +178,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -191,7 +194,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -255,7 +258,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -307,7 +310,7 @@ export class HttpClient { export class Api extends HttpClient { key = { /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. + * @description Revoke an Authentiq ID using email & phone. If called with \`email\` and \`phone\` only, a verification code will be sent by email. Do a second call adding \`code\` to complete the revocation. * * @tags key, delete * @name KeyRevokeNosecret @@ -321,7 +324,7 @@ export class Api extends HttpClient({ - path: `/key`, + path: \`/key\`, method: "DELETE", query: query, format: "json", @@ -329,7 +332,7 @@ export class Api extends HttpClient extends HttpClient({ - path: `/key`, + path: \`/key\`, method: "POST", body: body, format: "json", @@ -360,7 +363,7 @@ export class Api extends HttpClient this.request({ - path: `/key/${barBaz}/${pk}`, + path: \`/key/\${barBaz}/\${pk}\`, method: "DELETE", query: query, ...params, @@ -383,7 +386,7 @@ export class Api extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "DELETE", query: query, format: "json", @@ -408,7 +411,7 @@ export class Api extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "GET", format: "json", ...params, @@ -423,7 +426,7 @@ export class Api extends HttpClient this.request({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "HEAD", ...params, }), @@ -443,7 +446,7 @@ export class Api extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "POST", body: body, format: "json", @@ -451,7 +454,7 @@ export class Api extends HttpClient extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "PUT", body: body, format: "json", @@ -488,7 +491,7 @@ export class Api extends HttpClient({ - path: `/login`, + path: \`/login\`, method: "POST", query: query, body: body, @@ -514,7 +517,7 @@ export class Api extends HttpClient({ - path: `/scope`, + path: \`/scope\`, method: "POST", query: query, body: body, @@ -537,7 +540,7 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "DELETE", format: "json", ...params, @@ -560,7 +563,7 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "GET", format: "json", ...params, @@ -575,7 +578,7 @@ export class Api extends HttpClient this.request({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "HEAD", ...params, }), @@ -595,7 +598,7 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "POST", type: ContentType.Json, format: "json", @@ -619,9 +622,11 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "PUT", ...params, }), }; } +" +`; diff --git a/tests/spec/extractRequestParams/basic.test.ts b/tests/spec/extractRequestParams/basic.test.ts new file mode 100644 index 00000000..130efc36 --- /dev/null +++ b/tests/spec/extractRequestParams/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--extract-request-params", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + extractRequestParams: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/extractRequestParams/expected.ts b/tests/spec/extractRequestParams/expected.ts deleted file mode 100644 index 08b222e0..00000000 --- a/tests/spec/extractRequestParams/expected.ts +++ /dev/null @@ -1,627 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Authentiq ID in JWT format, self-signed. */ -export interface AuthentiqID { - /** device token for push messages */ - devtoken?: string; - /** UUID and public signing key */ - sub: string; -} - -/** Claim in JWT format, self- or issuer-signed. */ -export interface Claims { - email?: string; - phone?: string; - /** claim scope */ - scope: string; - /** UUID */ - sub: string; - type?: string; -} - -export interface Error { - detail?: string; - error: number; - title?: string; - /** unique uri for this error */ - type?: string; -} - -/** PushToken in JWT format, self-signed. */ -export interface PushToken { - /** audience (URI) */ - aud: string; - exp?: number; - iat?: number; - /** issuer (URI) */ - iss: string; - nbf?: number; - /** UUID and public signing key */ - sub: string; -} - -export interface KeyRevokeNosecretParams { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; -} - -export interface KeyRevokeParams { - /** revokation secret */ - secret: string; - /** bar baz */ - barBaz: string; - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; -} - -export interface KeyRevoke2Params { - /** revokation secret */ - secret: string; - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; -} - -export interface PushLoginRequestParams { - /** URI App will connect to */ - callback: string; -} - -export interface SignRequestParams { - /** test only mode, using test issuer */ - test?: number; -} - -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://6-dot-authentiqio.appspot.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 Authentiq - * @version 6 - * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://authentiq.com/terms/ - * @baseUrl https://6-dot-authentiqio.appspot.com - * @contact Authentiq team (http://authentiq.io/support) - * - * Strong authentication, without the passwords. - */ -export class Api extends HttpClient { - key = { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret: (query: KeyRevokeNosecretParams, params: RequestParams = {}) => - this.request< - { - /** pending or done */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "DELETE", - query: query, - format: "json", - ...params, - }), - - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister: (body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @name KeyRevoke - * @request DELETE:/key/{bar-baz}/{PK} - */ - keyRevoke: ({ barBaz, pk, ...query }: KeyRevokeParams, params: RequestParams = {}) => - this.request({ - path: `/key/${barBaz}/${pk}`, - method: "DELETE", - query: query, - ...params, - }), - - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke2 - * @request DELETE:/key/{PK} - * @originalName keyRevoke - * @duplicate - */ - keyRevoke2: ({ pk, ...query }: KeyRevoke2Params, params: RequestParams = {}) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "DELETE", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey: (pk: string, params: RequestParams = {}) => - this.request< - { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey: (pk: string, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "HEAD", - ...params, - }), - - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate: (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind: (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "PUT", - body: body, - format: "json", - ...params, - }), - }; - login = { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest: (query: PushLoginRequestParams, body: PushToken, params: RequestParams = {}) => - this.request< - { - /** sent */ - status?: string; - }, - Error - >({ - path: `/login`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }), - }; - scope = { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest: (query: SignRequestParams, body: Claims, params: RequestParams = {}) => - this.request< - { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }, - Error - >({ - path: `/scope`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }), - - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete: (job: string, params: RequestParams = {}) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "DELETE", - format: "json", - ...params, - }), - - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve: (job: string, params: RequestParams = {}) => - this.request< - { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "HEAD", - ...params, - }), - - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm: (job: string, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "POST", - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate: (job: string, params: RequestParams = {}) => - this.request< - { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "PUT", - ...params, - }), - }; -} diff --git a/tests/spec/extractRequestParams/test.js b/tests/spec/extractRequestParams/test.js deleted file mode 100644 index e89d798b..00000000 --- a/tests/spec/extractRequestParams/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--extract-request-params option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - extractRequestParams: true, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/extractResponseBody/schema.ts b/tests/spec/extractResponseBody/__snapshots__/basic.test.ts.snap similarity index 93% rename from tests/spec/extractResponseBody/schema.ts rename to tests/spec/extractResponseBody/__snapshots__/basic.test.ts.snap index 6ac2fc9e..457907f3 100644 --- a/tests/spec/extractResponseBody/schema.ts +++ b/tests/spec/extractResponseBody/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --extract-response-body 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -168,7 +171,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -233,7 +236,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -255,7 +258,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -271,7 +274,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -335,7 +338,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -383,7 +386,7 @@ export class HttpClient { * @externalDocs http://swagger.io * @contact * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key \`special-key\` to test the authorization filters. */ export class Api extends HttpClient { pet = { @@ -398,7 +401,7 @@ export class Api extends HttpClient this.request({ - path: `/pet`, + path: \`/pet\`, method: "POST", body: body, secure: true, @@ -417,7 +420,7 @@ export class Api extends HttpClient this.request({ - path: `/pet`, + path: \`/pet\`, method: "PUT", body: body, secure: true, @@ -442,7 +445,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/findByStatus`, + path: \`/pet/findByStatus\`, method: "GET", query: query, secure: true, @@ -466,7 +469,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/single-form-url-encoded`, + path: \`/pet/single-form-url-encoded\`, method: "POST", body: data, type: ContentType.UrlEncoded, @@ -490,7 +493,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/form-url-encoded`, + path: \`/pet/form-url-encoded\`, method: "POST", body: data, type: ContentType.UrlEncoded, @@ -516,7 +519,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/end-form-url-encoded`, + path: \`/pet/end-form-url-encoded\`, method: "POST", body: data, type: ContentType.UrlEncoded, @@ -541,7 +544,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/findByTags`, + path: \`/pet/findByTags\`, method: "GET", query: query, secure: true, @@ -559,7 +562,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}`, + path: \`/pet/\${petId}\`, method: "GET", secure: true, ...params, @@ -585,7 +588,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}`, + path: \`/pet/\${petId}\`, method: "POST", body: data, secure: true, @@ -604,7 +607,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}`, + path: \`/pet/\${petId}\`, method: "DELETE", secure: true, ...params, @@ -630,7 +633,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}/uploadImage`, + path: \`/pet/\${petId}/uploadImage\`, method: "POST", body: data, secure: true, @@ -650,7 +653,7 @@ export class Api extends HttpClient this.request({ - path: `/store/inventory`, + path: \`/store/inventory\`, method: "GET", secure: true, ...params, @@ -666,7 +669,7 @@ export class Api extends HttpClient this.request({ - path: `/store/order`, + path: \`/store/order\`, method: "POST", body: body, type: ContentType.Json, @@ -683,7 +686,7 @@ export class Api extends HttpClient this.request({ - path: `/store/order/${orderId}`, + path: \`/store/order/\${orderId}\`, method: "GET", ...params, }), @@ -698,7 +701,7 @@ export class Api extends HttpClient this.request({ - path: `/store/order/${orderId}`, + path: \`/store/order/\${orderId}\`, method: "DELETE", ...params, }), @@ -714,7 +717,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "POST", body: body, type: ContentType.Json, @@ -731,7 +734,7 @@ export class Api extends HttpClient this.request({ - path: `/user/createWithArray`, + path: \`/user/createWithArray\`, method: "POST", body: body, type: ContentType.Json, @@ -748,7 +751,7 @@ export class Api extends HttpClient this.request({ - path: `/user/createWithList`, + path: \`/user/createWithList\`, method: "POST", body: body, type: ContentType.Json, @@ -773,7 +776,7 @@ export class Api extends HttpClient this.request({ - path: `/user/login`, + path: \`/user/login\`, method: "GET", query: query, ...params, @@ -789,7 +792,7 @@ export class Api extends HttpClient this.request({ - path: `/user/logout`, + path: \`/user/logout\`, method: "GET", ...params, }), @@ -804,7 +807,7 @@ export class Api extends HttpClient this.request({ - path: `/user/${username}`, + path: \`/user/\${username}\`, method: "GET", ...params, }), @@ -819,7 +822,7 @@ export class Api extends HttpClient this.request({ - path: `/user/${username}`, + path: \`/user/\${username}\`, method: "PUT", body: body, type: ContentType.Json, @@ -836,9 +839,11 @@ export class Api extends HttpClient this.request({ - path: `/user/${username}`, + path: \`/user/\${username}\`, method: "DELETE", ...params, }), }; } +" +`; diff --git a/tests/spec/extractResponseBody/basic.test.ts b/tests/spec/extractResponseBody/basic.test.ts new file mode 100644 index 00000000..049e4313 --- /dev/null +++ b/tests/spec/extractResponseBody/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--extract-response-body", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + extractResponseBody: true, + typeSuffix: "TTT", + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/extractResponseBody/expected.ts b/tests/spec/extractResponseBody/expected.ts deleted file mode 100644 index 6ac2fc9e..00000000 --- a/tests/spec/extractResponseBody/expected.ts +++ /dev/null @@ -1,844 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** - * Pet Order - * An order for a pets from the pet store - * @example {"petId":6,"quantity":1,"id":0,"shipDate":"2000-01-23T04:56:07.000+00:00","complete":false,"status":"placed"} - */ -export interface OrderTTT { - /** @format int64 */ - id?: number; - /** @format int64 */ - petId?: number; - /** @format int32 */ - quantity?: number; - /** @format date-time */ - shipDate?: string; - /** Order Status */ - status?: "placed" | "approved" | "delivered" | null; - /** @default false */ - complete?: boolean; -} - -/** - * Pet category - * A category for a pet - * @example {"name":"name","id":6} - */ -export interface CategoryTTT { - /** @format int64 */ - id?: number; - name?: string; -} - -/** - * a User - * A User who is purchasing from the pet store - * @example {"firstName":"firstName","lastName":"lastName","password":"password","userStatus":6,"phone":"phone","id":0,"email":"email","username":"username"} - */ -export interface UserTTT { - /** @format int64 */ - id?: number; - username?: string; - firstName?: string; - lastName?: string; - email?: string; - password?: string; - phone?: string; - /** - * User Status - * @format int32 - */ - userStatus?: number; -} - -/** - * Pet Tag - * A tag for a pet - * @example {"name":"name","id":1} - */ -export interface TagTTT { - /** @format int64 */ - id?: number; - name?: string; -} - -export enum PetNamesTTT { - FluffyHero = "Fluffy Hero", - PiggyPo = "Piggy Po", - SwaggerTypescriptApi = "Swagger Typescript Api", - UPPER_CASE = "UPPER_CASE", -} - -export enum PetIdsTTT { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -export enum PetIdsWithWrongEnumTTT { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -/** - * a Pet - * A pet for sale in the pet store - * @example {"photoUrls":["photoUrls","photoUrls"],"name":"doggie","id":0,"category":{"name":"name","id":6},"tags":[{"name":"name","id":1},{"name":"name","id":1}],"status":"available"} - */ -export interface PetTTT { - /** @format int64 */ - id?: number; - /** A category for a pet */ - category?: CategoryTTT; - /** @example "doggie" */ - name: string; - photoUrls: string[]; - tags?: TagTTT[]; - /** pet status in the store */ - status?: "available" | "pending" | "sold"; -} - -/** some description */ -export interface AmountTTT { - /** - * some description - * @format double - * @min 0.01 - * @max 1000000000000000 - */ - value: number; - /** some description */ - currency: CurrencyTTT; -} - -/** - * some description - * @pattern ^[A-Z]{3,3}$ - */ -export type CurrencyTTT = string; - -export type FindPetsByStatusDataTTT = PetTTT[]; - -export type SingleFormUrlEncodedRequestDataTTT = any; - -export type FormUrlEncodedRequestDataTTT = any; - -export type FormUrlEncodedRequest2DataTTT = any; - -export type FindPetsByTagsDataTTT = PetTTT[]; - -export type GetPetByIdDataTTT = PetTTT; - -/** - * An uploaded response - * Describes the result of uploading an image resource - * @example {"code":0,"type":"type","message":"message"} - */ -export interface UploadFileDataTTT { - /** @format int32 */ - code?: number; - type?: string; - message?: string; -} - -export type GetInventoryDataTTT = Record; - -export type PlaceOrderDataTTT = OrderTTT; - -export type GetOrderByIdDataTTT = OrderTTT; - -export type LoginUserDataTTT = string; - -export type GetUserByNameDataTTT = UserTTT; - -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 = "http://petstore.swagger.io/v2"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/v2 - * @externalDocs http://swagger.io - * @contact - * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - */ -export class Api extends HttpClient { - pet = { - /** - * No description - * - * @tags pet - * @name AddPet - * @summary Add a new pet to the store - * @request POST:/pet - * @secure - */ - addPet: (body: PetTTT, params: RequestParams = {}) => - this.request({ - path: `/pet`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePet - * @summary Update an existing pet - * @request PUT:/pet - * @secure - */ - updatePet: (body: PetTTT, params: RequestParams = {}) => - this.request({ - path: `/pet`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * @description Multiple status values can be provided with comma separated strings - * - * @tags pet - * @name FindPetsByStatus - * @summary Finds Pets by status - * @request GET:/pet/findByStatus - * @secure - */ - findPetsByStatus: ( - query: { - /** Status values that need to be considered for filter */ - status: ("available" | "pending" | "sold")[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/findByStatus`, - method: "GET", - query: query, - secure: true, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name SingleFormUrlEncodedRequest - * @summary summary - * @request POST:/pet/single-form-url-encoded - */ - singleFormUrlEncodedRequest: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/single-form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name FormUrlEncodedRequest - * @summary summary - * @request POST:/pet/form-url-encoded - */ - formUrlEncodedRequest: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name FormUrlEncodedRequest2 - * @summary summary - * @request POST:/pet/end-form-url-encoded - * @originalName formUrlEncodedRequest - * @duplicate - */ - formUrlEncodedRequest2: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/end-form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @tags pet - * @name FindPetsByTags - * @summary Finds Pets by tags - * @request GET:/pet/findByTags - * @deprecated - * @secure - */ - findPetsByTags: ( - query: { - /** Tags to filter by */ - tags: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/findByTags`, - method: "GET", - query: query, - secure: true, - ...params, - }), - - /** - * @description Returns a single pet - * - * @tags pet - * @name GetPetById - * @summary Find pet by ID - * @request GET:/pet/{petId} - * @secure - */ - getPetById: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "GET", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePetWithForm - * @summary Updates a pet in the store with form data - * @request POST:/pet/{petId} - * @secure - */ - updatePetWithForm: ( - petId: number, - data: { - /** Updated name of the pet */ - name?: string; - /** Updated status of the pet */ - status?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/${petId}`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name DeletePet - * @summary Deletes a pet - * @request DELETE:/pet/{petId} - * @secure - */ - deletePet: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UploadFile - * @summary uploads an image - * @request POST:/pet/{petId}/uploadImage - * @secure - */ - uploadFile: ( - petId: number, - data: { - /** Additional data to pass to server */ - additionalMetadata?: string; - /** file to upload */ - file?: File; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/${petId}/uploadImage`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - ...params, - }), - }; - store = { - /** - * @description Returns a map of status codes to quantities - * - * @tags store - * @name GetInventory - * @summary Returns pet inventories by status - * @request GET:/store/inventory - * @secure - */ - getInventory: (params: RequestParams = {}) => - this.request({ - path: `/store/inventory`, - method: "GET", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags store - * @name PlaceOrder - * @summary Place an order for a pet - * @request POST:/store/order - */ - placeOrder: (body: OrderTTT, params: RequestParams = {}) => - this.request({ - path: `/store/order`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @tags store - * @name GetOrderById - * @summary Find purchase order by ID - * @request GET:/store/order/{orderId} - */ - getOrderById: (orderId: number, params: RequestParams = {}) => - this.request({ - path: `/store/order/${orderId}`, - method: "GET", - ...params, - }), - - /** - * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @tags store - * @name DeleteOrder - * @summary Delete purchase order by ID - * @request DELETE:/store/order/{orderId} - */ - deleteOrder: (orderId: string, params: RequestParams = {}) => - this.request({ - path: `/store/order/${orderId}`, - method: "DELETE", - ...params, - }), - }; - user = { - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name CreateUser - * @summary Create user - * @request POST:/user - */ - createUser: (body: UserTTT, params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithArrayInput - * @summary Creates list of users with given input array - * @request POST:/user/createWithArray - */ - createUsersWithArrayInput: (body: UserTTT[], params: RequestParams = {}) => - this.request({ - path: `/user/createWithArray`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithListInput - * @summary Creates list of users with given input array - * @request POST:/user/createWithList - */ - createUsersWithListInput: (body: UserTTT[], params: RequestParams = {}) => - this.request({ - path: `/user/createWithList`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name LoginUser - * @summary Logs user into the system - * @request GET:/user/login - */ - loginUser: ( - query: { - /** The user name for login */ - username: string; - /** The password for login in clear text */ - password: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/login`, - method: "GET", - query: query, - ...params, - }), - - /** - * No description - * - * @tags user - * @name LogoutUser - * @summary Logs out current logged in user session - * @request GET:/user/logout - */ - logoutUser: (params: RequestParams = {}) => - this.request({ - path: `/user/logout`, - method: "GET", - ...params, - }), - - /** - * No description - * - * @tags user - * @name GetUserByName - * @summary Get user by user name - * @request GET:/user/{username} - */ - getUserByName: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "GET", - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name UpdateUser - * @summary Updated user - * @request PUT:/user/{username} - */ - updateUser: (username: string, body: UserTTT, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "PUT", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name DeleteUser - * @summary Delete user - * @request DELETE:/user/{username} - */ - deleteUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "DELETE", - ...params, - }), - }; -} diff --git a/tests/spec/extractResponseBody/test.js b/tests/spec/extractResponseBody/test.js deleted file mode 100644 index 1f3a9406..00000000 --- a/tests/spec/extractResponseBody/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--extract-response-body option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - extractResponseBody: true, - typeSuffix: "TTT", - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/extractResponseError/expected.ts b/tests/spec/extractResponseError/__snapshots__/basic.test.ts.snap similarity index 93% rename from tests/spec/extractResponseError/expected.ts rename to tests/spec/extractResponseError/__snapshots__/basic.test.ts.snap index c7c17373..20d0b77e 100644 --- a/tests/spec/extractResponseError/expected.ts +++ b/tests/spec/extractResponseError/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --extract-response-body 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -163,7 +166,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -228,7 +231,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -250,7 +253,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -266,7 +269,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -330,7 +333,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -378,7 +381,7 @@ export class HttpClient { * @externalDocs http://swagger.io * @contact * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key \`special-key\` to test the authorization filters. */ export class Api extends HttpClient { pet = { @@ -393,7 +396,7 @@ export class Api extends HttpClient this.request({ - path: `/pet`, + path: \`/pet\`, method: "POST", body: body, secure: true, @@ -412,7 +415,7 @@ export class Api extends HttpClient this.request({ - path: `/pet`, + path: \`/pet\`, method: "PUT", body: body, secure: true, @@ -437,7 +440,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/findByStatus`, + path: \`/pet/findByStatus\`, method: "GET", query: query, secure: true, @@ -462,7 +465,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/single-form-url-encoded`, + path: \`/pet/single-form-url-encoded\`, method: "POST", body: data, type: ContentType.UrlEncoded, @@ -486,7 +489,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/form-url-encoded`, + path: \`/pet/form-url-encoded\`, method: "POST", body: data, type: ContentType.UrlEncoded, @@ -521,7 +524,7 @@ export class Api extends HttpClient({ - path: `/pet/end-form-url-encoded`, + path: \`/pet/end-form-url-encoded\`, method: "POST", body: data, type: ContentType.UrlEncoded, @@ -547,7 +550,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/findByTags`, + path: \`/pet/findByTags\`, method: "GET", query: query, secure: true, @@ -566,7 +569,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}`, + path: \`/pet/\${petId}\`, method: "GET", secure: true, format: "json", @@ -593,7 +596,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}`, + path: \`/pet/\${petId}\`, method: "POST", body: data, secure: true, @@ -612,7 +615,7 @@ export class Api extends HttpClient this.request({ - path: `/pet/${petId}`, + path: \`/pet/\${petId}\`, method: "DELETE", secure: true, ...params, @@ -646,7 +649,7 @@ export class Api extends HttpClient({ - path: `/pet/${petId}/uploadImage`, + path: \`/pet/\${petId}/uploadImage\`, method: "POST", body: data, secure: true, @@ -667,7 +670,7 @@ export class Api extends HttpClient this.request, any>({ - path: `/store/inventory`, + path: \`/store/inventory\`, method: "GET", secure: true, format: "json", @@ -684,7 +687,7 @@ export class Api extends HttpClient this.request({ - path: `/store/order`, + path: \`/store/order\`, method: "POST", body: body, type: ContentType.Json, @@ -702,7 +705,7 @@ export class Api extends HttpClient this.request({ - path: `/store/order/${orderId}`, + path: \`/store/order/\${orderId}\`, method: "GET", format: "json", ...params, @@ -718,7 +721,7 @@ export class Api extends HttpClient this.request({ - path: `/store/order/${orderId}`, + path: \`/store/order/\${orderId}\`, method: "DELETE", ...params, }), @@ -734,7 +737,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "POST", body: body, type: ContentType.Json, @@ -751,7 +754,7 @@ export class Api extends HttpClient this.request({ - path: `/user/createWithArray`, + path: \`/user/createWithArray\`, method: "POST", body: body, type: ContentType.Json, @@ -768,7 +771,7 @@ export class Api extends HttpClient this.request({ - path: `/user/createWithList`, + path: \`/user/createWithList\`, method: "POST", body: body, type: ContentType.Json, @@ -793,7 +796,7 @@ export class Api extends HttpClient this.request({ - path: `/user/login`, + path: \`/user/login\`, method: "GET", query: query, format: "json", @@ -810,7 +813,7 @@ export class Api extends HttpClient this.request({ - path: `/user/logout`, + path: \`/user/logout\`, method: "GET", ...params, }), @@ -825,7 +828,7 @@ export class Api extends HttpClient this.request({ - path: `/user/${username}`, + path: \`/user/\${username}\`, method: "GET", format: "json", ...params, @@ -841,7 +844,7 @@ export class Api extends HttpClient this.request({ - path: `/user/${username}`, + path: \`/user/\${username}\`, method: "PUT", body: body, type: ContentType.Json, @@ -858,9 +861,11 @@ export class Api extends HttpClient this.request({ - path: `/user/${username}`, + path: \`/user/\${username}\`, method: "DELETE", ...params, }), }; } +" +`; diff --git a/tests/spec/extractResponseError/basic.test.ts b/tests/spec/extractResponseError/basic.test.ts new file mode 100644 index 00000000..0d6e2355 --- /dev/null +++ b/tests/spec/extractResponseError/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--extract-response-body", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + extractResponseError: true, + typeSuffix: "TTT", + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/extractResponseError/schema.ts b/tests/spec/extractResponseError/schema.ts deleted file mode 100644 index c7c17373..00000000 --- a/tests/spec/extractResponseError/schema.ts +++ /dev/null @@ -1,866 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** - * Pet Order - * An order for a pets from the pet store - * @example {"petId":6,"quantity":1,"id":0,"shipDate":"2000-01-23T04:56:07.000+00:00","complete":false,"status":"placed"} - */ -export interface OrderTTT { - /** @format int64 */ - id?: number; - /** @format int64 */ - petId?: number; - /** @format int32 */ - quantity?: number; - /** @format date-time */ - shipDate?: string; - /** Order Status */ - status?: "placed" | "approved" | "delivered" | null; - /** @default false */ - complete?: boolean; -} - -/** - * Pet category - * A category for a pet - * @example {"name":"name","id":6} - */ -export interface CategoryTTT { - /** @format int64 */ - id?: number; - name?: string; -} - -/** - * a User - * A User who is purchasing from the pet store - * @example {"firstName":"firstName","lastName":"lastName","password":"password","userStatus":6,"phone":"phone","id":0,"email":"email","username":"username"} - */ -export interface UserTTT { - /** @format int64 */ - id?: number; - username?: string; - firstName?: string; - lastName?: string; - email?: string; - password?: string; - phone?: string; - /** - * User Status - * @format int32 - */ - userStatus?: number; -} - -/** - * Pet Tag - * A tag for a pet - * @example {"name":"name","id":1} - */ -export interface TagTTT { - /** @format int64 */ - id?: number; - name?: string; -} - -export enum PetNamesTTT { - FluffyHero = "Fluffy Hero", - PiggyPo = "Piggy Po", - SwaggerTypescriptApi = "Swagger Typescript Api", - UPPER_CASE = "UPPER_CASE", -} - -export enum PetIdsTTT { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -export enum PetIdsWithWrongEnumTTT { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -/** - * a Pet - * A pet for sale in the pet store - * @example {"photoUrls":["photoUrls","photoUrls"],"name":"doggie","id":0,"category":{"name":"name","id":6},"tags":[{"name":"name","id":1},{"name":"name","id":1}],"status":"available"} - */ -export interface PetTTT { - /** @format int64 */ - id?: number; - /** A category for a pet */ - category?: CategoryTTT; - /** @example "doggie" */ - name: string; - photoUrls: string[]; - tags?: TagTTT[]; - /** pet status in the store */ - status?: "available" | "pending" | "sold"; -} - -/** some description */ -export interface AmountTTT { - /** - * some description - * @format double - * @min 0.01 - * @max 1000000000000000 - */ - value: number; - /** some description */ - currency: CurrencyTTT; -} - -/** - * some description - * @pattern ^[A-Z]{3,3}$ - */ -export type CurrencyTTT = string; - -/** - * HttpError HttpError HttpErrorRetry HttpValidationError HttpError - * asd asd asd asd asd - */ -export type FormUrlEncodedRequest2ErrorTTT = - | { - /** - * Detail - * asdsad asd asd sa dsa - * @example "asdasd sad sa dsad" - */ - detail: string; - } - | { - /** - * Detail - * sadas das dasd asd - * @example "sadasd sads adsad asd " - */ - detail: string; - /** - * sadsa dsa dsa das - * sadas dasd as dasd asd - * @example 600 - */ - retry_after: number; - } - | Record; - -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 = "http://petstore.swagger.io/v2"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/v2 - * @externalDocs http://swagger.io - * @contact - * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - */ -export class Api extends HttpClient { - pet = { - /** - * No description - * - * @tags pet - * @name AddPet - * @summary Add a new pet to the store - * @request POST:/pet - * @secure - */ - addPet: (body: PetTTT, params: RequestParams = {}) => - this.request({ - path: `/pet`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePet - * @summary Update an existing pet - * @request PUT:/pet - * @secure - */ - updatePet: (body: PetTTT, params: RequestParams = {}) => - this.request({ - path: `/pet`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * @description Multiple status values can be provided with comma separated strings - * - * @tags pet - * @name FindPetsByStatus - * @summary Finds Pets by status - * @request GET:/pet/findByStatus - * @secure - */ - findPetsByStatus: ( - query: { - /** Status values that need to be considered for filter */ - status: ("available" | "pending" | "sold")[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/findByStatus`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pet - * @name SingleFormUrlEncodedRequest - * @summary summary - * @request POST:/pet/single-form-url-encoded - */ - singleFormUrlEncodedRequest: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/single-form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name FormUrlEncodedRequest - * @summary summary - * @request POST:/pet/form-url-encoded - */ - formUrlEncodedRequest: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name FormUrlEncodedRequest2 - * @summary summary - * @request POST:/pet/end-form-url-encoded - * @originalName formUrlEncodedRequest - * @duplicate - */ - formUrlEncodedRequest2: ( - data: { - /** @format string */ - param1: string; - param2: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** - * Id - * asd asdsad asd as - */ - id: string; - }, - FormUrlEncodedRequest2ErrorTTT - >({ - path: `/pet/end-form-url-encoded`, - method: "POST", - body: data, - type: ContentType.UrlEncoded, - format: "json", - ...params, - }), - - /** - * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @tags pet - * @name FindPetsByTags - * @summary Finds Pets by tags - * @request GET:/pet/findByTags - * @deprecated - * @secure - */ - findPetsByTags: ( - query: { - /** Tags to filter by */ - tags: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/findByTags`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Returns a single pet - * - * @tags pet - * @name GetPetById - * @summary Find pet by ID - * @request GET:/pet/{petId} - * @secure - */ - getPetById: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePetWithForm - * @summary Updates a pet in the store with form data - * @request POST:/pet/{petId} - * @secure - */ - updatePetWithForm: ( - petId: number, - data: { - /** Updated name of the pet */ - name?: string; - /** Updated status of the pet */ - status?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/pet/${petId}`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name DeletePet - * @summary Deletes a pet - * @request DELETE:/pet/{petId} - * @secure - */ - deletePet: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/pet/${petId}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UploadFile - * @summary uploads an image - * @request POST:/pet/{petId}/uploadImage - * @secure - */ - uploadFile: ( - petId: number, - data: { - /** Additional data to pass to server */ - additionalMetadata?: string; - /** file to upload */ - file?: File; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** @format int32 */ - code?: number; - type?: string; - message?: string; - }, - any - >({ - path: `/pet/${petId}/uploadImage`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - format: "json", - ...params, - }), - }; - store = { - /** - * @description Returns a map of status codes to quantities - * - * @tags store - * @name GetInventory - * @summary Returns pet inventories by status - * @request GET:/store/inventory - * @secure - */ - getInventory: (params: RequestParams = {}) => - this.request, any>({ - path: `/store/inventory`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags store - * @name PlaceOrder - * @summary Place an order for a pet - * @request POST:/store/order - */ - placeOrder: (body: OrderTTT, params: RequestParams = {}) => - this.request({ - path: `/store/order`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @tags store - * @name GetOrderById - * @summary Find purchase order by ID - * @request GET:/store/order/{orderId} - */ - getOrderById: (orderId: number, params: RequestParams = {}) => - this.request({ - path: `/store/order/${orderId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @tags store - * @name DeleteOrder - * @summary Delete purchase order by ID - * @request DELETE:/store/order/{orderId} - */ - deleteOrder: (orderId: string, params: RequestParams = {}) => - this.request({ - path: `/store/order/${orderId}`, - method: "DELETE", - ...params, - }), - }; - user = { - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name CreateUser - * @summary Create user - * @request POST:/user - */ - createUser: (body: UserTTT, params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithArrayInput - * @summary Creates list of users with given input array - * @request POST:/user/createWithArray - */ - createUsersWithArrayInput: (body: UserTTT[], params: RequestParams = {}) => - this.request({ - path: `/user/createWithArray`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithListInput - * @summary Creates list of users with given input array - * @request POST:/user/createWithList - */ - createUsersWithListInput: (body: UserTTT[], params: RequestParams = {}) => - this.request({ - path: `/user/createWithList`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name LoginUser - * @summary Logs user into the system - * @request GET:/user/login - */ - loginUser: ( - query: { - /** The user name for login */ - username: string; - /** The password for login in clear text */ - password: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/login`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags user - * @name LogoutUser - * @summary Logs out current logged in user session - * @request GET:/user/logout - */ - logoutUser: (params: RequestParams = {}) => - this.request({ - path: `/user/logout`, - method: "GET", - ...params, - }), - - /** - * No description - * - * @tags user - * @name GetUserByName - * @summary Get user by user name - * @request GET:/user/{username} - */ - getUserByName: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name UpdateUser - * @summary Updated user - * @request PUT:/user/{username} - */ - updateUser: (username: string, body: UserTTT, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "PUT", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name DeleteUser - * @summary Delete user - * @request DELETE:/user/{username} - */ - deleteUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/${username}`, - method: "DELETE", - ...params, - }), - }; -} diff --git a/tests/spec/extractResponseError/test.js b/tests/spec/extractResponseError/test.js deleted file mode 100644 index 697342e0..00000000 --- a/tests/spec/extractResponseError/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--extract-response-body option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - extractResponseError: true, - typeSuffix: "TTT", - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/jsAxios/schema.js b/tests/spec/js/__snapshots__/basic.test.ts.snap similarity index 87% rename from tests/spec/jsAxios/schema.js rename to tests/spec/js/__snapshots__/basic.test.ts.snap index 2bccff36..5eb08340 100644 --- a/tests/spec/jsAxios/schema.js +++ b/tests/spec/js/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --js --axios 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -49,7 +52,7 @@ export class HttpClient { if (typeof formItem === "object" && formItem !== null) { return JSON.stringify(formItem); } else { - return `${formItem}`; + return \`\${formItem}\`; } } createFormData(input) { @@ -109,7 +112,7 @@ export class Api extends HttpClient { */ emojisList: (params = {}) => this.request({ - path: `/emojis`, + path: \`/emojis\`, method: "GET", format: "json", ...params, @@ -124,7 +127,7 @@ export class Api extends HttpClient { */ eventsList: (params = {}) => this.request({ - path: `/events`, + path: \`/events\`, method: "GET", format: "json", ...params, @@ -139,7 +142,7 @@ export class Api extends HttpClient { */ feedsList: (params = {}) => this.request({ - path: `/feeds`, + path: \`/feeds\`, method: "GET", format: "json", ...params, @@ -154,7 +157,7 @@ export class Api extends HttpClient { */ gistsList: (query, params = {}) => this.request({ - path: `/gists`, + path: \`/gists\`, method: "GET", query: query, format: "json", @@ -168,7 +171,7 @@ export class Api extends HttpClient { */ gistsCreate: (body, params = {}) => this.request({ - path: `/gists`, + path: \`/gists\`, method: "POST", body: body, type: ContentType.Json, @@ -183,7 +186,7 @@ export class Api extends HttpClient { */ publicList: (query, params = {}) => this.request({ - path: `/gists/public`, + path: \`/gists/public\`, method: "GET", query: query, format: "json", @@ -197,7 +200,7 @@ export class Api extends HttpClient { */ starredList: (query, params = {}) => this.request({ - path: `/gists/starred`, + path: \`/gists/starred\`, method: "GET", query: query, format: "json", @@ -211,7 +214,7 @@ export class Api extends HttpClient { */ gistsDelete: (id, params = {}) => this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "DELETE", ...params, }), @@ -223,7 +226,7 @@ export class Api extends HttpClient { */ gistsDetail: (id, params = {}) => this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "GET", format: "json", ...params, @@ -236,7 +239,7 @@ export class Api extends HttpClient { */ gistsPartialUpdate: (id, body, params = {}) => this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -251,7 +254,7 @@ export class Api extends HttpClient { */ commentsDetail: (id, params = {}) => this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "GET", format: "json", ...params, @@ -264,7 +267,7 @@ export class Api extends HttpClient { */ commentsCreate: (id, body, params = {}) => this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "POST", body: body, format: "json", @@ -278,7 +281,7 @@ export class Api extends HttpClient { */ commentsDelete: (id, commentId, params = {}) => this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -292,7 +295,7 @@ export class Api extends HttpClient { */ commentsDetail2: (id, commentId, params = {}) => this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -305,7 +308,7 @@ export class Api extends HttpClient { */ commentsPartialUpdate: (id, commentId, body, params = {}) => this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -320,7 +323,7 @@ export class Api extends HttpClient { */ forksCreate: (id, params = {}) => this.request({ - path: `/gists/${id}/forks`, + path: \`/gists/\${id}/forks\`, method: "POST", ...params, }), @@ -332,7 +335,7 @@ export class Api extends HttpClient { */ starDelete: (id, params = {}) => this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "DELETE", ...params, }), @@ -344,7 +347,7 @@ export class Api extends HttpClient { */ starDetail: (id, params = {}) => this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "GET", ...params, }), @@ -356,7 +359,7 @@ export class Api extends HttpClient { */ starUpdate: (id, params = {}) => this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "PUT", ...params, }), @@ -370,7 +373,7 @@ export class Api extends HttpClient { */ templatesList: (params = {}) => this.request({ - path: `/gitignore/templates`, + path: \`/gitignore/templates\`, method: "GET", format: "json", ...params, @@ -383,7 +386,7 @@ export class Api extends HttpClient { */ templatesDetail: (language, params = {}) => this.request({ - path: `/gitignore/templates/${language}`, + path: \`/gitignore/templates/\${language}\`, method: "GET", format: "json", ...params, @@ -398,7 +401,7 @@ export class Api extends HttpClient { */ issuesList: (query, params = {}) => this.request({ - path: `/issues`, + path: \`/issues\`, method: "GET", query: query, format: "json", @@ -415,7 +418,7 @@ export class Api extends HttpClient { */ issuesSearchDetail: (keyword, state, owner, repository, params = {}) => this.request({ - path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + path: \`/legacy/issues/search/\${owner}/\${repository}/\${state}/\${keyword}\`, method: "GET", format: "json", ...params, @@ -429,7 +432,7 @@ export class Api extends HttpClient { */ reposSearchDetail: (keyword, query, params = {}) => this.request({ - path: `/legacy/repos/search/${keyword}`, + path: \`/legacy/repos/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -444,7 +447,7 @@ export class Api extends HttpClient { */ userEmailDetail: (email, params = {}) => this.request({ - path: `/legacy/user/email/${email}`, + path: \`/legacy/user/email/\${email}\`, method: "GET", format: "json", ...params, @@ -458,7 +461,7 @@ export class Api extends HttpClient { */ userSearchDetail: (keyword, query, params = {}) => this.request({ - path: `/legacy/user/search/${keyword}`, + path: \`/legacy/user/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -474,7 +477,7 @@ export class Api extends HttpClient { */ markdownCreate: (body, params = {}) => this.request({ - path: `/markdown`, + path: \`/markdown\`, method: "POST", body: body, type: ContentType.Json, @@ -488,7 +491,7 @@ export class Api extends HttpClient { */ postMarkdown: (params = {}) => this.request({ - path: `/markdown/raw`, + path: \`/markdown/raw\`, method: "POST", type: ContentType.Text, ...params, @@ -503,7 +506,7 @@ export class Api extends HttpClient { */ metaList: (params = {}) => this.request({ - path: `/meta`, + path: \`/meta\`, method: "GET", format: "json", ...params, @@ -518,7 +521,7 @@ export class Api extends HttpClient { */ eventsDetail: (owner, repo, params = {}) => this.request({ - path: `/networks/${owner}/${repo}/events`, + path: \`/networks/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -533,7 +536,7 @@ export class Api extends HttpClient { */ notificationsList: (query, params = {}) => this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "GET", query: query, format: "json", @@ -547,7 +550,7 @@ export class Api extends HttpClient { */ notificationsUpdate: (body, params = {}) => this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "PUT", body: body, ...params, @@ -560,7 +563,7 @@ export class Api extends HttpClient { */ threadsDetail: (id, params = {}) => this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "GET", format: "json", ...params, @@ -573,7 +576,7 @@ export class Api extends HttpClient { */ threadsPartialUpdate: (id, params = {}) => this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "PATCH", ...params, }), @@ -585,7 +588,7 @@ export class Api extends HttpClient { */ threadsSubscriptionDelete: (id, params = {}) => this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "DELETE", ...params, }), @@ -597,7 +600,7 @@ export class Api extends HttpClient { */ threadsSubscriptionDetail: (id, params = {}) => this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "GET", format: "json", ...params, @@ -610,7 +613,7 @@ export class Api extends HttpClient { */ threadsSubscriptionUpdate: (id, body, params = {}) => this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -627,7 +630,7 @@ export class Api extends HttpClient { */ orgsDetail: (org, params = {}) => this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "GET", format: "json", ...params, @@ -640,7 +643,7 @@ export class Api extends HttpClient { */ orgsPartialUpdate: (org, body, params = {}) => this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -655,7 +658,7 @@ export class Api extends HttpClient { */ eventsDetail: (org, params = {}) => this.request({ - path: `/orgs/${org}/events`, + path: \`/orgs/\${org}/events\`, method: "GET", format: "json", ...params, @@ -668,7 +671,7 @@ export class Api extends HttpClient { */ issuesDetail: (org, query, params = {}) => this.request({ - path: `/orgs/${org}/issues`, + path: \`/orgs/\${org}/issues\`, method: "GET", query: query, format: "json", @@ -682,7 +685,7 @@ export class Api extends HttpClient { */ membersDetail: (org, params = {}) => this.request({ - path: `/orgs/${org}/members`, + path: \`/orgs/\${org}/members\`, method: "GET", format: "json", ...params, @@ -695,7 +698,7 @@ export class Api extends HttpClient { */ membersDelete: (org, username, params = {}) => this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "DELETE", ...params, }), @@ -709,7 +712,7 @@ export class Api extends HttpClient { */ membersDetail2: (org, username, params = {}) => this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "GET", ...params, }), @@ -721,7 +724,7 @@ export class Api extends HttpClient { */ publicMembersDetail: (org, params = {}) => this.request({ - path: `/orgs/${org}/public_members`, + path: \`/orgs/\${org}/public_members\`, method: "GET", format: "json", ...params, @@ -734,7 +737,7 @@ export class Api extends HttpClient { */ publicMembersDelete: (org, username, params = {}) => this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "DELETE", ...params, }), @@ -748,7 +751,7 @@ export class Api extends HttpClient { */ publicMembersDetail2: (org, username, params = {}) => this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "GET", ...params, }), @@ -760,7 +763,7 @@ export class Api extends HttpClient { */ publicMembersUpdate: (org, username, params = {}) => this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "PUT", ...params, }), @@ -772,7 +775,7 @@ export class Api extends HttpClient { */ reposDetail: (org, query, params = {}) => this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "GET", query: query, format: "json", @@ -786,7 +789,7 @@ export class Api extends HttpClient { */ reposCreate: (org, body, params = {}) => this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "POST", body: body, format: "json", @@ -800,7 +803,7 @@ export class Api extends HttpClient { */ teamsDetail: (org, params = {}) => this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "GET", format: "json", ...params, @@ -813,7 +816,7 @@ export class Api extends HttpClient { */ teamsCreate: (org, body, params = {}) => this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "POST", body: body, type: ContentType.Json, @@ -830,7 +833,7 @@ export class Api extends HttpClient { */ rateLimitList: (params = {}) => this.request({ - path: `/rate_limit`, + path: \`/rate_limit\`, method: "GET", format: "json", ...params, @@ -845,7 +848,7 @@ export class Api extends HttpClient { */ reposDelete: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -857,7 +860,7 @@ export class Api extends HttpClient { */ reposDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "GET", format: "json", ...params, @@ -870,7 +873,7 @@ export class Api extends HttpClient { */ reposPartialUpdate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -885,7 +888,7 @@ export class Api extends HttpClient { */ assigneesDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/assignees`, + path: \`/repos/\${owner}/\${repo}/assignees\`, method: "GET", format: "json", ...params, @@ -900,7 +903,7 @@ export class Api extends HttpClient { */ assigneesDetail2: (owner, repo, assignee, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/assignees/${assignee}`, + path: \`/repos/\${owner}/\${repo}/assignees/\${assignee}\`, method: "GET", ...params, }), @@ -912,7 +915,7 @@ export class Api extends HttpClient { */ branchesDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/branches`, + path: \`/repos/\${owner}/\${repo}/branches\`, method: "GET", format: "json", ...params, @@ -927,7 +930,7 @@ export class Api extends HttpClient { */ branchesDetail2: (owner, repo, branch, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}`, + path: \`/repos/\${owner}/\${repo}/branches/\${branch}\`, method: "GET", format: "json", ...params, @@ -940,7 +943,7 @@ export class Api extends HttpClient { */ collaboratorsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/collaborators`, + path: \`/repos/\${owner}/\${repo}/collaborators\`, method: "GET", format: "json", ...params, @@ -953,7 +956,7 @@ export class Api extends HttpClient { */ collaboratorsDelete: (owner, repo, user, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "DELETE", ...params, }), @@ -967,7 +970,7 @@ export class Api extends HttpClient { */ collaboratorsDetail2: (owner, repo, user, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "GET", ...params, }), @@ -979,7 +982,7 @@ export class Api extends HttpClient { */ collaboratorsUpdate: (owner, repo, user, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "PUT", ...params, }), @@ -991,7 +994,7 @@ export class Api extends HttpClient { */ commentsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/comments`, + path: \`/repos/\${owner}/\${repo}/comments\`, method: "GET", format: "json", ...params, @@ -1004,7 +1007,7 @@ export class Api extends HttpClient { */ commentsDelete: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -1018,7 +1021,7 @@ export class Api extends HttpClient { */ commentsDetail2: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -1031,7 +1034,7 @@ export class Api extends HttpClient { */ commentsPartialUpdate: (owner, repo, commentId, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -1045,7 +1048,7 @@ export class Api extends HttpClient { */ commitsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/commits`, + path: \`/repos/\${owner}/\${repo}/commits\`, method: "GET", query: query, format: "json", @@ -1059,7 +1062,7 @@ export class Api extends HttpClient { */ commitsStatusDetail: (owner, repo, ref, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/status`, + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/status\`, method: "GET", format: "json", ...params, @@ -1074,7 +1077,7 @@ export class Api extends HttpClient { */ commitsDetail2: (owner, repo, shaCode, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -1087,7 +1090,7 @@ export class Api extends HttpClient { */ commitsCommentsDetail: (owner, repo, shaCode, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "GET", format: "json", ...params, @@ -1100,7 +1103,7 @@ export class Api extends HttpClient { */ commitsCommentsCreate: (owner, repo, shaCode, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -1115,7 +1118,7 @@ export class Api extends HttpClient { */ compareDetail: (owner, repo, baseId, headId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + path: \`/repos/\${owner}/\${repo}/compare/\${baseId}...\${headId}\`, method: "GET", format: "json", ...params, @@ -1128,7 +1131,7 @@ export class Api extends HttpClient { */ contentsDelete: (owner, repo, path, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "DELETE", body: body, type: ContentType.Json, @@ -1143,7 +1146,7 @@ export class Api extends HttpClient { */ contentsDetail: (owner, repo, path, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "GET", query: query, format: "json", @@ -1157,7 +1160,7 @@ export class Api extends HttpClient { */ contentsUpdate: (owner, repo, path, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "PUT", body: body, type: ContentType.Json, @@ -1172,7 +1175,7 @@ export class Api extends HttpClient { */ contributorsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/contributors`, + path: \`/repos/\${owner}/\${repo}/contributors\`, method: "GET", query: query, format: "json", @@ -1186,7 +1189,7 @@ export class Api extends HttpClient { */ deploymentsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "GET", format: "json", ...params, @@ -1199,7 +1202,7 @@ export class Api extends HttpClient { */ deploymentsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "POST", body: body, type: ContentType.Json, @@ -1214,7 +1217,7 @@ export class Api extends HttpClient { */ deploymentsStatusesDetail: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "GET", format: "json", ...params, @@ -1227,7 +1230,7 @@ export class Api extends HttpClient { */ deploymentsStatusesCreate: (owner, repo, id, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "POST", body: body, type: ContentType.Json, @@ -1242,7 +1245,7 @@ export class Api extends HttpClient { */ downloadsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/downloads`, + path: \`/repos/\${owner}/\${repo}/downloads\`, method: "GET", format: "json", ...params, @@ -1256,7 +1259,7 @@ export class Api extends HttpClient { */ downloadsDelete: (owner, repo, downloadId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "DELETE", ...params, }), @@ -1271,7 +1274,7 @@ export class Api extends HttpClient { */ downloadsDetail2: (owner, repo, downloadId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "GET", format: "json", ...params, @@ -1284,7 +1287,7 @@ export class Api extends HttpClient { */ eventsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/events`, + path: \`/repos/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -1297,7 +1300,7 @@ export class Api extends HttpClient { */ forksDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "GET", query: query, format: "json", @@ -1311,7 +1314,7 @@ export class Api extends HttpClient { */ forksCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "POST", body: body, type: ContentType.Json, @@ -1326,7 +1329,7 @@ export class Api extends HttpClient { */ gitBlobsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/blobs`, + path: \`/repos/\${owner}/\${repo}/git/blobs\`, method: "POST", body: body, type: ContentType.Json, @@ -1341,7 +1344,7 @@ export class Api extends HttpClient { */ gitBlobsDetail: (owner, repo, shaCode, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/blobs/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -1354,7 +1357,7 @@ export class Api extends HttpClient { */ gitCommitsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/commits`, + path: \`/repos/\${owner}/\${repo}/git/commits\`, method: "POST", body: body, type: ContentType.Json, @@ -1369,7 +1372,7 @@ export class Api extends HttpClient { */ gitCommitsDetail: (owner, repo, shaCode, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -1382,7 +1385,7 @@ export class Api extends HttpClient { */ gitRefsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "GET", format: "json", ...params, @@ -1395,7 +1398,7 @@ export class Api extends HttpClient { */ gitRefsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "POST", body: body, type: ContentType.Json, @@ -1410,7 +1413,7 @@ export class Api extends HttpClient { */ gitRefsDelete: (owner, repo, ref, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "DELETE", ...params, }), @@ -1424,7 +1427,7 @@ export class Api extends HttpClient { */ gitRefsDetail2: (owner, repo, ref, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "GET", format: "json", ...params, @@ -1437,7 +1440,7 @@ export class Api extends HttpClient { */ gitRefsPartialUpdate: (owner, repo, ref, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -1452,7 +1455,7 @@ export class Api extends HttpClient { */ gitTagsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/tags`, + path: \`/repos/\${owner}/\${repo}/git/tags\`, method: "POST", body: body, type: ContentType.Json, @@ -1467,7 +1470,7 @@ export class Api extends HttpClient { */ gitTagsDetail: (owner, repo, shaCode, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/tags/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -1480,7 +1483,7 @@ export class Api extends HttpClient { */ gitTreesCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/trees`, + path: \`/repos/\${owner}/\${repo}/git/trees\`, method: "POST", body: body, type: ContentType.Json, @@ -1495,7 +1498,7 @@ export class Api extends HttpClient { */ gitTreesDetail: (owner, repo, shaCode, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/trees/\${shaCode}\`, method: "GET", query: query, format: "json", @@ -1509,7 +1512,7 @@ export class Api extends HttpClient { */ hooksDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "GET", format: "json", ...params, @@ -1522,7 +1525,7 @@ export class Api extends HttpClient { */ hooksCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "POST", body: body, format: "json", @@ -1536,7 +1539,7 @@ export class Api extends HttpClient { */ hooksDelete: (owner, repo, hookId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "DELETE", ...params, }), @@ -1550,7 +1553,7 @@ export class Api extends HttpClient { */ hooksDetail2: (owner, repo, hookId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "GET", format: "json", ...params, @@ -1563,7 +1566,7 @@ export class Api extends HttpClient { */ hooksPartialUpdate: (owner, repo, hookId, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "PATCH", body: body, format: "json", @@ -1577,7 +1580,7 @@ export class Api extends HttpClient { */ hooksTestsCreate: (owner, repo, hookId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/tests\`, method: "POST", ...params, }), @@ -1589,7 +1592,7 @@ export class Api extends HttpClient { */ issuesDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "GET", query: query, format: "json", @@ -1603,7 +1606,7 @@ export class Api extends HttpClient { */ issuesCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "POST", body: body, format: "json", @@ -1617,7 +1620,7 @@ export class Api extends HttpClient { */ issuesCommentsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, + path: \`/repos/\${owner}/\${repo}/issues/comments\`, method: "GET", query: query, format: "json", @@ -1631,7 +1634,7 @@ export class Api extends HttpClient { */ issuesCommentsDelete: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -1645,7 +1648,7 @@ export class Api extends HttpClient { */ issuesCommentsDetail2: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -1658,7 +1661,7 @@ export class Api extends HttpClient { */ issuesCommentsPartialUpdate: (owner, repo, commentId, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -1672,7 +1675,7 @@ export class Api extends HttpClient { */ issuesEventsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/events`, + path: \`/repos/\${owner}/\${repo}/issues/events\`, method: "GET", format: "json", ...params, @@ -1687,7 +1690,7 @@ export class Api extends HttpClient { */ issuesEventsDetail2: (owner, repo, eventId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + path: \`/repos/\${owner}/\${repo}/issues/events/\${eventId}\`, method: "GET", format: "json", ...params, @@ -1702,7 +1705,7 @@ export class Api extends HttpClient { */ issuesDetail2: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "GET", format: "json", ...params, @@ -1715,7 +1718,7 @@ export class Api extends HttpClient { */ issuesPartialUpdate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "PATCH", body: body, format: "json", @@ -1731,7 +1734,7 @@ export class Api extends HttpClient { */ issuesCommentsDetail3: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -1744,7 +1747,7 @@ export class Api extends HttpClient { */ issuesCommentsCreate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "POST", body: body, format: "json", @@ -1760,7 +1763,7 @@ export class Api extends HttpClient { */ issuesEventsDetail3: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/events`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/events\`, method: "GET", format: "json", ...params, @@ -1773,7 +1776,7 @@ export class Api extends HttpClient { */ issuesLabelsDelete: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "DELETE", ...params, }), @@ -1785,7 +1788,7 @@ export class Api extends HttpClient { */ issuesLabelsDetail: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -1798,7 +1801,7 @@ export class Api extends HttpClient { */ issuesLabelsCreate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "POST", body: body, format: "json", @@ -1812,7 +1815,7 @@ export class Api extends HttpClient { */ issuesLabelsUpdate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "PUT", body: body, format: "json", @@ -1828,7 +1831,7 @@ export class Api extends HttpClient { */ issuesLabelsDelete2: (owner, repo, number, name, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -1840,7 +1843,7 @@ export class Api extends HttpClient { */ keysDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "GET", format: "json", ...params, @@ -1853,7 +1856,7 @@ export class Api extends HttpClient { */ keysCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "POST", body: body, format: "json", @@ -1867,7 +1870,7 @@ export class Api extends HttpClient { */ keysDelete: (owner, repo, keyId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -1881,7 +1884,7 @@ export class Api extends HttpClient { */ keysDetail2: (owner, repo, keyId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -1894,7 +1897,7 @@ export class Api extends HttpClient { */ labelsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "GET", format: "json", ...params, @@ -1907,7 +1910,7 @@ export class Api extends HttpClient { */ labelsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "POST", body: body, format: "json", @@ -1921,7 +1924,7 @@ export class Api extends HttpClient { */ labelsDelete: (owner, repo, name, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -1935,7 +1938,7 @@ export class Api extends HttpClient { */ labelsDetail2: (owner, repo, name, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "GET", format: "json", ...params, @@ -1948,7 +1951,7 @@ export class Api extends HttpClient { */ labelsPartialUpdate: (owner, repo, name, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "PATCH", body: body, format: "json", @@ -1962,7 +1965,7 @@ export class Api extends HttpClient { */ languagesDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/languages`, + path: \`/repos/\${owner}/\${repo}/languages\`, method: "GET", format: "json", ...params, @@ -1975,7 +1978,7 @@ export class Api extends HttpClient { */ mergesCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/merges`, + path: \`/repos/\${owner}/\${repo}/merges\`, method: "POST", body: body, type: ContentType.Json, @@ -1990,7 +1993,7 @@ export class Api extends HttpClient { */ milestonesDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "GET", query: query, format: "json", @@ -2004,7 +2007,7 @@ export class Api extends HttpClient { */ milestonesCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "POST", body: body, format: "json", @@ -2018,7 +2021,7 @@ export class Api extends HttpClient { */ milestonesDelete: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "DELETE", ...params, }), @@ -2032,7 +2035,7 @@ export class Api extends HttpClient { */ milestonesDetail2: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "GET", format: "json", ...params, @@ -2045,7 +2048,7 @@ export class Api extends HttpClient { */ milestonesPartialUpdate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "PATCH", body: body, format: "json", @@ -2059,7 +2062,7 @@ export class Api extends HttpClient { */ milestonesLabelsDetail: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -2072,7 +2075,7 @@ export class Api extends HttpClient { */ notificationsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "GET", query: query, format: "json", @@ -2086,7 +2089,7 @@ export class Api extends HttpClient { */ notificationsUpdate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "PUT", body: body, ...params, @@ -2099,7 +2102,7 @@ export class Api extends HttpClient { */ pullsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "GET", query: query, format: "json", @@ -2113,7 +2116,7 @@ export class Api extends HttpClient { */ pullsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "POST", body: body, type: ContentType.Json, @@ -2128,7 +2131,7 @@ export class Api extends HttpClient { */ pullsCommentsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/comments\`, method: "GET", query: query, format: "json", @@ -2142,7 +2145,7 @@ export class Api extends HttpClient { */ pullsCommentsDelete: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -2156,7 +2159,7 @@ export class Api extends HttpClient { */ pullsCommentsDetail2: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -2169,7 +2172,7 @@ export class Api extends HttpClient { */ pullsCommentsPartialUpdate: (owner, repo, commentId, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -2185,7 +2188,7 @@ export class Api extends HttpClient { */ pullsDetail2: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "GET", format: "json", ...params, @@ -2198,7 +2201,7 @@ export class Api extends HttpClient { */ pullsPartialUpdate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2215,7 +2218,7 @@ export class Api extends HttpClient { */ pullsCommentsDetail3: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -2228,7 +2231,7 @@ export class Api extends HttpClient { */ pullsCommentsCreate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -2243,7 +2246,7 @@ export class Api extends HttpClient { */ pullsCommitsDetail: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/commits\`, method: "GET", format: "json", ...params, @@ -2256,7 +2259,7 @@ export class Api extends HttpClient { */ pullsFilesDetail: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/files`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/files\`, method: "GET", format: "json", ...params, @@ -2269,7 +2272,7 @@ export class Api extends HttpClient { */ pullsMergeDetail: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "GET", ...params, }), @@ -2281,7 +2284,7 @@ export class Api extends HttpClient { */ pullsMergeUpdate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "PUT", body: body, type: ContentType.Json, @@ -2296,7 +2299,7 @@ export class Api extends HttpClient { */ readmeDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/readme`, + path: \`/repos/\${owner}/\${repo}/readme\`, method: "GET", query: query, format: "json", @@ -2310,7 +2313,7 @@ export class Api extends HttpClient { */ releasesDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "GET", format: "json", ...params, @@ -2323,7 +2326,7 @@ export class Api extends HttpClient { */ releasesCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "POST", body: body, format: "json", @@ -2337,7 +2340,7 @@ export class Api extends HttpClient { */ releasesAssetsDelete: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "DELETE", ...params, }), @@ -2349,7 +2352,7 @@ export class Api extends HttpClient { */ releasesAssetsDetail: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "GET", format: "json", ...params, @@ -2362,7 +2365,7 @@ export class Api extends HttpClient { */ releasesAssetsPartialUpdate: (owner, repo, id, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2377,7 +2380,7 @@ export class Api extends HttpClient { */ releasesDelete: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "DELETE", ...params, }), @@ -2391,7 +2394,7 @@ export class Api extends HttpClient { */ releasesDetail2: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "GET", format: "json", ...params, @@ -2404,7 +2407,7 @@ export class Api extends HttpClient { */ releasesPartialUpdate: (owner, repo, id, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "PATCH", body: body, format: "json", @@ -2420,7 +2423,7 @@ export class Api extends HttpClient { */ releasesAssetsDetail2: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/${id}/assets`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}/assets\`, method: "GET", format: "json", ...params, @@ -2433,7 +2436,7 @@ export class Api extends HttpClient { */ stargazersDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stargazers`, + path: \`/repos/\${owner}/\${repo}/stargazers\`, method: "GET", format: "json", ...params, @@ -2446,7 +2449,7 @@ export class Api extends HttpClient { */ statsCodeFrequencyDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stats/code_frequency`, + path: \`/repos/\${owner}/\${repo}/stats/code_frequency\`, method: "GET", format: "json", ...params, @@ -2459,7 +2462,7 @@ export class Api extends HttpClient { */ statsCommitActivityDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stats/commit_activity`, + path: \`/repos/\${owner}/\${repo}/stats/commit_activity\`, method: "GET", format: "json", ...params, @@ -2472,7 +2475,7 @@ export class Api extends HttpClient { */ statsContributorsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stats/contributors`, + path: \`/repos/\${owner}/\${repo}/stats/contributors\`, method: "GET", format: "json", ...params, @@ -2485,7 +2488,7 @@ export class Api extends HttpClient { */ statsParticipationDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stats/participation`, + path: \`/repos/\${owner}/\${repo}/stats/participation\`, method: "GET", format: "json", ...params, @@ -2498,7 +2501,7 @@ export class Api extends HttpClient { */ statsPunchCardDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stats/punch_card`, + path: \`/repos/\${owner}/\${repo}/stats/punch_card\`, method: "GET", format: "json", ...params, @@ -2511,7 +2514,7 @@ export class Api extends HttpClient { */ statusesDetail: (owner, repo, ref, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "GET", format: "json", ...params, @@ -2524,7 +2527,7 @@ export class Api extends HttpClient { */ statusesCreate: (owner, repo, ref, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "POST", body: body, type: ContentType.Json, @@ -2539,7 +2542,7 @@ export class Api extends HttpClient { */ subscribersDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/subscribers`, + path: \`/repos/\${owner}/\${repo}/subscribers\`, method: "GET", format: "json", ...params, @@ -2552,7 +2555,7 @@ export class Api extends HttpClient { */ subscriptionDelete: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "DELETE", ...params, }), @@ -2564,7 +2567,7 @@ export class Api extends HttpClient { */ subscriptionDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "GET", format: "json", ...params, @@ -2577,7 +2580,7 @@ export class Api extends HttpClient { */ subscriptionUpdate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -2592,7 +2595,7 @@ export class Api extends HttpClient { */ tagsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/tags`, + path: \`/repos/\${owner}/\${repo}/tags\`, method: "GET", format: "json", ...params, @@ -2605,7 +2608,7 @@ export class Api extends HttpClient { */ teamsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/teams`, + path: \`/repos/\${owner}/\${repo}/teams\`, method: "GET", format: "json", ...params, @@ -2618,7 +2621,7 @@ export class Api extends HttpClient { */ watchersDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/watchers`, + path: \`/repos/\${owner}/\${repo}/watchers\`, method: "GET", format: "json", ...params, @@ -2633,7 +2636,7 @@ export class Api extends HttpClient { */ reposDetail2: (owner, repo, archiveFormat, path, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + path: \`/repos/\${owner}/\${repo}/\${archiveFormat}/\${path}\`, method: "GET", ...params, }), @@ -2647,7 +2650,7 @@ export class Api extends HttpClient { */ repositoriesList: (query, params = {}) => this.request({ - path: `/repositories`, + path: \`/repositories\`, method: "GET", query: query, format: "json", @@ -2663,7 +2666,7 @@ export class Api extends HttpClient { */ codeList: (query, params = {}) => this.request({ - path: `/search/code`, + path: \`/search/code\`, method: "GET", query: query, format: "json", @@ -2677,7 +2680,7 @@ export class Api extends HttpClient { */ issuesList: (query, params = {}) => this.request({ - path: `/search/issues`, + path: \`/search/issues\`, method: "GET", query: query, format: "json", @@ -2691,7 +2694,7 @@ export class Api extends HttpClient { */ repositoriesList: (query, params = {}) => this.request({ - path: `/search/repositories`, + path: \`/search/repositories\`, method: "GET", query: query, format: "json", @@ -2705,7 +2708,7 @@ export class Api extends HttpClient { */ usersList: (query, params = {}) => this.request({ - path: `/search/users`, + path: \`/search/users\`, method: "GET", query: query, format: "json", @@ -2721,7 +2724,7 @@ export class Api extends HttpClient { */ teamsDelete: (teamId, params = {}) => this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "DELETE", ...params, }), @@ -2733,7 +2736,7 @@ export class Api extends HttpClient { */ teamsDetail: (teamId, params = {}) => this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "GET", format: "json", ...params, @@ -2746,7 +2749,7 @@ export class Api extends HttpClient { */ teamsPartialUpdate: (teamId, body, params = {}) => this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2761,7 +2764,7 @@ export class Api extends HttpClient { */ membersDetail: (teamId, params = {}) => this.request({ - path: `/teams/${teamId}/members`, + path: \`/teams/\${teamId}/members\`, method: "GET", format: "json", ...params, @@ -2775,7 +2778,7 @@ export class Api extends HttpClient { */ membersDelete: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "DELETE", ...params, }), @@ -2790,7 +2793,7 @@ export class Api extends HttpClient { */ membersDetail2: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "GET", ...params, }), @@ -2803,7 +2806,7 @@ export class Api extends HttpClient { */ membersUpdate: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "PUT", ...params, }), @@ -2815,7 +2818,7 @@ export class Api extends HttpClient { */ membershipsDelete: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "DELETE", ...params, }), @@ -2827,7 +2830,7 @@ export class Api extends HttpClient { */ membershipsDetail: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "GET", format: "json", ...params, @@ -2840,7 +2843,7 @@ export class Api extends HttpClient { */ membershipsUpdate: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "PUT", format: "json", ...params, @@ -2853,7 +2856,7 @@ export class Api extends HttpClient { */ reposDetail: (teamId, params = {}) => this.request({ - path: `/teams/${teamId}/repos`, + path: \`/teams/\${teamId}/repos\`, method: "GET", format: "json", ...params, @@ -2866,7 +2869,7 @@ export class Api extends HttpClient { */ reposDelete: (teamId, owner, repo, params = {}) => this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -2880,7 +2883,7 @@ export class Api extends HttpClient { */ reposDetail2: (teamId, owner, repo, params = {}) => this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -2892,7 +2895,7 @@ export class Api extends HttpClient { */ reposUpdate: (teamId, owner, repo, params = {}) => this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -2906,7 +2909,7 @@ export class Api extends HttpClient { */ userList: (params = {}) => this.request({ - path: `/user`, + path: \`/user\`, method: "GET", format: "json", ...params, @@ -2919,7 +2922,7 @@ export class Api extends HttpClient { */ userPartialUpdate: (body, params = {}) => this.request({ - path: `/user`, + path: \`/user\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2934,7 +2937,7 @@ export class Api extends HttpClient { */ emailsDelete: (body, params = {}) => this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "DELETE", body: body, type: ContentType.Json, @@ -2948,7 +2951,7 @@ export class Api extends HttpClient { */ emailsList: (params = {}) => this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "GET", ...params, }), @@ -2960,7 +2963,7 @@ export class Api extends HttpClient { */ emailsCreate: (body, params = {}) => this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "POST", body: body, ...params, @@ -2973,7 +2976,7 @@ export class Api extends HttpClient { */ followersList: (params = {}) => this.request({ - path: `/user/followers`, + path: \`/user/followers\`, method: "GET", format: "json", ...params, @@ -2986,7 +2989,7 @@ export class Api extends HttpClient { */ followingList: (params = {}) => this.request({ - path: `/user/following`, + path: \`/user/following\`, method: "GET", format: "json", ...params, @@ -2999,7 +3002,7 @@ export class Api extends HttpClient { */ followingDelete: (username, params = {}) => this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "DELETE", ...params, }), @@ -3011,7 +3014,7 @@ export class Api extends HttpClient { */ followingDetail: (username, params = {}) => this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "GET", ...params, }), @@ -3023,7 +3026,7 @@ export class Api extends HttpClient { */ followingUpdate: (username, params = {}) => this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "PUT", ...params, }), @@ -3035,7 +3038,7 @@ export class Api extends HttpClient { */ issuesList: (query, params = {}) => this.request({ - path: `/user/issues`, + path: \`/user/issues\`, method: "GET", query: query, format: "json", @@ -3049,7 +3052,7 @@ export class Api extends HttpClient { */ keysList: (params = {}) => this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "GET", format: "json", ...params, @@ -3062,7 +3065,7 @@ export class Api extends HttpClient { */ keysCreate: (body, params = {}) => this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "POST", body: body, format: "json", @@ -3076,7 +3079,7 @@ export class Api extends HttpClient { */ keysDelete: (keyId, params = {}) => this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -3088,7 +3091,7 @@ export class Api extends HttpClient { */ keysDetail: (keyId, params = {}) => this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -3101,7 +3104,7 @@ export class Api extends HttpClient { */ orgsList: (params = {}) => this.request({ - path: `/user/orgs`, + path: \`/user/orgs\`, method: "GET", format: "json", ...params, @@ -3114,7 +3117,7 @@ export class Api extends HttpClient { */ reposList: (query, params = {}) => this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "GET", query: query, format: "json", @@ -3128,7 +3131,7 @@ export class Api extends HttpClient { */ reposCreate: (body, params = {}) => this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "POST", body: body, format: "json", @@ -3142,7 +3145,7 @@ export class Api extends HttpClient { */ starredList: (query, params = {}) => this.request({ - path: `/user/starred`, + path: \`/user/starred\`, method: "GET", query: query, format: "json", @@ -3156,7 +3159,7 @@ export class Api extends HttpClient { */ starredDelete: (owner, repo, params = {}) => this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -3168,7 +3171,7 @@ export class Api extends HttpClient { */ starredDetail: (owner, repo, params = {}) => this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -3180,7 +3183,7 @@ export class Api extends HttpClient { */ starredUpdate: (owner, repo, params = {}) => this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -3192,7 +3195,7 @@ export class Api extends HttpClient { */ subscriptionsList: (params = {}) => this.request({ - path: `/user/subscriptions`, + path: \`/user/subscriptions\`, method: "GET", format: "json", ...params, @@ -3206,7 +3209,7 @@ export class Api extends HttpClient { */ subscriptionsDelete: (owner, repo, params = {}) => this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -3219,7 +3222,7 @@ export class Api extends HttpClient { */ subscriptionsDetail: (owner, repo, params = {}) => this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -3232,7 +3235,7 @@ export class Api extends HttpClient { */ subscriptionsUpdate: (owner, repo, params = {}) => this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -3244,7 +3247,7 @@ export class Api extends HttpClient { */ teamsList: (params = {}) => this.request({ - path: `/user/teams`, + path: \`/user/teams\`, method: "GET", format: "json", ...params, @@ -3259,7 +3262,7 @@ export class Api extends HttpClient { */ usersList: (query, params = {}) => this.request({ - path: `/users`, + path: \`/users\`, method: "GET", query: query, format: "json", @@ -3273,7 +3276,7 @@ export class Api extends HttpClient { */ usersDetail: (username, params = {}) => this.request({ - path: `/users/${username}`, + path: \`/users/\${username}\`, method: "GET", format: "json", ...params, @@ -3286,7 +3289,7 @@ export class Api extends HttpClient { */ eventsDetail: (username, params = {}) => this.request({ - path: `/users/${username}/events`, + path: \`/users/\${username}/events\`, method: "GET", ...params, }), @@ -3298,7 +3301,7 @@ export class Api extends HttpClient { */ eventsOrgsDetail: (username, org, params = {}) => this.request({ - path: `/users/${username}/events/orgs/${org}`, + path: \`/users/\${username}/events/orgs/\${org}\`, method: "GET", ...params, }), @@ -3310,7 +3313,7 @@ export class Api extends HttpClient { */ followersDetail: (username, params = {}) => this.request({ - path: `/users/${username}/followers`, + path: \`/users/\${username}/followers\`, method: "GET", format: "json", ...params, @@ -3323,7 +3326,7 @@ export class Api extends HttpClient { */ followingDetail: (username, targetUser, params = {}) => this.request({ - path: `/users/${username}/following/${targetUser}`, + path: \`/users/\${username}/following/\${targetUser}\`, method: "GET", ...params, }), @@ -3335,7 +3338,7 @@ export class Api extends HttpClient { */ gistsDetail: (username, query, params = {}) => this.request({ - path: `/users/${username}/gists`, + path: \`/users/\${username}/gists\`, method: "GET", query: query, format: "json", @@ -3349,7 +3352,7 @@ export class Api extends HttpClient { */ keysDetail: (username, params = {}) => this.request({ - path: `/users/${username}/keys`, + path: \`/users/\${username}/keys\`, method: "GET", format: "json", ...params, @@ -3362,7 +3365,7 @@ export class Api extends HttpClient { */ orgsDetail: (username, params = {}) => this.request({ - path: `/users/${username}/orgs`, + path: \`/users/\${username}/orgs\`, method: "GET", format: "json", ...params, @@ -3375,7 +3378,7 @@ export class Api extends HttpClient { */ receivedEventsDetail: (username, params = {}) => this.request({ - path: `/users/${username}/received_events`, + path: \`/users/\${username}/received_events\`, method: "GET", ...params, }), @@ -3387,7 +3390,7 @@ export class Api extends HttpClient { */ receivedEventsPublicDetail: (username, params = {}) => this.request({ - path: `/users/${username}/received_events/public`, + path: \`/users/\${username}/received_events/public\`, method: "GET", ...params, }), @@ -3399,7 +3402,7 @@ export class Api extends HttpClient { */ reposDetail: (username, query, params = {}) => this.request({ - path: `/users/${username}/repos`, + path: \`/users/\${username}/repos\`, method: "GET", query: query, format: "json", @@ -3413,7 +3416,7 @@ export class Api extends HttpClient { */ starredDetail: (username, params = {}) => this.request({ - path: `/users/${username}/starred`, + path: \`/users/\${username}/starred\`, method: "GET", ...params, }), @@ -3425,9 +3428,11 @@ export class Api extends HttpClient { */ subscriptionsDetail: (username, params = {}) => this.request({ - path: `/users/${username}/subscriptions`, + path: \`/users/\${username}/subscriptions\`, method: "GET", ...params, }), }; } +" +`; diff --git a/tests/spec/js/basic.test.ts b/tests/spec/js/basic.test.ts new file mode 100644 index 00000000..b3cd3c71 --- /dev/null +++ b/tests/spec/js/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--js --axios", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + httpClientType: "axios", + toJS: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.js"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/js/schema.d.ts b/tests/spec/js/schema.d.ts deleted file mode 100644 index 42997921..00000000 --- a/tests/spec/js/schema.d.ts +++ /dev/null @@ -1,4699 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** A user or organization */ -export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - 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; - /** The account username */ - login?: string; - /** The full account name */ - 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"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - 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?: { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601. */ - created_at?: string; - id?: number; - url?: string; - /** A GitHub user */ - user?: User; -}[]; -export interface Commit { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} -export interface CommitCommentBody { - body: string; - /** Deprecated - Use position parameter instead. */ - line?: string; - /** Line number in the file to comment on. Defaults to null. */ - number?: string; - /** Relative path of the file to comment on. */ - path?: string; - /** Line index in the diff to comment on. */ - position?: number; - /** SHA of the commit to comment on. */ - sha: string; -} -export type Commits = { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -}[]; -export interface CompareCommits { - ahead_by?: number; - base_commit?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - behind_by?: number; - commits?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - }; - /** The Total number of commits authored by the contributor. */ - total?: number; - weeks?: { - /** Number of additions. */ - a?: number; - /** Number of commits. */ - c?: number; - /** Number of deletions. */ - d?: number; - /** Start of the week. */ - 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; - /** A GitHub user */ - creator?: User; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -} -export type DeploymentStatuses = { - created_at?: string; - /** A GitHub user */ - 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 { - /** A user or organization */ - actor?: Actor; - created_at?: object; - id?: number; - /** A GitHub organization */ - 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; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - description?: string; - files?: { - "ring.erl"?: { - filename?: string; - raw_url?: string; - size?: number; - }; - }; - forks?: { - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }[]; - git_pull_url?: string; - git_push_url?: string; - history?: { - change_status?: { - additions?: number; - deletions?: number; - total?: number; - }; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - committed_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - version?: string; - }[]; - html_url?: string; - id?: string; - public?: boolean; - url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - 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; - }; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** A user or organization */ - actor?: Actor; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - event?: string; - issue?: { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }; - url?: string; -} -export type IssueEvents = IssueEvent[]; -export type Issues = { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; -export interface IssuesComment { - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} -export type IssuesComments = { - _links?: { - html?: { - href?: string; - }; - pull_request?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - body?: string; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - 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 { - /** Error message */ - message?: string; -} -export interface MergesSuccessful { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A user or organization */ - 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[]; -} -/** A GitHub organization */ -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 address. This address is not publicized. */ - billing_email?: string; - company?: string; - /** Publicly visible email address. */ - email?: string; - location?: string; - name?: string; -} -export interface PostGist { - description?: string; - files?: { - "file1.txt"?: { - content?: string; - }; - }; - public?: boolean; -} -export interface PostRepo { - /** True to create an initial commit with empty README. Default is false. */ - auto_init?: boolean; - description?: string; - /** Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell" Ignored if auto_init parameter is not provided. */ - gitignore_template?: string; - /** True to enable downloads for this repository, false to disable them. Default is true. */ - has_downloads?: boolean; - /** True to enable issues for this repository, false to disable them. Default is true. */ - has_issues?: boolean; - /** True to enable the wiki for this repository, false to disable it. Default is true. */ - has_wiki?: boolean; - homepage?: string; - name: string; - /** True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. */ - private?: boolean; - /** The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization. */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - merged_at?: string; - number?: number; - patch_url?: string; - state?: "open" | "closed"; - title?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 = { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub organization */ - organization?: Organization; - /** A user or organization */ - owner?: Actor; - /** Is present when the repo is a fork. Parent is the repo this repo was forked from. */ - parent?: Repo; - private?: boolean; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - pushed_at?: string; - size?: number; - /** Is present when the repo is a fork. Source is the ultimate source for the network. */ - source?: Repo; - ssh_url?: string; - svn_url?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - watchers?: number; - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; -export interface RepoCommit { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 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; - /** A user or organization */ - 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; - /** A GitHub user */ - 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 { - /** A GitHub user */ - user?: User; -} -export interface SearchUsers { - items?: Users; - total_count?: number; -} -export interface SearchUsersByKeyword { - users?: Users; -} -export interface Subscription { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** String of the tag message. */ - message?: string; - object?: { - sha?: string; - /** String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob. */ - type?: "commit" | "tree" | "blob"; - url?: string; - }; - sha?: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag?: string; - tagger?: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - url?: string; -} -export interface TagBody { - /** String of the tag message. */ - message: string; - /** String of the SHA of the git object this is tagging. */ - object: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag: string; - tagger: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - /** 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 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?: { - /** One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink. */ - mode?: "100644" | "100755" | "040000" | "160000" | "120000"; - path?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - size?: number; - type?: "blob" | "tree" | "commit"; - url?: string; - }[]; - url?: string; -} -export interface Trees { - base_tree?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - tree?: Tree[]; - url?: string; -} -/** A GitHub user */ -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 declare enum ContentType { - Json = "application/json", - FormData = "multipart/form-data", - UrlEncoded = "application/x-www-form-urlencoded", - Text = "text/plain", -} -export declare class HttpClient { - baseUrl: string; - private securityData; - private securityWorker?; - private abortControllers; - private customFetch; - private baseApiParams; - constructor(apiConfig?: ApiConfig); - setSecurityData: (data: SecurityDataType | null) => void; - protected encodeQueryParam(key: string, value: any): string; - protected addQueryParam(query: QueryParamsType, key: string): string; - protected addArrayQueryParam(query: QueryParamsType, key: string): any; - protected toQueryString(rawQuery?: QueryParamsType): string; - protected addQueryParams(rawQuery?: QueryParamsType): string; - private contentFormatters; - protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams; - protected createAbortSignal: (cancelToken: CancelToken) => AbortSignal | undefined; - abortRequest: (cancelToken: CancelToken) => void; - request: ({ - body, - secure, - path, - type, - query, - format, - baseUrl, - cancelToken, - ...params - }: FullRequestParams) => Promise>; -} -/** - * @title GitHub - * @version v3 - * @termsOfService https://help.github.com/articles/github-terms-of-service/#b-api-terms - * @baseUrl https://api.github.com - * @externalDocs https://developer.github.com/v3/ - * - * Powerful collaboration, code review, and code management for open source and private projects. - */ -export declare class Api extends HttpClient { - emojis: { - /** - * @description Lists all the emojis available to use on GitHub. - * - * @name EmojisList - * @request GET:/emojis - */ - emojisList: (params?: RequestParams) => Promise>; - }; - events: { - /** - * @description List public events. - * - * @name EventsList - * @request GET:/events - */ - eventsList: (params?: RequestParams) => Promise>; - }; - feeds: { - /** - * @description List Feeds. GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticating user. - * - * @name FeedsList - * @request GET:/feeds - */ - feedsList: (params?: RequestParams) => Promise>; - }; - gists: { - /** - * @description List the authenticated user's gists or if called anonymously, this will return all public gists. - * - * @name GistsList - * @request GET:/gists - */ - gistsList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a gist. - * - * @name GistsCreate - * @request POST:/gists - */ - gistsCreate: (body: PostGist, params?: RequestParams) => Promise>; - /** - * @description List all public gists. - * - * @name PublicList - * @request GET:/gists/public - */ - publicList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description List the authenticated user's starred gists. - * - * @name StarredList - * @request GET:/gists/starred - */ - starredList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a gist. - * - * @name GistsDelete - * @request DELETE:/gists/{id} - */ - gistsDelete: (id: number, params?: RequestParams) => Promise>; - /** - * @description Get a single gist. - * - * @name GistsDetail - * @request GET:/gists/{id} - */ - gistsDetail: (id: number, params?: RequestParams) => Promise>; - /** - * @description Edit a gist. - * - * @name GistsPartialUpdate - * @request PATCH:/gists/{id} - */ - gistsPartialUpdate: (id: number, body: PatchGist, params?: RequestParams) => Promise>; - /** - * @description List comments on a gist. - * - * @name CommentsDetail - * @request GET:/gists/{id}/comments - */ - commentsDetail: (id: number, params?: RequestParams) => Promise>; - /** - * @description Create a commen - * - * @name CommentsCreate - * @request POST:/gists/{id}/comments - */ - commentsCreate: (id: number, body: CommentBody, params?: RequestParams) => Promise>; - /** - * @description Delete a comment. - * - * @name CommentsDelete - * @request DELETE:/gists/{id}/comments/{commentId} - */ - commentsDelete: (id: number, commentId: number, params?: RequestParams) => Promise>; - /** - * @description Get a single comment. - * - * @name CommentsDetail2 - * @request GET:/gists/{id}/comments/{commentId} - * @originalName commentsDetail - * @duplicate - */ - commentsDetail2: (id: number, commentId: number, params?: RequestParams) => Promise>; - /** - * @description Edit a comment. - * - * @name CommentsPartialUpdate - * @request PATCH:/gists/{id}/comments/{commentId} - */ - commentsPartialUpdate: ( - id: number, - commentId: number, - body: Comment, - params?: RequestParams, - ) => Promise>; - /** - * @description Fork a gist. - * - * @name ForksCreate - * @request POST:/gists/{id}/forks - */ - forksCreate: (id: number, params?: RequestParams) => Promise>; - /** - * @description Unstar a gist. - * - * @name StarDelete - * @request DELETE:/gists/{id}/star - */ - starDelete: (id: number, params?: RequestParams) => Promise>; - /** - * @description Check if a gist is starred. - * - * @name StarDetail - * @request GET:/gists/{id}/star - */ - starDetail: (id: number, params?: RequestParams) => Promise>; - /** - * @description Star a gist. - * - * @name StarUpdate - * @request PUT:/gists/{id}/star - */ - starUpdate: (id: number, params?: RequestParams) => Promise>; - }; - gitignore: { - /** - * @description Listing available templates. List all templates available to pass as an option when creating a repository. - * - * @name TemplatesList - * @request GET:/gitignore/templates - */ - templatesList: (params?: RequestParams) => Promise>; - /** - * @description Get a single template. - * - * @name TemplatesDetail - * @request GET:/gitignore/templates/{language} - */ - templatesDetail: (language: string, params?: RequestParams) => Promise>; - }; - issues: { - /** - * @description List issues. List all issues across all the authenticated user's visible repositories. - * - * @name IssuesList - * @request GET:/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - }; - legacy: { - /** - * @description Find issues by state and keyword. - * - * @name IssuesSearchDetail - * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} - * @deprecated - */ - issuesSearchDetail: ( - keyword: string, - state: "open" | "closed", - owner: string, - repository: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter. - * - * @name ReposSearchDetail - * @request GET:/legacy/repos/search/{keyword} - * @deprecated - */ - reposSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** Filter results by language */ - language?: string; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description This API call is added for compatibility reasons only. - * - * @name UserEmailDetail - * @request GET:/legacy/user/email/{email} - * @deprecated - */ - userEmailDetail: (email: string, params?: RequestParams) => Promise>; - /** - * @description Find users by keyword. - * - * @name UserSearchDetail - * @request GET:/legacy/user/search/{keyword} - * @deprecated - */ - userSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params?: RequestParams, - ) => Promise>; - }; - markdown: { - /** - * @description Render an arbitrary Markdown document - * - * @name MarkdownCreate - * @request POST:/markdown - */ - markdownCreate: (body: Markdown, params?: RequestParams) => Promise>; - /** - * @description Render a Markdown document in raw mode - * - * @name PostMarkdown - * @request POST:/markdown/raw - */ - postMarkdown: (params?: RequestParams) => Promise>; - }; - meta: { - /** - * @description This gives some information about GitHub.com, the service. - * - * @name MetaList - * @request GET:/meta - */ - metaList: (params?: RequestParams) => Promise>; - }; - networks: { - /** - * @description List public events for a network of repositories. - * - * @name EventsDetail - * @request GET:/networks/{owner}/{repo}/events - */ - eventsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - }; - notifications: { - /** - * @description List your notifications. List all notifications for the current user, grouped by repository. - * - * @name NotificationsList - * @request GET:/notifications - */ - notificationsList: ( - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Mark as read. Marking a notification as "read" removes it from the default view on GitHub.com. - * - * @name NotificationsUpdate - * @request PUT:/notifications - */ - notificationsUpdate: (body: NotificationMarkRead, params?: RequestParams) => Promise>; - /** - * @description View a single thread. - * - * @name ThreadsDetail - * @request GET:/notifications/threads/{id} - */ - threadsDetail: (id: number, params?: RequestParams) => Promise>; - /** - * @description Mark a thread as read - * - * @name ThreadsPartialUpdate - * @request PATCH:/notifications/threads/{id} - */ - threadsPartialUpdate: (id: number, params?: RequestParams) => Promise>; - /** - * @description Delete a Thread Subscription. - * - * @name ThreadsSubscriptionDelete - * @request DELETE:/notifications/threads/{id}/subscription - */ - threadsSubscriptionDelete: (id: number, params?: RequestParams) => Promise>; - /** - * @description Get a Thread Subscription. - * - * @name ThreadsSubscriptionDetail - * @request GET:/notifications/threads/{id}/subscription - */ - threadsSubscriptionDetail: (id: number, params?: RequestParams) => Promise>; - /** - * @description Set a Thread Subscription. This lets you subscribe to a thread, or ignore it. Subscribing to a thread is unnecessary if the user is already subscribed to the repository. Ignoring a thread will mute all future notifications (until you comment or get @mentioned). - * - * @name ThreadsSubscriptionUpdate - * @request PUT:/notifications/threads/{id}/subscription - */ - threadsSubscriptionUpdate: ( - id: number, - body: PutSubscription, - params?: RequestParams, - ) => Promise>; - }; - orgs: { - /** - * @description Get an Organization. - * - * @name OrgsDetail - * @request GET:/orgs/{org} - */ - orgsDetail: (org: string, params?: RequestParams) => Promise>; - /** - * @description Edit an Organization. - * - * @name OrgsPartialUpdate - * @request PATCH:/orgs/{org} - */ - orgsPartialUpdate: ( - org: string, - body: PatchOrg, - params?: RequestParams, - ) => Promise>; - /** - * @description List public events for an organization. - * - * @name EventsDetail - * @request GET:/orgs/{org}/events - */ - eventsDetail: (org: string, params?: RequestParams) => Promise>; - /** - * @description List issues. List all issues for a given organization for the authenticated user. - * - * @name IssuesDetail - * @request GET:/orgs/{org}/issues - */ - issuesDetail: ( - org: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Members list. List all users who are members of an organization. A member is a user tha belongs to at least 1 team in the organization. If the authenticated user is also an owner of this organization then both concealed and public members will be returned. If the requester is not an owner of the organization the query will be redirected to the public members list. - * - * @name MembersDetail - * @request GET:/orgs/{org}/members - */ - membersDetail: (org: string, params?: RequestParams) => Promise>; - /** - * @description Remove a member. Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. - * - * @name MembersDelete - * @request DELETE:/orgs/{org}/members/{username} - */ - membersDelete: (org: string, username: string, params?: RequestParams) => Promise>; - /** - * @description Check if a user is, publicly or privately, a member of the organization. - * - * @name MembersDetail2 - * @request GET:/orgs/{org}/members/{username} - * @originalName membersDetail - * @duplicate - */ - membersDetail2: (org: string, username: string, params?: RequestParams) => Promise>; - /** - * @description Public members list. Members of an organization can choose to have their membership publicized or not. - * - * @name PublicMembersDetail - * @request GET:/orgs/{org}/public_members - */ - publicMembersDetail: (org: string, params?: RequestParams) => Promise>; - /** - * @description Conceal a user's membership. - * - * @name PublicMembersDelete - * @request DELETE:/orgs/{org}/public_members/{username} - */ - publicMembersDelete: (org: string, username: string, params?: RequestParams) => Promise>; - /** - * @description Check public membership. - * - * @name PublicMembersDetail2 - * @request GET:/orgs/{org}/public_members/{username} - * @originalName publicMembersDetail - * @duplicate - */ - publicMembersDetail2: (org: string, username: string, params?: RequestParams) => Promise>; - /** - * @description Publicize a user's membership. - * - * @name PublicMembersUpdate - * @request PUT:/orgs/{org}/public_members/{username} - */ - publicMembersUpdate: (org: string, username: string, params?: RequestParams) => Promise>; - /** - * @description List repositories for the specified org. - * - * @name ReposDetail - * @request GET:/orgs/{org}/repos - */ - reposDetail: ( - org: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @name ReposCreate - * @request POST:/orgs/{org}/repos - */ - reposCreate: (org: string, body: PostRepo, params?: RequestParams) => Promise>; - /** - * @description List teams. - * - * @name TeamsDetail - * @request GET:/orgs/{org}/teams - */ - teamsDetail: (org: string, params?: RequestParams) => Promise>; - /** - * @description Create team. In order to create a team, the authenticated user must be an owner of organization. - * - * @name TeamsCreate - * @request POST:/orgs/{org}/teams - */ - teamsCreate: (org: string, body: OrgTeamsPost, params?: RequestParams) => Promise>; - }; - rateLimit: { - /** - * @description Get your current rate limit status Note: Accessing this endpoint does not count against your rate limit. - * - * @name RateLimitList - * @request GET:/rate_limit - */ - rateLimitList: (params?: RequestParams) => Promise>; - }; - repos: { - /** - * @description Delete a Repository. Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required. - * - * @name ReposDelete - * @request DELETE:/repos/{owner}/{repo} - */ - reposDelete: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get repository. - * - * @name ReposDetail - * @request GET:/repos/{owner}/{repo} - */ - reposDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Edit repository. - * - * @name ReposPartialUpdate - * @request PATCH:/repos/{owner}/{repo} - */ - reposPartialUpdate: ( - owner: string, - repo: string, - body: RepoEdit, - params?: RequestParams, - ) => Promise>; - /** - * @description List assignees. This call lists all the available assignees (owner + collaborators) to which issues may be assigned. - * - * @name AssigneesDetail - * @request GET:/repos/{owner}/{repo}/assignees - */ - assigneesDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Check assignee. You may also check to see if a particular user is an assignee for a repository. - * - * @name AssigneesDetail2 - * @request GET:/repos/{owner}/{repo}/assignees/{assignee} - * @originalName assigneesDetail - * @duplicate - */ - assigneesDetail2: ( - owner: string, - repo: string, - assignee: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get list of branches - * - * @name BranchesDetail - * @request GET:/repos/{owner}/{repo}/branches - */ - branchesDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get Branch - * - * @name BranchesDetail2 - * @request GET:/repos/{owner}/{repo}/branches/{branch} - * @originalName branchesDetail - * @duplicate - */ - branchesDetail2: ( - owner: string, - repo: string, - branch: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List. When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list. - * - * @name CollaboratorsDetail - * @request GET:/repos/{owner}/{repo}/collaborators - */ - collaboratorsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Remove collaborator. - * - * @name CollaboratorsDelete - * @request DELETE:/repos/{owner}/{repo}/collaborators/{user} - */ - collaboratorsDelete: ( - owner: string, - repo: string, - user: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Check if user is a collaborator - * - * @name CollaboratorsDetail2 - * @request GET:/repos/{owner}/{repo}/collaborators/{user} - * @originalName collaboratorsDetail - * @duplicate - */ - collaboratorsDetail2: ( - owner: string, - repo: string, - user: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Add collaborator. - * - * @name CollaboratorsUpdate - * @request PUT:/repos/{owner}/{repo}/collaborators/{user} - */ - collaboratorsUpdate: ( - owner: string, - repo: string, - user: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List commit comments for a repository. Comments are ordered by ascending ID. - * - * @name CommentsDetail - * @request GET:/repos/{owner}/{repo}/comments - */ - commentsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Delete a commit comment - * - * @name CommentsDelete - * @request DELETE:/repos/{owner}/{repo}/comments/{commentId} - */ - commentsDelete: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single commit comment. - * - * @name CommentsDetail2 - * @request GET:/repos/{owner}/{repo}/comments/{commentId} - * @originalName commentsDetail - * @duplicate - */ - commentsDetail2: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Update a commit comment. - * - * @name CommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/comments/{commentId} - */ - commentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: CommentBody, - params?: RequestParams, - ) => Promise>; - /** - * @description List commits on a repository. - * - * @name CommitsDetail - * @request GET:/repos/{owner}/{repo}/commits - */ - commitsDetail: ( - owner: string, - repo: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - /** Sha or branch to start listing commits from. */ - sha?: string; - /** Only commits containing this file path will be returned. */ - path?: string; - /** GitHub login, name, or email by which to filter by commit author. */ - author?: string; - /** ISO 8601 Date - Only commits before this date will be returned. */ - until?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Get the combined Status for a specific Ref The Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access this endpoint during the preview period, you must provide a custom media type in the Accept header: application/vnd.github.she-hulk-preview+json - * - * @name CommitsStatusDetail - * @request GET:/repos/{owner}/{repo}/commits/{ref}/status - */ - commitsStatusDetail: ( - owner: string, - repo: string, - ref: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single commit. - * - * @name CommitsDetail2 - * @request GET:/repos/{owner}/{repo}/commits/{shaCode} - * @originalName commitsDetail - * @duplicate - */ - commitsDetail2: ( - owner: string, - repo: string, - shaCode: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List comments for a single commitList comments for a single commit. - * - * @name CommitsCommentsDetail - * @request GET:/repos/{owner}/{repo}/commits/{shaCode}/comments - */ - commitsCommentsDetail: ( - owner: string, - repo: string, - shaCode: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a commit comment. - * - * @name CommitsCommentsCreate - * @request POST:/repos/{owner}/{repo}/commits/{shaCode}/comments - */ - commitsCommentsCreate: ( - owner: string, - repo: string, - shaCode: string, - body: CommitCommentBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Compare two commits - * - * @name CompareDetail - * @request GET:/repos/{owner}/{repo}/compare/{baseId}...{headId} - */ - compareDetail: ( - owner: string, - repo: string, - baseId: string, - headId: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a file. This method deletes a file in a repository. - * - * @name ContentsDelete - * @request DELETE:/repos/{owner}/{repo}/contents/{path} - */ - contentsDelete: ( - owner: string, - repo: string, - path: string, - body: DeleteFileBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get contents. This method returns the contents of a file or directory in a repository. Files and symlinks support a custom media type for getting the raw content. Directories and submodules do not support custom media types. Note: This API supports files up to 1 megabyte in size. Here can be many outcomes. For details see "http://developer.github.com/v3/repos/contents/" - * - * @name ContentsDetail - * @request GET:/repos/{owner}/{repo}/contents/{path} - */ - contentsDetail: ( - owner: string, - repo: string, - path: string, - query?: { - /** The content path. */ - path?: string; - /** The String name of the Commit/Branch/Tag. Defaults to 'master'. */ - ref?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a file. - * - * @name ContentsUpdate - * @request PUT:/repos/{owner}/{repo}/contents/{path} - */ - contentsUpdate: ( - owner: string, - repo: string, - path: string, - body: CreateFileBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get list of contributors. - * - * @name ContributorsDetail - * @request GET:/repos/{owner}/{repo}/contributors - */ - contributorsDetail: ( - owner: string, - repo: string, - query: { - /** Set to 1 or true to include anonymous contributors in results. */ - anon: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with pull access can view deployments for a repository - * - * @name DeploymentsDetail - * @request GET:/repos/{owner}/{repo}/deployments - */ - deploymentsDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with push access can create a deployment for a given ref - * - * @name DeploymentsCreate - * @request POST:/repos/{owner}/{repo}/deployments - */ - deploymentsCreate: ( - owner: string, - repo: string, - body: Deployment, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with pull access can view deployment statuses for a deployment - * - * @name DeploymentsStatusesDetail - * @request GET:/repos/{owner}/{repo}/deployments/{id}/statuses - */ - deploymentsStatusesDetail: ( - owner: string, - repo: string, - id: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a Deployment Status Users with push access can create deployment statuses for a given deployment: - * - * @name DeploymentsStatusesCreate - * @request POST:/repos/{owner}/{repo}/deployments/{id}/statuses - */ - deploymentsStatusesCreate: ( - owner: string, - repo: string, - id: number, - body: DeploymentStatusesCreate, - params?: RequestParams, - ) => Promise>; - /** - * @description Deprecated. List downloads for a repository. - * - * @name DownloadsDetail - * @request GET:/repos/{owner}/{repo}/downloads - * @deprecated - */ - downloadsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Deprecated. Delete a download. - * - * @name DownloadsDelete - * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - */ - downloadsDelete: ( - owner: string, - repo: string, - downloadId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Deprecated. Get a single download. - * - * @name DownloadsDetail2 - * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - * @originalName downloadsDetail - * @duplicate - */ - downloadsDetail2: ( - owner: string, - repo: string, - downloadId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get list of repository events. - * - * @name EventsDetail - * @request GET:/repos/{owner}/{repo}/events - */ - eventsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description List forks. - * - * @name ForksDetail - * @request GET:/repos/{owner}/{repo}/forks - */ - forksDetail: ( - owner: string, - repo: string, - query?: { - /** @default "newes" */ - sort?: "newes" | "oldes" | "watchers"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a fork. Forking a Repository happens asynchronously. Therefore, you may have to wai a short period before accessing the git objects. If this takes longer than 5 minutes, be sure to contact Support. - * - * @name ForksCreate - * @request POST:/repos/{owner}/{repo}/forks - */ - forksCreate: ( - owner: string, - repo: string, - body: ForkBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a Blob. - * - * @name GitBlobsCreate - * @request POST:/repos/{owner}/{repo}/git/blobs - */ - gitBlobsCreate: ( - owner: string, - repo: string, - body: Blob, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a Blob. Since blobs can be any arbitrary binary data, the input and responses for the blob API takes an encoding parameter that can be either utf-8 or base64. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it. - * - * @name GitBlobsDetail - * @request GET:/repos/{owner}/{repo}/git/blobs/{shaCode} - */ - gitBlobsDetail: ( - owner: string, - repo: string, - shaCode: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a Commit. - * - * @name GitCommitsCreate - * @request POST:/repos/{owner}/{repo}/git/commits - */ - gitCommitsCreate: ( - owner: string, - repo: string, - body: RepoCommitBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a Commit. - * - * @name GitCommitsDetail - * @request GET:/repos/{owner}/{repo}/git/commits/{shaCode} - */ - gitCommitsDetail: ( - owner: string, - repo: string, - shaCode: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get all References - * - * @name GitRefsDetail - * @request GET:/repos/{owner}/{repo}/git/refs - */ - gitRefsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Create a Reference - * - * @name GitRefsCreate - * @request POST:/repos/{owner}/{repo}/git/refs - */ - gitRefsCreate: ( - owner: string, - repo: string, - body: RefsBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a Reference Example: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a Example: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0 - * - * @name GitRefsDelete - * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} - */ - gitRefsDelete: ( - owner: string, - repo: string, - ref: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a Reference - * - * @name GitRefsDetail2 - * @request GET:/repos/{owner}/{repo}/git/refs/{ref} - * @originalName gitRefsDetail - * @duplicate - */ - gitRefsDetail2: ( - owner: string, - repo: string, - ref: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Update a Reference - * - * @name GitRefsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} - */ - gitRefsPartialUpdate: ( - owner: string, - repo: string, - ref: string, - body: GitRefPatch, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a Tag Object. Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary. - * - * @name GitTagsCreate - * @request POST:/repos/{owner}/{repo}/git/tags - */ - gitTagsCreate: ( - owner: string, - repo: string, - body: TagBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a Tag. - * - * @name GitTagsDetail - * @request GET:/repos/{owner}/{repo}/git/tags/{shaCode} - */ - gitTagsDetail: ( - owner: string, - repo: string, - shaCode: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a Tree. The tree creation API will take nested entries as well. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out. - * - * @name GitTreesCreate - * @request POST:/repos/{owner}/{repo}/git/trees - */ - gitTreesCreate: ( - owner: string, - repo: string, - body: Tree, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a Tree. - * - * @name GitTreesDetail - * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} - */ - gitTreesDetail: ( - owner: string, - repo: string, - shaCode: string, - query?: { - /** Get a Tree Recursively. (0 or 1) */ - recursive?: number; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Get list of hooks. - * - * @name HooksDetail - * @request GET:/repos/{owner}/{repo}/hooks - */ - hooksDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Create a hook. - * - * @name HooksCreate - * @request POST:/repos/{owner}/{repo}/hooks - */ - hooksCreate: ( - owner: string, - repo: string, - body: HookBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a hook. - * - * @name HooksDelete - * @request DELETE:/repos/{owner}/{repo}/hooks/{hookId} - */ - hooksDelete: ( - owner: string, - repo: string, - hookId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get single hook. - * - * @name HooksDetail2 - * @request GET:/repos/{owner}/{repo}/hooks/{hookId} - * @originalName hooksDetail - * @duplicate - */ - hooksDetail2: ( - owner: string, - repo: string, - hookId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Edit a hook. - * - * @name HooksPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/hooks/{hookId} - */ - hooksPartialUpdate: ( - owner: string, - repo: string, - hookId: number, - body: HookBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Test a push hook. This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated. Note: Previously /repos/:owner/:repo/hooks/:id/tes - * - * @name HooksTestsCreate - * @request POST:/repos/{owner}/{repo}/hooks/{hookId}/tests - */ - hooksTestsCreate: ( - owner: string, - repo: string, - hookId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description List issues for a repository. - * - * @name IssuesDetail - * @request GET:/repos/{owner}/{repo}/issues - */ - issuesDetail: ( - owner: string, - repo: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create an issue. Any user with pull access to a repository can create an issue. - * - * @name IssuesCreate - * @request POST:/repos/{owner}/{repo}/issues - */ - issuesCreate: ( - owner: string, - repo: string, - body: Issue, - params?: RequestParams, - ) => Promise>; - /** - * @description List comments in a repository. - * - * @name IssuesCommentsDetail - * @request GET:/repos/{owner}/{repo}/issues/comments - */ - issuesCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a comment. - * - * @name IssuesCommentsDelete - * @request DELETE:/repos/{owner}/{repo}/issues/comments/{commentId} - */ - issuesCommentsDelete: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single comment. - * - * @name IssuesCommentsDetail2 - * @request GET:/repos/{owner}/{repo}/issues/comments/{commentId} - * @originalName issuesCommentsDetail - * @duplicate - */ - issuesCommentsDetail2: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Edit a comment. - * - * @name IssuesCommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/issues/comments/{commentId} - */ - issuesCommentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: CommentBody, - params?: RequestParams, - ) => Promise>; - /** - * @description List issue events for a repository. - * - * @name IssuesEventsDetail - * @request GET:/repos/{owner}/{repo}/issues/events - */ - issuesEventsDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single event. - * - * @name IssuesEventsDetail2 - * @request GET:/repos/{owner}/{repo}/issues/events/{eventId} - * @originalName issuesEventsDetail - * @duplicate - */ - issuesEventsDetail2: ( - owner: string, - repo: string, - eventId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single issue - * - * @name IssuesDetail2 - * @request GET:/repos/{owner}/{repo}/issues/{number} - * @originalName issuesDetail - * @duplicate - */ - issuesDetail2: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Edit an issue. Issue owners and users with push access can edit an issue. - * - * @name IssuesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/issues/{number} - */ - issuesPartialUpdate: ( - owner: string, - repo: string, - number: number, - body: Issue, - params?: RequestParams, - ) => Promise>; - /** - * @description List comments on an issue. - * - * @name IssuesCommentsDetail3 - * @request GET:/repos/{owner}/{repo}/issues/{number}/comments - * @originalName issuesCommentsDetail - * @duplicate - */ - issuesCommentsDetail3: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a comment. - * - * @name IssuesCommentsCreate - * @request POST:/repos/{owner}/{repo}/issues/{number}/comments - */ - issuesCommentsCreate: ( - owner: string, - repo: string, - number: number, - body: CommentBody, - params?: RequestParams, - ) => Promise>; - /** - * @description List events for an issue. - * - * @name IssuesEventsDetail3 - * @request GET:/repos/{owner}/{repo}/issues/{number}/events - * @originalName issuesEventsDetail - * @duplicate - */ - issuesEventsDetail3: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Remove all labels from an issue. - * - * @name IssuesLabelsDelete - * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsDelete: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description List labels on an issue. - * - * @name IssuesLabelsDetail - * @request GET:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsDetail: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Add labels to an issue. - * - * @name IssuesLabelsCreate - * @request POST:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsCreate: ( - owner: string, - repo: string, - number: number, - body: EmailsPost, - params?: RequestParams, - ) => Promise>; - /** - * @description Replace all labels for an issue. Sending an empty array ([]) will remove all Labels from the Issue. - * - * @name IssuesLabelsUpdate - * @request PUT:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsUpdate: ( - owner: string, - repo: string, - number: number, - body: EmailsPost, - params?: RequestParams, - ) => Promise>; - /** - * @description Remove a label from an issue. - * - * @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, - ) => Promise>; - /** - * @description Get list of keys. - * - * @name KeysDetail - * @request GET:/repos/{owner}/{repo}/keys - */ - keysDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Create a key. - * - * @name KeysCreate - * @request POST:/repos/{owner}/{repo}/keys - */ - keysCreate: ( - owner: string, - repo: string, - body: UserKeysPost, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a key. - * - * @name KeysDelete - * @request DELETE:/repos/{owner}/{repo}/keys/{keyId} - */ - keysDelete: ( - owner: string, - repo: string, - keyId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a key - * - * @name KeysDetail2 - * @request GET:/repos/{owner}/{repo}/keys/{keyId} - * @originalName keysDetail - * @duplicate - */ - keysDetail2: ( - owner: string, - repo: string, - keyId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description List all labels for this repository. - * - * @name LabelsDetail - * @request GET:/repos/{owner}/{repo}/labels - */ - labelsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Create a label. - * - * @name LabelsCreate - * @request POST:/repos/{owner}/{repo}/labels - */ - labelsCreate: ( - owner: string, - repo: string, - body: EmailsPost, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a label. - * - * @name LabelsDelete - * @request DELETE:/repos/{owner}/{repo}/labels/{name} - */ - labelsDelete: ( - owner: string, - repo: string, - name: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single label. - * - * @name LabelsDetail2 - * @request GET:/repos/{owner}/{repo}/labels/{name} - * @originalName labelsDetail - * @duplicate - */ - labelsDetail2: ( - owner: string, - repo: string, - name: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Update a label. - * - * @name LabelsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/labels/{name} - */ - labelsPartialUpdate: ( - owner: string, - repo: string, - name: string, - body: EmailsPost, - params?: RequestParams, - ) => Promise>; - /** - * @description List languages. List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language. - * - * @name LanguagesDetail - * @request GET:/repos/{owner}/{repo}/languages - */ - languagesDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Perform a merge. - * - * @name MergesCreate - * @request POST:/repos/{owner}/{repo}/merges - */ - mergesCreate: ( - owner: string, - repo: string, - body: MergesBody, - params?: RequestParams, - ) => Promise>; - /** - * @description List milestones for a repository. - * - * @name MilestonesDetail - * @request GET:/repos/{owner}/{repo}/milestones - */ - milestonesDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "due_date" */ - sort?: "due_date" | "completeness"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a milestone. - * - * @name MilestonesCreate - * @request POST:/repos/{owner}/{repo}/milestones - */ - milestonesCreate: ( - owner: string, - repo: string, - body: MilestoneUpdate, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a milestone. - * - * @name MilestonesDelete - * @request DELETE:/repos/{owner}/{repo}/milestones/{number} - */ - milestonesDelete: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single milestone. - * - * @name MilestonesDetail2 - * @request GET:/repos/{owner}/{repo}/milestones/{number} - * @originalName milestonesDetail - * @duplicate - */ - milestonesDetail2: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Update a milestone. - * - * @name MilestonesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/milestones/{number} - */ - milestonesPartialUpdate: ( - owner: string, - repo: string, - number: number, - body: MilestoneUpdate, - params?: RequestParams, - ) => Promise>; - /** - * @description Get labels for every issue in a milestone. - * - * @name MilestonesLabelsDetail - * @request GET:/repos/{owner}/{repo}/milestones/{number}/labels - */ - milestonesLabelsDetail: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description List your notifications in a repository List all notifications for the current user. - * - * @name NotificationsDetail - * @request GET:/repos/{owner}/{repo}/notifications - */ - notificationsDetail: ( - owner: string, - repo: string, - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Mark notifications as read in a repository. Marking all notifications in a repository as "read" removes them from the default view on GitHub.com. - * - * @name NotificationsUpdate - * @request PUT:/repos/{owner}/{repo}/notifications - */ - notificationsUpdate: ( - owner: string, - repo: string, - body: NotificationMarkRead, - params?: RequestParams, - ) => Promise>; - /** - * @description List pull requests. - * - * @name PullsDetail - * @request GET:/repos/{owner}/{repo}/pulls - */ - pullsDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** - * Filter pulls by head user and branch name in the format of 'user:ref-name'. - * Example: github:new-script-format. - */ - head?: string; - /** Filter pulls by base branch name. Example - gh-pages. */ - base?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a pull request. - * - * @name PullsCreate - * @request POST:/repos/{owner}/{repo}/pulls - */ - pullsCreate: ( - owner: string, - repo: string, - body: PullsPost, - params?: RequestParams, - ) => Promise>; - /** - * @description List comments in a repository. By default, Review Comments are ordered by ascending ID. - * - * @name PullsCommentsDetail - * @request GET:/repos/{owner}/{repo}/pulls/comments - */ - pullsCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a comment. - * - * @name PullsCommentsDelete - * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{commentId} - */ - pullsCommentsDelete: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single comment. - * - * @name PullsCommentsDetail2 - * @request GET:/repos/{owner}/{repo}/pulls/comments/{commentId} - * @originalName pullsCommentsDetail - * @duplicate - */ - pullsCommentsDetail2: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Edit a comment. - * - * @name PullsCommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{commentId} - */ - pullsCommentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: CommentBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single pull request. - * - * @name PullsDetail2 - * @request GET:/repos/{owner}/{repo}/pulls/{number} - * @originalName pullsDetail - * @duplicate - */ - pullsDetail2: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Update a pull request. - * - * @name PullsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/pulls/{number} - */ - pullsPartialUpdate: ( - owner: string, - repo: string, - number: number, - body: PullUpdate, - params?: RequestParams, - ) => Promise>; - /** - * @description List comments on a pull request. - * - * @name PullsCommentsDetail3 - * @request GET:/repos/{owner}/{repo}/pulls/{number}/comments - * @originalName pullsCommentsDetail - * @duplicate - */ - pullsCommentsDetail3: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a comment. #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ ) description: | Alternative Input. Instead of passing commit_id, path, and position you can reply to an existing Pull Request Comment like this: body Required string in_reply_to Required number - Comment id to reply to. - * - * @name PullsCommentsCreate - * @request POST:/repos/{owner}/{repo}/pulls/{number}/comments - */ - pullsCommentsCreate: ( - owner: string, - repo: string, - number: number, - body: PullsCommentPost, - params?: RequestParams, - ) => Promise>; - /** - * @description List commits on a pull request. - * - * @name PullsCommitsDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/commits - */ - pullsCommitsDetail: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description List pull requests files. - * - * @name PullsFilesDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/files - */ - pullsFilesDetail: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get if a pull request has been merged. - * - * @name PullsMergeDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/merge - */ - pullsMergeDetail: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Merge a pull request (Merge Button's) - * - * @name PullsMergeUpdate - * @request PUT:/repos/{owner}/{repo}/pulls/{number}/merge - */ - pullsMergeUpdate: ( - owner: string, - repo: string, - number: number, - body: MergePullBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get the README. This method returns the preferred README for a repository. - * - * @name ReadmeDetail - * @request GET:/repos/{owner}/{repo}/readme - */ - readmeDetail: ( - owner: string, - repo: string, - query?: { - /** The String name of the Commit/Branch/Tag. Defaults to master. */ - ref?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only - * - * @name ReleasesDetail - * @request GET:/repos/{owner}/{repo}/releases - */ - releasesDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Create a release Users with push access to the repository can create a release. - * - * @name ReleasesCreate - * @request POST:/repos/{owner}/{repo}/releases - */ - releasesCreate: ( - owner: string, - repo: string, - body: ReleaseCreate, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a release asset - * - * @name ReleasesAssetsDelete - * @request DELETE:/repos/{owner}/{repo}/releases/assets/{id} - */ - releasesAssetsDelete: ( - owner: string, - repo: string, - id: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single release asset - * - * @name ReleasesAssetsDetail - * @request GET:/repos/{owner}/{repo}/releases/assets/{id} - */ - releasesAssetsDetail: ( - owner: string, - repo: string, - id: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Edit a release asset Users with push access to the repository can edit a release asset. - * - * @name ReleasesAssetsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/releases/assets/{id} - */ - releasesAssetsPartialUpdate: ( - owner: string, - repo: string, - id: string, - body: AssetPatch, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with push access to the repository can delete a release. - * - * @name ReleasesDelete - * @request DELETE:/repos/{owner}/{repo}/releases/{id} - */ - releasesDelete: ( - owner: string, - repo: string, - id: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single release - * - * @name ReleasesDetail2 - * @request GET:/repos/{owner}/{repo}/releases/{id} - * @originalName releasesDetail - * @duplicate - */ - releasesDetail2: ( - owner: string, - repo: string, - id: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with push access to the repository can edit a release - * - * @name ReleasesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/releases/{id} - */ - releasesPartialUpdate: ( - owner: string, - repo: string, - id: string, - body: ReleaseCreate, - params?: RequestParams, - ) => Promise>; - /** - * @description List assets for a release - * - * @name ReleasesAssetsDetail2 - * @request GET:/repos/{owner}/{repo}/releases/{id}/assets - * @originalName releasesAssetsDetail - * @duplicate - */ - releasesAssetsDetail2: ( - owner: string, - repo: string, - id: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List Stargazers. - * - * @name StargazersDetail - * @request GET:/repos/{owner}/{repo}/stargazers - */ - stargazersDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get the number of additions and deletions per week. Returns a weekly aggregate of the number of additions and deletions pushed to a repository. - * - * @name StatsCodeFrequencyDetail - * @request GET:/repos/{owner}/{repo}/stats/code_frequency - */ - statsCodeFrequencyDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get the last year of commit activity data. Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday. - * - * @name StatsCommitActivityDetail - * @request GET:/repos/{owner}/{repo}/stats/commit_activity - */ - statsCommitActivityDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get contributors list with additions, deletions, and commit counts. - * - * @name StatsContributorsDetail - * @request GET:/repos/{owner}/{repo}/stats/contributors - */ - statsContributorsDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get the weekly commit count for the repo owner and everyone else. - * - * @name StatsParticipationDetail - * @request GET:/repos/{owner}/{repo}/stats/participation - */ - statsParticipationDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get the number of commits per hour in each day. Each array contains the day number, hour number, and number of commits 0-6 Sunday - Saturday 0-23 Hour of day Number of commits For example, [2, 14, 25] indicates that there were 25 total commits, during the 2.00pm hour on Tuesdays. All times are based on the time zone of individual commits. - * - * @name StatsPunchCardDetail - * @request GET:/repos/{owner}/{repo}/stats/punch_card - */ - statsPunchCardDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List Statuses for a specific Ref. - * - * @name StatusesDetail - * @request GET:/repos/{owner}/{repo}/statuses/{ref} - */ - statusesDetail: ( - owner: string, - repo: string, - ref: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a Status. - * - * @name StatusesCreate - * @request POST:/repos/{owner}/{repo}/statuses/{ref} - */ - statusesCreate: ( - owner: string, - repo: string, - ref: string, - body: HeadBranch, - params?: RequestParams, - ) => Promise>; - /** - * @description List watchers. - * - * @name SubscribersDetail - * @request GET:/repos/{owner}/{repo}/subscribers - */ - subscribersDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Delete a Repository Subscription. - * - * @name SubscriptionDelete - * @request DELETE:/repos/{owner}/{repo}/subscription - */ - subscriptionDelete: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get a Repository Subscription. - * - * @name SubscriptionDetail - * @request GET:/repos/{owner}/{repo}/subscription - */ - subscriptionDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Set a Repository Subscription - * - * @name SubscriptionUpdate - * @request PUT:/repos/{owner}/{repo}/subscription - */ - subscriptionUpdate: ( - owner: string, - repo: string, - body: SubscriptionBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get list of tags. - * - * @name TagsDetail - * @request GET:/repos/{owner}/{repo}/tags - */ - tagsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get list of teams - * - * @name TeamsDetail - * @request GET:/repos/{owner}/{repo}/teams - */ - teamsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description List Stargazers. New implementation. - * - * @name WatchersDetail - * @request GET:/repos/{owner}/{repo}/watchers - */ - watchersDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get archive link. This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. Note: For private repositories, these links are temporary and expire quickly. - * - * @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, - ) => Promise>; - }; - repositories: { - /** - * @description List all public repositories. This provides a dump of every public repository, in the order that they were created. Note: Pagination is powered exclusively by the since parameter. is the Link header to get the URL for the next page of repositories. - * - * @name RepositoriesList - * @request GET:/repositories - */ - repositoriesList: ( - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - }; - search: { - /** - * @description Search code. - * - * @name CodeList - * @request GET:/search/code - */ - codeList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported code - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier - * you can restrict the search to just the file contents, the file path, - * or both. - * 'Languages' Searches code based on the language it's written in. - * 'Forks' Filters repositories based on the number of forks, and/or - * whether code from forked repositories should be included in the results - * at all. - * 'Size' Finds files that match a certain size (in bytes). - * 'Path' Specifies the path that the resulting file must be at. - * 'Extension' Matches files with a certain extension. - * 'Users' or 'Repositories' Limits searches to a specific user or repository. - */ - q: string; - /** - * Can only be 'indexed', which indicates how recently a file has been indexed - * by the GitHub search infrastructure. If not provided, results are sorted - * by best match. - */ - sort?: "indexed"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Find issues by state and keyword. (This method returns up to 100 results per page.) - * - * @name IssuesList - * @request GET:/search/issues - */ - issuesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The q search term can also contain any combination of the supported issue search qualifiers: */ - q: string; - /** The sort field. Can be comments, created, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "created" | "comments"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Search repositories. - * - * @name RepositoriesList - * @request GET:/search/repositories - */ - repositoriesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported repository - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the repository name, description, readme, - * or any combination of these. - * 'Size' Finds repositories that match a certain size (in kilobytes). - * 'Forks' Filters repositories based on the number of forks, and/or whether - * forked repositories should be included in the results at all. - * 'Created' and 'Last Updated' Filters repositories based on times of - * creation, or when they were last updated. - * 'Users or Repositories' Limits searches to a specific user or repository. - * 'Languages' Searches repositories based on the language they are written in. - * 'Stars' Searches repositories based on the number of stars. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "stars" | "forks" | "updated"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Search users. - * - * @name UsersList - * @request GET:/search/users - */ - usersList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported user - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the username, public email, full name, - * location, or any combination of these. - * 'Repository count' Filters users based on the number of repositories they - * have. - * 'Location' Filter users by the location indicated in their profile. - * 'Language' Search for users that have repositories that match a certain - * language. - * 'Created' Filter users based on when they joined. - * 'Followers' Filter users based on the number of followers they have. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "followers" | "repositories" | "joined"; - }, - params?: RequestParams, - ) => Promise>; - }; - teams: { - /** - * @description Delete team. In order to delete a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @name TeamsDelete - * @request DELETE:/teams/{teamId} - */ - teamsDelete: (teamId: number, params?: RequestParams) => Promise>; - /** - * @description Get team. - * - * @name TeamsDetail - * @request GET:/teams/{teamId} - */ - teamsDetail: (teamId: number, params?: RequestParams) => Promise>; - /** - * @description Edit team. In order to edit a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @name TeamsPartialUpdate - * @request PATCH:/teams/{teamId} - */ - teamsPartialUpdate: (teamId: number, body: EditTeam, params?: RequestParams) => Promise>; - /** - * @description List team members. In order to list members in a team, the authenticated user must be a member of the team. - * - * @name MembersDetail - * @request GET:/teams/{teamId}/members - */ - membersDetail: (teamId: number, params?: RequestParams) => Promise>; - /** - * @description The "Remove team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships. Remove team member. In order to remove a user from a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. NOTE This does not delete the user, it just remove them from the team. - * - * @name MembersDelete - * @request DELETE:/teams/{teamId}/members/{username} - * @deprecated - */ - membersDelete: (teamId: number, username: string, params?: RequestParams) => Promise>; - /** - * @description The "Get team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships. Get team member. In order to get if a user is a member of a team, the authenticated user mus be a member of the team. - * - * @name MembersDetail2 - * @request GET:/teams/{teamId}/members/{username} - * @deprecated - * @originalName membersDetail - * @duplicate - */ - membersDetail2: (teamId: number, username: string, params?: RequestParams) => Promise>; - /** - * @description The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams. Add team member. In order to add a user to a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. - * - * @name MembersUpdate - * @request PUT:/teams/{teamId}/members/{username} - * @deprecated - */ - membersUpdate: ( - teamId: number, - username: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Remove team membership. In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team. - * - * @name MembershipsDelete - * @request DELETE:/teams/{teamId}/memberships/{username} - */ - membershipsDelete: (teamId: number, username: string, params?: RequestParams) => Promise>; - /** - * @description Get team membership. In order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization. - * - * @name MembershipsDetail - * @request GET:/teams/{teamId}/memberships/{username} - */ - membershipsDetail: ( - teamId: number, - username: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Add team membership. In order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. If the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team. If the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the 'pending' state until the user accepts the invitation, at which point the membership will transition to the 'active' state and the user will be added as a member of the team. - * - * @name MembershipsUpdate - * @request PUT:/teams/{teamId}/memberships/{username} - */ - membershipsUpdate: ( - teamId: number, - username: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List team repos - * - * @name ReposDetail - * @request GET:/teams/{teamId}/repos - */ - reposDetail: (teamId: number, params?: RequestParams) => Promise>; - /** - * @description In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team. - * - * @name ReposDelete - * @request DELETE:/teams/{teamId}/repos/{owner}/{repo} - */ - reposDelete: ( - teamId: number, - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Check if a team manages a repository - * - * @name ReposDetail2 - * @request GET:/teams/{teamId}/repos/{owner}/{repo} - * @originalName reposDetail - * @duplicate - */ - reposDetail2: ( - teamId: number, - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization. - * - * @name ReposUpdate - * @request PUT:/teams/{teamId}/repos/{owner}/{repo} - */ - reposUpdate: ( - teamId: number, - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - }; - user: { - /** - * @description Get the authenticated user. - * - * @name UserList - * @request GET:/user - */ - userList: (params?: RequestParams) => Promise>; - /** - * @description Update the authenticated user. - * - * @name UserPartialUpdate - * @request PATCH:/user - */ - userPartialUpdate: (body: UserUpdate, params?: RequestParams) => Promise>; - /** - * @description Delete email address(es). You can include a single email address or an array of addresses. - * - * @name EmailsDelete - * @request DELETE:/user/emails - */ - emailsDelete: (body: UserEmails, params?: RequestParams) => Promise>; - /** - * @description List email addresses for a user. In the final version of the API, this method will return an array of hashes with extended information for each email address indicating if the address has been verified and if it's primary email address for GitHub. Until API v3 is finalized, use the application/vnd.github.v3 media type to get other response format. - * - * @name EmailsList - * @request GET:/user/emails - */ - emailsList: (params?: RequestParams) => Promise>; - /** - * @description Add email address(es). You can post a single email address or an array of addresses. - * - * @name EmailsCreate - * @request POST:/user/emails - */ - emailsCreate: (body: EmailsPost, params?: RequestParams) => Promise>; - /** - * @description List the authenticated user's followers - * - * @name FollowersList - * @request GET:/user/followers - */ - followersList: (params?: RequestParams) => Promise>; - /** - * @description List who the authenticated user is following. - * - * @name FollowingList - * @request GET:/user/following - */ - followingList: (params?: RequestParams) => Promise>; - /** - * @description Unfollow a user. Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingDelete - * @request DELETE:/user/following/{username} - */ - followingDelete: (username: string, params?: RequestParams) => Promise>; - /** - * @description Check if you are following a user. - * - * @name FollowingDetail - * @request GET:/user/following/{username} - */ - followingDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description Follow a user. Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingUpdate - * @request PUT:/user/following/{username} - */ - followingUpdate: (username: string, params?: RequestParams) => Promise>; - /** - * @description List issues. List all issues across owned and member repositories for the authenticated user. - * - * @name IssuesList - * @request GET:/user/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description List your public keys. Lists the current user's keys. Management of public keys via the API requires that you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes. - * - * @name KeysList - * @request GET:/user/keys - */ - keysList: (params?: RequestParams) => Promise>; - /** - * @description Create a public key. - * - * @name KeysCreate - * @request POST:/user/keys - */ - keysCreate: (body: UserKeysPost, params?: RequestParams) => Promise>; - /** - * @description Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope. - * - * @name KeysDelete - * @request DELETE:/user/keys/{keyId} - */ - keysDelete: (keyId: number, params?: RequestParams) => Promise>; - /** - * @description Get a single public key. - * - * @name KeysDetail - * @request GET:/user/keys/{keyId} - */ - keysDetail: (keyId: number, params?: RequestParams) => Promise>; - /** - * @description List public and private organizations for the authenticated user. - * - * @name OrgsList - * @request GET:/user/orgs - */ - orgsList: (params?: RequestParams) => Promise>; - /** - * @description List repositories for the authenticated user. Note that this does not include repositories owned by organizations which the user can access. You can lis user organizations and list organization repositories separately. - * - * @name ReposList - * @request GET:/user/repos - */ - reposList: ( - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @name ReposCreate - * @request POST:/user/repos - */ - reposCreate: (body: PostRepo, params?: RequestParams) => Promise>; - /** - * @description List repositories being starred by the authenticated user. - * - * @name StarredList - * @request GET:/user/starred - */ - starredList: ( - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "created" */ - sort?: "created" | "updated"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Unstar a repository - * - * @name StarredDelete - * @request DELETE:/user/starred/{owner}/{repo} - */ - starredDelete: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Check if you are starring a repository. - * - * @name StarredDetail - * @request GET:/user/starred/{owner}/{repo} - */ - starredDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Star a repository. - * - * @name StarredUpdate - * @request PUT:/user/starred/{owner}/{repo} - */ - starredUpdate: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description List repositories being watched by the authenticated user. - * - * @name SubscriptionsList - * @request GET:/user/subscriptions - */ - subscriptionsList: (params?: RequestParams) => Promise>; - /** - * @description Stop watching a repository - * - * @name SubscriptionsDelete - * @request DELETE:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDelete: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Check if you are watching a repository. - * - * @name SubscriptionsDetail - * @request GET:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Watch a repository. - * - * @name SubscriptionsUpdate - * @request PUT:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsUpdate: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth. - * - * @name TeamsList - * @request GET:/user/teams - */ - teamsList: (params?: RequestParams) => Promise>; - }; - users: { - /** - * @description Get all users. This provides a dump of every user, in the order that they signed up for GitHub. Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users. - * - * @name UsersList - * @request GET:/users - */ - usersList: ( - query?: { - /** The integer ID of the last user that you've seen. */ - since?: number; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single user. - * - * @name UsersDetail - * @request GET:/users/{username} - */ - usersDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. - * - * @name EventsDetail - * @request GET:/users/{username}/events - */ - eventsDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description This is the user's organization dashboard. You must be authenticated as the user to view this. - * - * @name EventsOrgsDetail - * @request GET:/users/{username}/events/orgs/{org} - */ - eventsOrgsDetail: (username: string, org: string, params?: RequestParams) => Promise>; - /** - * @description List a user's followers - * - * @name FollowersDetail - * @request GET:/users/{username}/followers - */ - followersDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description Check if one user follows another. - * - * @name FollowingDetail - * @request GET:/users/{username}/following/{targetUser} - */ - followingDetail: ( - username: string, - targetUser: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List a users gists. - * - * @name GistsDetail - * @request GET:/users/{username}/gists - */ - gistsDetail: ( - username: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description List public keys for a user. Lists the verified public keys for a user. This is accessible by anyone. - * - * @name KeysDetail - * @request GET:/users/{username}/keys - */ - keysDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description List all public organizations for a user. - * - * @name OrgsDetail - * @request GET:/users/{username}/orgs - */ - orgsDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description These are events that you'll only see public events. - * - * @name ReceivedEventsDetail - * @request GET:/users/{username}/received_events - */ - receivedEventsDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description List public events that a user has received - * - * @name ReceivedEventsPublicDetail - * @request GET:/users/{username}/received_events/public - */ - receivedEventsPublicDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description List public repositories for the specified user. - * - * @name ReposDetail - * @request GET:/users/{username}/repos - */ - reposDetail: ( - username: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description List repositories being starred by a user. - * - * @name StarredDetail - * @request GET:/users/{username}/starred - */ - starredDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description List repositories being watched by a user. - * - * @name SubscriptionsDetail - * @request GET:/users/{username}/subscriptions - */ - subscriptionsDetail: (username: string, params?: RequestParams) => Promise>; - }; -} -export {}; diff --git a/tests/spec/js/test.js b/tests/spec/js/test.js deleted file mode 100644 index 1d798142..00000000 --- a/tests/spec/js/test.js +++ /dev/null @@ -1,19 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node:path"); -const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); -const createSchemaInfos = require("../../helpers/createSchemaInfos"); - -const schemas = createSchemaInfos({ - absolutePathToSchemas: resolve(__dirname, "./"), -}); - -schemas.forEach(({ absolutePath, apiFileName }) => { - generateApiForTest({ - testName: "--js option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - toJS: true, - }); -}); diff --git a/tests/spec/js/schema.js b/tests/spec/jsAxios/__snapshots__/basic.test.ts.snap similarity index 87% rename from tests/spec/js/schema.js rename to tests/spec/jsAxios/__snapshots__/basic.test.ts.snap index b023cd0d..d257b150 100644 --- a/tests/spec/js/schema.js +++ b/tests/spec/jsAxios/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --js 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -36,7 +39,7 @@ export class HttpClient { }; encodeQueryParam(key, value) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } addQueryParam(query, key) { return this.encodeQueryParam(key, query[key]); @@ -54,7 +57,7 @@ export class HttpClient { } addQueryParams(rawQuery) { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } contentFormatters = { [ContentType.Json]: (input) => @@ -69,7 +72,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -116,7 +119,7 @@ export class HttpClient { 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}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -170,7 +173,7 @@ export class Api extends HttpClient { */ emojisList: (params = {}) => this.request({ - path: `/emojis`, + path: \`/emojis\`, method: "GET", format: "json", ...params, @@ -185,7 +188,7 @@ export class Api extends HttpClient { */ eventsList: (params = {}) => this.request({ - path: `/events`, + path: \`/events\`, method: "GET", format: "json", ...params, @@ -200,7 +203,7 @@ export class Api extends HttpClient { */ feedsList: (params = {}) => this.request({ - path: `/feeds`, + path: \`/feeds\`, method: "GET", format: "json", ...params, @@ -215,7 +218,7 @@ export class Api extends HttpClient { */ gistsList: (query, params = {}) => this.request({ - path: `/gists`, + path: \`/gists\`, method: "GET", query: query, format: "json", @@ -229,7 +232,7 @@ export class Api extends HttpClient { */ gistsCreate: (body, params = {}) => this.request({ - path: `/gists`, + path: \`/gists\`, method: "POST", body: body, type: ContentType.Json, @@ -244,7 +247,7 @@ export class Api extends HttpClient { */ publicList: (query, params = {}) => this.request({ - path: `/gists/public`, + path: \`/gists/public\`, method: "GET", query: query, format: "json", @@ -258,7 +261,7 @@ export class Api extends HttpClient { */ starredList: (query, params = {}) => this.request({ - path: `/gists/starred`, + path: \`/gists/starred\`, method: "GET", query: query, format: "json", @@ -272,7 +275,7 @@ export class Api extends HttpClient { */ gistsDelete: (id, params = {}) => this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "DELETE", ...params, }), @@ -284,7 +287,7 @@ export class Api extends HttpClient { */ gistsDetail: (id, params = {}) => this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "GET", format: "json", ...params, @@ -297,7 +300,7 @@ export class Api extends HttpClient { */ gistsPartialUpdate: (id, body, params = {}) => this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -312,7 +315,7 @@ export class Api extends HttpClient { */ commentsDetail: (id, params = {}) => this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "GET", format: "json", ...params, @@ -325,7 +328,7 @@ export class Api extends HttpClient { */ commentsCreate: (id, body, params = {}) => this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "POST", body: body, format: "json", @@ -339,7 +342,7 @@ export class Api extends HttpClient { */ commentsDelete: (id, commentId, params = {}) => this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -353,7 +356,7 @@ export class Api extends HttpClient { */ commentsDetail2: (id, commentId, params = {}) => this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -366,7 +369,7 @@ export class Api extends HttpClient { */ commentsPartialUpdate: (id, commentId, body, params = {}) => this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -381,7 +384,7 @@ export class Api extends HttpClient { */ forksCreate: (id, params = {}) => this.request({ - path: `/gists/${id}/forks`, + path: \`/gists/\${id}/forks\`, method: "POST", ...params, }), @@ -393,7 +396,7 @@ export class Api extends HttpClient { */ starDelete: (id, params = {}) => this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "DELETE", ...params, }), @@ -405,7 +408,7 @@ export class Api extends HttpClient { */ starDetail: (id, params = {}) => this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "GET", ...params, }), @@ -417,7 +420,7 @@ export class Api extends HttpClient { */ starUpdate: (id, params = {}) => this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "PUT", ...params, }), @@ -431,7 +434,7 @@ export class Api extends HttpClient { */ templatesList: (params = {}) => this.request({ - path: `/gitignore/templates`, + path: \`/gitignore/templates\`, method: "GET", format: "json", ...params, @@ -444,7 +447,7 @@ export class Api extends HttpClient { */ templatesDetail: (language, params = {}) => this.request({ - path: `/gitignore/templates/${language}`, + path: \`/gitignore/templates/\${language}\`, method: "GET", format: "json", ...params, @@ -459,7 +462,7 @@ export class Api extends HttpClient { */ issuesList: (query, params = {}) => this.request({ - path: `/issues`, + path: \`/issues\`, method: "GET", query: query, format: "json", @@ -476,7 +479,7 @@ export class Api extends HttpClient { */ issuesSearchDetail: (keyword, state, owner, repository, params = {}) => this.request({ - path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + path: \`/legacy/issues/search/\${owner}/\${repository}/\${state}/\${keyword}\`, method: "GET", format: "json", ...params, @@ -490,7 +493,7 @@ export class Api extends HttpClient { */ reposSearchDetail: (keyword, query, params = {}) => this.request({ - path: `/legacy/repos/search/${keyword}`, + path: \`/legacy/repos/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -505,7 +508,7 @@ export class Api extends HttpClient { */ userEmailDetail: (email, params = {}) => this.request({ - path: `/legacy/user/email/${email}`, + path: \`/legacy/user/email/\${email}\`, method: "GET", format: "json", ...params, @@ -519,7 +522,7 @@ export class Api extends HttpClient { */ userSearchDetail: (keyword, query, params = {}) => this.request({ - path: `/legacy/user/search/${keyword}`, + path: \`/legacy/user/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -535,7 +538,7 @@ export class Api extends HttpClient { */ markdownCreate: (body, params = {}) => this.request({ - path: `/markdown`, + path: \`/markdown\`, method: "POST", body: body, type: ContentType.Json, @@ -549,7 +552,7 @@ export class Api extends HttpClient { */ postMarkdown: (params = {}) => this.request({ - path: `/markdown/raw`, + path: \`/markdown/raw\`, method: "POST", type: ContentType.Text, ...params, @@ -564,7 +567,7 @@ export class Api extends HttpClient { */ metaList: (params = {}) => this.request({ - path: `/meta`, + path: \`/meta\`, method: "GET", format: "json", ...params, @@ -579,7 +582,7 @@ export class Api extends HttpClient { */ eventsDetail: (owner, repo, params = {}) => this.request({ - path: `/networks/${owner}/${repo}/events`, + path: \`/networks/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -594,7 +597,7 @@ export class Api extends HttpClient { */ notificationsList: (query, params = {}) => this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "GET", query: query, format: "json", @@ -608,7 +611,7 @@ export class Api extends HttpClient { */ notificationsUpdate: (body, params = {}) => this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "PUT", body: body, ...params, @@ -621,7 +624,7 @@ export class Api extends HttpClient { */ threadsDetail: (id, params = {}) => this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "GET", format: "json", ...params, @@ -634,7 +637,7 @@ export class Api extends HttpClient { */ threadsPartialUpdate: (id, params = {}) => this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "PATCH", ...params, }), @@ -646,7 +649,7 @@ export class Api extends HttpClient { */ threadsSubscriptionDelete: (id, params = {}) => this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "DELETE", ...params, }), @@ -658,7 +661,7 @@ export class Api extends HttpClient { */ threadsSubscriptionDetail: (id, params = {}) => this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "GET", format: "json", ...params, @@ -671,7 +674,7 @@ export class Api extends HttpClient { */ threadsSubscriptionUpdate: (id, body, params = {}) => this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -688,7 +691,7 @@ export class Api extends HttpClient { */ orgsDetail: (org, params = {}) => this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "GET", format: "json", ...params, @@ -701,7 +704,7 @@ export class Api extends HttpClient { */ orgsPartialUpdate: (org, body, params = {}) => this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -716,7 +719,7 @@ export class Api extends HttpClient { */ eventsDetail: (org, params = {}) => this.request({ - path: `/orgs/${org}/events`, + path: \`/orgs/\${org}/events\`, method: "GET", format: "json", ...params, @@ -729,7 +732,7 @@ export class Api extends HttpClient { */ issuesDetail: (org, query, params = {}) => this.request({ - path: `/orgs/${org}/issues`, + path: \`/orgs/\${org}/issues\`, method: "GET", query: query, format: "json", @@ -743,7 +746,7 @@ export class Api extends HttpClient { */ membersDetail: (org, params = {}) => this.request({ - path: `/orgs/${org}/members`, + path: \`/orgs/\${org}/members\`, method: "GET", format: "json", ...params, @@ -756,7 +759,7 @@ export class Api extends HttpClient { */ membersDelete: (org, username, params = {}) => this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "DELETE", ...params, }), @@ -770,7 +773,7 @@ export class Api extends HttpClient { */ membersDetail2: (org, username, params = {}) => this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "GET", ...params, }), @@ -782,7 +785,7 @@ export class Api extends HttpClient { */ publicMembersDetail: (org, params = {}) => this.request({ - path: `/orgs/${org}/public_members`, + path: \`/orgs/\${org}/public_members\`, method: "GET", format: "json", ...params, @@ -795,7 +798,7 @@ export class Api extends HttpClient { */ publicMembersDelete: (org, username, params = {}) => this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "DELETE", ...params, }), @@ -809,7 +812,7 @@ export class Api extends HttpClient { */ publicMembersDetail2: (org, username, params = {}) => this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "GET", ...params, }), @@ -821,7 +824,7 @@ export class Api extends HttpClient { */ publicMembersUpdate: (org, username, params = {}) => this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "PUT", ...params, }), @@ -833,7 +836,7 @@ export class Api extends HttpClient { */ reposDetail: (org, query, params = {}) => this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "GET", query: query, format: "json", @@ -847,7 +850,7 @@ export class Api extends HttpClient { */ reposCreate: (org, body, params = {}) => this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "POST", body: body, format: "json", @@ -861,7 +864,7 @@ export class Api extends HttpClient { */ teamsDetail: (org, params = {}) => this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "GET", format: "json", ...params, @@ -874,7 +877,7 @@ export class Api extends HttpClient { */ teamsCreate: (org, body, params = {}) => this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "POST", body: body, type: ContentType.Json, @@ -891,7 +894,7 @@ export class Api extends HttpClient { */ rateLimitList: (params = {}) => this.request({ - path: `/rate_limit`, + path: \`/rate_limit\`, method: "GET", format: "json", ...params, @@ -906,7 +909,7 @@ export class Api extends HttpClient { */ reposDelete: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -918,7 +921,7 @@ export class Api extends HttpClient { */ reposDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "GET", format: "json", ...params, @@ -931,7 +934,7 @@ export class Api extends HttpClient { */ reposPartialUpdate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -946,7 +949,7 @@ export class Api extends HttpClient { */ assigneesDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/assignees`, + path: \`/repos/\${owner}/\${repo}/assignees\`, method: "GET", format: "json", ...params, @@ -961,7 +964,7 @@ export class Api extends HttpClient { */ assigneesDetail2: (owner, repo, assignee, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/assignees/${assignee}`, + path: \`/repos/\${owner}/\${repo}/assignees/\${assignee}\`, method: "GET", ...params, }), @@ -973,7 +976,7 @@ export class Api extends HttpClient { */ branchesDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/branches`, + path: \`/repos/\${owner}/\${repo}/branches\`, method: "GET", format: "json", ...params, @@ -988,7 +991,7 @@ export class Api extends HttpClient { */ branchesDetail2: (owner, repo, branch, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}`, + path: \`/repos/\${owner}/\${repo}/branches/\${branch}\`, method: "GET", format: "json", ...params, @@ -1001,7 +1004,7 @@ export class Api extends HttpClient { */ collaboratorsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/collaborators`, + path: \`/repos/\${owner}/\${repo}/collaborators\`, method: "GET", format: "json", ...params, @@ -1014,7 +1017,7 @@ export class Api extends HttpClient { */ collaboratorsDelete: (owner, repo, user, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "DELETE", ...params, }), @@ -1028,7 +1031,7 @@ export class Api extends HttpClient { */ collaboratorsDetail2: (owner, repo, user, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "GET", ...params, }), @@ -1040,7 +1043,7 @@ export class Api extends HttpClient { */ collaboratorsUpdate: (owner, repo, user, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "PUT", ...params, }), @@ -1052,7 +1055,7 @@ export class Api extends HttpClient { */ commentsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/comments`, + path: \`/repos/\${owner}/\${repo}/comments\`, method: "GET", format: "json", ...params, @@ -1065,7 +1068,7 @@ export class Api extends HttpClient { */ commentsDelete: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -1079,7 +1082,7 @@ export class Api extends HttpClient { */ commentsDetail2: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -1092,7 +1095,7 @@ export class Api extends HttpClient { */ commentsPartialUpdate: (owner, repo, commentId, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -1106,7 +1109,7 @@ export class Api extends HttpClient { */ commitsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/commits`, + path: \`/repos/\${owner}/\${repo}/commits\`, method: "GET", query: query, format: "json", @@ -1120,7 +1123,7 @@ export class Api extends HttpClient { */ commitsStatusDetail: (owner, repo, ref, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/status`, + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/status\`, method: "GET", format: "json", ...params, @@ -1135,7 +1138,7 @@ export class Api extends HttpClient { */ commitsDetail2: (owner, repo, shaCode, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -1148,7 +1151,7 @@ export class Api extends HttpClient { */ commitsCommentsDetail: (owner, repo, shaCode, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "GET", format: "json", ...params, @@ -1161,7 +1164,7 @@ export class Api extends HttpClient { */ commitsCommentsCreate: (owner, repo, shaCode, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -1176,7 +1179,7 @@ export class Api extends HttpClient { */ compareDetail: (owner, repo, baseId, headId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + path: \`/repos/\${owner}/\${repo}/compare/\${baseId}...\${headId}\`, method: "GET", format: "json", ...params, @@ -1189,7 +1192,7 @@ export class Api extends HttpClient { */ contentsDelete: (owner, repo, path, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "DELETE", body: body, type: ContentType.Json, @@ -1204,7 +1207,7 @@ export class Api extends HttpClient { */ contentsDetail: (owner, repo, path, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "GET", query: query, format: "json", @@ -1218,7 +1221,7 @@ export class Api extends HttpClient { */ contentsUpdate: (owner, repo, path, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "PUT", body: body, type: ContentType.Json, @@ -1233,7 +1236,7 @@ export class Api extends HttpClient { */ contributorsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/contributors`, + path: \`/repos/\${owner}/\${repo}/contributors\`, method: "GET", query: query, format: "json", @@ -1247,7 +1250,7 @@ export class Api extends HttpClient { */ deploymentsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "GET", format: "json", ...params, @@ -1260,7 +1263,7 @@ export class Api extends HttpClient { */ deploymentsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "POST", body: body, type: ContentType.Json, @@ -1275,7 +1278,7 @@ export class Api extends HttpClient { */ deploymentsStatusesDetail: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "GET", format: "json", ...params, @@ -1288,7 +1291,7 @@ export class Api extends HttpClient { */ deploymentsStatusesCreate: (owner, repo, id, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "POST", body: body, type: ContentType.Json, @@ -1303,7 +1306,7 @@ export class Api extends HttpClient { */ downloadsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/downloads`, + path: \`/repos/\${owner}/\${repo}/downloads\`, method: "GET", format: "json", ...params, @@ -1317,7 +1320,7 @@ export class Api extends HttpClient { */ downloadsDelete: (owner, repo, downloadId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "DELETE", ...params, }), @@ -1332,7 +1335,7 @@ export class Api extends HttpClient { */ downloadsDetail2: (owner, repo, downloadId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "GET", format: "json", ...params, @@ -1345,7 +1348,7 @@ export class Api extends HttpClient { */ eventsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/events`, + path: \`/repos/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -1358,7 +1361,7 @@ export class Api extends HttpClient { */ forksDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "GET", query: query, format: "json", @@ -1372,7 +1375,7 @@ export class Api extends HttpClient { */ forksCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "POST", body: body, type: ContentType.Json, @@ -1387,7 +1390,7 @@ export class Api extends HttpClient { */ gitBlobsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/blobs`, + path: \`/repos/\${owner}/\${repo}/git/blobs\`, method: "POST", body: body, type: ContentType.Json, @@ -1402,7 +1405,7 @@ export class Api extends HttpClient { */ gitBlobsDetail: (owner, repo, shaCode, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/blobs/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -1415,7 +1418,7 @@ export class Api extends HttpClient { */ gitCommitsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/commits`, + path: \`/repos/\${owner}/\${repo}/git/commits\`, method: "POST", body: body, type: ContentType.Json, @@ -1430,7 +1433,7 @@ export class Api extends HttpClient { */ gitCommitsDetail: (owner, repo, shaCode, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -1443,7 +1446,7 @@ export class Api extends HttpClient { */ gitRefsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "GET", format: "json", ...params, @@ -1456,7 +1459,7 @@ export class Api extends HttpClient { */ gitRefsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "POST", body: body, type: ContentType.Json, @@ -1471,7 +1474,7 @@ export class Api extends HttpClient { */ gitRefsDelete: (owner, repo, ref, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "DELETE", ...params, }), @@ -1485,7 +1488,7 @@ export class Api extends HttpClient { */ gitRefsDetail2: (owner, repo, ref, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "GET", format: "json", ...params, @@ -1498,7 +1501,7 @@ export class Api extends HttpClient { */ gitRefsPartialUpdate: (owner, repo, ref, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -1513,7 +1516,7 @@ export class Api extends HttpClient { */ gitTagsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/tags`, + path: \`/repos/\${owner}/\${repo}/git/tags\`, method: "POST", body: body, type: ContentType.Json, @@ -1528,7 +1531,7 @@ export class Api extends HttpClient { */ gitTagsDetail: (owner, repo, shaCode, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/tags/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -1541,7 +1544,7 @@ export class Api extends HttpClient { */ gitTreesCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/trees`, + path: \`/repos/\${owner}/\${repo}/git/trees\`, method: "POST", body: body, type: ContentType.Json, @@ -1556,7 +1559,7 @@ export class Api extends HttpClient { */ gitTreesDetail: (owner, repo, shaCode, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/trees/\${shaCode}\`, method: "GET", query: query, format: "json", @@ -1570,7 +1573,7 @@ export class Api extends HttpClient { */ hooksDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "GET", format: "json", ...params, @@ -1583,7 +1586,7 @@ export class Api extends HttpClient { */ hooksCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "POST", body: body, format: "json", @@ -1597,7 +1600,7 @@ export class Api extends HttpClient { */ hooksDelete: (owner, repo, hookId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "DELETE", ...params, }), @@ -1611,7 +1614,7 @@ export class Api extends HttpClient { */ hooksDetail2: (owner, repo, hookId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "GET", format: "json", ...params, @@ -1624,7 +1627,7 @@ export class Api extends HttpClient { */ hooksPartialUpdate: (owner, repo, hookId, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "PATCH", body: body, format: "json", @@ -1638,7 +1641,7 @@ export class Api extends HttpClient { */ hooksTestsCreate: (owner, repo, hookId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/tests\`, method: "POST", ...params, }), @@ -1650,7 +1653,7 @@ export class Api extends HttpClient { */ issuesDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "GET", query: query, format: "json", @@ -1664,7 +1667,7 @@ export class Api extends HttpClient { */ issuesCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "POST", body: body, format: "json", @@ -1678,7 +1681,7 @@ export class Api extends HttpClient { */ issuesCommentsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, + path: \`/repos/\${owner}/\${repo}/issues/comments\`, method: "GET", query: query, format: "json", @@ -1692,7 +1695,7 @@ export class Api extends HttpClient { */ issuesCommentsDelete: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -1706,7 +1709,7 @@ export class Api extends HttpClient { */ issuesCommentsDetail2: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -1719,7 +1722,7 @@ export class Api extends HttpClient { */ issuesCommentsPartialUpdate: (owner, repo, commentId, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -1733,7 +1736,7 @@ export class Api extends HttpClient { */ issuesEventsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/events`, + path: \`/repos/\${owner}/\${repo}/issues/events\`, method: "GET", format: "json", ...params, @@ -1748,7 +1751,7 @@ export class Api extends HttpClient { */ issuesEventsDetail2: (owner, repo, eventId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + path: \`/repos/\${owner}/\${repo}/issues/events/\${eventId}\`, method: "GET", format: "json", ...params, @@ -1763,7 +1766,7 @@ export class Api extends HttpClient { */ issuesDetail2: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "GET", format: "json", ...params, @@ -1776,7 +1779,7 @@ export class Api extends HttpClient { */ issuesPartialUpdate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "PATCH", body: body, format: "json", @@ -1792,7 +1795,7 @@ export class Api extends HttpClient { */ issuesCommentsDetail3: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -1805,7 +1808,7 @@ export class Api extends HttpClient { */ issuesCommentsCreate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "POST", body: body, format: "json", @@ -1821,7 +1824,7 @@ export class Api extends HttpClient { */ issuesEventsDetail3: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/events`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/events\`, method: "GET", format: "json", ...params, @@ -1834,7 +1837,7 @@ export class Api extends HttpClient { */ issuesLabelsDelete: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "DELETE", ...params, }), @@ -1846,7 +1849,7 @@ export class Api extends HttpClient { */ issuesLabelsDetail: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -1859,7 +1862,7 @@ export class Api extends HttpClient { */ issuesLabelsCreate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "POST", body: body, format: "json", @@ -1873,7 +1876,7 @@ export class Api extends HttpClient { */ issuesLabelsUpdate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "PUT", body: body, format: "json", @@ -1889,7 +1892,7 @@ export class Api extends HttpClient { */ issuesLabelsDelete2: (owner, repo, number, name, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -1901,7 +1904,7 @@ export class Api extends HttpClient { */ keysDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "GET", format: "json", ...params, @@ -1914,7 +1917,7 @@ export class Api extends HttpClient { */ keysCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "POST", body: body, format: "json", @@ -1928,7 +1931,7 @@ export class Api extends HttpClient { */ keysDelete: (owner, repo, keyId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -1942,7 +1945,7 @@ export class Api extends HttpClient { */ keysDetail2: (owner, repo, keyId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -1955,7 +1958,7 @@ export class Api extends HttpClient { */ labelsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "GET", format: "json", ...params, @@ -1968,7 +1971,7 @@ export class Api extends HttpClient { */ labelsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "POST", body: body, format: "json", @@ -1982,7 +1985,7 @@ export class Api extends HttpClient { */ labelsDelete: (owner, repo, name, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -1996,7 +1999,7 @@ export class Api extends HttpClient { */ labelsDetail2: (owner, repo, name, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "GET", format: "json", ...params, @@ -2009,7 +2012,7 @@ export class Api extends HttpClient { */ labelsPartialUpdate: (owner, repo, name, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "PATCH", body: body, format: "json", @@ -2023,7 +2026,7 @@ export class Api extends HttpClient { */ languagesDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/languages`, + path: \`/repos/\${owner}/\${repo}/languages\`, method: "GET", format: "json", ...params, @@ -2036,7 +2039,7 @@ export class Api extends HttpClient { */ mergesCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/merges`, + path: \`/repos/\${owner}/\${repo}/merges\`, method: "POST", body: body, type: ContentType.Json, @@ -2051,7 +2054,7 @@ export class Api extends HttpClient { */ milestonesDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "GET", query: query, format: "json", @@ -2065,7 +2068,7 @@ export class Api extends HttpClient { */ milestonesCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "POST", body: body, format: "json", @@ -2079,7 +2082,7 @@ export class Api extends HttpClient { */ milestonesDelete: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "DELETE", ...params, }), @@ -2093,7 +2096,7 @@ export class Api extends HttpClient { */ milestonesDetail2: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "GET", format: "json", ...params, @@ -2106,7 +2109,7 @@ export class Api extends HttpClient { */ milestonesPartialUpdate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "PATCH", body: body, format: "json", @@ -2120,7 +2123,7 @@ export class Api extends HttpClient { */ milestonesLabelsDetail: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -2133,7 +2136,7 @@ export class Api extends HttpClient { */ notificationsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "GET", query: query, format: "json", @@ -2147,7 +2150,7 @@ export class Api extends HttpClient { */ notificationsUpdate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "PUT", body: body, ...params, @@ -2160,7 +2163,7 @@ export class Api extends HttpClient { */ pullsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "GET", query: query, format: "json", @@ -2174,7 +2177,7 @@ export class Api extends HttpClient { */ pullsCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "POST", body: body, type: ContentType.Json, @@ -2189,7 +2192,7 @@ export class Api extends HttpClient { */ pullsCommentsDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/comments\`, method: "GET", query: query, format: "json", @@ -2203,7 +2206,7 @@ export class Api extends HttpClient { */ pullsCommentsDelete: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -2217,7 +2220,7 @@ export class Api extends HttpClient { */ pullsCommentsDetail2: (owner, repo, commentId, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -2230,7 +2233,7 @@ export class Api extends HttpClient { */ pullsCommentsPartialUpdate: (owner, repo, commentId, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -2246,7 +2249,7 @@ export class Api extends HttpClient { */ pullsDetail2: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "GET", format: "json", ...params, @@ -2259,7 +2262,7 @@ export class Api extends HttpClient { */ pullsPartialUpdate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2276,7 +2279,7 @@ export class Api extends HttpClient { */ pullsCommentsDetail3: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -2289,7 +2292,7 @@ export class Api extends HttpClient { */ pullsCommentsCreate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -2304,7 +2307,7 @@ export class Api extends HttpClient { */ pullsCommitsDetail: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/commits\`, method: "GET", format: "json", ...params, @@ -2317,7 +2320,7 @@ export class Api extends HttpClient { */ pullsFilesDetail: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/files`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/files\`, method: "GET", format: "json", ...params, @@ -2330,7 +2333,7 @@ export class Api extends HttpClient { */ pullsMergeDetail: (owner, repo, number, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "GET", ...params, }), @@ -2342,7 +2345,7 @@ export class Api extends HttpClient { */ pullsMergeUpdate: (owner, repo, number, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "PUT", body: body, type: ContentType.Json, @@ -2357,7 +2360,7 @@ export class Api extends HttpClient { */ readmeDetail: (owner, repo, query, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/readme`, + path: \`/repos/\${owner}/\${repo}/readme\`, method: "GET", query: query, format: "json", @@ -2371,7 +2374,7 @@ export class Api extends HttpClient { */ releasesDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "GET", format: "json", ...params, @@ -2384,7 +2387,7 @@ export class Api extends HttpClient { */ releasesCreate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "POST", body: body, format: "json", @@ -2398,7 +2401,7 @@ export class Api extends HttpClient { */ releasesAssetsDelete: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "DELETE", ...params, }), @@ -2410,7 +2413,7 @@ export class Api extends HttpClient { */ releasesAssetsDetail: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "GET", format: "json", ...params, @@ -2423,7 +2426,7 @@ export class Api extends HttpClient { */ releasesAssetsPartialUpdate: (owner, repo, id, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2438,7 +2441,7 @@ export class Api extends HttpClient { */ releasesDelete: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "DELETE", ...params, }), @@ -2452,7 +2455,7 @@ export class Api extends HttpClient { */ releasesDetail2: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "GET", format: "json", ...params, @@ -2465,7 +2468,7 @@ export class Api extends HttpClient { */ releasesPartialUpdate: (owner, repo, id, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "PATCH", body: body, format: "json", @@ -2481,7 +2484,7 @@ export class Api extends HttpClient { */ releasesAssetsDetail2: (owner, repo, id, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/releases/${id}/assets`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}/assets\`, method: "GET", format: "json", ...params, @@ -2494,7 +2497,7 @@ export class Api extends HttpClient { */ stargazersDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stargazers`, + path: \`/repos/\${owner}/\${repo}/stargazers\`, method: "GET", format: "json", ...params, @@ -2507,7 +2510,7 @@ export class Api extends HttpClient { */ statsCodeFrequencyDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stats/code_frequency`, + path: \`/repos/\${owner}/\${repo}/stats/code_frequency\`, method: "GET", format: "json", ...params, @@ -2520,7 +2523,7 @@ export class Api extends HttpClient { */ statsCommitActivityDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stats/commit_activity`, + path: \`/repos/\${owner}/\${repo}/stats/commit_activity\`, method: "GET", format: "json", ...params, @@ -2533,7 +2536,7 @@ export class Api extends HttpClient { */ statsContributorsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stats/contributors`, + path: \`/repos/\${owner}/\${repo}/stats/contributors\`, method: "GET", format: "json", ...params, @@ -2546,7 +2549,7 @@ export class Api extends HttpClient { */ statsParticipationDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stats/participation`, + path: \`/repos/\${owner}/\${repo}/stats/participation\`, method: "GET", format: "json", ...params, @@ -2559,7 +2562,7 @@ export class Api extends HttpClient { */ statsPunchCardDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/stats/punch_card`, + path: \`/repos/\${owner}/\${repo}/stats/punch_card\`, method: "GET", format: "json", ...params, @@ -2572,7 +2575,7 @@ export class Api extends HttpClient { */ statusesDetail: (owner, repo, ref, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "GET", format: "json", ...params, @@ -2585,7 +2588,7 @@ export class Api extends HttpClient { */ statusesCreate: (owner, repo, ref, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "POST", body: body, type: ContentType.Json, @@ -2600,7 +2603,7 @@ export class Api extends HttpClient { */ subscribersDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/subscribers`, + path: \`/repos/\${owner}/\${repo}/subscribers\`, method: "GET", format: "json", ...params, @@ -2613,7 +2616,7 @@ export class Api extends HttpClient { */ subscriptionDelete: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "DELETE", ...params, }), @@ -2625,7 +2628,7 @@ export class Api extends HttpClient { */ subscriptionDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "GET", format: "json", ...params, @@ -2638,7 +2641,7 @@ export class Api extends HttpClient { */ subscriptionUpdate: (owner, repo, body, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -2653,7 +2656,7 @@ export class Api extends HttpClient { */ tagsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/tags`, + path: \`/repos/\${owner}/\${repo}/tags\`, method: "GET", format: "json", ...params, @@ -2666,7 +2669,7 @@ export class Api extends HttpClient { */ teamsDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/teams`, + path: \`/repos/\${owner}/\${repo}/teams\`, method: "GET", format: "json", ...params, @@ -2679,7 +2682,7 @@ export class Api extends HttpClient { */ watchersDetail: (owner, repo, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/watchers`, + path: \`/repos/\${owner}/\${repo}/watchers\`, method: "GET", format: "json", ...params, @@ -2694,7 +2697,7 @@ export class Api extends HttpClient { */ reposDetail2: (owner, repo, archiveFormat, path, params = {}) => this.request({ - path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + path: \`/repos/\${owner}/\${repo}/\${archiveFormat}/\${path}\`, method: "GET", ...params, }), @@ -2708,7 +2711,7 @@ export class Api extends HttpClient { */ repositoriesList: (query, params = {}) => this.request({ - path: `/repositories`, + path: \`/repositories\`, method: "GET", query: query, format: "json", @@ -2724,7 +2727,7 @@ export class Api extends HttpClient { */ codeList: (query, params = {}) => this.request({ - path: `/search/code`, + path: \`/search/code\`, method: "GET", query: query, format: "json", @@ -2738,7 +2741,7 @@ export class Api extends HttpClient { */ issuesList: (query, params = {}) => this.request({ - path: `/search/issues`, + path: \`/search/issues\`, method: "GET", query: query, format: "json", @@ -2752,7 +2755,7 @@ export class Api extends HttpClient { */ repositoriesList: (query, params = {}) => this.request({ - path: `/search/repositories`, + path: \`/search/repositories\`, method: "GET", query: query, format: "json", @@ -2766,7 +2769,7 @@ export class Api extends HttpClient { */ usersList: (query, params = {}) => this.request({ - path: `/search/users`, + path: \`/search/users\`, method: "GET", query: query, format: "json", @@ -2782,7 +2785,7 @@ export class Api extends HttpClient { */ teamsDelete: (teamId, params = {}) => this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "DELETE", ...params, }), @@ -2794,7 +2797,7 @@ export class Api extends HttpClient { */ teamsDetail: (teamId, params = {}) => this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "GET", format: "json", ...params, @@ -2807,7 +2810,7 @@ export class Api extends HttpClient { */ teamsPartialUpdate: (teamId, body, params = {}) => this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2822,7 +2825,7 @@ export class Api extends HttpClient { */ membersDetail: (teamId, params = {}) => this.request({ - path: `/teams/${teamId}/members`, + path: \`/teams/\${teamId}/members\`, method: "GET", format: "json", ...params, @@ -2836,7 +2839,7 @@ export class Api extends HttpClient { */ membersDelete: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "DELETE", ...params, }), @@ -2851,7 +2854,7 @@ export class Api extends HttpClient { */ membersDetail2: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "GET", ...params, }), @@ -2864,7 +2867,7 @@ export class Api extends HttpClient { */ membersUpdate: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "PUT", ...params, }), @@ -2876,7 +2879,7 @@ export class Api extends HttpClient { */ membershipsDelete: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "DELETE", ...params, }), @@ -2888,7 +2891,7 @@ export class Api extends HttpClient { */ membershipsDetail: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "GET", format: "json", ...params, @@ -2901,7 +2904,7 @@ export class Api extends HttpClient { */ membershipsUpdate: (teamId, username, params = {}) => this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "PUT", format: "json", ...params, @@ -2914,7 +2917,7 @@ export class Api extends HttpClient { */ reposDetail: (teamId, params = {}) => this.request({ - path: `/teams/${teamId}/repos`, + path: \`/teams/\${teamId}/repos\`, method: "GET", format: "json", ...params, @@ -2927,7 +2930,7 @@ export class Api extends HttpClient { */ reposDelete: (teamId, owner, repo, params = {}) => this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -2941,7 +2944,7 @@ export class Api extends HttpClient { */ reposDetail2: (teamId, owner, repo, params = {}) => this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -2953,7 +2956,7 @@ export class Api extends HttpClient { */ reposUpdate: (teamId, owner, repo, params = {}) => this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -2967,7 +2970,7 @@ export class Api extends HttpClient { */ userList: (params = {}) => this.request({ - path: `/user`, + path: \`/user\`, method: "GET", format: "json", ...params, @@ -2980,7 +2983,7 @@ export class Api extends HttpClient { */ userPartialUpdate: (body, params = {}) => this.request({ - path: `/user`, + path: \`/user\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2995,7 +2998,7 @@ export class Api extends HttpClient { */ emailsDelete: (body, params = {}) => this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "DELETE", body: body, type: ContentType.Json, @@ -3009,7 +3012,7 @@ export class Api extends HttpClient { */ emailsList: (params = {}) => this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "GET", ...params, }), @@ -3021,7 +3024,7 @@ export class Api extends HttpClient { */ emailsCreate: (body, params = {}) => this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "POST", body: body, ...params, @@ -3034,7 +3037,7 @@ export class Api extends HttpClient { */ followersList: (params = {}) => this.request({ - path: `/user/followers`, + path: \`/user/followers\`, method: "GET", format: "json", ...params, @@ -3047,7 +3050,7 @@ export class Api extends HttpClient { */ followingList: (params = {}) => this.request({ - path: `/user/following`, + path: \`/user/following\`, method: "GET", format: "json", ...params, @@ -3060,7 +3063,7 @@ export class Api extends HttpClient { */ followingDelete: (username, params = {}) => this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "DELETE", ...params, }), @@ -3072,7 +3075,7 @@ export class Api extends HttpClient { */ followingDetail: (username, params = {}) => this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "GET", ...params, }), @@ -3084,7 +3087,7 @@ export class Api extends HttpClient { */ followingUpdate: (username, params = {}) => this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "PUT", ...params, }), @@ -3096,7 +3099,7 @@ export class Api extends HttpClient { */ issuesList: (query, params = {}) => this.request({ - path: `/user/issues`, + path: \`/user/issues\`, method: "GET", query: query, format: "json", @@ -3110,7 +3113,7 @@ export class Api extends HttpClient { */ keysList: (params = {}) => this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "GET", format: "json", ...params, @@ -3123,7 +3126,7 @@ export class Api extends HttpClient { */ keysCreate: (body, params = {}) => this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "POST", body: body, format: "json", @@ -3137,7 +3140,7 @@ export class Api extends HttpClient { */ keysDelete: (keyId, params = {}) => this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -3149,7 +3152,7 @@ export class Api extends HttpClient { */ keysDetail: (keyId, params = {}) => this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -3162,7 +3165,7 @@ export class Api extends HttpClient { */ orgsList: (params = {}) => this.request({ - path: `/user/orgs`, + path: \`/user/orgs\`, method: "GET", format: "json", ...params, @@ -3175,7 +3178,7 @@ export class Api extends HttpClient { */ reposList: (query, params = {}) => this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "GET", query: query, format: "json", @@ -3189,7 +3192,7 @@ export class Api extends HttpClient { */ reposCreate: (body, params = {}) => this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "POST", body: body, format: "json", @@ -3203,7 +3206,7 @@ export class Api extends HttpClient { */ starredList: (query, params = {}) => this.request({ - path: `/user/starred`, + path: \`/user/starred\`, method: "GET", query: query, format: "json", @@ -3217,7 +3220,7 @@ export class Api extends HttpClient { */ starredDelete: (owner, repo, params = {}) => this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -3229,7 +3232,7 @@ export class Api extends HttpClient { */ starredDetail: (owner, repo, params = {}) => this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -3241,7 +3244,7 @@ export class Api extends HttpClient { */ starredUpdate: (owner, repo, params = {}) => this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -3253,7 +3256,7 @@ export class Api extends HttpClient { */ subscriptionsList: (params = {}) => this.request({ - path: `/user/subscriptions`, + path: \`/user/subscriptions\`, method: "GET", format: "json", ...params, @@ -3267,7 +3270,7 @@ export class Api extends HttpClient { */ subscriptionsDelete: (owner, repo, params = {}) => this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -3280,7 +3283,7 @@ export class Api extends HttpClient { */ subscriptionsDetail: (owner, repo, params = {}) => this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -3293,7 +3296,7 @@ export class Api extends HttpClient { */ subscriptionsUpdate: (owner, repo, params = {}) => this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -3305,7 +3308,7 @@ export class Api extends HttpClient { */ teamsList: (params = {}) => this.request({ - path: `/user/teams`, + path: \`/user/teams\`, method: "GET", format: "json", ...params, @@ -3320,7 +3323,7 @@ export class Api extends HttpClient { */ usersList: (query, params = {}) => this.request({ - path: `/users`, + path: \`/users\`, method: "GET", query: query, format: "json", @@ -3334,7 +3337,7 @@ export class Api extends HttpClient { */ usersDetail: (username, params = {}) => this.request({ - path: `/users/${username}`, + path: \`/users/\${username}\`, method: "GET", format: "json", ...params, @@ -3347,7 +3350,7 @@ export class Api extends HttpClient { */ eventsDetail: (username, params = {}) => this.request({ - path: `/users/${username}/events`, + path: \`/users/\${username}/events\`, method: "GET", ...params, }), @@ -3359,7 +3362,7 @@ export class Api extends HttpClient { */ eventsOrgsDetail: (username, org, params = {}) => this.request({ - path: `/users/${username}/events/orgs/${org}`, + path: \`/users/\${username}/events/orgs/\${org}\`, method: "GET", ...params, }), @@ -3371,7 +3374,7 @@ export class Api extends HttpClient { */ followersDetail: (username, params = {}) => this.request({ - path: `/users/${username}/followers`, + path: \`/users/\${username}/followers\`, method: "GET", format: "json", ...params, @@ -3384,7 +3387,7 @@ export class Api extends HttpClient { */ followingDetail: (username, targetUser, params = {}) => this.request({ - path: `/users/${username}/following/${targetUser}`, + path: \`/users/\${username}/following/\${targetUser}\`, method: "GET", ...params, }), @@ -3396,7 +3399,7 @@ export class Api extends HttpClient { */ gistsDetail: (username, query, params = {}) => this.request({ - path: `/users/${username}/gists`, + path: \`/users/\${username}/gists\`, method: "GET", query: query, format: "json", @@ -3410,7 +3413,7 @@ export class Api extends HttpClient { */ keysDetail: (username, params = {}) => this.request({ - path: `/users/${username}/keys`, + path: \`/users/\${username}/keys\`, method: "GET", format: "json", ...params, @@ -3423,7 +3426,7 @@ export class Api extends HttpClient { */ orgsDetail: (username, params = {}) => this.request({ - path: `/users/${username}/orgs`, + path: \`/users/\${username}/orgs\`, method: "GET", format: "json", ...params, @@ -3436,7 +3439,7 @@ export class Api extends HttpClient { */ receivedEventsDetail: (username, params = {}) => this.request({ - path: `/users/${username}/received_events`, + path: \`/users/\${username}/received_events\`, method: "GET", ...params, }), @@ -3448,7 +3451,7 @@ export class Api extends HttpClient { */ receivedEventsPublicDetail: (username, params = {}) => this.request({ - path: `/users/${username}/received_events/public`, + path: \`/users/\${username}/received_events/public\`, method: "GET", ...params, }), @@ -3460,7 +3463,7 @@ export class Api extends HttpClient { */ reposDetail: (username, query, params = {}) => this.request({ - path: `/users/${username}/repos`, + path: \`/users/\${username}/repos\`, method: "GET", query: query, format: "json", @@ -3474,7 +3477,7 @@ export class Api extends HttpClient { */ starredDetail: (username, params = {}) => this.request({ - path: `/users/${username}/starred`, + path: \`/users/\${username}/starred\`, method: "GET", ...params, }), @@ -3486,9 +3489,11 @@ export class Api extends HttpClient { */ subscriptionsDetail: (username, params = {}) => this.request({ - path: `/users/${username}/subscriptions`, + path: \`/users/\${username}/subscriptions\`, method: "GET", ...params, }), }; } +" +`; diff --git a/tests/spec/jsAxios/basic.test.ts b/tests/spec/jsAxios/basic.test.ts new file mode 100644 index 00000000..9249436d --- /dev/null +++ b/tests/spec/jsAxios/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--js", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + toJS: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.js"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/jsAxios/schema.d.ts b/tests/spec/jsAxios/schema.d.ts deleted file mode 100644 index 1c46ab41..00000000 --- a/tests/spec/jsAxios/schema.d.ts +++ /dev/null @@ -1,4572 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** A user or organization */ -export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - 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; - /** The account username */ - login?: string; - /** The full account name */ - 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"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - 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?: { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601. */ - created_at?: string; - id?: number; - url?: string; - /** A GitHub user */ - user?: User; -}[]; -export interface Commit { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} -export interface CommitCommentBody { - body: string; - /** Deprecated - Use position parameter instead. */ - line?: string; - /** Line number in the file to comment on. Defaults to null. */ - number?: string; - /** Relative path of the file to comment on. */ - path?: string; - /** Line index in the diff to comment on. */ - position?: number; - /** SHA of the commit to comment on. */ - sha: string; -} -export type Commits = { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -}[]; -export interface CompareCommits { - ahead_by?: number; - base_commit?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - behind_by?: number; - commits?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - }; - /** The Total number of commits authored by the contributor. */ - total?: number; - weeks?: { - /** Number of additions. */ - a?: number; - /** Number of commits. */ - c?: number; - /** Number of deletions. */ - d?: number; - /** Start of the week. */ - 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; - /** A GitHub user */ - creator?: User; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -} -export type DeploymentStatuses = { - created_at?: string; - /** A GitHub user */ - 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 { - /** A user or organization */ - actor?: Actor; - created_at?: object; - id?: number; - /** A GitHub organization */ - 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; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - description?: string; - files?: { - "ring.erl"?: { - filename?: string; - raw_url?: string; - size?: number; - }; - }; - forks?: { - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }[]; - git_pull_url?: string; - git_push_url?: string; - history?: { - change_status?: { - additions?: number; - deletions?: number; - total?: number; - }; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - committed_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - version?: string; - }[]; - html_url?: string; - id?: string; - public?: boolean; - url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - 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; - }; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** A user or organization */ - actor?: Actor; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - event?: string; - issue?: { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }; - url?: string; -} -export type IssueEvents = IssueEvent[]; -export type Issues = { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; -export interface IssuesComment { - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} -export type IssuesComments = { - _links?: { - html?: { - href?: string; - }; - pull_request?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - body?: string; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - 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 { - /** Error message */ - message?: string; -} -export interface MergesSuccessful { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A user or organization */ - 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[]; -} -/** A GitHub organization */ -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 address. This address is not publicized. */ - billing_email?: string; - company?: string; - /** Publicly visible email address. */ - email?: string; - location?: string; - name?: string; -} -export interface PostGist { - description?: string; - files?: { - "file1.txt"?: { - content?: string; - }; - }; - public?: boolean; -} -export interface PostRepo { - /** True to create an initial commit with empty README. Default is false. */ - auto_init?: boolean; - description?: string; - /** Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell" Ignored if auto_init parameter is not provided. */ - gitignore_template?: string; - /** True to enable downloads for this repository, false to disable them. Default is true. */ - has_downloads?: boolean; - /** True to enable issues for this repository, false to disable them. Default is true. */ - has_issues?: boolean; - /** True to enable the wiki for this repository, false to disable it. Default is true. */ - has_wiki?: boolean; - homepage?: string; - name: string; - /** True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. */ - private?: boolean; - /** The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization. */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - merged_at?: string; - number?: number; - patch_url?: string; - state?: "open" | "closed"; - title?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 = { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub organization */ - organization?: Organization; - /** A user or organization */ - owner?: Actor; - /** Is present when the repo is a fork. Parent is the repo this repo was forked from. */ - parent?: Repo; - private?: boolean; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - pushed_at?: string; - size?: number; - /** Is present when the repo is a fork. Source is the ultimate source for the network. */ - source?: Repo; - ssh_url?: string; - svn_url?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - watchers?: number; - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; -export interface RepoCommit { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 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; - /** A user or organization */ - 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; - /** A GitHub user */ - 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 { - /** A GitHub user */ - user?: User; -} -export interface SearchUsers { - items?: Users; - total_count?: number; -} -export interface SearchUsersByKeyword { - users?: Users; -} -export interface Subscription { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** String of the tag message. */ - message?: string; - object?: { - sha?: string; - /** String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob. */ - type?: "commit" | "tree" | "blob"; - url?: string; - }; - sha?: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag?: string; - tagger?: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - url?: string; -} -export interface TagBody { - /** String of the tag message. */ - message: string; - /** String of the SHA of the git object this is tagging. */ - object: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag: string; - tagger: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - /** 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 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?: { - /** One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink. */ - mode?: "100644" | "100755" | "040000" | "160000" | "120000"; - path?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - size?: number; - type?: "blob" | "tree" | "commit"; - url?: string; - }[]; - url?: string; -} -export interface Trees { - base_tree?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - tree?: Tree[]; - url?: string; -} -/** A GitHub user */ -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[]; -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; - /** 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?: ResponseType; - /** request body */ - body?: unknown; -} -export type RequestParams = Omit; -export interface ApiConfig extends Omit { - securityWorker?: ( - securityData: SecurityDataType | null, - ) => Promise | AxiosRequestConfig | void; - secure?: boolean; - format?: ResponseType; -} -export declare enum ContentType { - Json = "application/json", - FormData = "multipart/form-data", - UrlEncoded = "application/x-www-form-urlencoded", - Text = "text/plain", -} -export declare class HttpClient { - instance: AxiosInstance; - private securityData; - private securityWorker?; - private secure?; - private format?; - constructor({ securityWorker, secure, format, ...axiosConfig }?: ApiConfig); - setSecurityData: (data: SecurityDataType | null) => void; - protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig; - protected stringifyFormItem(formItem: unknown): string; - protected createFormData(input: Record): FormData; - request: ({ - secure, - path, - type, - query, - format, - body, - ...params - }: FullRequestParams) => Promise>; -} -/** - * @title GitHub - * @version v3 - * @termsOfService https://help.github.com/articles/github-terms-of-service/#b-api-terms - * @baseUrl https://api.github.com - * @externalDocs https://developer.github.com/v3/ - * - * Powerful collaboration, code review, and code management for open source and private projects. - */ -export declare class Api extends HttpClient { - emojis: { - /** - * @description Lists all the emojis available to use on GitHub. - * - * @name EmojisList - * @request GET:/emojis - */ - emojisList: (params?: RequestParams) => Promise>; - }; - events: { - /** - * @description List public events. - * - * @name EventsList - * @request GET:/events - */ - eventsList: (params?: RequestParams) => Promise>; - }; - feeds: { - /** - * @description List Feeds. GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticating user. - * - * @name FeedsList - * @request GET:/feeds - */ - feedsList: (params?: RequestParams) => Promise>; - }; - gists: { - /** - * @description List the authenticated user's gists or if called anonymously, this will return all public gists. - * - * @name GistsList - * @request GET:/gists - */ - gistsList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a gist. - * - * @name GistsCreate - * @request POST:/gists - */ - gistsCreate: (body: PostGist, params?: RequestParams) => Promise>; - /** - * @description List all public gists. - * - * @name PublicList - * @request GET:/gists/public - */ - publicList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description List the authenticated user's starred gists. - * - * @name StarredList - * @request GET:/gists/starred - */ - starredList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a gist. - * - * @name GistsDelete - * @request DELETE:/gists/{id} - */ - gistsDelete: (id: number, params?: RequestParams) => Promise>; - /** - * @description Get a single gist. - * - * @name GistsDetail - * @request GET:/gists/{id} - */ - gistsDetail: (id: number, params?: RequestParams) => Promise>; - /** - * @description Edit a gist. - * - * @name GistsPartialUpdate - * @request PATCH:/gists/{id} - */ - gistsPartialUpdate: (id: number, body: PatchGist, params?: RequestParams) => Promise>; - /** - * @description List comments on a gist. - * - * @name CommentsDetail - * @request GET:/gists/{id}/comments - */ - commentsDetail: (id: number, params?: RequestParams) => Promise>; - /** - * @description Create a commen - * - * @name CommentsCreate - * @request POST:/gists/{id}/comments - */ - commentsCreate: (id: number, body: CommentBody, params?: RequestParams) => Promise>; - /** - * @description Delete a comment. - * - * @name CommentsDelete - * @request DELETE:/gists/{id}/comments/{commentId} - */ - commentsDelete: (id: number, commentId: number, params?: RequestParams) => Promise>; - /** - * @description Get a single comment. - * - * @name CommentsDetail2 - * @request GET:/gists/{id}/comments/{commentId} - * @originalName commentsDetail - * @duplicate - */ - commentsDetail2: (id: number, commentId: number, params?: RequestParams) => Promise>; - /** - * @description Edit a comment. - * - * @name CommentsPartialUpdate - * @request PATCH:/gists/{id}/comments/{commentId} - */ - commentsPartialUpdate: ( - id: number, - commentId: number, - body: Comment, - params?: RequestParams, - ) => Promise>; - /** - * @description Fork a gist. - * - * @name ForksCreate - * @request POST:/gists/{id}/forks - */ - forksCreate: (id: number, params?: RequestParams) => Promise>; - /** - * @description Unstar a gist. - * - * @name StarDelete - * @request DELETE:/gists/{id}/star - */ - starDelete: (id: number, params?: RequestParams) => Promise>; - /** - * @description Check if a gist is starred. - * - * @name StarDetail - * @request GET:/gists/{id}/star - */ - starDetail: (id: number, params?: RequestParams) => Promise>; - /** - * @description Star a gist. - * - * @name StarUpdate - * @request PUT:/gists/{id}/star - */ - starUpdate: (id: number, params?: RequestParams) => Promise>; - }; - gitignore: { - /** - * @description Listing available templates. List all templates available to pass as an option when creating a repository. - * - * @name TemplatesList - * @request GET:/gitignore/templates - */ - templatesList: (params?: RequestParams) => Promise>; - /** - * @description Get a single template. - * - * @name TemplatesDetail - * @request GET:/gitignore/templates/{language} - */ - templatesDetail: (language: string, params?: RequestParams) => Promise>; - }; - issues: { - /** - * @description List issues. List all issues across all the authenticated user's visible repositories. - * - * @name IssuesList - * @request GET:/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - }; - legacy: { - /** - * @description Find issues by state and keyword. - * - * @name IssuesSearchDetail - * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} - * @deprecated - */ - issuesSearchDetail: ( - keyword: string, - state: "open" | "closed", - owner: string, - repository: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter. - * - * @name ReposSearchDetail - * @request GET:/legacy/repos/search/{keyword} - * @deprecated - */ - reposSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** Filter results by language */ - language?: string; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description This API call is added for compatibility reasons only. - * - * @name UserEmailDetail - * @request GET:/legacy/user/email/{email} - * @deprecated - */ - userEmailDetail: (email: string, params?: RequestParams) => Promise>; - /** - * @description Find users by keyword. - * - * @name UserSearchDetail - * @request GET:/legacy/user/search/{keyword} - * @deprecated - */ - userSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params?: RequestParams, - ) => Promise>; - }; - markdown: { - /** - * @description Render an arbitrary Markdown document - * - * @name MarkdownCreate - * @request POST:/markdown - */ - markdownCreate: (body: Markdown, params?: RequestParams) => Promise>; - /** - * @description Render a Markdown document in raw mode - * - * @name PostMarkdown - * @request POST:/markdown/raw - */ - postMarkdown: (params?: RequestParams) => Promise>; - }; - meta: { - /** - * @description This gives some information about GitHub.com, the service. - * - * @name MetaList - * @request GET:/meta - */ - metaList: (params?: RequestParams) => Promise>; - }; - networks: { - /** - * @description List public events for a network of repositories. - * - * @name EventsDetail - * @request GET:/networks/{owner}/{repo}/events - */ - eventsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - }; - notifications: { - /** - * @description List your notifications. List all notifications for the current user, grouped by repository. - * - * @name NotificationsList - * @request GET:/notifications - */ - notificationsList: ( - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Mark as read. Marking a notification as "read" removes it from the default view on GitHub.com. - * - * @name NotificationsUpdate - * @request PUT:/notifications - */ - notificationsUpdate: (body: NotificationMarkRead, params?: RequestParams) => Promise>; - /** - * @description View a single thread. - * - * @name ThreadsDetail - * @request GET:/notifications/threads/{id} - */ - threadsDetail: (id: number, params?: RequestParams) => Promise>; - /** - * @description Mark a thread as read - * - * @name ThreadsPartialUpdate - * @request PATCH:/notifications/threads/{id} - */ - threadsPartialUpdate: (id: number, params?: RequestParams) => Promise>; - /** - * @description Delete a Thread Subscription. - * - * @name ThreadsSubscriptionDelete - * @request DELETE:/notifications/threads/{id}/subscription - */ - threadsSubscriptionDelete: (id: number, params?: RequestParams) => Promise>; - /** - * @description Get a Thread Subscription. - * - * @name ThreadsSubscriptionDetail - * @request GET:/notifications/threads/{id}/subscription - */ - threadsSubscriptionDetail: (id: number, params?: RequestParams) => Promise>; - /** - * @description Set a Thread Subscription. This lets you subscribe to a thread, or ignore it. Subscribing to a thread is unnecessary if the user is already subscribed to the repository. Ignoring a thread will mute all future notifications (until you comment or get @mentioned). - * - * @name ThreadsSubscriptionUpdate - * @request PUT:/notifications/threads/{id}/subscription - */ - threadsSubscriptionUpdate: ( - id: number, - body: PutSubscription, - params?: RequestParams, - ) => Promise>; - }; - orgs: { - /** - * @description Get an Organization. - * - * @name OrgsDetail - * @request GET:/orgs/{org} - */ - orgsDetail: (org: string, params?: RequestParams) => Promise>; - /** - * @description Edit an Organization. - * - * @name OrgsPartialUpdate - * @request PATCH:/orgs/{org} - */ - orgsPartialUpdate: (org: string, body: PatchOrg, params?: RequestParams) => Promise>; - /** - * @description List public events for an organization. - * - * @name EventsDetail - * @request GET:/orgs/{org}/events - */ - eventsDetail: (org: string, params?: RequestParams) => Promise>; - /** - * @description List issues. List all issues for a given organization for the authenticated user. - * - * @name IssuesDetail - * @request GET:/orgs/{org}/issues - */ - issuesDetail: ( - org: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Members list. List all users who are members of an organization. A member is a user tha belongs to at least 1 team in the organization. If the authenticated user is also an owner of this organization then both concealed and public members will be returned. If the requester is not an owner of the organization the query will be redirected to the public members list. - * - * @name MembersDetail - * @request GET:/orgs/{org}/members - */ - membersDetail: (org: string, params?: RequestParams) => Promise>; - /** - * @description Remove a member. Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. - * - * @name MembersDelete - * @request DELETE:/orgs/{org}/members/{username} - */ - membersDelete: (org: string, username: string, params?: RequestParams) => Promise>; - /** - * @description Check if a user is, publicly or privately, a member of the organization. - * - * @name MembersDetail2 - * @request GET:/orgs/{org}/members/{username} - * @originalName membersDetail - * @duplicate - */ - membersDetail2: (org: string, username: string, params?: RequestParams) => Promise>; - /** - * @description Public members list. Members of an organization can choose to have their membership publicized or not. - * - * @name PublicMembersDetail - * @request GET:/orgs/{org}/public_members - */ - publicMembersDetail: (org: string, params?: RequestParams) => Promise>; - /** - * @description Conceal a user's membership. - * - * @name PublicMembersDelete - * @request DELETE:/orgs/{org}/public_members/{username} - */ - publicMembersDelete: (org: string, username: string, params?: RequestParams) => Promise>; - /** - * @description Check public membership. - * - * @name PublicMembersDetail2 - * @request GET:/orgs/{org}/public_members/{username} - * @originalName publicMembersDetail - * @duplicate - */ - publicMembersDetail2: (org: string, username: string, params?: RequestParams) => Promise>; - /** - * @description Publicize a user's membership. - * - * @name PublicMembersUpdate - * @request PUT:/orgs/{org}/public_members/{username} - */ - publicMembersUpdate: (org: string, username: string, params?: RequestParams) => Promise>; - /** - * @description List repositories for the specified org. - * - * @name ReposDetail - * @request GET:/orgs/{org}/repos - */ - reposDetail: ( - org: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @name ReposCreate - * @request POST:/orgs/{org}/repos - */ - reposCreate: (org: string, body: PostRepo, params?: RequestParams) => Promise>; - /** - * @description List teams. - * - * @name TeamsDetail - * @request GET:/orgs/{org}/teams - */ - teamsDetail: (org: string, params?: RequestParams) => Promise>; - /** - * @description Create team. In order to create a team, the authenticated user must be an owner of organization. - * - * @name TeamsCreate - * @request POST:/orgs/{org}/teams - */ - teamsCreate: (org: string, body: OrgTeamsPost, params?: RequestParams) => Promise>; - }; - rateLimit: { - /** - * @description Get your current rate limit status Note: Accessing this endpoint does not count against your rate limit. - * - * @name RateLimitList - * @request GET:/rate_limit - */ - rateLimitList: (params?: RequestParams) => Promise>; - }; - repos: { - /** - * @description Delete a Repository. Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required. - * - * @name ReposDelete - * @request DELETE:/repos/{owner}/{repo} - */ - reposDelete: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get repository. - * - * @name ReposDetail - * @request GET:/repos/{owner}/{repo} - */ - reposDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Edit repository. - * - * @name ReposPartialUpdate - * @request PATCH:/repos/{owner}/{repo} - */ - reposPartialUpdate: ( - owner: string, - repo: string, - body: RepoEdit, - params?: RequestParams, - ) => Promise>; - /** - * @description List assignees. This call lists all the available assignees (owner + collaborators) to which issues may be assigned. - * - * @name AssigneesDetail - * @request GET:/repos/{owner}/{repo}/assignees - */ - assigneesDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Check assignee. You may also check to see if a particular user is an assignee for a repository. - * - * @name AssigneesDetail2 - * @request GET:/repos/{owner}/{repo}/assignees/{assignee} - * @originalName assigneesDetail - * @duplicate - */ - assigneesDetail2: ( - owner: string, - repo: string, - assignee: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get list of branches - * - * @name BranchesDetail - * @request GET:/repos/{owner}/{repo}/branches - */ - branchesDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get Branch - * - * @name BranchesDetail2 - * @request GET:/repos/{owner}/{repo}/branches/{branch} - * @originalName branchesDetail - * @duplicate - */ - branchesDetail2: ( - owner: string, - repo: string, - branch: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List. When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list. - * - * @name CollaboratorsDetail - * @request GET:/repos/{owner}/{repo}/collaborators - */ - collaboratorsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Remove collaborator. - * - * @name CollaboratorsDelete - * @request DELETE:/repos/{owner}/{repo}/collaborators/{user} - */ - collaboratorsDelete: ( - owner: string, - repo: string, - user: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Check if user is a collaborator - * - * @name CollaboratorsDetail2 - * @request GET:/repos/{owner}/{repo}/collaborators/{user} - * @originalName collaboratorsDetail - * @duplicate - */ - collaboratorsDetail2: ( - owner: string, - repo: string, - user: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Add collaborator. - * - * @name CollaboratorsUpdate - * @request PUT:/repos/{owner}/{repo}/collaborators/{user} - */ - collaboratorsUpdate: ( - owner: string, - repo: string, - user: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List commit comments for a repository. Comments are ordered by ascending ID. - * - * @name CommentsDetail - * @request GET:/repos/{owner}/{repo}/comments - */ - commentsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Delete a commit comment - * - * @name CommentsDelete - * @request DELETE:/repos/{owner}/{repo}/comments/{commentId} - */ - commentsDelete: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single commit comment. - * - * @name CommentsDetail2 - * @request GET:/repos/{owner}/{repo}/comments/{commentId} - * @originalName commentsDetail - * @duplicate - */ - commentsDetail2: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Update a commit comment. - * - * @name CommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/comments/{commentId} - */ - commentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: CommentBody, - params?: RequestParams, - ) => Promise>; - /** - * @description List commits on a repository. - * - * @name CommitsDetail - * @request GET:/repos/{owner}/{repo}/commits - */ - commitsDetail: ( - owner: string, - repo: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - /** Sha or branch to start listing commits from. */ - sha?: string; - /** Only commits containing this file path will be returned. */ - path?: string; - /** GitHub login, name, or email by which to filter by commit author. */ - author?: string; - /** ISO 8601 Date - Only commits before this date will be returned. */ - until?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Get the combined Status for a specific Ref The Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access this endpoint during the preview period, you must provide a custom media type in the Accept header: application/vnd.github.she-hulk-preview+json - * - * @name CommitsStatusDetail - * @request GET:/repos/{owner}/{repo}/commits/{ref}/status - */ - commitsStatusDetail: ( - owner: string, - repo: string, - ref: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single commit. - * - * @name CommitsDetail2 - * @request GET:/repos/{owner}/{repo}/commits/{shaCode} - * @originalName commitsDetail - * @duplicate - */ - commitsDetail2: ( - owner: string, - repo: string, - shaCode: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List comments for a single commitList comments for a single commit. - * - * @name CommitsCommentsDetail - * @request GET:/repos/{owner}/{repo}/commits/{shaCode}/comments - */ - commitsCommentsDetail: ( - owner: string, - repo: string, - shaCode: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a commit comment. - * - * @name CommitsCommentsCreate - * @request POST:/repos/{owner}/{repo}/commits/{shaCode}/comments - */ - commitsCommentsCreate: ( - owner: string, - repo: string, - shaCode: string, - body: CommitCommentBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Compare two commits - * - * @name CompareDetail - * @request GET:/repos/{owner}/{repo}/compare/{baseId}...{headId} - */ - compareDetail: ( - owner: string, - repo: string, - baseId: string, - headId: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a file. This method deletes a file in a repository. - * - * @name ContentsDelete - * @request DELETE:/repos/{owner}/{repo}/contents/{path} - */ - contentsDelete: ( - owner: string, - repo: string, - path: string, - body: DeleteFileBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get contents. This method returns the contents of a file or directory in a repository. Files and symlinks support a custom media type for getting the raw content. Directories and submodules do not support custom media types. Note: This API supports files up to 1 megabyte in size. Here can be many outcomes. For details see "http://developer.github.com/v3/repos/contents/" - * - * @name ContentsDetail - * @request GET:/repos/{owner}/{repo}/contents/{path} - */ - contentsDetail: ( - owner: string, - repo: string, - path: string, - query?: { - /** The content path. */ - path?: string; - /** The String name of the Commit/Branch/Tag. Defaults to 'master'. */ - ref?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a file. - * - * @name ContentsUpdate - * @request PUT:/repos/{owner}/{repo}/contents/{path} - */ - contentsUpdate: ( - owner: string, - repo: string, - path: string, - body: CreateFileBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get list of contributors. - * - * @name ContributorsDetail - * @request GET:/repos/{owner}/{repo}/contributors - */ - contributorsDetail: ( - owner: string, - repo: string, - query: { - /** Set to 1 or true to include anonymous contributors in results. */ - anon: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with pull access can view deployments for a repository - * - * @name DeploymentsDetail - * @request GET:/repos/{owner}/{repo}/deployments - */ - deploymentsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Users with push access can create a deployment for a given ref - * - * @name DeploymentsCreate - * @request POST:/repos/{owner}/{repo}/deployments - */ - deploymentsCreate: ( - owner: string, - repo: string, - body: Deployment, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with pull access can view deployment statuses for a deployment - * - * @name DeploymentsStatusesDetail - * @request GET:/repos/{owner}/{repo}/deployments/{id}/statuses - */ - deploymentsStatusesDetail: ( - owner: string, - repo: string, - id: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a Deployment Status Users with push access can create deployment statuses for a given deployment: - * - * @name DeploymentsStatusesCreate - * @request POST:/repos/{owner}/{repo}/deployments/{id}/statuses - */ - deploymentsStatusesCreate: ( - owner: string, - repo: string, - id: number, - body: DeploymentStatusesCreate, - params?: RequestParams, - ) => Promise>; - /** - * @description Deprecated. List downloads for a repository. - * - * @name DownloadsDetail - * @request GET:/repos/{owner}/{repo}/downloads - * @deprecated - */ - downloadsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Deprecated. Delete a download. - * - * @name DownloadsDelete - * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - */ - downloadsDelete: ( - owner: string, - repo: string, - downloadId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Deprecated. Get a single download. - * - * @name DownloadsDetail2 - * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - * @originalName downloadsDetail - * @duplicate - */ - downloadsDetail2: ( - owner: string, - repo: string, - downloadId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get list of repository events. - * - * @name EventsDetail - * @request GET:/repos/{owner}/{repo}/events - */ - eventsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description List forks. - * - * @name ForksDetail - * @request GET:/repos/{owner}/{repo}/forks - */ - forksDetail: ( - owner: string, - repo: string, - query?: { - /** @default "newes" */ - sort?: "newes" | "oldes" | "watchers"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a fork. Forking a Repository happens asynchronously. Therefore, you may have to wai a short period before accessing the git objects. If this takes longer than 5 minutes, be sure to contact Support. - * - * @name ForksCreate - * @request POST:/repos/{owner}/{repo}/forks - */ - forksCreate: (owner: string, repo: string, body: ForkBody, params?: RequestParams) => Promise>; - /** - * @description Create a Blob. - * - * @name GitBlobsCreate - * @request POST:/repos/{owner}/{repo}/git/blobs - */ - gitBlobsCreate: (owner: string, repo: string, body: Blob, params?: RequestParams) => Promise>; - /** - * @description Get a Blob. Since blobs can be any arbitrary binary data, the input and responses for the blob API takes an encoding parameter that can be either utf-8 or base64. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it. - * - * @name GitBlobsDetail - * @request GET:/repos/{owner}/{repo}/git/blobs/{shaCode} - */ - gitBlobsDetail: ( - owner: string, - repo: string, - shaCode: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a Commit. - * - * @name GitCommitsCreate - * @request POST:/repos/{owner}/{repo}/git/commits - */ - gitCommitsCreate: ( - owner: string, - repo: string, - body: RepoCommitBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a Commit. - * - * @name GitCommitsDetail - * @request GET:/repos/{owner}/{repo}/git/commits/{shaCode} - */ - gitCommitsDetail: ( - owner: string, - repo: string, - shaCode: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get all References - * - * @name GitRefsDetail - * @request GET:/repos/{owner}/{repo}/git/refs - */ - gitRefsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Create a Reference - * - * @name GitRefsCreate - * @request POST:/repos/{owner}/{repo}/git/refs - */ - gitRefsCreate: ( - owner: string, - repo: string, - body: RefsBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a Reference Example: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a Example: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0 - * - * @name GitRefsDelete - * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} - */ - gitRefsDelete: (owner: string, repo: string, ref: string, params?: RequestParams) => Promise>; - /** - * @description Get a Reference - * - * @name GitRefsDetail2 - * @request GET:/repos/{owner}/{repo}/git/refs/{ref} - * @originalName gitRefsDetail - * @duplicate - */ - gitRefsDetail2: ( - owner: string, - repo: string, - ref: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Update a Reference - * - * @name GitRefsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} - */ - gitRefsPartialUpdate: ( - owner: string, - repo: string, - ref: string, - body: GitRefPatch, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a Tag Object. Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary. - * - * @name GitTagsCreate - * @request POST:/repos/{owner}/{repo}/git/tags - */ - gitTagsCreate: (owner: string, repo: string, body: TagBody, params?: RequestParams) => Promise>; - /** - * @description Get a Tag. - * - * @name GitTagsDetail - * @request GET:/repos/{owner}/{repo}/git/tags/{shaCode} - */ - gitTagsDetail: ( - owner: string, - repo: string, - shaCode: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a Tree. The tree creation API will take nested entries as well. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out. - * - * @name GitTreesCreate - * @request POST:/repos/{owner}/{repo}/git/trees - */ - gitTreesCreate: (owner: string, repo: string, body: Tree, params?: RequestParams) => Promise>; - /** - * @description Get a Tree. - * - * @name GitTreesDetail - * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} - */ - gitTreesDetail: ( - owner: string, - repo: string, - shaCode: string, - query?: { - /** Get a Tree Recursively. (0 or 1) */ - recursive?: number; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Get list of hooks. - * - * @name HooksDetail - * @request GET:/repos/{owner}/{repo}/hooks - */ - hooksDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Create a hook. - * - * @name HooksCreate - * @request POST:/repos/{owner}/{repo}/hooks - */ - hooksCreate: (owner: string, repo: string, body: HookBody, params?: RequestParams) => Promise>; - /** - * @description Delete a hook. - * - * @name HooksDelete - * @request DELETE:/repos/{owner}/{repo}/hooks/{hookId} - */ - hooksDelete: (owner: string, repo: string, hookId: number, params?: RequestParams) => Promise>; - /** - * @description Get single hook. - * - * @name HooksDetail2 - * @request GET:/repos/{owner}/{repo}/hooks/{hookId} - * @originalName hooksDetail - * @duplicate - */ - hooksDetail2: (owner: string, repo: string, hookId: number, params?: RequestParams) => Promise>; - /** - * @description Edit a hook. - * - * @name HooksPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/hooks/{hookId} - */ - hooksPartialUpdate: ( - owner: string, - repo: string, - hookId: number, - body: HookBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Test a push hook. This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated. Note: Previously /repos/:owner/:repo/hooks/:id/tes - * - * @name HooksTestsCreate - * @request POST:/repos/{owner}/{repo}/hooks/{hookId}/tests - */ - hooksTestsCreate: ( - owner: string, - repo: string, - hookId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description List issues for a repository. - * - * @name IssuesDetail - * @request GET:/repos/{owner}/{repo}/issues - */ - issuesDetail: ( - owner: string, - repo: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create an issue. Any user with pull access to a repository can create an issue. - * - * @name IssuesCreate - * @request POST:/repos/{owner}/{repo}/issues - */ - issuesCreate: (owner: string, repo: string, body: Issue, params?: RequestParams) => Promise>; - /** - * @description List comments in a repository. - * - * @name IssuesCommentsDetail - * @request GET:/repos/{owner}/{repo}/issues/comments - */ - issuesCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a comment. - * - * @name IssuesCommentsDelete - * @request DELETE:/repos/{owner}/{repo}/issues/comments/{commentId} - */ - issuesCommentsDelete: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single comment. - * - * @name IssuesCommentsDetail2 - * @request GET:/repos/{owner}/{repo}/issues/comments/{commentId} - * @originalName issuesCommentsDetail - * @duplicate - */ - issuesCommentsDetail2: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Edit a comment. - * - * @name IssuesCommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/issues/comments/{commentId} - */ - issuesCommentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: CommentBody, - params?: RequestParams, - ) => Promise>; - /** - * @description List issue events for a repository. - * - * @name IssuesEventsDetail - * @request GET:/repos/{owner}/{repo}/issues/events - */ - issuesEventsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get a single event. - * - * @name IssuesEventsDetail2 - * @request GET:/repos/{owner}/{repo}/issues/events/{eventId} - * @originalName issuesEventsDetail - * @duplicate - */ - issuesEventsDetail2: ( - owner: string, - repo: string, - eventId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single issue - * - * @name IssuesDetail2 - * @request GET:/repos/{owner}/{repo}/issues/{number} - * @originalName issuesDetail - * @duplicate - */ - issuesDetail2: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Edit an issue. Issue owners and users with push access can edit an issue. - * - * @name IssuesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/issues/{number} - */ - issuesPartialUpdate: ( - owner: string, - repo: string, - number: number, - body: Issue, - params?: RequestParams, - ) => Promise>; - /** - * @description List comments on an issue. - * - * @name IssuesCommentsDetail3 - * @request GET:/repos/{owner}/{repo}/issues/{number}/comments - * @originalName issuesCommentsDetail - * @duplicate - */ - issuesCommentsDetail3: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a comment. - * - * @name IssuesCommentsCreate - * @request POST:/repos/{owner}/{repo}/issues/{number}/comments - */ - issuesCommentsCreate: ( - owner: string, - repo: string, - number: number, - body: CommentBody, - params?: RequestParams, - ) => Promise>; - /** - * @description List events for an issue. - * - * @name IssuesEventsDetail3 - * @request GET:/repos/{owner}/{repo}/issues/{number}/events - * @originalName issuesEventsDetail - * @duplicate - */ - issuesEventsDetail3: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Remove all labels from an issue. - * - * @name IssuesLabelsDelete - * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsDelete: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description List labels on an issue. - * - * @name IssuesLabelsDetail - * @request GET:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsDetail: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Add labels to an issue. - * - * @name IssuesLabelsCreate - * @request POST:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsCreate: ( - owner: string, - repo: string, - number: number, - body: EmailsPost, - params?: RequestParams, - ) => Promise>; - /** - * @description Replace all labels for an issue. Sending an empty array ([]) will remove all Labels from the Issue. - * - * @name IssuesLabelsUpdate - * @request PUT:/repos/{owner}/{repo}/issues/{number}/labels - */ - issuesLabelsUpdate: ( - owner: string, - repo: string, - number: number, - body: EmailsPost, - params?: RequestParams, - ) => Promise>; - /** - * @description Remove a label from an issue. - * - * @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, - ) => Promise>; - /** - * @description Get list of keys. - * - * @name KeysDetail - * @request GET:/repos/{owner}/{repo}/keys - */ - keysDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Create a key. - * - * @name KeysCreate - * @request POST:/repos/{owner}/{repo}/keys - */ - keysCreate: ( - owner: string, - repo: string, - body: UserKeysPost, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a key. - * - * @name KeysDelete - * @request DELETE:/repos/{owner}/{repo}/keys/{keyId} - */ - keysDelete: (owner: string, repo: string, keyId: number, params?: RequestParams) => Promise>; - /** - * @description Get a key - * - * @name KeysDetail2 - * @request GET:/repos/{owner}/{repo}/keys/{keyId} - * @originalName keysDetail - * @duplicate - */ - keysDetail2: ( - owner: string, - repo: string, - keyId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description List all labels for this repository. - * - * @name LabelsDetail - * @request GET:/repos/{owner}/{repo}/labels - */ - labelsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Create a label. - * - * @name LabelsCreate - * @request POST:/repos/{owner}/{repo}/labels - */ - labelsCreate: ( - owner: string, - repo: string, - body: EmailsPost, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a label. - * - * @name LabelsDelete - * @request DELETE:/repos/{owner}/{repo}/labels/{name} - */ - labelsDelete: (owner: string, repo: string, name: string, params?: RequestParams) => Promise>; - /** - * @description Get a single label. - * - * @name LabelsDetail2 - * @request GET:/repos/{owner}/{repo}/labels/{name} - * @originalName labelsDetail - * @duplicate - */ - labelsDetail2: (owner: string, repo: string, name: string, params?: RequestParams) => Promise>; - /** - * @description Update a label. - * - * @name LabelsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/labels/{name} - */ - labelsPartialUpdate: ( - owner: string, - repo: string, - name: string, - body: EmailsPost, - params?: RequestParams, - ) => Promise>; - /** - * @description List languages. List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language. - * - * @name LanguagesDetail - * @request GET:/repos/{owner}/{repo}/languages - */ - languagesDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Perform a merge. - * - * @name MergesCreate - * @request POST:/repos/{owner}/{repo}/merges - */ - mergesCreate: ( - owner: string, - repo: string, - body: MergesBody, - params?: RequestParams, - ) => Promise>; - /** - * @description List milestones for a repository. - * - * @name MilestonesDetail - * @request GET:/repos/{owner}/{repo}/milestones - */ - milestonesDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "due_date" */ - sort?: "due_date" | "completeness"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a milestone. - * - * @name MilestonesCreate - * @request POST:/repos/{owner}/{repo}/milestones - */ - milestonesCreate: ( - owner: string, - repo: string, - body: MilestoneUpdate, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a milestone. - * - * @name MilestonesDelete - * @request DELETE:/repos/{owner}/{repo}/milestones/{number} - */ - milestonesDelete: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single milestone. - * - * @name MilestonesDetail2 - * @request GET:/repos/{owner}/{repo}/milestones/{number} - * @originalName milestonesDetail - * @duplicate - */ - milestonesDetail2: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Update a milestone. - * - * @name MilestonesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/milestones/{number} - */ - milestonesPartialUpdate: ( - owner: string, - repo: string, - number: number, - body: MilestoneUpdate, - params?: RequestParams, - ) => Promise>; - /** - * @description Get labels for every issue in a milestone. - * - * @name MilestonesLabelsDetail - * @request GET:/repos/{owner}/{repo}/milestones/{number}/labels - */ - milestonesLabelsDetail: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description List your notifications in a repository List all notifications for the current user. - * - * @name NotificationsDetail - * @request GET:/repos/{owner}/{repo}/notifications - */ - notificationsDetail: ( - owner: string, - repo: string, - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Mark notifications as read in a repository. Marking all notifications in a repository as "read" removes them from the default view on GitHub.com. - * - * @name NotificationsUpdate - * @request PUT:/repos/{owner}/{repo}/notifications - */ - notificationsUpdate: ( - owner: string, - repo: string, - body: NotificationMarkRead, - params?: RequestParams, - ) => Promise>; - /** - * @description List pull requests. - * - * @name PullsDetail - * @request GET:/repos/{owner}/{repo}/pulls - */ - pullsDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** - * Filter pulls by head user and branch name in the format of 'user:ref-name'. - * Example: github:new-script-format. - */ - head?: string; - /** Filter pulls by base branch name. Example - gh-pages. */ - base?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a pull request. - * - * @name PullsCreate - * @request POST:/repos/{owner}/{repo}/pulls - */ - pullsCreate: ( - owner: string, - repo: string, - body: PullsPost, - params?: RequestParams, - ) => Promise>; - /** - * @description List comments in a repository. By default, Review Comments are ordered by ascending ID. - * - * @name PullsCommentsDetail - * @request GET:/repos/{owner}/{repo}/pulls/comments - */ - pullsCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a comment. - * - * @name PullsCommentsDelete - * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{commentId} - */ - pullsCommentsDelete: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single comment. - * - * @name PullsCommentsDetail2 - * @request GET:/repos/{owner}/{repo}/pulls/comments/{commentId} - * @originalName pullsCommentsDetail - * @duplicate - */ - pullsCommentsDetail2: ( - owner: string, - repo: string, - commentId: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Edit a comment. - * - * @name PullsCommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{commentId} - */ - pullsCommentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: CommentBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single pull request. - * - * @name PullsDetail2 - * @request GET:/repos/{owner}/{repo}/pulls/{number} - * @originalName pullsDetail - * @duplicate - */ - pullsDetail2: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Update a pull request. - * - * @name PullsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/pulls/{number} - */ - pullsPartialUpdate: ( - owner: string, - repo: string, - number: number, - body: PullUpdate, - params?: RequestParams, - ) => Promise>; - /** - * @description List comments on a pull request. - * - * @name PullsCommentsDetail3 - * @request GET:/repos/{owner}/{repo}/pulls/{number}/comments - * @originalName pullsCommentsDetail - * @duplicate - */ - pullsCommentsDetail3: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a comment. #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ ) description: | Alternative Input. Instead of passing commit_id, path, and position you can reply to an existing Pull Request Comment like this: body Required string in_reply_to Required number - Comment id to reply to. - * - * @name PullsCommentsCreate - * @request POST:/repos/{owner}/{repo}/pulls/{number}/comments - */ - pullsCommentsCreate: ( - owner: string, - repo: string, - number: number, - body: PullsCommentPost, - params?: RequestParams, - ) => Promise>; - /** - * @description List commits on a pull request. - * - * @name PullsCommitsDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/commits - */ - pullsCommitsDetail: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description List pull requests files. - * - * @name PullsFilesDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/files - */ - pullsFilesDetail: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Get if a pull request has been merged. - * - * @name PullsMergeDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/merge - */ - pullsMergeDetail: ( - owner: string, - repo: string, - number: number, - params?: RequestParams, - ) => Promise>; - /** - * @description Merge a pull request (Merge Button's) - * - * @name PullsMergeUpdate - * @request PUT:/repos/{owner}/{repo}/pulls/{number}/merge - */ - pullsMergeUpdate: ( - owner: string, - repo: string, - number: number, - body: MergePullBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get the README. This method returns the preferred README for a repository. - * - * @name ReadmeDetail - * @request GET:/repos/{owner}/{repo}/readme - */ - readmeDetail: ( - owner: string, - repo: string, - query?: { - /** The String name of the Commit/Branch/Tag. Defaults to master. */ - ref?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only - * - * @name ReleasesDetail - * @request GET:/repos/{owner}/{repo}/releases - */ - releasesDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Create a release Users with push access to the repository can create a release. - * - * @name ReleasesCreate - * @request POST:/repos/{owner}/{repo}/releases - */ - releasesCreate: ( - owner: string, - repo: string, - body: ReleaseCreate, - params?: RequestParams, - ) => Promise>; - /** - * @description Delete a release asset - * - * @name ReleasesAssetsDelete - * @request DELETE:/repos/{owner}/{repo}/releases/assets/{id} - */ - releasesAssetsDelete: ( - owner: string, - repo: string, - id: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single release asset - * - * @name ReleasesAssetsDetail - * @request GET:/repos/{owner}/{repo}/releases/assets/{id} - */ - releasesAssetsDetail: ( - owner: string, - repo: string, - id: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Edit a release asset Users with push access to the repository can edit a release asset. - * - * @name ReleasesAssetsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/releases/assets/{id} - */ - releasesAssetsPartialUpdate: ( - owner: string, - repo: string, - id: string, - body: AssetPatch, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with push access to the repository can delete a release. - * - * @name ReleasesDelete - * @request DELETE:/repos/{owner}/{repo}/releases/{id} - */ - releasesDelete: (owner: string, repo: string, id: string, params?: RequestParams) => Promise>; - /** - * @description Get a single release - * - * @name ReleasesDetail2 - * @request GET:/repos/{owner}/{repo}/releases/{id} - * @originalName releasesDetail - * @duplicate - */ - releasesDetail2: ( - owner: string, - repo: string, - id: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Users with push access to the repository can edit a release - * - * @name ReleasesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/releases/{id} - */ - releasesPartialUpdate: ( - owner: string, - repo: string, - id: string, - body: ReleaseCreate, - params?: RequestParams, - ) => Promise>; - /** - * @description List assets for a release - * - * @name ReleasesAssetsDetail2 - * @request GET:/repos/{owner}/{repo}/releases/{id}/assets - * @originalName releasesAssetsDetail - * @duplicate - */ - releasesAssetsDetail2: ( - owner: string, - repo: string, - id: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List Stargazers. - * - * @name StargazersDetail - * @request GET:/repos/{owner}/{repo}/stargazers - */ - stargazersDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get the number of additions and deletions per week. Returns a weekly aggregate of the number of additions and deletions pushed to a repository. - * - * @name StatsCodeFrequencyDetail - * @request GET:/repos/{owner}/{repo}/stats/code_frequency - */ - statsCodeFrequencyDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get the last year of commit activity data. Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday. - * - * @name StatsCommitActivityDetail - * @request GET:/repos/{owner}/{repo}/stats/commit_activity - */ - statsCommitActivityDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get contributors list with additions, deletions, and commit counts. - * - * @name StatsContributorsDetail - * @request GET:/repos/{owner}/{repo}/stats/contributors - */ - statsContributorsDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get the weekly commit count for the repo owner and everyone else. - * - * @name StatsParticipationDetail - * @request GET:/repos/{owner}/{repo}/stats/participation - */ - statsParticipationDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Get the number of commits per hour in each day. Each array contains the day number, hour number, and number of commits 0-6 Sunday - Saturday 0-23 Hour of day Number of commits For example, [2, 14, 25] indicates that there were 25 total commits, during the 2.00pm hour on Tuesdays. All times are based on the time zone of individual commits. - * - * @name StatsPunchCardDetail - * @request GET:/repos/{owner}/{repo}/stats/punch_card - */ - statsPunchCardDetail: ( - owner: string, - repo: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List Statuses for a specific Ref. - * - * @name StatusesDetail - * @request GET:/repos/{owner}/{repo}/statuses/{ref} - */ - statusesDetail: (owner: string, repo: string, ref: string, params?: RequestParams) => Promise>; - /** - * @description Create a Status. - * - * @name StatusesCreate - * @request POST:/repos/{owner}/{repo}/statuses/{ref} - */ - statusesCreate: ( - owner: string, - repo: string, - ref: string, - body: HeadBranch, - params?: RequestParams, - ) => Promise>; - /** - * @description List watchers. - * - * @name SubscribersDetail - * @request GET:/repos/{owner}/{repo}/subscribers - */ - subscribersDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Delete a Repository Subscription. - * - * @name SubscriptionDelete - * @request DELETE:/repos/{owner}/{repo}/subscription - */ - subscriptionDelete: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get a Repository Subscription. - * - * @name SubscriptionDetail - * @request GET:/repos/{owner}/{repo}/subscription - */ - subscriptionDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Set a Repository Subscription - * - * @name SubscriptionUpdate - * @request PUT:/repos/{owner}/{repo}/subscription - */ - subscriptionUpdate: ( - owner: string, - repo: string, - body: SubscriptionBody, - params?: RequestParams, - ) => Promise>; - /** - * @description Get list of tags. - * - * @name TagsDetail - * @request GET:/repos/{owner}/{repo}/tags - */ - tagsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get list of teams - * - * @name TeamsDetail - * @request GET:/repos/{owner}/{repo}/teams - */ - teamsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description List Stargazers. New implementation. - * - * @name WatchersDetail - * @request GET:/repos/{owner}/{repo}/watchers - */ - watchersDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Get archive link. This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. Note: For private repositories, these links are temporary and expire quickly. - * - * @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, - ) => Promise>; - }; - repositories: { - /** - * @description List all public repositories. This provides a dump of every public repository, in the order that they were created. Note: Pagination is powered exclusively by the since parameter. is the Link header to get the URL for the next page of repositories. - * - * @name RepositoriesList - * @request GET:/repositories - */ - repositoriesList: ( - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - }; - search: { - /** - * @description Search code. - * - * @name CodeList - * @request GET:/search/code - */ - codeList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported code - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier - * you can restrict the search to just the file contents, the file path, - * or both. - * 'Languages' Searches code based on the language it's written in. - * 'Forks' Filters repositories based on the number of forks, and/or - * whether code from forked repositories should be included in the results - * at all. - * 'Size' Finds files that match a certain size (in bytes). - * 'Path' Specifies the path that the resulting file must be at. - * 'Extension' Matches files with a certain extension. - * 'Users' or 'Repositories' Limits searches to a specific user or repository. - */ - q: string; - /** - * Can only be 'indexed', which indicates how recently a file has been indexed - * by the GitHub search infrastructure. If not provided, results are sorted - * by best match. - */ - sort?: "indexed"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Find issues by state and keyword. (This method returns up to 100 results per page.) - * - * @name IssuesList - * @request GET:/search/issues - */ - issuesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The q search term can also contain any combination of the supported issue search qualifiers: */ - q: string; - /** The sort field. Can be comments, created, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "created" | "comments"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Search repositories. - * - * @name RepositoriesList - * @request GET:/search/repositories - */ - repositoriesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported repository - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the repository name, description, readme, - * or any combination of these. - * 'Size' Finds repositories that match a certain size (in kilobytes). - * 'Forks' Filters repositories based on the number of forks, and/or whether - * forked repositories should be included in the results at all. - * 'Created' and 'Last Updated' Filters repositories based on times of - * creation, or when they were last updated. - * 'Users or Repositories' Limits searches to a specific user or repository. - * 'Languages' Searches repositories based on the language they are written in. - * 'Stars' Searches repositories based on the number of stars. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "stars" | "forks" | "updated"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Search users. - * - * @name UsersList - * @request GET:/search/users - */ - usersList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported user - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the username, public email, full name, - * location, or any combination of these. - * 'Repository count' Filters users based on the number of repositories they - * have. - * 'Location' Filter users by the location indicated in their profile. - * 'Language' Search for users that have repositories that match a certain - * language. - * 'Created' Filter users based on when they joined. - * 'Followers' Filter users based on the number of followers they have. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "followers" | "repositories" | "joined"; - }, - params?: RequestParams, - ) => Promise>; - }; - teams: { - /** - * @description Delete team. In order to delete a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @name TeamsDelete - * @request DELETE:/teams/{teamId} - */ - teamsDelete: (teamId: number, params?: RequestParams) => Promise>; - /** - * @description Get team. - * - * @name TeamsDetail - * @request GET:/teams/{teamId} - */ - teamsDetail: (teamId: number, params?: RequestParams) => Promise>; - /** - * @description Edit team. In order to edit a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @name TeamsPartialUpdate - * @request PATCH:/teams/{teamId} - */ - teamsPartialUpdate: (teamId: number, body: EditTeam, params?: RequestParams) => Promise>; - /** - * @description List team members. In order to list members in a team, the authenticated user must be a member of the team. - * - * @name MembersDetail - * @request GET:/teams/{teamId}/members - */ - membersDetail: (teamId: number, params?: RequestParams) => Promise>; - /** - * @description The "Remove team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships. Remove team member. In order to remove a user from a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. NOTE This does not delete the user, it just remove them from the team. - * - * @name MembersDelete - * @request DELETE:/teams/{teamId}/members/{username} - * @deprecated - */ - membersDelete: (teamId: number, username: string, params?: RequestParams) => Promise>; - /** - * @description The "Get team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships. Get team member. In order to get if a user is a member of a team, the authenticated user mus be a member of the team. - * - * @name MembersDetail2 - * @request GET:/teams/{teamId}/members/{username} - * @deprecated - * @originalName membersDetail - * @duplicate - */ - membersDetail2: (teamId: number, username: string, params?: RequestParams) => Promise>; - /** - * @description The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams. Add team member. In order to add a user to a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. - * - * @name MembersUpdate - * @request PUT:/teams/{teamId}/members/{username} - * @deprecated - */ - membersUpdate: (teamId: number, username: string, params?: RequestParams) => Promise>; - /** - * @description Remove team membership. In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team. - * - * @name MembershipsDelete - * @request DELETE:/teams/{teamId}/memberships/{username} - */ - membershipsDelete: (teamId: number, username: string, params?: RequestParams) => Promise>; - /** - * @description Get team membership. In order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization. - * - * @name MembershipsDetail - * @request GET:/teams/{teamId}/memberships/{username} - */ - membershipsDetail: ( - teamId: number, - username: string, - params?: RequestParams, - ) => Promise>; - /** - * @description Add team membership. In order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. If the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team. If the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the 'pending' state until the user accepts the invitation, at which point the membership will transition to the 'active' state and the user will be added as a member of the team. - * - * @name MembershipsUpdate - * @request PUT:/teams/{teamId}/memberships/{username} - */ - membershipsUpdate: ( - teamId: number, - username: string, - params?: RequestParams, - ) => Promise>; - /** - * @description List team repos - * - * @name ReposDetail - * @request GET:/teams/{teamId}/repos - */ - reposDetail: (teamId: number, params?: RequestParams) => Promise>; - /** - * @description In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team. - * - * @name ReposDelete - * @request DELETE:/teams/{teamId}/repos/{owner}/{repo} - */ - reposDelete: (teamId: number, owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Check if a team manages a repository - * - * @name ReposDetail2 - * @request GET:/teams/{teamId}/repos/{owner}/{repo} - * @originalName reposDetail - * @duplicate - */ - reposDetail2: (teamId: number, owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization. - * - * @name ReposUpdate - * @request PUT:/teams/{teamId}/repos/{owner}/{repo} - */ - reposUpdate: (teamId: number, owner: string, repo: string, params?: RequestParams) => Promise>; - }; - user: { - /** - * @description Get the authenticated user. - * - * @name UserList - * @request GET:/user - */ - userList: (params?: RequestParams) => Promise>; - /** - * @description Update the authenticated user. - * - * @name UserPartialUpdate - * @request PATCH:/user - */ - userPartialUpdate: (body: UserUpdate, params?: RequestParams) => Promise>; - /** - * @description Delete email address(es). You can include a single email address or an array of addresses. - * - * @name EmailsDelete - * @request DELETE:/user/emails - */ - emailsDelete: (body: UserEmails, params?: RequestParams) => Promise>; - /** - * @description List email addresses for a user. In the final version of the API, this method will return an array of hashes with extended information for each email address indicating if the address has been verified and if it's primary email address for GitHub. Until API v3 is finalized, use the application/vnd.github.v3 media type to get other response format. - * - * @name EmailsList - * @request GET:/user/emails - */ - emailsList: (params?: RequestParams) => Promise>; - /** - * @description Add email address(es). You can post a single email address or an array of addresses. - * - * @name EmailsCreate - * @request POST:/user/emails - */ - emailsCreate: (body: EmailsPost, params?: RequestParams) => Promise>; - /** - * @description List the authenticated user's followers - * - * @name FollowersList - * @request GET:/user/followers - */ - followersList: (params?: RequestParams) => Promise>; - /** - * @description List who the authenticated user is following. - * - * @name FollowingList - * @request GET:/user/following - */ - followingList: (params?: RequestParams) => Promise>; - /** - * @description Unfollow a user. Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingDelete - * @request DELETE:/user/following/{username} - */ - followingDelete: (username: string, params?: RequestParams) => Promise>; - /** - * @description Check if you are following a user. - * - * @name FollowingDetail - * @request GET:/user/following/{username} - */ - followingDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description Follow a user. Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingUpdate - * @request PUT:/user/following/{username} - */ - followingUpdate: (username: string, params?: RequestParams) => Promise>; - /** - * @description List issues. List all issues across owned and member repositories for the authenticated user. - * - * @name IssuesList - * @request GET:/user/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description List your public keys. Lists the current user's keys. Management of public keys via the API requires that you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes. - * - * @name KeysList - * @request GET:/user/keys - */ - keysList: (params?: RequestParams) => Promise>; - /** - * @description Create a public key. - * - * @name KeysCreate - * @request POST:/user/keys - */ - keysCreate: (body: UserKeysPost, params?: RequestParams) => Promise>; - /** - * @description Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope. - * - * @name KeysDelete - * @request DELETE:/user/keys/{keyId} - */ - keysDelete: (keyId: number, params?: RequestParams) => Promise>; - /** - * @description Get a single public key. - * - * @name KeysDetail - * @request GET:/user/keys/{keyId} - */ - keysDetail: (keyId: number, params?: RequestParams) => Promise>; - /** - * @description List public and private organizations for the authenticated user. - * - * @name OrgsList - * @request GET:/user/orgs - */ - orgsList: (params?: RequestParams) => Promise>; - /** - * @description List repositories for the authenticated user. Note that this does not include repositories owned by organizations which the user can access. You can lis user organizations and list organization repositories separately. - * - * @name ReposList - * @request GET:/user/repos - */ - reposList: ( - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @name ReposCreate - * @request POST:/user/repos - */ - reposCreate: (body: PostRepo, params?: RequestParams) => Promise>; - /** - * @description List repositories being starred by the authenticated user. - * - * @name StarredList - * @request GET:/user/starred - */ - starredList: ( - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "created" */ - sort?: "created" | "updated"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Unstar a repository - * - * @name StarredDelete - * @request DELETE:/user/starred/{owner}/{repo} - */ - starredDelete: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Check if you are starring a repository. - * - * @name StarredDetail - * @request GET:/user/starred/{owner}/{repo} - */ - starredDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Star a repository. - * - * @name StarredUpdate - * @request PUT:/user/starred/{owner}/{repo} - */ - starredUpdate: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description List repositories being watched by the authenticated user. - * - * @name SubscriptionsList - * @request GET:/user/subscriptions - */ - subscriptionsList: (params?: RequestParams) => Promise>; - /** - * @description Stop watching a repository - * - * @name SubscriptionsDelete - * @request DELETE:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDelete: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Check if you are watching a repository. - * - * @name SubscriptionsDetail - * @request GET:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDetail: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description Watch a repository. - * - * @name SubscriptionsUpdate - * @request PUT:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsUpdate: (owner: string, repo: string, params?: RequestParams) => Promise>; - /** - * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth. - * - * @name TeamsList - * @request GET:/user/teams - */ - teamsList: (params?: RequestParams) => Promise>; - }; - users: { - /** - * @description Get all users. This provides a dump of every user, in the order that they signed up for GitHub. Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users. - * - * @name UsersList - * @request GET:/users - */ - usersList: ( - query?: { - /** The integer ID of the last user that you've seen. */ - since?: number; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description Get a single user. - * - * @name UsersDetail - * @request GET:/users/{username} - */ - usersDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. - * - * @name EventsDetail - * @request GET:/users/{username}/events - */ - eventsDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description This is the user's organization dashboard. You must be authenticated as the user to view this. - * - * @name EventsOrgsDetail - * @request GET:/users/{username}/events/orgs/{org} - */ - eventsOrgsDetail: (username: string, org: string, params?: RequestParams) => Promise>; - /** - * @description List a user's followers - * - * @name FollowersDetail - * @request GET:/users/{username}/followers - */ - followersDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description Check if one user follows another. - * - * @name FollowingDetail - * @request GET:/users/{username}/following/{targetUser} - */ - followingDetail: (username: string, targetUser: string, params?: RequestParams) => Promise>; - /** - * @description List a users gists. - * - * @name GistsDetail - * @request GET:/users/{username}/gists - */ - gistsDetail: ( - username: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description List public keys for a user. Lists the verified public keys for a user. This is accessible by anyone. - * - * @name KeysDetail - * @request GET:/users/{username}/keys - */ - keysDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description List all public organizations for a user. - * - * @name OrgsDetail - * @request GET:/users/{username}/orgs - */ - orgsDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description These are events that you'll only see public events. - * - * @name ReceivedEventsDetail - * @request GET:/users/{username}/received_events - */ - receivedEventsDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description List public events that a user has received - * - * @name ReceivedEventsPublicDetail - * @request GET:/users/{username}/received_events/public - */ - receivedEventsPublicDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description List public repositories for the specified user. - * - * @name ReposDetail - * @request GET:/users/{username}/repos - */ - reposDetail: ( - username: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params?: RequestParams, - ) => Promise>; - /** - * @description List repositories being starred by a user. - * - * @name StarredDetail - * @request GET:/users/{username}/starred - */ - starredDetail: (username: string, params?: RequestParams) => Promise>; - /** - * @description List repositories being watched by a user. - * - * @name SubscriptionsDetail - * @request GET:/users/{username}/subscriptions - */ - subscriptionsDetail: (username: string, params?: RequestParams) => Promise>; - }; -} diff --git a/tests/spec/jsAxios/test.js b/tests/spec/jsAxios/test.js deleted file mode 100644 index 21d8f855..00000000 --- a/tests/spec/jsAxios/test.js +++ /dev/null @@ -1,20 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node:path"); -const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); -const createSchemaInfos = require("../../helpers/createSchemaInfos"); - -const schemas = createSchemaInfos({ - absolutePathToSchemas: resolve(__dirname, "./"), -}); - -schemas.forEach(({ absolutePath, apiFileName }) => { - generateApiForTest({ - testName: "--js --axios option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - toJS: true, - httpClientType: "axios", - }); -}); diff --git a/tests/spec/jsSingleHttpClientModular/expected/Key.d.ts b/tests/spec/jsSingleHttpClientModular/expected/Key.d.ts deleted file mode 100644 index 4839c9dc..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/Key.d.ts +++ /dev/null @@ -1,157 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { AuthentiqID, Error } from "./data-contracts"; -import { HttpClient, HttpResponse, RequestParams } from "./http-client"; -export declare class Key { - http: HttpClient; - constructor(http: HttpClient); - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret: ( - query: { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** pending or done */ - status?: string; - }, - Error - > - >; - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister: ( - body: AuthentiqID, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - > - >; - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - keyRevoke: ( - pk: string, - query: { - /** revokation secret */ - secret: string; - }, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** done */ - status?: string; - }, - Error - > - >; - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey: ( - pk: string, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - > - >; - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey: (pk: string, params?: RequestParams) => Promise>; - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate: ( - pk: string, - body: AuthentiqID, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** confirmed */ - status?: string; - }, - Error - > - >; - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind: ( - pk: string, - body: AuthentiqID, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** confirmed */ - status?: string; - }, - Error - > - >; -} diff --git a/tests/spec/jsSingleHttpClientModular/expected/Key.js b/tests/spec/jsSingleHttpClientModular/expected/Key.js deleted file mode 100644 index 0d616643..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/Key.js +++ /dev/null @@ -1,119 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export class Key { - http; - constructor(http) { - this.http = http; - } - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret = (query, params = {}) => - this.http.request({ - path: `/key`, - method: "DELETE", - query: query, - format: "json", - ...params, - }); - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister = (body, params = {}) => - this.http.request({ - path: `/key`, - method: "POST", - body: body, - format: "json", - ...params, - }); - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - keyRevoke = (pk, query, params = {}) => - this.http.request({ - path: `/key/${pk}`, - method: "DELETE", - query: query, - format: "json", - ...params, - }); - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey = (pk, params = {}) => - this.http.request({ - path: `/key/${pk}`, - method: "GET", - format: "json", - ...params, - }); - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey = (pk, params = {}) => - this.http.request({ - path: `/key/${pk}`, - method: "HEAD", - ...params, - }); - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate = (pk, body, params = {}) => - this.http.request({ - path: `/key/${pk}`, - method: "POST", - body: body, - format: "json", - ...params, - }); - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind = (pk, body, params = {}) => - this.http.request({ - path: `/key/${pk}`, - method: "PUT", - body: body, - format: "json", - ...params, - }); -} diff --git a/tests/spec/jsSingleHttpClientModular/expected/KeyRoute.d.ts b/tests/spec/jsSingleHttpClientModular/expected/KeyRoute.d.ts deleted file mode 100644 index b1d3a0be..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/KeyRoute.d.ts +++ /dev/null @@ -1,153 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { AuthentiqID } from "./data-contracts"; -export declare namespace Key { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - namespace KeyRevokeNosecret { - type RequestParams = {}; - type RequestQuery = { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** pending or done */ - status?: string; - }; - } - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - namespace KeyRegister { - type RequestParams = {}; - type RequestQuery = {}; - type RequestBody = AuthentiqID; - type RequestHeaders = {}; - type ResponseBody = { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }; - } - /** - * @description Revoke an Identity (Key) with a revocation secret - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - namespace KeyRevoke { - type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - type RequestQuery = { - /** revokation secret */ - secret: string; - }; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** done */ - status?: string; - }; - } - /** - * @description Get public details of an Authentiq ID. - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - namespace GetKey { - type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }; - } - /** - * @description HEAD info on Authentiq ID - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - namespace HeadKey { - type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = void; - } - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - namespace KeyUpdate { - type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - type RequestQuery = {}; - type RequestBody = AuthentiqID; - type RequestHeaders = {}; - type ResponseBody = { - /** confirmed */ - status?: string; - }; - } - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - namespace KeyBind { - type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - type RequestQuery = {}; - type RequestBody = AuthentiqID; - type RequestHeaders = {}; - type ResponseBody = { - /** confirmed */ - status?: string; - }; - } -} diff --git a/tests/spec/jsSingleHttpClientModular/expected/KeyRoute.js b/tests/spec/jsSingleHttpClientModular/expected/KeyRoute.js deleted file mode 100644 index e785e7ef..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/KeyRoute.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export {}; diff --git a/tests/spec/jsSingleHttpClientModular/expected/Login.d.ts b/tests/spec/jsSingleHttpClientModular/expected/Login.d.ts deleted file mode 100644 index c648cece..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/Login.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Error, PushToken } from "./data-contracts"; -import { HttpClient, HttpResponse, RequestParams } from "./http-client"; -export declare class Login { - http: HttpClient; - constructor(http: HttpClient); - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest: ( - query: { - /** URI App will connect to */ - callback: string; - }, - body: PushToken, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** sent */ - status?: string; - }, - Error - > - >; - /** - * @description Get a current key register - * - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - keyRegister: (params?: RequestParams) => Promise< - HttpResponse< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - > - >; -} diff --git a/tests/spec/jsSingleHttpClientModular/expected/Login.js b/tests/spec/jsSingleHttpClientModular/expected/Login.js deleted file mode 100644 index 21e83fde..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/Login.js +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export class Login { - http; - constructor(http) { - this.http = http; - } - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest = (query, body, params = {}) => - this.http.request({ - path: `/login`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }); - /** - * @description Get a current key register - * - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - keyRegister = (params = {}) => - this.http.request({ - path: `/login`, - method: "GET", - format: "json", - ...params, - }); -} diff --git a/tests/spec/jsSingleHttpClientModular/expected/LoginRoute.d.ts b/tests/spec/jsSingleHttpClientModular/expected/LoginRoute.d.ts deleted file mode 100644 index f12a9cb1..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/LoginRoute.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { PushToken } from "./data-contracts"; -export declare namespace Login { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - namespace PushLoginRequest { - type RequestParams = {}; - type RequestQuery = { - /** URI App will connect to */ - callback: string; - }; - type RequestBody = PushToken; - type RequestHeaders = {}; - type ResponseBody = { - /** sent */ - status?: string; - }; - } - /** - * @description Get a current key register - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - namespace KeyRegister { - type RequestParams = {}; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }; - } -} diff --git a/tests/spec/jsSingleHttpClientModular/expected/LoginRoute.js b/tests/spec/jsSingleHttpClientModular/expected/LoginRoute.js deleted file mode 100644 index e785e7ef..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/LoginRoute.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export {}; diff --git a/tests/spec/jsSingleHttpClientModular/expected/Scope.d.ts b/tests/spec/jsSingleHttpClientModular/expected/Scope.d.ts deleted file mode 100644 index 5d0709c5..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/Scope.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Claims, Error } from "./data-contracts"; -import { HttpClient, HttpResponse, RequestParams } from "./http-client"; -export declare class Scope { - http: HttpClient; - constructor(http: HttpClient); - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest: ( - body: Claims, - query?: { - /** test only mode, using test issuer */ - test?: number; - }, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }, - Error - > - >; - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete: ( - job: string, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** done */ - status?: string; - }, - Error - > - >; - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve: ( - job: string, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - > - >; - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead: (job: string, params?: RequestParams) => Promise>; - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm: ( - job: string, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** confirmed */ - status?: string; - }, - Error - > - >; - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate: ( - job: string, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }, - Error - > - >; -} diff --git a/tests/spec/jsSingleHttpClientModular/expected/Scope.js b/tests/spec/jsSingleHttpClientModular/expected/Scope.js deleted file mode 100644 index 8dedfdde..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/Scope.js +++ /dev/null @@ -1,103 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { ContentType } from "./http-client"; -export class Scope { - http; - constructor(http) { - this.http = http; - } - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest = (body, query, params = {}) => - this.http.request({ - path: `/scope`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }); - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete = (job, params = {}) => - this.http.request({ - path: `/scope/${job}`, - method: "DELETE", - format: "json", - ...params, - }); - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve = (job, params = {}) => - this.http.request({ - path: `/scope/${job}`, - method: "GET", - format: "json", - ...params, - }); - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead = (job, params = {}) => - this.http.request({ - path: `/scope/${job}`, - method: "HEAD", - ...params, - }); - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm = (job, params = {}) => - this.http.request({ - path: `/scope/${job}`, - method: "POST", - type: ContentType.Json, - format: "json", - ...params, - }); - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate = (job, params = {}) => - this.http.request({ - path: `/scope/${job}`, - method: "PUT", - ...params, - }); -} diff --git a/tests/spec/jsSingleHttpClientModular/expected/ScopeRoute.d.ts b/tests/spec/jsSingleHttpClientModular/expected/ScopeRoute.d.ts deleted file mode 100644 index 2c7ba2ed..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/ScopeRoute.d.ts +++ /dev/null @@ -1,131 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Claims } from "./data-contracts"; -export declare namespace Scope { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - namespace SignRequest { - type RequestParams = {}; - type RequestQuery = { - /** test only mode, using test issuer */ - test?: number; - }; - type RequestBody = Claims; - type RequestHeaders = {}; - type ResponseBody = { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }; - } - /** - * @description delete a verification job - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - namespace SignDelete { - type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** done */ - status?: string; - }; - } - /** - * @description get the status / current content of a verification job - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - namespace SignRetrieve { - type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }; - } - /** - * @description HEAD to get the status of a verification job - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - namespace SignRetrieveHead { - type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = void; - } - /** - * @description this is a scope confirmation - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - namespace SignConfirm { - type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** confirmed */ - status?: string; - }; - } - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - namespace SignUpdate { - type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }; - } -} diff --git a/tests/spec/jsSingleHttpClientModular/expected/ScopeRoute.js b/tests/spec/jsSingleHttpClientModular/expected/ScopeRoute.js deleted file mode 100644 index e785e7ef..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/ScopeRoute.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export {}; diff --git a/tests/spec/jsSingleHttpClientModular/expected/data-contracts.d.ts b/tests/spec/jsSingleHttpClientModular/expected/data-contracts.d.ts deleted file mode 100644 index 207c3dbb..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/data-contracts.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Authentiq ID in JWT format, self-signed. */ -export interface AuthentiqID { - /** device token for push messages */ - devtoken?: string; - /** UUID and public signing key */ - sub: string; -} -/** Claim in JWT format, self- or issuer-signed. */ -export interface Claims { - email?: string; - phone?: string; - /** claim scope */ - scope: string; - /** UUID */ - sub: string; - type?: string; -} -export interface Error { - detail?: string; - error: number; - title?: string; - /** unique uri for this error */ - type?: string; -} -/** PushToken in JWT format, self-signed. */ -export interface PushToken { - /** audience (URI) */ - aud: string; - exp?: number; - iat?: number; - /** issuer (URI) */ - iss: string; - nbf?: number; - /** UUID and public signing key */ - sub: string; -} diff --git a/tests/spec/jsSingleHttpClientModular/expected/data-contracts.js b/tests/spec/jsSingleHttpClientModular/expected/data-contracts.js deleted file mode 100644 index e785e7ef..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/data-contracts.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export {}; diff --git a/tests/spec/jsSingleHttpClientModular/expected/http-client.d.ts b/tests/spec/jsSingleHttpClientModular/expected/http-client.d.ts deleted file mode 100644 index 395b6542..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/http-client.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* 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 declare enum ContentType { - Json = "application/json", - FormData = "multipart/form-data", - UrlEncoded = "application/x-www-form-urlencoded", - Text = "text/plain", -} -export declare class HttpClient { - baseUrl: string; - private securityData; - private securityWorker?; - private abortControllers; - private customFetch; - private baseApiParams; - constructor(apiConfig?: ApiConfig); - setSecurityData: (data: SecurityDataType | null) => void; - protected encodeQueryParam(key: string, value: any): string; - protected addQueryParam(query: QueryParamsType, key: string): string; - protected addArrayQueryParam(query: QueryParamsType, key: string): any; - protected toQueryString(rawQuery?: QueryParamsType): string; - protected addQueryParams(rawQuery?: QueryParamsType): string; - private contentFormatters; - protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams; - protected createAbortSignal: (cancelToken: CancelToken) => AbortSignal | undefined; - abortRequest: (cancelToken: CancelToken) => void; - request: ({ - body, - secure, - path, - type, - query, - format, - baseUrl, - cancelToken, - ...params - }: FullRequestParams) => Promise>; -} -export {}; diff --git a/tests/spec/jsSingleHttpClientModular/expected/http-client.js b/tests/spec/jsSingleHttpClientModular/expected/http-client.js deleted file mode 100644 index 337c65e4..00000000 --- a/tests/spec/jsSingleHttpClientModular/expected/http-client.js +++ /dev/null @@ -1,153 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export var ContentType; -(function (ContentType) { - ContentType["Json"] = "application/json"; - ContentType["FormData"] = "multipart/form-data"; - ContentType["UrlEncoded"] = "application/x-www-form-urlencoded"; - ContentType["Text"] = "text/plain"; -})(ContentType || (ContentType = {})); -export class HttpClient { - baseUrl = "https://6-dot-authentiqio.appspot.com"; - securityData = null; - securityWorker; - abortControllers = new Map(); - customFetch = (...fetchParams) => fetch(...fetchParams); - baseApiParams = { - credentials: "same-origin", - headers: {}, - redirect: "follow", - referrerPolicy: "no-referrer", - }; - constructor(apiConfig = {}) { - Object.assign(this, apiConfig); - } - setSecurityData = (data) => { - this.securityData = data; - }; - encodeQueryParam(key, value) { - const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; - } - addQueryParam(query, key) { - return this.encodeQueryParam(key, query[key]); - } - addArrayQueryParam(query, key) { - const value = query[key]; - return value.map((v) => this.encodeQueryParam(key, v)).join("&"); - } - toQueryString(rawQuery) { - 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("&"); - } - addQueryParams(rawQuery) { - const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; - } - contentFormatters = { - [ContentType.Json]: (input) => - input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, - [ContentType.Text]: (input) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input), - [ContentType.FormData]: (input) => - 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) => this.toQueryString(input), - }; - mergeRequestParams(params1, params2) { - return { - ...this.baseApiParams, - ...params1, - ...(params2 || {}), - headers: { - ...(this.baseApiParams.headers || {}), - ...(params1.headers || {}), - ...((params2 && params2.headers) || {}), - }, - }; - } - createAbortSignal = (cancelToken) => { - 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; - }; - abortRequest = (cancelToken) => { - const abortController = this.abortControllers.get(cancelToken); - if (abortController) { - abortController.abort(); - this.abortControllers.delete(cancelToken); - } - }; - request = async ({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }) => { - 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.clone(); - r.data = null; - r.error = null; - 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; - }); - }; -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/Key.d.ts b/tests/spec/jsSingleHttpClientModular/generated/Key.d.ts deleted file mode 100644 index 4839c9dc..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/Key.d.ts +++ /dev/null @@ -1,157 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { AuthentiqID, Error } from "./data-contracts"; -import { HttpClient, HttpResponse, RequestParams } from "./http-client"; -export declare class Key { - http: HttpClient; - constructor(http: HttpClient); - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret: ( - query: { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** pending or done */ - status?: string; - }, - Error - > - >; - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister: ( - body: AuthentiqID, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - > - >; - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - keyRevoke: ( - pk: string, - query: { - /** revokation secret */ - secret: string; - }, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** done */ - status?: string; - }, - Error - > - >; - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey: ( - pk: string, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - > - >; - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey: (pk: string, params?: RequestParams) => Promise>; - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate: ( - pk: string, - body: AuthentiqID, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** confirmed */ - status?: string; - }, - Error - > - >; - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind: ( - pk: string, - body: AuthentiqID, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** confirmed */ - status?: string; - }, - Error - > - >; -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/Key.js b/tests/spec/jsSingleHttpClientModular/generated/Key.js deleted file mode 100644 index 0d616643..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/Key.js +++ /dev/null @@ -1,119 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export class Key { - http; - constructor(http) { - this.http = http; - } - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret = (query, params = {}) => - this.http.request({ - path: `/key`, - method: "DELETE", - query: query, - format: "json", - ...params, - }); - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister = (body, params = {}) => - this.http.request({ - path: `/key`, - method: "POST", - body: body, - format: "json", - ...params, - }); - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - keyRevoke = (pk, query, params = {}) => - this.http.request({ - path: `/key/${pk}`, - method: "DELETE", - query: query, - format: "json", - ...params, - }); - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey = (pk, params = {}) => - this.http.request({ - path: `/key/${pk}`, - method: "GET", - format: "json", - ...params, - }); - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey = (pk, params = {}) => - this.http.request({ - path: `/key/${pk}`, - method: "HEAD", - ...params, - }); - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate = (pk, body, params = {}) => - this.http.request({ - path: `/key/${pk}`, - method: "POST", - body: body, - format: "json", - ...params, - }); - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind = (pk, body, params = {}) => - this.http.request({ - path: `/key/${pk}`, - method: "PUT", - body: body, - format: "json", - ...params, - }); -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/KeyRoute.d.ts b/tests/spec/jsSingleHttpClientModular/generated/KeyRoute.d.ts deleted file mode 100644 index b1d3a0be..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/KeyRoute.d.ts +++ /dev/null @@ -1,153 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { AuthentiqID } from "./data-contracts"; -export declare namespace Key { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - namespace KeyRevokeNosecret { - type RequestParams = {}; - type RequestQuery = { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** pending or done */ - status?: string; - }; - } - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - namespace KeyRegister { - type RequestParams = {}; - type RequestQuery = {}; - type RequestBody = AuthentiqID; - type RequestHeaders = {}; - type ResponseBody = { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }; - } - /** - * @description Revoke an Identity (Key) with a revocation secret - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - namespace KeyRevoke { - type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - type RequestQuery = { - /** revokation secret */ - secret: string; - }; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** done */ - status?: string; - }; - } - /** - * @description Get public details of an Authentiq ID. - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - namespace GetKey { - type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }; - } - /** - * @description HEAD info on Authentiq ID - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - namespace HeadKey { - type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = void; - } - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - namespace KeyUpdate { - type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - type RequestQuery = {}; - type RequestBody = AuthentiqID; - type RequestHeaders = {}; - type ResponseBody = { - /** confirmed */ - status?: string; - }; - } - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - namespace KeyBind { - type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - type RequestQuery = {}; - type RequestBody = AuthentiqID; - type RequestHeaders = {}; - type ResponseBody = { - /** confirmed */ - status?: string; - }; - } -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/KeyRoute.js b/tests/spec/jsSingleHttpClientModular/generated/KeyRoute.js deleted file mode 100644 index e785e7ef..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/KeyRoute.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export {}; diff --git a/tests/spec/jsSingleHttpClientModular/generated/Login.d.ts b/tests/spec/jsSingleHttpClientModular/generated/Login.d.ts deleted file mode 100644 index c648cece..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/Login.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Error, PushToken } from "./data-contracts"; -import { HttpClient, HttpResponse, RequestParams } from "./http-client"; -export declare class Login { - http: HttpClient; - constructor(http: HttpClient); - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest: ( - query: { - /** URI App will connect to */ - callback: string; - }, - body: PushToken, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** sent */ - status?: string; - }, - Error - > - >; - /** - * @description Get a current key register - * - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - keyRegister: (params?: RequestParams) => Promise< - HttpResponse< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - > - >; -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/Login.js b/tests/spec/jsSingleHttpClientModular/generated/Login.js deleted file mode 100644 index 21e83fde..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/Login.js +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export class Login { - http; - constructor(http) { - this.http = http; - } - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest = (query, body, params = {}) => - this.http.request({ - path: `/login`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }); - /** - * @description Get a current key register - * - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - keyRegister = (params = {}) => - this.http.request({ - path: `/login`, - method: "GET", - format: "json", - ...params, - }); -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/LoginRoute.d.ts b/tests/spec/jsSingleHttpClientModular/generated/LoginRoute.d.ts deleted file mode 100644 index f12a9cb1..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/LoginRoute.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { PushToken } from "./data-contracts"; -export declare namespace Login { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - namespace PushLoginRequest { - type RequestParams = {}; - type RequestQuery = { - /** URI App will connect to */ - callback: string; - }; - type RequestBody = PushToken; - type RequestHeaders = {}; - type ResponseBody = { - /** sent */ - status?: string; - }; - } - /** - * @description Get a current key register - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - namespace KeyRegister { - type RequestParams = {}; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }; - } -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/LoginRoute.js b/tests/spec/jsSingleHttpClientModular/generated/LoginRoute.js deleted file mode 100644 index e785e7ef..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/LoginRoute.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export {}; diff --git a/tests/spec/jsSingleHttpClientModular/generated/Scope.d.ts b/tests/spec/jsSingleHttpClientModular/generated/Scope.d.ts deleted file mode 100644 index 5d0709c5..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/Scope.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Claims, Error } from "./data-contracts"; -import { HttpClient, HttpResponse, RequestParams } from "./http-client"; -export declare class Scope { - http: HttpClient; - constructor(http: HttpClient); - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest: ( - body: Claims, - query?: { - /** test only mode, using test issuer */ - test?: number; - }, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }, - Error - > - >; - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete: ( - job: string, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** done */ - status?: string; - }, - Error - > - >; - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve: ( - job: string, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - > - >; - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead: (job: string, params?: RequestParams) => Promise>; - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm: ( - job: string, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** confirmed */ - status?: string; - }, - Error - > - >; - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate: ( - job: string, - params?: RequestParams, - ) => Promise< - HttpResponse< - { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }, - Error - > - >; -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/Scope.js b/tests/spec/jsSingleHttpClientModular/generated/Scope.js deleted file mode 100644 index 8dedfdde..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/Scope.js +++ /dev/null @@ -1,103 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { ContentType } from "./http-client"; -export class Scope { - http; - constructor(http) { - this.http = http; - } - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest = (body, query, params = {}) => - this.http.request({ - path: `/scope`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }); - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete = (job, params = {}) => - this.http.request({ - path: `/scope/${job}`, - method: "DELETE", - format: "json", - ...params, - }); - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve = (job, params = {}) => - this.http.request({ - path: `/scope/${job}`, - method: "GET", - format: "json", - ...params, - }); - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead = (job, params = {}) => - this.http.request({ - path: `/scope/${job}`, - method: "HEAD", - ...params, - }); - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm = (job, params = {}) => - this.http.request({ - path: `/scope/${job}`, - method: "POST", - type: ContentType.Json, - format: "json", - ...params, - }); - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate = (job, params = {}) => - this.http.request({ - path: `/scope/${job}`, - method: "PUT", - ...params, - }); -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/ScopeRoute.d.ts b/tests/spec/jsSingleHttpClientModular/generated/ScopeRoute.d.ts deleted file mode 100644 index 2c7ba2ed..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/ScopeRoute.d.ts +++ /dev/null @@ -1,131 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Claims } from "./data-contracts"; -export declare namespace Scope { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - namespace SignRequest { - type RequestParams = {}; - type RequestQuery = { - /** test only mode, using test issuer */ - test?: number; - }; - type RequestBody = Claims; - type RequestHeaders = {}; - type ResponseBody = { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }; - } - /** - * @description delete a verification job - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - namespace SignDelete { - type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** done */ - status?: string; - }; - } - /** - * @description get the status / current content of a verification job - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - namespace SignRetrieve { - type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }; - } - /** - * @description HEAD to get the status of a verification job - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - namespace SignRetrieveHead { - type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = void; - } - /** - * @description this is a scope confirmation - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - namespace SignConfirm { - type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** confirmed */ - status?: string; - }; - } - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - namespace SignUpdate { - type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - type RequestQuery = {}; - type RequestBody = never; - type RequestHeaders = {}; - type ResponseBody = { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }; - } -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/ScopeRoute.js b/tests/spec/jsSingleHttpClientModular/generated/ScopeRoute.js deleted file mode 100644 index e785e7ef..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/ScopeRoute.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export {}; diff --git a/tests/spec/jsSingleHttpClientModular/generated/data-contracts.d.ts b/tests/spec/jsSingleHttpClientModular/generated/data-contracts.d.ts deleted file mode 100644 index 207c3dbb..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/data-contracts.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Authentiq ID in JWT format, self-signed. */ -export interface AuthentiqID { - /** device token for push messages */ - devtoken?: string; - /** UUID and public signing key */ - sub: string; -} -/** Claim in JWT format, self- or issuer-signed. */ -export interface Claims { - email?: string; - phone?: string; - /** claim scope */ - scope: string; - /** UUID */ - sub: string; - type?: string; -} -export interface Error { - detail?: string; - error: number; - title?: string; - /** unique uri for this error */ - type?: string; -} -/** PushToken in JWT format, self-signed. */ -export interface PushToken { - /** audience (URI) */ - aud: string; - exp?: number; - iat?: number; - /** issuer (URI) */ - iss: string; - nbf?: number; - /** UUID and public signing key */ - sub: string; -} diff --git a/tests/spec/jsSingleHttpClientModular/generated/data-contracts.js b/tests/spec/jsSingleHttpClientModular/generated/data-contracts.js deleted file mode 100644 index e785e7ef..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/data-contracts.js +++ /dev/null @@ -1,12 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export {}; diff --git a/tests/spec/jsSingleHttpClientModular/generated/http-client.d.ts b/tests/spec/jsSingleHttpClientModular/generated/http-client.d.ts deleted file mode 100644 index 395b6542..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/http-client.d.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* 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 declare enum ContentType { - Json = "application/json", - FormData = "multipart/form-data", - UrlEncoded = "application/x-www-form-urlencoded", - Text = "text/plain", -} -export declare class HttpClient { - baseUrl: string; - private securityData; - private securityWorker?; - private abortControllers; - private customFetch; - private baseApiParams; - constructor(apiConfig?: ApiConfig); - setSecurityData: (data: SecurityDataType | null) => void; - protected encodeQueryParam(key: string, value: any): string; - protected addQueryParam(query: QueryParamsType, key: string): string; - protected addArrayQueryParam(query: QueryParamsType, key: string): any; - protected toQueryString(rawQuery?: QueryParamsType): string; - protected addQueryParams(rawQuery?: QueryParamsType): string; - private contentFormatters; - protected mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams; - protected createAbortSignal: (cancelToken: CancelToken) => AbortSignal | undefined; - abortRequest: (cancelToken: CancelToken) => void; - request: ({ - body, - secure, - path, - type, - query, - format, - baseUrl, - cancelToken, - ...params - }: FullRequestParams) => Promise>; -} -export {}; diff --git a/tests/spec/jsSingleHttpClientModular/generated/http-client.js b/tests/spec/jsSingleHttpClientModular/generated/http-client.js deleted file mode 100644 index 337c65e4..00000000 --- a/tests/spec/jsSingleHttpClientModular/generated/http-client.js +++ /dev/null @@ -1,153 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export var ContentType; -(function (ContentType) { - ContentType["Json"] = "application/json"; - ContentType["FormData"] = "multipart/form-data"; - ContentType["UrlEncoded"] = "application/x-www-form-urlencoded"; - ContentType["Text"] = "text/plain"; -})(ContentType || (ContentType = {})); -export class HttpClient { - baseUrl = "https://6-dot-authentiqio.appspot.com"; - securityData = null; - securityWorker; - abortControllers = new Map(); - customFetch = (...fetchParams) => fetch(...fetchParams); - baseApiParams = { - credentials: "same-origin", - headers: {}, - redirect: "follow", - referrerPolicy: "no-referrer", - }; - constructor(apiConfig = {}) { - Object.assign(this, apiConfig); - } - setSecurityData = (data) => { - this.securityData = data; - }; - encodeQueryParam(key, value) { - const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; - } - addQueryParam(query, key) { - return this.encodeQueryParam(key, query[key]); - } - addArrayQueryParam(query, key) { - const value = query[key]; - return value.map((v) => this.encodeQueryParam(key, v)).join("&"); - } - toQueryString(rawQuery) { - 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("&"); - } - addQueryParams(rawQuery) { - const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; - } - contentFormatters = { - [ContentType.Json]: (input) => - input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input, - [ContentType.Text]: (input) => (input !== null && typeof input !== "string" ? JSON.stringify(input) : input), - [ContentType.FormData]: (input) => - 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) => this.toQueryString(input), - }; - mergeRequestParams(params1, params2) { - return { - ...this.baseApiParams, - ...params1, - ...(params2 || {}), - headers: { - ...(this.baseApiParams.headers || {}), - ...(params1.headers || {}), - ...((params2 && params2.headers) || {}), - }, - }; - } - createAbortSignal = (cancelToken) => { - 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; - }; - abortRequest = (cancelToken) => { - const abortController = this.abortControllers.get(cancelToken); - if (abortController) { - abortController.abort(); - this.abortControllers.delete(cancelToken); - } - }; - request = async ({ body, secure, path, type, query, format, baseUrl, cancelToken, ...params }) => { - 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.clone(); - r.data = null; - r.error = null; - 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; - }); - }; -} diff --git a/tests/spec/jsSingleHttpClientModular/schema.json b/tests/spec/jsSingleHttpClientModular/schema.json deleted file mode 100644 index 9712e3ab..00000000 --- a/tests/spec/jsSingleHttpClientModular/schema.json +++ /dev/null @@ -1,814 +0,0 @@ -{ - "swagger": "2.0", - "schemes": ["https"], - "host": "6-dot-authentiqio.appspot.com", - "basePath": "/", - "info": { - "contact": { - "email": "hello@authentiq.com", - "name": "Authentiq team", - "url": "http://authentiq.io/support" - }, - "description": "Strong authentication, without the passwords.", - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - }, - "termsOfService": "http://authentiq.com/terms/", - "title": "Authentiq", - "version": "6", - "x-apisguru-categories": ["security"], - "x-logo": { - "backgroundColor": "#F26641", - "url": "https://api.apis.guru/v2/cache/logo/https_www.authentiq.com_theme_images_authentiq-logo-a-inverse.svg" - }, - "x-origin": [ - { - "format": "swagger", - "url": "https://raw.githubusercontent.com/AuthentiqID/authentiq-docs/master/docs/swagger/issuer.yaml", - "version": "2.0" - } - ], - "x-preferred": true, - "x-providerName": "6-dot-authentiqio.appspot.com" - }, - "parameters": { - "AuthentiqID": { - "description": "Authentiq ID to register", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AuthentiqID" - } - }, - "JobID": { - "description": "Job ID (20 chars)", - "in": "path", - "name": "job", - "required": true, - "type": "string" - }, - "PK": { - "description": "Public Signing Key - Authentiq ID (43 chars)", - "in": "path", - "name": "PK", - "required": true, - "type": "string" - }, - "PushToken": { - "description": "Push Token.", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PushToken" - } - }, - "Scope": { - "description": "Claims of scope", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Claims" - } - } - }, - "responses": { - "ErrorResponse": { - "description": "Error response", - "schema": { - "$ref": "#/definitions/Error" - } - } - }, - "paths": { - "/key": { - "delete": { - "description": "Revoke an Authentiq ID using email & phone.\n\nIf called with `email` and `phone` only, a verification code \nwill be sent by email. Do a second call adding `code` to \ncomplete the revocation.\n", - "operationId": "key_revoke_nosecret", - "parameters": [ - { - "description": "primary email associated to Key (ID)", - "in": "query", - "name": "email", - "required": true, - "type": "string" - }, - { - "description": "primary phone number, international representation", - "in": "query", - "name": "phone", - "required": true, - "type": "string" - }, - { - "description": "verification code sent by email", - "in": "query", - "name": "code", - "required": false, - "type": "string" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successfully deleted", - "schema": { - "properties": { - "status": { - "description": "pending or done", - "type": "string" - } - }, - "type": "object" - } - }, - "401": { - "description": "Authentication error `auth-error`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "409": { - "description": "Confirm with code sent `confirm-first`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "delete"] - }, - "post": { - "consumes": ["application/jwt"], - "description": "Register a new ID `JWT(sub, devtoken)`\n\nv5: `JWT(sub, pk, devtoken, ...)`\n\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "key_register", - "parameters": [ - { - "$ref": "#/parameters/AuthentiqID" - } - ], - "produces": ["application/json"], - "responses": { - "201": { - "description": "Successfully registered", - "schema": { - "properties": { - "secret": { - "description": "revoke key", - "type": "string" - }, - "status": { - "description": "registered", - "type": "string" - } - }, - "type": "object" - } - }, - "409": { - "description": "Key already registered `duplicate-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "post"] - } - }, - "/key/{PK}": { - "delete": { - "description": "Revoke an Identity (Key) with a revocation secret", - "operationId": "key_revoke", - "parameters": [ - { - "$ref": "#/parameters/PK" - }, - { - "description": "revokation secret", - "in": "query", - "name": "secret", - "required": true, - "type": "string" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successful response", - "schema": { - "properties": { - "status": { - "description": "done", - "type": "string" - } - }, - "type": "object" - } - }, - "401": { - "description": "Key not found / wrong code `auth-error`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "delete"] - }, - "get": { - "description": "Get public details of an Authentiq ID.\n", - "parameters": [ - { - "$ref": "#/parameters/PK" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successfully retrieved", - "schema": { - "properties": { - "since": { - "format": "date-time", - "type": "string" - }, - "status": { - "type": "string" - }, - "sub": { - "description": "base64safe encoded public signing key", - "type": "string" - } - }, - "title": "JWT", - "type": "object" - } - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "410": { - "description": "Key is revoked (gone). `revoked-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "get"] - }, - "head": { - "description": "HEAD info on Authentiq ID\n", - "parameters": [ - { - "$ref": "#/parameters/PK" - } - ], - "responses": { - "200": { - "description": "Key exists" - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "410": { - "description": "Key is revoked `revoked-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "head"] - }, - "post": { - "consumes": ["application/jwt"], - "description": "update properties of an Authentiq ID.\n(not operational in v4; use PUT for now)\n\nv5: POST issuer-signed email & phone scopes in\na self-signed JWT\n\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "key_update", - "parameters": [ - { - "$ref": "#/parameters/PK" - }, - { - "$ref": "#/parameters/AuthentiqID" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successfully updated", - "schema": { - "properties": { - "status": { - "description": "confirmed", - "type": "string" - } - }, - "type": "object" - } - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "post"] - }, - "put": { - "consumes": ["application/jwt"], - "description": "Update Authentiq ID by replacing the object.\n\nv4: `JWT(sub,email,phone)` to bind email/phone hash; \n\nv5: POST issuer-signed email & phone scopes\nand PUT to update registration `JWT(sub, pk, devtoken, ...)`\n\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "key_bind", - "parameters": [ - { - "$ref": "#/parameters/PK" - }, - { - "$ref": "#/parameters/AuthentiqID" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successfully updated", - "schema": { - "properties": { - "status": { - "description": "confirmed", - "type": "string" - } - }, - "type": "object" - } - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "409": { - "description": "Already bound to another key `duplicate-hash`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "put"] - } - }, - "/login": { - "post": { - "consumes": ["application/jwt"], - "description": "push sign-in request\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "push_login_request", - "parameters": [ - { - "$ref": "#/parameters/PushToken" - }, - { - "description": "URI App will connect to", - "in": "query", - "name": "callback", - "required": true, - "type": "string" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successful response", - "schema": { - "properties": { - "status": { - "description": "sent", - "type": "string" - } - }, - "type": "object" - } - }, - "401": { - "description": "Unauthorized for this callback audience `aud-error` or JWT should be self-signed `auth-error`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["login", "post"] - }, - "get": { - "consumes": ["application/jwt"], - "description": "Get a current key register", - "operationId": "key_register", - "parameters": [], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Success", - "schema": { - "properties": { - "secret": { - "description": "revoke key", - "type": "string" - }, - "status": { - "description": "registered", - "type": "string" - } - }, - "type": "object" - } - }, - "409": { - "description": "Key already registered `duplicate-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "get"] - } - }, - "/scope": { - "post": { - "consumes": ["application/jwt"], - "description": "scope verification request\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "sign_request", - "parameters": [ - { - "$ref": "#/parameters/Scope" - }, - { - "description": "test only mode, using test issuer", - "in": "query", - "name": "test", - "required": false, - "type": "integer" - } - ], - "produces": ["application/json"], - "responses": { - "201": { - "description": "Successful response", - "schema": { - "properties": { - "job": { - "description": "20-character ID", - "type": "string" - }, - "status": { - "description": "waiting", - "type": "string" - } - }, - "type": "object" - } - }, - "429": { - "description": "Too Many Requests on same address / number `rate-limit`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "post"] - } - }, - "/scope/{job}": { - "delete": { - "description": "delete a verification job", - "operationId": "sign_delete", - "parameters": [ - { - "$ref": "#/parameters/JobID" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successfully deleted", - "schema": { - "properties": { - "status": { - "description": "done", - "type": "string" - } - }, - "type": "object" - } - }, - "404": { - "description": "Job not found `unknown-job`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "delete"] - }, - "get": { - "description": "get the status / current content of a verification job", - "operationId": "sign_retrieve", - "parameters": [ - { - "$ref": "#/parameters/JobID" - } - ], - "produces": ["application/json", "application/jwt"], - "responses": { - "200": { - "description": "Successful response (JWT)", - "schema": { - "properties": { - "exp": { - "type": "integer" - }, - "field": { - "type": "string" - }, - "sub": { - "description": "base64safe encoded public signing key", - "type": "string" - } - }, - "title": "JWT", - "type": "object" - } - }, - "204": { - "description": "Confirmed, waiting for signing" - }, - "404": { - "description": "Job not found `unknown-job`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "get"] - }, - "head": { - "description": "HEAD to get the status of a verification job", - "operationId": "sign_retrieve_head", - "parameters": [ - { - "$ref": "#/parameters/JobID" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Confirmed and signed" - }, - "204": { - "description": "Confirmed, waiting for signing" - }, - "404": { - "description": "Job not found `unknown-job`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "head"] - }, - "post": { - "consumes": ["application/json"], - "description": "this is a scope confirmation", - "operationId": "sign_confirm", - "parameters": [ - { - "$ref": "#/parameters/JobID" - } - ], - "produces": ["application/json"], - "responses": { - "202": { - "description": "Successfully confirmed", - "schema": { - "properties": { - "status": { - "description": "confirmed", - "type": "string" - } - }, - "type": "object" - } - }, - "401": { - "description": "Confirmation error `auth-error`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "404": { - "description": "Job not found `unknown-job`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "405": { - "description": "JWT POSTed to scope `not-supported`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "post"] - }, - "put": { - "consumes": ["application/jwt"], - "description": "authority updates a JWT with its signature\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "sign_update", - "parameters": [ - { - "$ref": "#/parameters/JobID" - } - ], - "produces": ["application/jwt"], - "responses": { - "200": { - "description": "Successfully updated", - "schema": { - "properties": { - "jwt": { - "description": "result is JWT or JSON??", - "type": "string" - }, - "status": { - "description": "ready", - "type": "string" - } - }, - "type": "object" - } - }, - "404": { - "description": "Job not found `unknown-job`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "409": { - "description": "Job not confirmed yet `confirm-first`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "put"] - } - } - }, - "definitions": { - "AuthentiqID": { - "description": "Authentiq ID in JWT format, self-signed.\n", - "properties": { - "devtoken": { - "description": "device token for push messages", - "type": "string" - }, - "sub": { - "description": "UUID and public signing key", - "type": "string" - } - }, - "required": ["sub"] - }, - "Claims": { - "description": "Claim in JWT format, self- or issuer-signed. \n", - "properties": { - "email": { - "description": "", - "type": "string" - }, - "phone": { - "description": "", - "type": "string" - }, - "scope": { - "description": "claim scope", - "type": "string" - }, - "sub": { - "description": "UUID", - "type": "string" - }, - "type": { - "description": "", - "type": "string" - } - }, - "required": ["sub", "scope"] - }, - "Error": { - "properties": { - "detail": { - "type": "string" - }, - "error": { - "type": "integer" - }, - "title": { - "type": "string" - }, - "type": { - "description": "unique uri for this error", - "type": "string" - } - }, - "required": ["error"] - }, - "PushToken": { - "description": "PushToken in JWT format, self-signed. \n", - "properties": { - "aud": { - "description": "audience (URI)", - "type": "string" - }, - "exp": { - "type": "integer" - }, - "iat": { - "type": "integer" - }, - "iss": { - "description": "issuer (URI)", - "type": "string" - }, - "nbf": { - "type": "integer" - }, - "sub": { - "description": "UUID and public signing key", - "type": "string" - } - }, - "required": ["sub", "iss", "aud"] - } - } -} diff --git a/tests/spec/jsSingleHttpClientModular/test.js b/tests/spec/jsSingleHttpClientModular/test.js deleted file mode 100644 index 0b1d6abb..00000000 --- a/tests/spec/jsSingleHttpClientModular/test.js +++ /dev/null @@ -1,50 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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, Exception }) => { - generateApiForTest({ - testName: "--modular-js option test", - silent: true, - input: absolutePath, - output: resolve(__dirname, "./generated"), - modular: true, - toJS: true, - singleHttpClient: true, - generateClient: true, - generateRouteTypes: true, - }).then(() => { - const outputFileNames = [ - "data-contracts.d.ts", - "data-contracts.js", - "http-client.d.ts", - "http-client.js", - "Key.d.ts", - "Key.js", - "KeyRoute.d.ts", - "KeyRoute.js", - "Login.d.ts", - "Login.js", - "LoginRoute.d.ts", - "LoginRoute.js", - "Scope.d.ts", - "Scope.js", - "ScopeRoute.d.ts", - "ScopeRoute.js", - ]; - - for (const fileName of outputFileNames) { - validateGeneratedModule(resolve(__dirname, `./generated/${fileName}`)); - assertGeneratedModule( - resolve(__dirname, `./generated/${fileName}`), - resolve(__dirname, `./expected/${fileName}`), - ); - } - }); -}); diff --git a/tests/spec/modular/expected/Key.ts b/tests/spec/modular/expected/Key.ts deleted file mode 100644 index 0ee5c954..00000000 --- a/tests/spec/modular/expected/Key.ts +++ /dev/null @@ -1,176 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { AuthentiqID, Error } from "./data-contracts"; -import { HttpClient, RequestParams } from "./http-client"; - -export class Key extends HttpClient { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret = ( - query: { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** pending or done */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "DELETE", - query: query, - format: "json", - ...params, - }); - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister = (body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "POST", - body: body, - format: "json", - ...params, - }); - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - keyRevoke = ( - pk: string, - query: { - /** revokation secret */ - secret: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "DELETE", - query: query, - format: "json", - ...params, - }); - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey = (pk: string, params: RequestParams = {}) => - this.request< - { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "GET", - format: "json", - ...params, - }); - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey = (pk: string, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "HEAD", - ...params, - }); - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate = (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "POST", - body: body, - format: "json", - ...params, - }); - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind = (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "PUT", - body: body, - format: "json", - ...params, - }); -} diff --git a/tests/spec/modular/expected/KeyRoute.ts b/tests/spec/modular/expected/KeyRoute.ts deleted file mode 100644 index be168a2f..00000000 --- a/tests/spec/modular/expected/KeyRoute.ts +++ /dev/null @@ -1,160 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { AuthentiqID } from "./data-contracts"; - -export namespace Key { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - export namespace KeyRevokeNosecret { - export type RequestParams = {}; - export type RequestQuery = { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** pending or done */ - status?: string; - }; - } - - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - export namespace KeyRegister { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }; - } - - /** - * @description Revoke an Identity (Key) with a revocation secret - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - export namespace KeyRevoke { - export type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - export type RequestQuery = { - /** revokation secret */ - secret: string; - }; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** done */ - status?: string; - }; - } - - /** - * @description Get public details of an Authentiq ID. - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - export namespace GetKey { - export type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }; - } - - /** - * @description HEAD info on Authentiq ID - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - export namespace HeadKey { - export type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = void; - } - - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - export namespace KeyUpdate { - export type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { - /** confirmed */ - status?: string; - }; - } - - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - export namespace KeyBind { - export type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { - /** confirmed */ - status?: string; - }; - } -} diff --git a/tests/spec/modular/expected/Login.ts b/tests/spec/modular/expected/Login.ts deleted file mode 100644 index c9390b9f..00000000 --- a/tests/spec/modular/expected/Login.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Error, PushToken } from "./data-contracts"; -import { HttpClient, RequestParams } from "./http-client"; - -export class Login extends HttpClient { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest = ( - query: { - /** URI App will connect to */ - callback: string; - }, - body: PushToken, - params: RequestParams = {}, - ) => - this.request< - { - /** sent */ - status?: string; - }, - Error - >({ - path: `/login`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }); - /** - * @description Get a current key register - * - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - keyRegister = (params: RequestParams = {}) => - this.request< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - >({ - path: `/login`, - method: "GET", - format: "json", - ...params, - }); -} diff --git a/tests/spec/modular/expected/LoginRoute.ts b/tests/spec/modular/expected/LoginRoute.ts deleted file mode 100644 index 5e6e1bc2..00000000 --- a/tests/spec/modular/expected/LoginRoute.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { PushToken } from "./data-contracts"; - -export namespace Login { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - export namespace PushLoginRequest { - export type RequestParams = {}; - export type RequestQuery = { - /** URI App will connect to */ - callback: string; - }; - export type RequestBody = PushToken; - export type RequestHeaders = {}; - export type ResponseBody = { - /** sent */ - status?: string; - }; - } - - /** - * @description Get a current key register - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - export namespace KeyRegister { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }; - } -} diff --git a/tests/spec/modular/expected/Scope.ts b/tests/spec/modular/expected/Scope.ts deleted file mode 100644 index beefc4c8..00000000 --- a/tests/spec/modular/expected/Scope.ts +++ /dev/null @@ -1,144 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Claims, Error } from "./data-contracts"; -import { ContentType, HttpClient, RequestParams } from "./http-client"; - -export class Scope extends HttpClient { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest = ( - body: Claims, - query?: { - /** test only mode, using test issuer */ - test?: number; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }, - Error - >({ - path: `/scope`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }); - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete = (job: string, params: RequestParams = {}) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "DELETE", - format: "json", - ...params, - }); - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve = (job: string, params: RequestParams = {}) => - this.request< - { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "GET", - format: "json", - ...params, - }); - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead = (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "HEAD", - ...params, - }); - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm = (job: string, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "POST", - type: ContentType.Json, - format: "json", - ...params, - }); - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate = (job: string, params: RequestParams = {}) => - this.request< - { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "PUT", - ...params, - }); -} diff --git a/tests/spec/modular/expected/ScopeRoute.ts b/tests/spec/modular/expected/ScopeRoute.ts deleted file mode 100644 index 0d645b8f..00000000 --- a/tests/spec/modular/expected/ScopeRoute.ts +++ /dev/null @@ -1,137 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Claims } from "./data-contracts"; - -export namespace Scope { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - export namespace SignRequest { - export type RequestParams = {}; - export type RequestQuery = { - /** test only mode, using test issuer */ - test?: number; - }; - export type RequestBody = Claims; - export type RequestHeaders = {}; - export type ResponseBody = { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }; - } - - /** - * @description delete a verification job - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - export namespace SignDelete { - export type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** done */ - status?: string; - }; - } - - /** - * @description get the status / current content of a verification job - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - export namespace SignRetrieve { - export type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }; - } - - /** - * @description HEAD to get the status of a verification job - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - export namespace SignRetrieveHead { - export type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = void; - } - - /** - * @description this is a scope confirmation - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - export namespace SignConfirm { - export type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** confirmed */ - status?: string; - }; - } - - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - export namespace SignUpdate { - export type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }; - } -} diff --git a/tests/spec/modular/expected/data-contracts.ts b/tests/spec/modular/expected/data-contracts.ts deleted file mode 100644 index 144ba040..00000000 --- a/tests/spec/modular/expected/data-contracts.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Authentiq ID in JWT format, self-signed. */ -export interface AuthentiqID { - /** device token for push messages */ - devtoken?: string; - /** UUID and public signing key */ - sub: string; -} - -/** Claim in JWT format, self- or issuer-signed. */ -export interface Claims { - email?: string; - phone?: string; - /** claim scope */ - scope: string; - /** UUID */ - sub: string; - type?: string; -} - -export interface Error { - detail?: string; - error: number; - title?: string; - /** unique uri for this error */ - type?: string; -} - -/** PushToken in JWT format, self-signed. */ -export interface PushToken { - /** audience (URI) */ - aud: string; - exp?: number; - iat?: number; - /** issuer (URI) */ - iss: string; - nbf?: number; - /** UUID and public signing key */ - sub: string; -} diff --git a/tests/spec/modular/expected/http-client.ts b/tests/spec/modular/expected/http-client.ts deleted file mode 100644 index ed2aebb7..00000000 --- a/tests/spec/modular/expected/http-client.ts +++ /dev/null @@ -1,220 +0,0 @@ -/* 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://6-dot-authentiqio.appspot.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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; - }); - }; -} diff --git a/tests/spec/modular/expected/route-types.ts b/tests/spec/modular/expected/route-types.ts deleted file mode 100644 index d1cd6888..00000000 --- a/tests/spec/modular/expected/route-types.ts +++ /dev/null @@ -1,216 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { AuthentiqID, Claims, PushToken } from "./data-contracts"; - -export namespace key { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - export namespace KeyRevokeNosecret { - export type RequestParams = {}; - export type RequestQuery = { email: string; phone: string; code?: string }; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - export namespace KeyRegister { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { secret?: string; status?: string }; - } - /** - * @description Revoke an Identity (Key) with a revocation secret - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - export namespace KeyRevoke { - export type RequestParams = { pk: string }; - export type RequestQuery = { secret: string }; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description Get public details of an Authentiq ID. - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - export namespace GetKey { - export type RequestParams = { pk: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { since?: string; status?: string; sub?: string }; - } - /** - * @description HEAD info on Authentiq ID - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - export namespace HeadKey { - export type RequestParams = { pk: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = void; - } - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - export namespace KeyUpdate { - export type RequestParams = { pk: string }; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - export namespace KeyBind { - export type RequestParams = { pk: string }; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } -} - -export namespace login { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - export namespace PushLoginRequest { - export type RequestParams = {}; - export type RequestQuery = { callback: string }; - export type RequestBody = PushToken; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description Get a current key register - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - export namespace KeyRegister { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { secret?: string; status?: string }; - } -} - -export namespace scope { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - export namespace SignRequest { - export type RequestParams = {}; - export type RequestQuery = { test?: number }; - export type RequestBody = Claims; - export type RequestHeaders = {}; - export type ResponseBody = { job?: string; status?: string }; - } - /** - * @description delete a verification job - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - export namespace SignDelete { - export type RequestParams = { job: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description get the status / current content of a verification job - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - export namespace SignRetrieve { - export type RequestParams = { job: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { exp?: number; field?: string; sub?: string }; - } - /** - * @description HEAD to get the status of a verification job - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - export namespace SignRetrieveHead { - export type RequestParams = { job: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = void; - } - /** - * @description this is a scope confirmation - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - export namespace SignConfirm { - export type RequestParams = { job: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - export namespace SignUpdate { - export type RequestParams = { job: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { jwt?: string; status?: string }; - } -} diff --git a/tests/spec/modular/generated/Key.ts b/tests/spec/modular/generated/Key.ts deleted file mode 100644 index 0ee5c954..00000000 --- a/tests/spec/modular/generated/Key.ts +++ /dev/null @@ -1,176 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { AuthentiqID, Error } from "./data-contracts"; -import { HttpClient, RequestParams } from "./http-client"; - -export class Key extends HttpClient { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - keyRevokeNosecret = ( - query: { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** pending or done */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "DELETE", - query: query, - format: "json", - ...params, - }); - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister = (body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "POST", - body: body, - format: "json", - ...params, - }); - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - keyRevoke = ( - pk: string, - query: { - /** revokation secret */ - secret: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "DELETE", - query: query, - format: "json", - ...params, - }); - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - getKey = (pk: string, params: RequestParams = {}) => - this.request< - { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "GET", - format: "json", - ...params, - }); - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - headKey = (pk: string, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "HEAD", - ...params, - }); - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - keyUpdate = (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "POST", - body: body, - format: "json", - ...params, - }); - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - keyBind = (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "PUT", - body: body, - format: "json", - ...params, - }); -} diff --git a/tests/spec/modular/generated/KeyRoute.ts b/tests/spec/modular/generated/KeyRoute.ts deleted file mode 100644 index be168a2f..00000000 --- a/tests/spec/modular/generated/KeyRoute.ts +++ /dev/null @@ -1,160 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { AuthentiqID } from "./data-contracts"; - -export namespace Key { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - export namespace KeyRevokeNosecret { - export type RequestParams = {}; - export type RequestQuery = { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** pending or done */ - status?: string; - }; - } - - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - export namespace KeyRegister { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }; - } - - /** - * @description Revoke an Identity (Key) with a revocation secret - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - export namespace KeyRevoke { - export type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - export type RequestQuery = { - /** revokation secret */ - secret: string; - }; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** done */ - status?: string; - }; - } - - /** - * @description Get public details of an Authentiq ID. - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - export namespace GetKey { - export type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }; - } - - /** - * @description HEAD info on Authentiq ID - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - export namespace HeadKey { - export type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = void; - } - - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - export namespace KeyUpdate { - export type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { - /** confirmed */ - status?: string; - }; - } - - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - export namespace KeyBind { - export type RequestParams = { - /** Public Signing Key - Authentiq ID (43 chars) */ - pk: string; - }; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { - /** confirmed */ - status?: string; - }; - } -} diff --git a/tests/spec/modular/generated/Login.ts b/tests/spec/modular/generated/Login.ts deleted file mode 100644 index c9390b9f..00000000 --- a/tests/spec/modular/generated/Login.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Error, PushToken } from "./data-contracts"; -import { HttpClient, RequestParams } from "./http-client"; - -export class Login extends HttpClient { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - pushLoginRequest = ( - query: { - /** URI App will connect to */ - callback: string; - }, - body: PushToken, - params: RequestParams = {}, - ) => - this.request< - { - /** sent */ - status?: string; - }, - Error - >({ - path: `/login`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }); - /** - * @description Get a current key register - * - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - keyRegister = (params: RequestParams = {}) => - this.request< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - >({ - path: `/login`, - method: "GET", - format: "json", - ...params, - }); -} diff --git a/tests/spec/modular/generated/LoginRoute.ts b/tests/spec/modular/generated/LoginRoute.ts deleted file mode 100644 index 5e6e1bc2..00000000 --- a/tests/spec/modular/generated/LoginRoute.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { PushToken } from "./data-contracts"; - -export namespace Login { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - export namespace PushLoginRequest { - export type RequestParams = {}; - export type RequestQuery = { - /** URI App will connect to */ - callback: string; - }; - export type RequestBody = PushToken; - export type RequestHeaders = {}; - export type ResponseBody = { - /** sent */ - status?: string; - }; - } - - /** - * @description Get a current key register - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - export namespace KeyRegister { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }; - } -} diff --git a/tests/spec/modular/generated/Scope.ts b/tests/spec/modular/generated/Scope.ts deleted file mode 100644 index beefc4c8..00000000 --- a/tests/spec/modular/generated/Scope.ts +++ /dev/null @@ -1,144 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Claims, Error } from "./data-contracts"; -import { ContentType, HttpClient, RequestParams } from "./http-client"; - -export class Scope extends HttpClient { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - signRequest = ( - body: Claims, - query?: { - /** test only mode, using test issuer */ - test?: number; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }, - Error - >({ - path: `/scope`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }); - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - signDelete = (job: string, params: RequestParams = {}) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "DELETE", - format: "json", - ...params, - }); - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - signRetrieve = (job: string, params: RequestParams = {}) => - this.request< - { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "GET", - format: "json", - ...params, - }); - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - signRetrieveHead = (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "HEAD", - ...params, - }); - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - signConfirm = (job: string, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "POST", - type: ContentType.Json, - format: "json", - ...params, - }); - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - signUpdate = (job: string, params: RequestParams = {}) => - this.request< - { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "PUT", - ...params, - }); -} diff --git a/tests/spec/modular/generated/ScopeRoute.ts b/tests/spec/modular/generated/ScopeRoute.ts deleted file mode 100644 index 0d645b8f..00000000 --- a/tests/spec/modular/generated/ScopeRoute.ts +++ /dev/null @@ -1,137 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { Claims } from "./data-contracts"; - -export namespace Scope { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - export namespace SignRequest { - export type RequestParams = {}; - export type RequestQuery = { - /** test only mode, using test issuer */ - test?: number; - }; - export type RequestBody = Claims; - export type RequestHeaders = {}; - export type ResponseBody = { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }; - } - - /** - * @description delete a verification job - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - export namespace SignDelete { - export type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** done */ - status?: string; - }; - } - - /** - * @description get the status / current content of a verification job - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - export namespace SignRetrieve { - export type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }; - } - - /** - * @description HEAD to get the status of a verification job - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - export namespace SignRetrieveHead { - export type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = void; - } - - /** - * @description this is a scope confirmation - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - export namespace SignConfirm { - export type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** confirmed */ - status?: string; - }; - } - - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - export namespace SignUpdate { - export type RequestParams = { - /** Job ID (20 chars) */ - job: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }; - } -} diff --git a/tests/spec/modular/generated/data-contracts.ts b/tests/spec/modular/generated/data-contracts.ts deleted file mode 100644 index 144ba040..00000000 --- a/tests/spec/modular/generated/data-contracts.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Authentiq ID in JWT format, self-signed. */ -export interface AuthentiqID { - /** device token for push messages */ - devtoken?: string; - /** UUID and public signing key */ - sub: string; -} - -/** Claim in JWT format, self- or issuer-signed. */ -export interface Claims { - email?: string; - phone?: string; - /** claim scope */ - scope: string; - /** UUID */ - sub: string; - type?: string; -} - -export interface Error { - detail?: string; - error: number; - title?: string; - /** unique uri for this error */ - type?: string; -} - -/** PushToken in JWT format, self-signed. */ -export interface PushToken { - /** audience (URI) */ - aud: string; - exp?: number; - iat?: number; - /** issuer (URI) */ - iss: string; - nbf?: number; - /** UUID and public signing key */ - sub: string; -} diff --git a/tests/spec/modular/generated/http-client.ts b/tests/spec/modular/generated/http-client.ts deleted file mode 100644 index ed2aebb7..00000000 --- a/tests/spec/modular/generated/http-client.ts +++ /dev/null @@ -1,220 +0,0 @@ -/* 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://6-dot-authentiqio.appspot.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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; - }); - }; -} diff --git a/tests/spec/modular/generated/route-types.ts b/tests/spec/modular/generated/route-types.ts deleted file mode 100644 index d1cd6888..00000000 --- a/tests/spec/modular/generated/route-types.ts +++ /dev/null @@ -1,216 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -import { AuthentiqID, Claims, PushToken } from "./data-contracts"; - -export namespace key { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - */ - export namespace KeyRevokeNosecret { - export type RequestParams = {}; - export type RequestQuery = { email: string; phone: string; code?: string }; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - export namespace KeyRegister { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { secret?: string; status?: string }; - } - /** - * @description Revoke an Identity (Key) with a revocation secret - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - */ - export namespace KeyRevoke { - export type RequestParams = { pk: string }; - export type RequestQuery = { secret: string }; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description Get public details of an Authentiq ID. - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - */ - export namespace GetKey { - export type RequestParams = { pk: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { since?: string; status?: string; sub?: string }; - } - /** - * @description HEAD info on Authentiq ID - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - */ - export namespace HeadKey { - export type RequestParams = { pk: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = void; - } - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - */ - export namespace KeyUpdate { - export type RequestParams = { pk: string }; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - */ - export namespace KeyBind { - export type RequestParams = { pk: string }; - export type RequestQuery = {}; - export type RequestBody = AuthentiqID; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } -} - -export namespace login { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - */ - export namespace PushLoginRequest { - export type RequestParams = {}; - export type RequestQuery = { callback: string }; - export type RequestBody = PushToken; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description Get a current key register - * @tags key, get - * @name KeyRegister - * @request GET:/login - */ - export namespace KeyRegister { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { secret?: string; status?: string }; - } -} - -export namespace scope { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, post - * @name SignRequest - * @request POST:/scope - */ - export namespace SignRequest { - export type RequestParams = {}; - export type RequestQuery = { test?: number }; - export type RequestBody = Claims; - export type RequestHeaders = {}; - export type ResponseBody = { job?: string; status?: string }; - } - /** - * @description delete a verification job - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - */ - export namespace SignDelete { - export type RequestParams = { job: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description get the status / current content of a verification job - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - */ - export namespace SignRetrieve { - export type RequestParams = { job: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { exp?: number; field?: string; sub?: string }; - } - /** - * @description HEAD to get the status of a verification job - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - */ - export namespace SignRetrieveHead { - export type RequestParams = { job: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = void; - } - /** - * @description this is a scope confirmation - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - */ - export namespace SignConfirm { - export type RequestParams = { job: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { status?: string }; - } - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - */ - export namespace SignUpdate { - export type RequestParams = { job: string }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { jwt?: string; status?: string }; - } -} diff --git a/tests/spec/modular/schema.json b/tests/spec/modular/schema.json deleted file mode 100644 index 9712e3ab..00000000 --- a/tests/spec/modular/schema.json +++ /dev/null @@ -1,814 +0,0 @@ -{ - "swagger": "2.0", - "schemes": ["https"], - "host": "6-dot-authentiqio.appspot.com", - "basePath": "/", - "info": { - "contact": { - "email": "hello@authentiq.com", - "name": "Authentiq team", - "url": "http://authentiq.io/support" - }, - "description": "Strong authentication, without the passwords.", - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - }, - "termsOfService": "http://authentiq.com/terms/", - "title": "Authentiq", - "version": "6", - "x-apisguru-categories": ["security"], - "x-logo": { - "backgroundColor": "#F26641", - "url": "https://api.apis.guru/v2/cache/logo/https_www.authentiq.com_theme_images_authentiq-logo-a-inverse.svg" - }, - "x-origin": [ - { - "format": "swagger", - "url": "https://raw.githubusercontent.com/AuthentiqID/authentiq-docs/master/docs/swagger/issuer.yaml", - "version": "2.0" - } - ], - "x-preferred": true, - "x-providerName": "6-dot-authentiqio.appspot.com" - }, - "parameters": { - "AuthentiqID": { - "description": "Authentiq ID to register", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/AuthentiqID" - } - }, - "JobID": { - "description": "Job ID (20 chars)", - "in": "path", - "name": "job", - "required": true, - "type": "string" - }, - "PK": { - "description": "Public Signing Key - Authentiq ID (43 chars)", - "in": "path", - "name": "PK", - "required": true, - "type": "string" - }, - "PushToken": { - "description": "Push Token.", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/PushToken" - } - }, - "Scope": { - "description": "Claims of scope", - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/Claims" - } - } - }, - "responses": { - "ErrorResponse": { - "description": "Error response", - "schema": { - "$ref": "#/definitions/Error" - } - } - }, - "paths": { - "/key": { - "delete": { - "description": "Revoke an Authentiq ID using email & phone.\n\nIf called with `email` and `phone` only, a verification code \nwill be sent by email. Do a second call adding `code` to \ncomplete the revocation.\n", - "operationId": "key_revoke_nosecret", - "parameters": [ - { - "description": "primary email associated to Key (ID)", - "in": "query", - "name": "email", - "required": true, - "type": "string" - }, - { - "description": "primary phone number, international representation", - "in": "query", - "name": "phone", - "required": true, - "type": "string" - }, - { - "description": "verification code sent by email", - "in": "query", - "name": "code", - "required": false, - "type": "string" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successfully deleted", - "schema": { - "properties": { - "status": { - "description": "pending or done", - "type": "string" - } - }, - "type": "object" - } - }, - "401": { - "description": "Authentication error `auth-error`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "409": { - "description": "Confirm with code sent `confirm-first`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "delete"] - }, - "post": { - "consumes": ["application/jwt"], - "description": "Register a new ID `JWT(sub, devtoken)`\n\nv5: `JWT(sub, pk, devtoken, ...)`\n\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "key_register", - "parameters": [ - { - "$ref": "#/parameters/AuthentiqID" - } - ], - "produces": ["application/json"], - "responses": { - "201": { - "description": "Successfully registered", - "schema": { - "properties": { - "secret": { - "description": "revoke key", - "type": "string" - }, - "status": { - "description": "registered", - "type": "string" - } - }, - "type": "object" - } - }, - "409": { - "description": "Key already registered `duplicate-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "post"] - } - }, - "/key/{PK}": { - "delete": { - "description": "Revoke an Identity (Key) with a revocation secret", - "operationId": "key_revoke", - "parameters": [ - { - "$ref": "#/parameters/PK" - }, - { - "description": "revokation secret", - "in": "query", - "name": "secret", - "required": true, - "type": "string" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successful response", - "schema": { - "properties": { - "status": { - "description": "done", - "type": "string" - } - }, - "type": "object" - } - }, - "401": { - "description": "Key not found / wrong code `auth-error`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "delete"] - }, - "get": { - "description": "Get public details of an Authentiq ID.\n", - "parameters": [ - { - "$ref": "#/parameters/PK" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successfully retrieved", - "schema": { - "properties": { - "since": { - "format": "date-time", - "type": "string" - }, - "status": { - "type": "string" - }, - "sub": { - "description": "base64safe encoded public signing key", - "type": "string" - } - }, - "title": "JWT", - "type": "object" - } - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "410": { - "description": "Key is revoked (gone). `revoked-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "get"] - }, - "head": { - "description": "HEAD info on Authentiq ID\n", - "parameters": [ - { - "$ref": "#/parameters/PK" - } - ], - "responses": { - "200": { - "description": "Key exists" - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "410": { - "description": "Key is revoked `revoked-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "head"] - }, - "post": { - "consumes": ["application/jwt"], - "description": "update properties of an Authentiq ID.\n(not operational in v4; use PUT for now)\n\nv5: POST issuer-signed email & phone scopes in\na self-signed JWT\n\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "key_update", - "parameters": [ - { - "$ref": "#/parameters/PK" - }, - { - "$ref": "#/parameters/AuthentiqID" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successfully updated", - "schema": { - "properties": { - "status": { - "description": "confirmed", - "type": "string" - } - }, - "type": "object" - } - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "post"] - }, - "put": { - "consumes": ["application/jwt"], - "description": "Update Authentiq ID by replacing the object.\n\nv4: `JWT(sub,email,phone)` to bind email/phone hash; \n\nv5: POST issuer-signed email & phone scopes\nand PUT to update registration `JWT(sub, pk, devtoken, ...)`\n\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "key_bind", - "parameters": [ - { - "$ref": "#/parameters/PK" - }, - { - "$ref": "#/parameters/AuthentiqID" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successfully updated", - "schema": { - "properties": { - "status": { - "description": "confirmed", - "type": "string" - } - }, - "type": "object" - } - }, - "404": { - "description": "Unknown key `unknown-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "409": { - "description": "Already bound to another key `duplicate-hash`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "put"] - } - }, - "/login": { - "post": { - "consumes": ["application/jwt"], - "description": "push sign-in request\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "push_login_request", - "parameters": [ - { - "$ref": "#/parameters/PushToken" - }, - { - "description": "URI App will connect to", - "in": "query", - "name": "callback", - "required": true, - "type": "string" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successful response", - "schema": { - "properties": { - "status": { - "description": "sent", - "type": "string" - } - }, - "type": "object" - } - }, - "401": { - "description": "Unauthorized for this callback audience `aud-error` or JWT should be self-signed `auth-error`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["login", "post"] - }, - "get": { - "consumes": ["application/jwt"], - "description": "Get a current key register", - "operationId": "key_register", - "parameters": [], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Success", - "schema": { - "properties": { - "secret": { - "description": "revoke key", - "type": "string" - }, - "status": { - "description": "registered", - "type": "string" - } - }, - "type": "object" - } - }, - "409": { - "description": "Key already registered `duplicate-key`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["key", "get"] - } - }, - "/scope": { - "post": { - "consumes": ["application/jwt"], - "description": "scope verification request\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "sign_request", - "parameters": [ - { - "$ref": "#/parameters/Scope" - }, - { - "description": "test only mode, using test issuer", - "in": "query", - "name": "test", - "required": false, - "type": "integer" - } - ], - "produces": ["application/json"], - "responses": { - "201": { - "description": "Successful response", - "schema": { - "properties": { - "job": { - "description": "20-character ID", - "type": "string" - }, - "status": { - "description": "waiting", - "type": "string" - } - }, - "type": "object" - } - }, - "429": { - "description": "Too Many Requests on same address / number `rate-limit`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "post"] - } - }, - "/scope/{job}": { - "delete": { - "description": "delete a verification job", - "operationId": "sign_delete", - "parameters": [ - { - "$ref": "#/parameters/JobID" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Successfully deleted", - "schema": { - "properties": { - "status": { - "description": "done", - "type": "string" - } - }, - "type": "object" - } - }, - "404": { - "description": "Job not found `unknown-job`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "delete"] - }, - "get": { - "description": "get the status / current content of a verification job", - "operationId": "sign_retrieve", - "parameters": [ - { - "$ref": "#/parameters/JobID" - } - ], - "produces": ["application/json", "application/jwt"], - "responses": { - "200": { - "description": "Successful response (JWT)", - "schema": { - "properties": { - "exp": { - "type": "integer" - }, - "field": { - "type": "string" - }, - "sub": { - "description": "base64safe encoded public signing key", - "type": "string" - } - }, - "title": "JWT", - "type": "object" - } - }, - "204": { - "description": "Confirmed, waiting for signing" - }, - "404": { - "description": "Job not found `unknown-job`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "get"] - }, - "head": { - "description": "HEAD to get the status of a verification job", - "operationId": "sign_retrieve_head", - "parameters": [ - { - "$ref": "#/parameters/JobID" - } - ], - "produces": ["application/json"], - "responses": { - "200": { - "description": "Confirmed and signed" - }, - "204": { - "description": "Confirmed, waiting for signing" - }, - "404": { - "description": "Job not found `unknown-job`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "head"] - }, - "post": { - "consumes": ["application/json"], - "description": "this is a scope confirmation", - "operationId": "sign_confirm", - "parameters": [ - { - "$ref": "#/parameters/JobID" - } - ], - "produces": ["application/json"], - "responses": { - "202": { - "description": "Successfully confirmed", - "schema": { - "properties": { - "status": { - "description": "confirmed", - "type": "string" - } - }, - "type": "object" - } - }, - "401": { - "description": "Confirmation error `auth-error`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "404": { - "description": "Job not found `unknown-job`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "405": { - "description": "JWT POSTed to scope `not-supported`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "post"] - }, - "put": { - "consumes": ["application/jwt"], - "description": "authority updates a JWT with its signature\nSee: https://github.com/skion/authentiq/wiki/JWT-Examples\n", - "operationId": "sign_update", - "parameters": [ - { - "$ref": "#/parameters/JobID" - } - ], - "produces": ["application/jwt"], - "responses": { - "200": { - "description": "Successfully updated", - "schema": { - "properties": { - "jwt": { - "description": "result is JWT or JSON??", - "type": "string" - }, - "status": { - "description": "ready", - "type": "string" - } - }, - "type": "object" - } - }, - "404": { - "description": "Job not found `unknown-job`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "409": { - "description": "Job not confirmed yet `confirm-first`", - "schema": { - "$ref": "#/definitions/Error" - } - }, - "default": { - "$ref": "#/responses/ErrorResponse" - } - }, - "tags": ["scope", "put"] - } - } - }, - "definitions": { - "AuthentiqID": { - "description": "Authentiq ID in JWT format, self-signed.\n", - "properties": { - "devtoken": { - "description": "device token for push messages", - "type": "string" - }, - "sub": { - "description": "UUID and public signing key", - "type": "string" - } - }, - "required": ["sub"] - }, - "Claims": { - "description": "Claim in JWT format, self- or issuer-signed. \n", - "properties": { - "email": { - "description": "", - "type": "string" - }, - "phone": { - "description": "", - "type": "string" - }, - "scope": { - "description": "claim scope", - "type": "string" - }, - "sub": { - "description": "UUID", - "type": "string" - }, - "type": { - "description": "", - "type": "string" - } - }, - "required": ["sub", "scope"] - }, - "Error": { - "properties": { - "detail": { - "type": "string" - }, - "error": { - "type": "integer" - }, - "title": { - "type": "string" - }, - "type": { - "description": "unique uri for this error", - "type": "string" - } - }, - "required": ["error"] - }, - "PushToken": { - "description": "PushToken in JWT format, self-signed. \n", - "properties": { - "aud": { - "description": "audience (URI)", - "type": "string" - }, - "exp": { - "type": "integer" - }, - "iat": { - "type": "integer" - }, - "iss": { - "description": "issuer (URI)", - "type": "string" - }, - "nbf": { - "type": "integer" - }, - "sub": { - "description": "UUID and public signing key", - "type": "string" - } - }, - "required": ["sub", "iss", "aud"] - } - } -} diff --git a/tests/spec/modular/test.js b/tests/spec/modular/test.js deleted file mode 100644 index 033ff249..00000000 --- a/tests/spec/modular/test.js +++ /dev/null @@ -1,41 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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, Exception }) => { - generateApiForTest({ - testName: "--modular option test", - silent: true, - input: absolutePath, - output: resolve(__dirname, "./generated"), - modular: true, - generateClient: true, - generateRouteTypes: true, - }).then(() => { - const outputFileNames = [ - "data-contracts", - "http-client", - "Key", - "KeyRoute", - "Login", - "LoginRoute", - "route-types", - "Scope", - "ScopeRoute", - ]; - - for (const fileName of outputFileNames) { - validateGeneratedModule(resolve(__dirname, `./generated/${fileName}.ts`)); - assertGeneratedModule( - resolve(__dirname, `./generated/${fileName}.ts`), - resolve(__dirname, `./expected/${fileName}.ts`), - ); - } - }); -}); diff --git a/tests/spec/moduleNameFirstTag/schema.ts b/tests/spec/moduleNameFirstTag/__snapshots__/basic.test.ts.snap similarity index 92% rename from tests/spec/moduleNameFirstTag/schema.ts rename to tests/spec/moduleNameFirstTag/__snapshots__/basic.test.ts.snap index e6b7c5d4..4541e3c8 100644 --- a/tests/spec/moduleNameFirstTag/schema.ts +++ b/tests/spec/moduleNameFirstTag/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --module-name-first-tag 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -138,7 +141,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -203,7 +206,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -225,7 +228,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -241,7 +244,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -305,7 +308,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -353,7 +356,7 @@ export class HttpClient { * @externalDocs http://swagger.io * @contact * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key \`special-key\` to test the authorization filters. */ export class Api extends HttpClient { pet = { @@ -368,7 +371,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet`, + path: \`api/v1/pet\`, method: "POST", body: body, secure: true, @@ -387,7 +390,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet`, + path: \`api/v1/pet\`, method: "PUT", body: body, secure: true, @@ -412,7 +415,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/findByStatus`, + path: \`api/v1/pet/findByStatus\`, method: "GET", query: query, secure: true, @@ -438,7 +441,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/findByTags`, + path: \`api/v1/pet/findByTags\`, method: "GET", query: query, secure: true, @@ -457,7 +460,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/${petId}`, + path: \`api/v1/pet/\${petId}\`, method: "GET", secure: true, format: "json", @@ -484,7 +487,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/${petId}`, + path: \`api/v1/pet/\${petId}\`, method: "POST", body: data, secure: true, @@ -503,7 +506,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/${petId}`, + path: \`api/v1/pet/\${petId}\`, method: "DELETE", secure: true, ...params, @@ -529,7 +532,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/${petId}/uploadImage`, + path: \`api/v1/pet/\${petId}/uploadImage\`, method: "POST", body: data, secure: true, @@ -550,7 +553,7 @@ export class Api extends HttpClient this.request, any>({ - path: `api/v1/store/inventory`, + path: \`api/v1/store/inventory\`, method: "GET", secure: true, format: "json", @@ -567,7 +570,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/store/order`, + path: \`api/v1/store/order\`, method: "POST", body: body, type: ContentType.Json, @@ -585,7 +588,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/store/order/${orderId}`, + path: \`api/v1/store/order/\${orderId}\`, method: "GET", format: "json", ...params, @@ -601,7 +604,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/store/order/${orderId}`, + path: \`api/v1/store/order/\${orderId}\`, method: "DELETE", ...params, }), @@ -617,7 +620,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user`, + path: \`api/v1/user\`, method: "POST", body: body, type: ContentType.Json, @@ -634,7 +637,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/createWithArray`, + path: \`api/v1/user/createWithArray\`, method: "POST", body: body, type: ContentType.Json, @@ -651,7 +654,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/createWithList`, + path: \`api/v1/user/createWithList\`, method: "POST", body: body, type: ContentType.Json, @@ -676,7 +679,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/login`, + path: \`api/v1/user/login\`, method: "GET", query: query, format: "json", @@ -693,7 +696,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/logout`, + path: \`api/v1/user/logout\`, method: "GET", ...params, }), @@ -708,7 +711,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/${username}`, + path: \`api/v1/user/\${username}\`, method: "GET", format: "json", ...params, @@ -724,7 +727,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/${username}`, + path: \`api/v1/user/\${username}\`, method: "PUT", body: body, type: ContentType.Json, @@ -741,7 +744,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/${username}`, + path: \`api/v1/user/\${username}\`, method: "DELETE", ...params, }), @@ -758,7 +761,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/${username}`, + path: \`api/v1/\${username}\`, method: "GET", format: "json", ...params, @@ -776,7 +779,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/${username}`, + path: \`api/v1/\${username}\`, method: "PUT", body: body, type: ContentType.Json, @@ -795,9 +798,11 @@ export class Api extends HttpClient this.request({ - path: `api/v1/${username}`, + path: \`api/v1/\${username}\`, method: "DELETE", ...params, }), }; } +" +`; diff --git a/tests/spec/moduleNameFirstTag/basic.test.ts b/tests/spec/moduleNameFirstTag/basic.test.ts new file mode 100644 index 00000000..5557663b --- /dev/null +++ b/tests/spec/moduleNameFirstTag/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--module-name-first-tag", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + moduleNameFirstTag: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/moduleNameFirstTag/expected.ts b/tests/spec/moduleNameFirstTag/expected.ts deleted file mode 100644 index e6b7c5d4..00000000 --- a/tests/spec/moduleNameFirstTag/expected.ts +++ /dev/null @@ -1,803 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** - * Pet Order - * An order for a pets from the pet store - * @example {"petId":6,"quantity":1,"id":0,"shipDate":"2000-01-23T04:56:07.000+00:00","complete":false,"status":"placed"} - */ -export interface Order { - /** @format int64 */ - id?: number; - /** @format int64 */ - petId?: number; - /** @format int32 */ - quantity?: number; - /** @format date-time */ - shipDate?: string; - /** Order Status */ - status?: "placed" | "approved" | "delivered"; - /** @default false */ - complete?: boolean; -} - -/** - * Pet category - * A category for a pet - * @example {"name":"name","id":6} - */ -export interface Category { - /** @format int64 */ - id?: number; - name?: string; -} - -/** - * a User - * A User who is purchasing from the pet store - * @example {"firstName":"firstName","lastName":"lastName","password":"password","userStatus":6,"phone":"phone","id":0,"email":"email","username":"username"} - */ -export interface User { - /** @format int64 */ - id?: number; - username?: string; - firstName?: string; - lastName?: string; - email?: string; - password?: string; - phone?: string; - /** - * User Status - * @format int32 - */ - userStatus?: number; -} - -/** - * Pet Tag - * A tag for a pet - * @example {"name":"name","id":1} - */ -export interface Tag { - /** @format int64 */ - id?: number; - name?: string; -} - -export enum PetNames { - FluffyHero = "Fluffy Hero", - PiggyPo = "Piggy Po", - SwaggerTypescriptApi = "Swagger Typescript Api", -} - -export enum PetIds { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -/** - * a Pet - * A pet for sale in the pet store - * @example {"photoUrls":["photoUrls","photoUrls"],"name":"doggie","id":0,"category":{"name":"name","id":6},"tags":[{"name":"name","id":1},{"name":"name","id":1}],"status":"available"} - */ -export interface Pet { - /** @format int64 */ - id?: number; - /** A category for a pet */ - category?: Category; - /** @example "doggie" */ - name: string; - photoUrls: string[]; - tags?: Tag[]; - /** pet status in the store */ - status?: "available" | "pending" | "sold"; -} - -/** - * An uploaded response - * Describes the result of uploading an image resource - * @example {"code":0,"type":"type","message":"message"} - */ -export interface ApiResponse { - /** @format int32 */ - code?: number; - type?: string; - message?: string; -} - -/** some description */ -export interface Amount { - /** - * some description - * @format double - * @min 0.01 - * @max 1000000000000000 - */ - value: number; - /** some description */ - currency: Currency; -} - -/** - * some description - * @pattern ^[A-Z]{3,3}$ - */ -export type Currency = string; - -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 = "http://petstore.swagger.io/v2"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/v2 - * @externalDocs http://swagger.io - * @contact - * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - */ -export class Api extends HttpClient { - pet = { - /** - * No description - * - * @tags pet - * @name AddPet - * @summary Add a new pet to the store - * @request POST:api/v1/pet - * @secure - */ - addPet: (body: Pet, params: RequestParams = {}) => - this.request({ - path: `api/v1/pet`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePet - * @summary Update an existing pet - * @request PUT:api/v1/pet - * @secure - */ - updatePet: (body: Pet, params: RequestParams = {}) => - this.request({ - path: `api/v1/pet`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * @description Multiple status values can be provided with comma separated strings - * - * @tags pet - * @name FindPetsByStatus - * @summary Finds Pets by status - * @request GET:api/v1/pet/findByStatus - * @secure - */ - findPetsByStatus: ( - query: { - /** Status values that need to be considered for filter */ - status: ("available" | "pending" | "sold")[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `api/v1/pet/findByStatus`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @tags pet - * @name FindPetsByTags - * @summary Finds Pets by tags - * @request GET:api/v1/pet/findByTags - * @deprecated - * @secure - */ - findPetsByTags: ( - query: { - /** Tags to filter by */ - tags: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `api/v1/pet/findByTags`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Returns a single pet - * - * @tags pet - * @name GetPetById - * @summary Find pet by ID - * @request GET:api/v1/pet/{petId} - * @secure - */ - getPetById: (petId: number, params: RequestParams = {}) => - this.request({ - path: `api/v1/pet/${petId}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePetWithForm - * @summary Updates a pet in the store with form data - * @request POST:api/v1/pet/{petId} - * @secure - */ - updatePetWithForm: ( - petId: number, - data: { - /** Updated name of the pet */ - name?: string; - /** Updated status of the pet */ - status?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `api/v1/pet/${petId}`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name DeletePet - * @summary Deletes a pet - * @request DELETE:api/v1/pet/{petId} - * @secure - */ - deletePet: (petId: number, params: RequestParams = {}) => - this.request({ - path: `api/v1/pet/${petId}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UploadFile - * @summary uploads an image - * @request POST:api/v1/pet/{petId}/uploadImage - * @secure - */ - uploadFile: ( - petId: number, - data: { - /** Additional data to pass to server */ - additionalMetadata?: string; - /** file to upload */ - file?: File; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `api/v1/pet/${petId}/uploadImage`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - format: "json", - ...params, - }), - }; - store = { - /** - * @description Returns a map of status codes to quantities - * - * @tags store - * @name GetInventory - * @summary Returns pet inventories by status - * @request GET:api/v1/store/inventory - * @secure - */ - getInventory: (params: RequestParams = {}) => - this.request, any>({ - path: `api/v1/store/inventory`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags store - * @name PlaceOrder - * @summary Place an order for a pet - * @request POST:api/v1/store/order - */ - placeOrder: (body: Order, params: RequestParams = {}) => - this.request({ - path: `api/v1/store/order`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @tags store - * @name GetOrderById - * @summary Find purchase order by ID - * @request GET:api/v1/store/order/{orderId} - */ - getOrderById: (orderId: number, params: RequestParams = {}) => - this.request({ - path: `api/v1/store/order/${orderId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @tags store - * @name DeleteOrder - * @summary Delete purchase order by ID - * @request DELETE:api/v1/store/order/{orderId} - */ - deleteOrder: (orderId: string, params: RequestParams = {}) => - this.request({ - path: `api/v1/store/order/${orderId}`, - method: "DELETE", - ...params, - }), - }; - user = { - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name CreateUser - * @summary Create user - * @request POST:api/v1/user - */ - createUser: (body: User, params: RequestParams = {}) => - this.request({ - path: `api/v1/user`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithArrayInput - * @summary Creates list of users with given input array - * @request POST:api/v1/user/createWithArray - */ - createUsersWithArrayInput: (body: User[], params: RequestParams = {}) => - this.request({ - path: `api/v1/user/createWithArray`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithListInput - * @summary Creates list of users with given input array - * @request POST:api/v1/user/createWithList - */ - createUsersWithListInput: (body: User[], params: RequestParams = {}) => - this.request({ - path: `api/v1/user/createWithList`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name LoginUser - * @summary Logs user into the system - * @request GET:api/v1/user/login - */ - loginUser: ( - query: { - /** The user name for login */ - username: string; - /** The password for login in clear text */ - password: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `api/v1/user/login`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags user - * @name LogoutUser - * @summary Logs out current logged in user session - * @request GET:api/v1/user/logout - */ - logoutUser: (params: RequestParams = {}) => - this.request({ - path: `api/v1/user/logout`, - method: "GET", - ...params, - }), - - /** - * No description - * - * @tags user - * @name GetUserByName - * @summary Get user by user name - * @request GET:api/v1/user/{username} - */ - getUserByName: (username: string, params: RequestParams = {}) => - this.request({ - path: `api/v1/user/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name UpdateUser - * @summary Updated user - * @request PUT:api/v1/user/{username} - */ - updateUser: (username: string, body: User, params: RequestParams = {}) => - this.request({ - path: `api/v1/user/${username}`, - method: "PUT", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name DeleteUser - * @summary Delete user - * @request DELETE:api/v1/user/{username} - */ - deleteUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `api/v1/user/${username}`, - method: "DELETE", - ...params, - }), - - /** - * No description - * - * @tags user - * @name GetUserByName2 - * @summary Get user by user name - * @request GET:api/v1/{username} - * @originalName getUserByName - * @duplicate - */ - getUserByName2: (username: string, params: RequestParams = {}) => - this.request({ - path: `api/v1/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name UpdateUser2 - * @summary Updated user - * @request PUT:api/v1/{username} - * @originalName updateUser - * @duplicate - */ - updateUser2: (username: string, body: User, params: RequestParams = {}) => - this.request({ - path: `api/v1/${username}`, - method: "PUT", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name DeleteUser2 - * @summary Delete user - * @request DELETE:api/v1/{username} - * @originalName deleteUser - * @duplicate - */ - deleteUser2: (username: string, params: RequestParams = {}) => - this.request({ - path: `api/v1/${username}`, - method: "DELETE", - ...params, - }), - }; -} diff --git a/tests/spec/moduleNameFirstTag/test.js b/tests/spec/moduleNameFirstTag/test.js deleted file mode 100644 index 4870e6c0..00000000 --- a/tests/spec/moduleNameFirstTag/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--module-name-first-tag option test", - silent: true, - name: apiFileName, - spec: require(absolutePath), - output: resolve(__dirname, "./"), - moduleNameFirstTag: true, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/moduleNameIndex/schema.ts b/tests/spec/moduleNameIndex/__snapshots__/basic.test.ts.snap similarity index 92% rename from tests/spec/moduleNameIndex/schema.ts rename to tests/spec/moduleNameIndex/__snapshots__/basic.test.ts.snap index 82e4a607..dadd562c 100644 --- a/tests/spec/moduleNameIndex/schema.ts +++ b/tests/spec/moduleNameIndex/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --module-name-index 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -138,7 +141,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -203,7 +206,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -225,7 +228,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -241,7 +244,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -305,7 +308,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -353,7 +356,7 @@ export class HttpClient { * @externalDocs http://swagger.io * @contact * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key \`special-key\` to test the authorization filters. */ export class Api extends HttpClient { pet = { @@ -368,7 +371,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet`, + path: \`api/v1/pet\`, method: "POST", body: body, secure: true, @@ -387,7 +390,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet`, + path: \`api/v1/pet\`, method: "PUT", body: body, secure: true, @@ -412,7 +415,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/findByStatus`, + path: \`api/v1/pet/findByStatus\`, method: "GET", query: query, secure: true, @@ -438,7 +441,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/findByTags`, + path: \`api/v1/pet/findByTags\`, method: "GET", query: query, secure: true, @@ -457,7 +460,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/${petId}`, + path: \`api/v1/pet/\${petId}\`, method: "GET", secure: true, format: "json", @@ -484,7 +487,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/${petId}`, + path: \`api/v1/pet/\${petId}\`, method: "POST", body: data, secure: true, @@ -503,7 +506,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/${petId}`, + path: \`api/v1/pet/\${petId}\`, method: "DELETE", secure: true, ...params, @@ -529,7 +532,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/pet/${petId}/uploadImage`, + path: \`api/v1/pet/\${petId}/uploadImage\`, method: "POST", body: data, secure: true, @@ -550,7 +553,7 @@ export class Api extends HttpClient this.request, any>({ - path: `api/v1/store/inventory`, + path: \`api/v1/store/inventory\`, method: "GET", secure: true, format: "json", @@ -567,7 +570,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/store/order`, + path: \`api/v1/store/order\`, method: "POST", body: body, type: ContentType.Json, @@ -585,7 +588,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/store/order/${orderId}`, + path: \`api/v1/store/order/\${orderId}\`, method: "GET", format: "json", ...params, @@ -601,7 +604,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/store/order/${orderId}`, + path: \`api/v1/store/order/\${orderId}\`, method: "DELETE", ...params, }), @@ -617,7 +620,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user`, + path: \`api/v1/user\`, method: "POST", body: body, type: ContentType.Json, @@ -634,7 +637,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/createWithArray`, + path: \`api/v1/user/createWithArray\`, method: "POST", body: body, type: ContentType.Json, @@ -651,7 +654,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/createWithList`, + path: \`api/v1/user/createWithList\`, method: "POST", body: body, type: ContentType.Json, @@ -676,7 +679,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/login`, + path: \`api/v1/user/login\`, method: "GET", query: query, format: "json", @@ -693,7 +696,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/logout`, + path: \`api/v1/user/logout\`, method: "GET", ...params, }), @@ -708,7 +711,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/${username}`, + path: \`api/v1/user/\${username}\`, method: "GET", format: "json", ...params, @@ -724,7 +727,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/${username}`, + path: \`api/v1/user/\${username}\`, method: "PUT", body: body, type: ContentType.Json, @@ -741,7 +744,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/user/${username}`, + path: \`api/v1/user/\${username}\`, method: "DELETE", ...params, }), @@ -757,7 +760,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/${username}`, + path: \`api/v1/\${username}\`, method: "GET", format: "json", ...params, @@ -773,7 +776,7 @@ export class Api extends HttpClient this.request({ - path: `api/v1/${username}`, + path: \`api/v1/\${username}\`, method: "PUT", body: body, type: ContentType.Json, @@ -790,9 +793,11 @@ export class Api extends HttpClient this.request({ - path: `api/v1/${username}`, + path: \`api/v1/\${username}\`, method: "DELETE", ...params, }), }; } +" +`; diff --git a/tests/spec/moduleNameIndex/basic.test.ts b/tests/spec/moduleNameIndex/basic.test.ts new file mode 100644 index 00000000..ff6fca74 --- /dev/null +++ b/tests/spec/moduleNameIndex/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--module-name-index", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + moduleNameIndex: 2, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/moduleNameIndex/expected.ts b/tests/spec/moduleNameIndex/expected.ts deleted file mode 100644 index 82e4a607..00000000 --- a/tests/spec/moduleNameIndex/expected.ts +++ /dev/null @@ -1,798 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** - * Pet Order - * An order for a pets from the pet store - * @example {"petId":6,"quantity":1,"id":0,"shipDate":"2000-01-23T04:56:07.000+00:00","complete":false,"status":"placed"} - */ -export interface Order { - /** @format int64 */ - id?: number; - /** @format int64 */ - petId?: number; - /** @format int32 */ - quantity?: number; - /** @format date-time */ - shipDate?: string; - /** Order Status */ - status?: "placed" | "approved" | "delivered"; - /** @default false */ - complete?: boolean; -} - -/** - * Pet category - * A category for a pet - * @example {"name":"name","id":6} - */ -export interface Category { - /** @format int64 */ - id?: number; - name?: string; -} - -/** - * a User - * A User who is purchasing from the pet store - * @example {"firstName":"firstName","lastName":"lastName","password":"password","userStatus":6,"phone":"phone","id":0,"email":"email","username":"username"} - */ -export interface User { - /** @format int64 */ - id?: number; - username?: string; - firstName?: string; - lastName?: string; - email?: string; - password?: string; - phone?: string; - /** - * User Status - * @format int32 - */ - userStatus?: number; -} - -/** - * Pet Tag - * A tag for a pet - * @example {"name":"name","id":1} - */ -export interface Tag { - /** @format int64 */ - id?: number; - name?: string; -} - -export enum PetNames { - FluffyHero = "Fluffy Hero", - PiggyPo = "Piggy Po", - SwaggerTypescriptApi = "Swagger Typescript Api", -} - -export enum PetIds { - Value10 = 10, - Value20 = 20, - Value30 = 30, - Value40 = 40, -} - -/** - * a Pet - * A pet for sale in the pet store - * @example {"photoUrls":["photoUrls","photoUrls"],"name":"doggie","id":0,"category":{"name":"name","id":6},"tags":[{"name":"name","id":1},{"name":"name","id":1}],"status":"available"} - */ -export interface Pet { - /** @format int64 */ - id?: number; - /** A category for a pet */ - category?: Category; - /** @example "doggie" */ - name: string; - photoUrls: string[]; - tags?: Tag[]; - /** pet status in the store */ - status?: "available" | "pending" | "sold"; -} - -/** - * An uploaded response - * Describes the result of uploading an image resource - * @example {"code":0,"type":"type","message":"message"} - */ -export interface ApiResponse { - /** @format int32 */ - code?: number; - type?: string; - message?: string; -} - -/** some description */ -export interface Amount { - /** - * some description - * @format double - * @min 0.01 - * @max 1000000000000000 - */ - value: number; - /** some description */ - currency: Currency; -} - -/** - * some description - * @pattern ^[A-Z]{3,3}$ - */ -export type Currency = string; - -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 = "http://petstore.swagger.io/v2"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license Apache-2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/v2 - * @externalDocs http://swagger.io - * @contact - * - * This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. - */ -export class Api extends HttpClient { - pet = { - /** - * No description - * - * @tags pet - * @name AddPet - * @summary Add a new pet to the store - * @request POST:api/v1/pet - * @secure - */ - addPet: (body: Pet, params: RequestParams = {}) => - this.request({ - path: `api/v1/pet`, - method: "POST", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePet - * @summary Update an existing pet - * @request PUT:api/v1/pet - * @secure - */ - updatePet: (body: Pet, params: RequestParams = {}) => - this.request({ - path: `api/v1/pet`, - method: "PUT", - body: body, - secure: true, - type: ContentType.Json, - ...params, - }), - - /** - * @description Multiple status values can be provided with comma separated strings - * - * @tags pet - * @name FindPetsByStatus - * @summary Finds Pets by status - * @request GET:api/v1/pet/findByStatus - * @secure - */ - findPetsByStatus: ( - query: { - /** Status values that need to be considered for filter */ - status: ("available" | "pending" | "sold")[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `api/v1/pet/findByStatus`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. - * - * @tags pet - * @name FindPetsByTags - * @summary Finds Pets by tags - * @request GET:api/v1/pet/findByTags - * @deprecated - * @secure - */ - findPetsByTags: ( - query: { - /** Tags to filter by */ - tags: string[]; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `api/v1/pet/findByTags`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - - /** - * @description Returns a single pet - * - * @tags pet - * @name GetPetById - * @summary Find pet by ID - * @request GET:api/v1/pet/{petId} - * @secure - */ - getPetById: (petId: number, params: RequestParams = {}) => - this.request({ - path: `api/v1/pet/${petId}`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UpdatePetWithForm - * @summary Updates a pet in the store with form data - * @request POST:api/v1/pet/{petId} - * @secure - */ - updatePetWithForm: ( - petId: number, - data: { - /** Updated name of the pet */ - name?: string; - /** Updated status of the pet */ - status?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `api/v1/pet/${petId}`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name DeletePet - * @summary Deletes a pet - * @request DELETE:api/v1/pet/{petId} - * @secure - */ - deletePet: (petId: number, params: RequestParams = {}) => - this.request({ - path: `api/v1/pet/${petId}`, - method: "DELETE", - secure: true, - ...params, - }), - - /** - * No description - * - * @tags pet - * @name UploadFile - * @summary uploads an image - * @request POST:api/v1/pet/{petId}/uploadImage - * @secure - */ - uploadFile: ( - petId: number, - data: { - /** Additional data to pass to server */ - additionalMetadata?: string; - /** file to upload */ - file?: File; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `api/v1/pet/${petId}/uploadImage`, - method: "POST", - body: data, - secure: true, - type: ContentType.FormData, - format: "json", - ...params, - }), - }; - store = { - /** - * @description Returns a map of status codes to quantities - * - * @tags store - * @name GetInventory - * @summary Returns pet inventories by status - * @request GET:api/v1/store/inventory - * @secure - */ - getInventory: (params: RequestParams = {}) => - this.request, any>({ - path: `api/v1/store/inventory`, - method: "GET", - secure: true, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags store - * @name PlaceOrder - * @summary Place an order for a pet - * @request POST:api/v1/store/order - */ - placeOrder: (body: Order, params: RequestParams = {}) => - this.request({ - path: `api/v1/store/order`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - * - * @tags store - * @name GetOrderById - * @summary Find purchase order by ID - * @request GET:api/v1/store/order/{orderId} - */ - getOrderById: (orderId: number, params: RequestParams = {}) => - this.request({ - path: `api/v1/store/order/${orderId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors - * - * @tags store - * @name DeleteOrder - * @summary Delete purchase order by ID - * @request DELETE:api/v1/store/order/{orderId} - */ - deleteOrder: (orderId: string, params: RequestParams = {}) => - this.request({ - path: `api/v1/store/order/${orderId}`, - method: "DELETE", - ...params, - }), - }; - user = { - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name CreateUser - * @summary Create user - * @request POST:api/v1/user - */ - createUser: (body: User, params: RequestParams = {}) => - this.request({ - path: `api/v1/user`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithArrayInput - * @summary Creates list of users with given input array - * @request POST:api/v1/user/createWithArray - */ - createUsersWithArrayInput: (body: User[], params: RequestParams = {}) => - this.request({ - path: `api/v1/user/createWithArray`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name CreateUsersWithListInput - * @summary Creates list of users with given input array - * @request POST:api/v1/user/createWithList - */ - createUsersWithListInput: (body: User[], params: RequestParams = {}) => - this.request({ - path: `api/v1/user/createWithList`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @tags user - * @name LoginUser - * @summary Logs user into the system - * @request GET:api/v1/user/login - */ - loginUser: ( - query: { - /** The user name for login */ - username: string; - /** The password for login in clear text */ - password: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `api/v1/user/login`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @tags user - * @name LogoutUser - * @summary Logs out current logged in user session - * @request GET:api/v1/user/logout - */ - logoutUser: (params: RequestParams = {}) => - this.request({ - path: `api/v1/user/logout`, - method: "GET", - ...params, - }), - - /** - * No description - * - * @tags user - * @name GetUserByName - * @summary Get user by user name - * @request GET:api/v1/user/{username} - */ - getUserByName: (username: string, params: RequestParams = {}) => - this.request({ - path: `api/v1/user/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name UpdateUser - * @summary Updated user - * @request PUT:api/v1/user/{username} - */ - updateUser: (username: string, body: User, params: RequestParams = {}) => - this.request({ - path: `api/v1/user/${username}`, - method: "PUT", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name DeleteUser - * @summary Delete user - * @request DELETE:api/v1/user/{username} - */ - deleteUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `api/v1/user/${username}`, - method: "DELETE", - ...params, - }), - }; - username = { - /** - * No description - * - * @tags user - * @name GetUserByName - * @summary Get user by user name - * @request GET:api/v1/{username} - */ - getUserByName: (username: string, params: RequestParams = {}) => - this.request({ - path: `api/v1/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name UpdateUser - * @summary Updated user - * @request PUT:api/v1/{username} - */ - updateUser: (username: string, body: User, params: RequestParams = {}) => - this.request({ - path: `api/v1/${username}`, - method: "PUT", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * @description This can only be done by the logged in user. - * - * @tags user - * @name DeleteUser - * @summary Delete user - * @request DELETE:api/v1/{username} - */ - deleteUser: (username: string, params: RequestParams = {}) => - this.request({ - path: `api/v1/${username}`, - method: "DELETE", - ...params, - }), - }; -} diff --git a/tests/spec/moduleNameIndex/test.js b/tests/spec/moduleNameIndex/test.js deleted file mode 100644 index 58a3c476..00000000 --- a/tests/spec/moduleNameIndex/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--module-name-index option test", - silent: true, - name: apiFileName, - spec: require(absolutePath), - output: resolve(__dirname, "./"), - moduleNameIndex: 2, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/noClient/expected.ts b/tests/spec/noClient/__snapshots__/basic.test.ts.snap similarity index 99% rename from tests/spec/noClient/expected.ts rename to tests/spec/noClient/__snapshots__/basic.test.ts.snap index f1052990..3a7491fc 100644 --- a/tests/spec/noClient/expected.ts +++ b/tests/spec/noClient/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --no-client 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -1906,3 +1909,5 @@ export interface UserUpdate { } export type Users = User[]; +" +`; diff --git a/tests/spec/noClient/basic.test.ts b/tests/spec/noClient/basic.test.ts new file mode 100644 index 00000000..f0b2bb52 --- /dev/null +++ b/tests/spec/noClient/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--no-client", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/noClient/schema.ts b/tests/spec/noClient/schema.ts deleted file mode 100644 index f1052990..00000000 --- a/tests/spec/noClient/schema.ts +++ /dev/null @@ -1,1908 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** A user or organization */ -export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - 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; - /** The account username */ - login?: string; - /** The full account name */ - 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"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - 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?: { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601. */ - created_at?: string; - id?: number; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface Commit { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export interface CommitCommentBody { - body: string; - /** Deprecated - Use position parameter instead. */ - line?: string; - /** Line number in the file to comment on. Defaults to null. */ - number?: string; - /** Relative path of the file to comment on. */ - path?: string; - /** Line index in the diff to comment on. */ - position?: number; - /** SHA of the commit to comment on. */ - sha: string; -} - -export type Commits = { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -}[]; - -export interface CompareCommits { - ahead_by?: number; - base_commit?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - behind_by?: number; - commits?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - }; - /** The Total number of commits authored by the contributor. */ - total?: number; - weeks?: { - /** Number of additions. */ - a?: number; - /** Number of commits. */ - c?: number; - /** Number of deletions. */ - d?: number; - /** Start of the week. */ - 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; - /** A GitHub user */ - creator?: User; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -} - -export type DeploymentStatuses = { - created_at?: string; - /** A GitHub user */ - 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 { - /** A user or organization */ - actor?: Actor; - created_at?: object; - id?: number; - /** A GitHub organization */ - 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; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - description?: string; - files?: { - "ring.erl"?: { - filename?: string; - raw_url?: string; - size?: number; - }; - }; - forks?: { - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }[]; - git_pull_url?: string; - git_push_url?: string; - history?: { - change_status?: { - additions?: number; - deletions?: number; - total?: number; - }; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - committed_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - version?: string; - }[]; - html_url?: string; - id?: string; - public?: boolean; - url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - 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; - }; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** A user or organization */ - actor?: Actor; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - event?: string; - issue?: { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }; - url?: string; -} - -export type IssueEvents = IssueEvent[]; - -export type Issues = { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface IssuesComment { - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export type IssuesComments = { - _links?: { - html?: { - href?: string; - }; - pull_request?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - body?: string; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - 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 { - /** Error message */ - message?: string; -} - -export interface MergesSuccessful { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A user or organization */ - 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[]; -} - -/** A GitHub organization */ -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 address. This address is not publicized. */ - billing_email?: string; - company?: string; - /** Publicly visible email address. */ - email?: string; - location?: string; - name?: string; -} - -export interface PostGist { - description?: string; - files?: { - "file1.txt"?: { - content?: string; - }; - }; - public?: boolean; -} - -export interface PostRepo { - /** True to create an initial commit with empty README. Default is false. */ - auto_init?: boolean; - description?: string; - /** Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell" Ignored if auto_init parameter is not provided. */ - gitignore_template?: string; - /** True to enable downloads for this repository, false to disable them. Default is true. */ - has_downloads?: boolean; - /** True to enable issues for this repository, false to disable them. Default is true. */ - has_issues?: boolean; - /** True to enable the wiki for this repository, false to disable it. Default is true. */ - has_wiki?: boolean; - homepage?: string; - name: string; - /** True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. */ - private?: boolean; - /** The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization. */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - merged_at?: string; - number?: number; - patch_url?: string; - state?: "open" | "closed"; - title?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 = { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub organization */ - organization?: Organization; - /** A user or organization */ - owner?: Actor; - /** Is present when the repo is a fork. Parent is the repo this repo was forked from. */ - parent?: Repo; - private?: boolean; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - pushed_at?: string; - size?: number; - /** Is present when the repo is a fork. Source is the ultimate source for the network. */ - source?: Repo; - ssh_url?: string; - svn_url?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - watchers?: number; - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface RepoCommit { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 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; - /** A user or organization */ - 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; - /** A GitHub user */ - 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 { - /** A GitHub user */ - user?: User; -} - -export interface SearchUsers { - items?: Users; - total_count?: number; -} - -export interface SearchUsersByKeyword { - users?: Users; -} - -export interface Subscription { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** String of the tag message. */ - message?: string; - object?: { - sha?: string; - /** String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob. */ - type?: "commit" | "tree" | "blob"; - url?: string; - }; - sha?: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag?: string; - tagger?: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - url?: string; -} - -export interface TagBody { - /** String of the tag message. */ - message: string; - /** String of the SHA of the git object this is tagging. */ - object: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag: string; - tagger: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - /** 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 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?: { - /** One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink. */ - mode?: "100644" | "100755" | "040000" | "160000" | "120000"; - path?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - size?: number; - type?: "blob" | "tree" | "commit"; - url?: string; - }[]; - url?: string; -} - -export interface Trees { - base_tree?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - tree?: Tree[]; - url?: string; -} - -/** A GitHub user */ -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[]; diff --git a/tests/spec/noClient/test.js b/tests/spec/noClient/test.js deleted file mode 100644 index 8c6da417..00000000 --- a/tests/spec/noClient/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--no-client option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - generateClient: false, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/nullable-2.0/schema.ts b/tests/spec/nullable-2.0/__snapshots__/basic.test.ts.snap similarity index 87% rename from tests/spec/nullable-2.0/schema.ts rename to tests/spec/nullable-2.0/__snapshots__/basic.test.ts.snap index 0790cf12..3bbcb137 100644 --- a/tests/spec/nullable-2.0/schema.ts +++ b/tests/spec/nullable-2.0/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > nullable-2.0 refs 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -27,3 +30,5 @@ export interface TestObject { } export type OtherObject = object; +" +`; diff --git a/tests/spec/nullable-2.0/basic.test.ts b/tests/spec/nullable-2.0/basic.test.ts new file mode 100644 index 00000000..4c48503c --- /dev/null +++ b/tests/spec/nullable-2.0/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("nullable-2.0 refs", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + addReadonly: true, + generateClient: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/nullable-2.0/expected.ts b/tests/spec/nullable-2.0/expected.ts deleted file mode 100644 index 0790cf12..00000000 --- a/tests/spec/nullable-2.0/expected.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type MyObject = { - id: string; - name: string; -} | null; - -export interface TestObject { - stringMaybeUndefined?: string; - stringMaybeNullA?: string | null; - stringMaybeNullB?: string | null; - stringMaybeNullAndUndefined?: string | null; - otherObjectMaybeUndefined?: OtherObject; - otherObjectMaybeNullA?: OtherObject | null; - otherObjectMaybeNullB?: OtherObject | null; - otherObjectMaybeNullC?: OtherObject | null; - otherObjectMaybeNullD: OtherObject; -} - -export type OtherObject = object; diff --git a/tests/spec/nullable-2.0/test.js b/tests/spec/nullable-2.0/test.js deleted file mode 100644 index 89bd3f2a..00000000 --- a/tests/spec/nullable-2.0/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "nullable-2.0 refs 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/nullable-3.0/expected.ts b/tests/spec/nullable-3.0/__snapshots__/basic.test.ts.snap similarity index 87% rename from tests/spec/nullable-3.0/expected.ts rename to tests/spec/nullable-3.0/__snapshots__/basic.test.ts.snap index 2f34b79d..cd7b3be0 100644 --- a/tests/spec/nullable-3.0/expected.ts +++ b/tests/spec/nullable-3.0/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > nullable-3.0 refs 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -27,3 +30,5 @@ export interface TestObject { } export type OtherObject = object; +" +`; diff --git a/tests/spec/nullable-3.0/basic.test.ts b/tests/spec/nullable-3.0/basic.test.ts new file mode 100644 index 00000000..72a29798 --- /dev/null +++ b/tests/spec/nullable-3.0/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("nullable-3.0 refs", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + addReadonly: true, + generateClient: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/nullable-3.0/schema.ts b/tests/spec/nullable-3.0/schema.ts deleted file mode 100644 index 2f34b79d..00000000 --- a/tests/spec/nullable-3.0/schema.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type MyObject = { - id: string; - name: string; -} | null; - -export interface TestObject { - stringMaybeUndefined?: string; - stringMaybeNullA: string | null; - stringMaybeNullB: string | null; - stringMaybeNullAndUndefined?: string | null; - otherObjectMaybeUndefined?: OtherObject; - otherObjectMaybeNullA: OtherObject | null; - otherObjectMaybeNullB: OtherObject | null; - otherObjectMaybeNullC: OtherObject | null; - otherObjectMaybeNullD: OtherObject | null; -} - -export type OtherObject = object; diff --git a/tests/spec/nullable-3.0/test.js b/tests/spec/nullable-3.0/test.js deleted file mode 100644 index 542434b6..00000000 --- a/tests/spec/nullable-3.0/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "nullable-3.0 refs 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/object-types/expected.ts b/tests/spec/object-types/__snapshots__/basic.test.ts.snap similarity index 93% rename from tests/spec/object-types/expected.ts rename to tests/spec/object-types/__snapshots__/basic.test.ts.snap index 82bb8b9f..9ad39c20 100644 --- a/tests/spec/object-types/expected.ts +++ b/tests/spec/object-types/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > object-types 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -87,3 +90,5 @@ export type NestedObjectWithRequiredId = { /** id */ id1?: number; }; +" +`; diff --git a/tests/spec/object-types/basic.test.ts b/tests/spec/object-types/basic.test.ts new file mode 100644 index 00000000..42554a9b --- /dev/null +++ b/tests/spec/object-types/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("object-types", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + addReadonly: true, + generateClient: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/object-types/schema.ts b/tests/spec/object-types/schema.ts deleted file mode 100644 index 82bb8b9f..00000000 --- a/tests/spec/object-types/schema.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -type UtilRequiredKeys = Omit & Required>; - -/** - * title - * description - * @example "https://ya.ru/a.png" - */ -export type AnyOfWithNullable = string | null; - -/** https://github.com/acacode/swagger-typescript-api/issues/445 */ -export interface SpecificEnum1 { - myEnum?: ["foo", "bar", "baz"]; -} - -/** https://github.com/acacode/swagger-typescript-api/issues/445 */ -export interface SpecificEnum2 { - myEnum?: ["foo", "bar", "baz"] | ["foo", "bar", "bad"]; -} - -/** - * It is a Pet title - * It is a Pet description - */ -export type Test1 = { - /** - * It is an id title - * It is an id description - */ - id: number; - /** - * It is a name title - * It is a name description - */ - name: string; - /** - * It is a tag title - * It is a tag description - * @deprecated - */ - tag: string; - /** - * It is a multiple title - * It is a multiple description - */ - multiple: string | number; -} | null; - -export interface AdditionalObjectProperties { - id?: string; - [key: string]: any; -} - -export interface AdditionalIntProperties { - id?: string; - [key: string]: any; -} - -export interface ABCOptional { - /** a */ - a?: string; - /** b */ - b?: string; - /** c */ - c?: number; -} - -export type ABCOptionalWithRequiredId = UtilRequiredKeys & { - /** id */ - id: number; -}; - -export type NestedObjectWithRequiredId = { - /** id */ - id: number; -} & { - /** id */ - id1?: number; -}; diff --git a/tests/spec/object-types/test.js b/tests/spec/object-types/test.js deleted file mode 100644 index f3dd720c..00000000 --- a/tests/spec/object-types/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "object-types 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/on-insert-path-param/schema.ts b/tests/spec/on-insert-path-param/__snapshots__/basic.test.ts.snap similarity index 92% rename from tests/spec/on-insert-path-param/schema.ts rename to tests/spec/on-insert-path-param/__snapshots__/basic.test.ts.snap index e0a7d5d0..81245bc5 100644 --- a/tests/spec/on-insert-path-param/schema.ts +++ b/tests/spec/on-insert-path-param/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > on-insert-path-param 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -13,7 +16,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -78,7 +81,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -100,7 +103,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -116,7 +119,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -180,7 +183,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -246,7 +249,7 @@ export class Api extends HttpClient this.request({ - path: `/wrong-path-params1/${encodeURIComponent(pathParam1)}/${encodeURIComponent(pathParam2)}/${encodeURIComponent(pathParam3)}/${encodeURIComponent(pathParam4)}`, + path: \`/wrong-path-params1/\${encodeURIComponent(pathParam1)}/\${encodeURIComponent(pathParam2)}/\${encodeURIComponent(pathParam3)}/\${encodeURIComponent(pathParam4)}\`, method: "DELETE", ...params, }), @@ -278,7 +281,7 @@ export class Api extends HttpClient this.request({ - path: `/checks`, + path: \`/checks\`, method: "GET", query: query, secure: true, @@ -287,3 +290,5 @@ export class Api extends HttpClient { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("on-insert-path-param", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: true, + hooks: { + // @ts-expect-error + onInsertPathParam: (paramName) => `encodeURIComponent(${paramName})`, + }, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/on-insert-path-param/expected.ts b/tests/spec/on-insert-path-param/expected.ts deleted file mode 100644 index e0a7d5d0..00000000 --- a/tests/spec/on-insert-path-param/expected.ts +++ /dev/null @@ -1,289 +0,0 @@ -/* 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 = "http://petstore.swagger.io/api"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license MIT - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/api - * @contact Swagger API Team - * - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - wrongPathParams1 = { - /** - * @description DDD - * - * @tags key, delete - * @name WrongPathParams1 - * @request DELETE:/wrong-path-params1/{pathParam1}/{path_param2}/{path_param3}/:pathParam4 - */ - wrongPathParams1: ( - pathParam1: string, - pathParam2: string, - pathParam3: string, - pathParam4: string, - params: RequestParams = {}, - ) => - this.request({ - path: `/wrong-path-params1/${encodeURIComponent(pathParam1)}/${encodeURIComponent(pathParam2)}/${encodeURIComponent(pathParam3)}/${encodeURIComponent(pathParam4)}`, - method: "DELETE", - ...params, - }), - }; - checks = { - /** - * @description

description

- * - * @tags check - * @name GetChecksCheckGet - * @summary Get Checks - * @request GET:/checks - * @secure - */ - getChecksCheckGet: ( - query?: { - /** - * Page - * @min 1 - * @default 1 - */ - page?: number; - /** - * Size - * @default 1 - */ - size?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/checks`, - method: "GET", - query: query, - secure: true, - format: "json", - ...params, - }), - }; -} diff --git a/tests/spec/on-insert-path-param/test.js b/tests/spec/on-insert-path-param/test.js deleted file mode 100644 index e8173a97..00000000 --- a/tests/spec/on-insert-path-param/test.js +++ /dev/null @@ -1,29 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "on-insert-path-param test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - generateClient: true, - hooks: { - onInsertPathParam: (paramName) => `encodeURIComponent(${paramName})`, - }, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/partialBaseTemplate/expected.ts b/tests/spec/partialBaseTemplate/expected.ts deleted file mode 100644 index eb2391ed..00000000 --- a/tests/spec/partialBaseTemplate/expected.ts +++ /dev/null @@ -1,260 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** PARTIAL TEMPLATES */ -/** - * * FOO BAR - */ -export interface Pet { - /** @format int64 */ - id: number; - name: string; - tag?: string; - multiple?: string | number; -} - -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 = "http://petstore.swagger.io/api"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license MIT - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/api - * @contact Swagger API Team - * - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - pets = { - /** - * @description Returns all pets from the system that the user has access to - * - * @name PetsList - * @request GET:/pets - */ - petsList: (params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "GET", - format: "json", - ...params, - }), - }; -} diff --git a/tests/spec/partialBaseTemplate/schema.json b/tests/spec/partialBaseTemplate/schema.json deleted file mode 100644 index 66d6de40..00000000 --- a/tests/spec/partialBaseTemplate/schema.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "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": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to", - "produces": ["application/json"], - "responses": { - "200": { - "description": "A list of pets.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - } - } - } - } - }, - "definitions": { - "Pet": { - "type": "object", - "required": ["id", "name"], - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - }, - "multiple": { - "type": ["string", "number"] - } - } - } - } -} diff --git a/tests/spec/partialBaseTemplate/schema.ts b/tests/spec/partialBaseTemplate/schema.ts deleted file mode 100644 index eb2391ed..00000000 --- a/tests/spec/partialBaseTemplate/schema.ts +++ /dev/null @@ -1,260 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** PARTIAL TEMPLATES */ -/** - * * FOO BAR - */ -export interface Pet { - /** @format int64 */ - id: number; - name: string; - tag?: string; - multiple?: string | number; -} - -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 = "http://petstore.swagger.io/api"; - 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.clone() 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 Swagger Petstore - * @version 1.0.0 - * @license MIT - * @termsOfService http://swagger.io/terms/ - * @baseUrl http://petstore.swagger.io/api - * @contact Swagger API Team - * - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - pets = { - /** - * @description Returns all pets from the system that the user has access to - * - * @name PetsList - * @request GET:/pets - */ - petsList: (params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "GET", - format: "json", - ...params, - }), - }; -} diff --git a/tests/spec/partialBaseTemplate/spec_templates/data-contracts.eta b/tests/spec/partialBaseTemplate/spec_templates/data-contracts.eta deleted file mode 100644 index c14940e6..00000000 --- a/tests/spec/partialBaseTemplate/spec_templates/data-contracts.eta +++ /dev/null @@ -1,27 +0,0 @@ -<% - const { modelTypes, utils } = it; - const { formatDescription } = utils; - - - const dataContractTemplates = { - enum: (contract) => { - return `enum ${contract.name} {\r\n${contract.content} \r\n }`; - }, - interface: (contract) => { - return `interface ${contract.name} {\r\n${contract.content}}`; - }, - type: (contract) => { - return `type ${contract.name} = ${contract.content}`; - }, - } -%> -/** PARTIAL TEMPLATES */ -<% modelTypes.forEach((contract) => { %> -/** -* <%~ formatDescription(contract.description) %> -* FOO BAR -*/ -export <%~ (dataContractTemplates[contract.typeIdentifier] || dataContractTemplates.type)(contract) %> - - -<% }) %> diff --git a/tests/spec/partialBaseTemplate/test.js b/tests/spec/partialBaseTemplate/test.js deleted file mode 100644 index 3c1ed685..00000000 --- a/tests/spec/partialBaseTemplate/test.js +++ /dev/null @@ -1,37 +0,0 @@ -const _ = require("lodash"); -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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, Exception }) => { - generateApiForTest({ - testName: "partialBaseTemplate test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - // because this script was called from package.json folder - templates: "./tests/spec/partialBaseTemplate/spec_templates", - }).then((output) => { - if ( - !_.includes( - _.get(output.files, "[0].fileContent"), - "/** PARTIAL TEMPLATES */", - ) - ) { - throw new Exception("Failed, spec templates are not applied"); - } - - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/partialDefaultTemplate/expected.ts b/tests/spec/partialDefaultTemplate/expected.ts deleted file mode 100644 index c12ca39d..00000000 --- a/tests/spec/partialDefaultTemplate/expected.ts +++ /dev/null @@ -1,253 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Pet { - /** @format int64 */ - id: number; - name: string; - tag?: string; - multiple?: string | number; -} - -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 = "http://petstore.swagger.io/api"; - 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.clone() 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; - }); - }; -} - -/** PARTIAL TEMPLATES */ -/** - * @title Swagger Petstore - * @version 1.0.0 - * @baseUrl http://petstore.swagger.io/api - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - pets = { - /** - * @description Returns all pets from the system that the user has access to - * - * @name PetsList - * @request GET:/pets - */ - petsList: (params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "GET", - format: "json", - ...params, - }), - }; -} diff --git a/tests/spec/partialDefaultTemplate/schema.json b/tests/spec/partialDefaultTemplate/schema.json deleted file mode 100644 index 66d6de40..00000000 --- a/tests/spec/partialDefaultTemplate/schema.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "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": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to", - "produces": ["application/json"], - "responses": { - "200": { - "description": "A list of pets.", - "schema": { - "type": "array", - "items": { - "$ref": "#/definitions/Pet" - } - } - } - } - } - } - }, - "definitions": { - "Pet": { - "type": "object", - "required": ["id", "name"], - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - }, - "multiple": { - "type": ["string", "number"] - } - } - } - } -} diff --git a/tests/spec/partialDefaultTemplate/schema.ts b/tests/spec/partialDefaultTemplate/schema.ts deleted file mode 100644 index c12ca39d..00000000 --- a/tests/spec/partialDefaultTemplate/schema.ts +++ /dev/null @@ -1,253 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Pet { - /** @format int64 */ - id: number; - name: string; - tag?: string; - multiple?: string | number; -} - -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 = "http://petstore.swagger.io/api"; - 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.clone() 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; - }); - }; -} - -/** PARTIAL TEMPLATES */ -/** - * @title Swagger Petstore - * @version 1.0.0 - * @baseUrl http://petstore.swagger.io/api - * A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification - */ -export class Api extends HttpClient { - pets = { - /** - * @description Returns all pets from the system that the user has access to - * - * @name PetsList - * @request GET:/pets - */ - petsList: (params: RequestParams = {}) => - this.request({ - path: `/pets`, - method: "GET", - format: "json", - ...params, - }), - }; -} diff --git a/tests/spec/partialDefaultTemplate/spec_templates/api.eta b/tests/spec/partialDefaultTemplate/spec_templates/api.eta deleted file mode 100644 index b81eea38..00000000 --- a/tests/spec/partialDefaultTemplate/spec_templates/api.eta +++ /dev/null @@ -1,47 +0,0 @@ -<% -const { apiConfig, routes, utils, config } = it; -const { info, servers } = apiConfig; -const { _, require, formatDescription } = utils; - -const server = (servers && servers[0]) || { url: "" }; - -const descriptionLines = _.compact([ - `@title ${info.title || "No title"}`, - info.version && `@version ${info.version}`, - server.url && `@baseUrl ${server.url}`, - info.description && _.replace(formatDescription(info.description), /\n/g, "\n * "), -]); - -%> -/** PARTIAL TEMPLATES */ -<% if (descriptionLines.length) { %> -/** -<% descriptionLines.forEach((descriptionLine) => { %> -* <%~ descriptionLine %> - -<% }) %> -*/ -<% } %> -export class Api<% if (!config.singleHttpClient) { %> extends HttpClient <% } %> { - -<% if(config.singleHttpClient) { %> - constructor (private http: HttpClient) {} -<% } %> - - -<% routes.outOfModule && routes.outOfModule.forEach((route) => { %> - - <%~ includeFile('./procedure-call.ejs', { route, utils, config }) %> - -<% }) %> - -<% routes.combined && routes.combined.forEach(({ routes = [], moduleName }) => { %> - <%~ moduleName %> = { - <% routes.forEach((route) => { %> - - <%~ includeFile('./procedure-call.ejs', { route, utils, config }) %> - - <% }) %> - } -<% }) %> -} diff --git a/tests/spec/partialDefaultTemplate/test.js b/tests/spec/partialDefaultTemplate/test.js deleted file mode 100644 index 33325a91..00000000 --- a/tests/spec/partialDefaultTemplate/test.js +++ /dev/null @@ -1,37 +0,0 @@ -const _ = require("lodash"); -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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, Exception }) => { - generateApiForTest({ - testName: "partialDefaultTemplate test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - // because this script was called from package.json folder - templates: "./tests/spec/partialDefaultTemplate/spec_templates", - }).then((output) => { - if ( - !_.includes( - _.get(output.files, "[0].fileContent"), - "/** PARTIAL TEMPLATES */", - ) - ) { - throw new Exception("Failed, spec templates are not applied"); - } - - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/patch/schema.ts b/tests/spec/patch/__snapshots__/basic.test.ts.snap similarity index 90% rename from tests/spec/patch/schema.ts rename to tests/spec/patch/__snapshots__/basic.test.ts.snap index fd49a427..95c6dc6c 100644 --- a/tests/spec/patch/schema.ts +++ b/tests/spec/patch/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --patch 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -1770,7 +1773,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -1835,7 +1838,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -1857,7 +1860,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -1873,7 +1876,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -1937,7 +1940,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -2027,7 +2030,7 @@ export class Api extends HttpClient({ - path: `/some-test`, + path: \`/some-test\`, method: "GET", format: "json", ...params, @@ -2042,7 +2045,7 @@ export class Api extends HttpClient this.request({ - path: `/path-params`, + path: \`/path-params\`, method: "GET", format: "json", ...params, @@ -2057,7 +2060,7 @@ export class Api extends HttpClient this.request({ - path: `/events`, + path: \`/events\`, method: "GET", format: "json", ...params, @@ -2072,7 +2075,7 @@ export class Api extends HttpClient this.request({ - path: `/feeds`, + path: \`/feeds\`, method: "GET", format: "json", ...params, @@ -2092,7 +2095,7 @@ export class Api extends HttpClient this.request({ - path: `/gists`, + path: \`/gists\`, method: "GET", query: query, format: "json", @@ -2107,7 +2110,7 @@ export class Api extends HttpClient this.request({ - path: `/gists`, + path: \`/gists\`, method: "POST", body: body, type: ContentType.Json, @@ -2128,7 +2131,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/public`, + path: \`/gists/public\`, method: "GET", query: query, format: "json", @@ -2148,7 +2151,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/starred`, + path: \`/gists/starred\`, method: "GET", query: query, format: "json", @@ -2163,7 +2166,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "DELETE", ...params, }), @@ -2176,7 +2179,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "GET", format: "json", ...params, @@ -2190,7 +2193,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2206,7 +2209,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "GET", format: "json", ...params, @@ -2220,7 +2223,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "POST", body: body, format: "json", @@ -2235,7 +2238,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -2250,7 +2253,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -2264,7 +2267,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2280,7 +2283,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/forks`, + path: \`/gists/\${id}/forks\`, method: "POST", ...params, }), @@ -2293,7 +2296,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "DELETE", ...params, }), @@ -2306,7 +2309,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "GET", ...params, }), @@ -2319,7 +2322,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "PUT", ...params, }), @@ -2333,7 +2336,7 @@ export class Api extends HttpClient this.request({ - path: `/gitignore/templates`, + path: \`/gitignore/templates\`, method: "GET", format: "json", ...params, @@ -2347,7 +2350,7 @@ export class Api extends HttpClient this.request({ - path: `/gitignore/templates/${language}`, + path: \`/gitignore/templates/\${language}\`, method: "GET", format: "json", ...params, @@ -2376,7 +2379,7 @@ export class Api extends HttpClient this.request({ - path: `/issues`, + path: \`/issues\`, method: "GET", query: query, format: "json", @@ -2399,7 +2402,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + path: \`/legacy/issues/search/\${owner}/\${repository}/\${state}/\${keyword}\`, method: "GET", format: "json", ...params, @@ -2424,7 +2427,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/repos/search/${keyword}`, + path: \`/legacy/repos/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2440,7 +2443,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/user/email/${email}`, + path: \`/legacy/user/email/\${email}\`, method: "GET", format: "json", ...params, @@ -2464,7 +2467,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/user/search/${keyword}`, + path: \`/legacy/user/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2480,7 +2483,7 @@ export class Api extends HttpClient this.request({ - path: `/markdown`, + path: \`/markdown\`, method: "POST", body: body, type: ContentType.Json, @@ -2495,7 +2498,7 @@ export class Api extends HttpClient this.request({ - path: `/markdown/raw`, + path: \`/markdown/raw\`, method: "POST", type: ContentType.Text, ...params, @@ -2510,7 +2513,7 @@ export class Api extends HttpClient this.request({ - path: `/meta`, + path: \`/meta\`, method: "GET", format: "json", ...params, @@ -2525,7 +2528,7 @@ export class Api extends HttpClient this.request({ - path: `/networks/${owner}/${repo}/events`, + path: \`/networks/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -2547,7 +2550,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "GET", query: query, format: "json", @@ -2562,7 +2565,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "PUT", body: body, ...params, @@ -2576,7 +2579,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "GET", format: "json", ...params, @@ -2590,7 +2593,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "PATCH", ...params, }), @@ -2603,7 +2606,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "DELETE", ...params, }), @@ -2616,7 +2619,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "GET", format: "json", ...params, @@ -2630,7 +2633,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -2647,7 +2650,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "GET", format: "json", ...params, @@ -2661,7 +2664,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2677,7 +2680,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/events`, + path: \`/orgs/\${org}/events\`, method: "GET", format: "json", ...params, @@ -2706,7 +2709,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/issues`, + path: \`/orgs/\${org}/issues\`, method: "GET", query: query, format: "json", @@ -2721,7 +2724,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members`, + path: \`/orgs/\${org}/members\`, method: "GET", format: "json", ...params, @@ -2735,7 +2738,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "DELETE", ...params, }), @@ -2750,7 +2753,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "GET", ...params, }), @@ -2763,7 +2766,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members`, + path: \`/orgs/\${org}/public_members\`, method: "GET", format: "json", ...params, @@ -2777,7 +2780,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "DELETE", ...params, }), @@ -2792,7 +2795,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "GET", ...params, }), @@ -2805,7 +2808,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "PUT", ...params, }), @@ -2825,7 +2828,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "GET", query: query, format: "json", @@ -2840,7 +2843,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "POST", body: body, format: "json", @@ -2855,7 +2858,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "GET", format: "json", ...params, @@ -2869,7 +2872,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "POST", body: body, type: ContentType.Json, @@ -2886,7 +2889,7 @@ export class Api extends HttpClient this.request({ - path: `/rate_limit`, + path: \`/rate_limit\`, method: "GET", format: "json", ...params, @@ -2901,7 +2904,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -2914,7 +2917,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "GET", format: "json", ...params, @@ -2928,7 +2931,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2944,7 +2947,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/assignees`, + path: \`/repos/\${owner}/\${repo}/assignees\`, method: "GET", format: "json", ...params, @@ -2960,7 +2963,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/assignees/${assignee}`, + path: \`/repos/\${owner}/\${repo}/assignees/\${assignee}\`, method: "GET", ...params, }), @@ -2973,7 +2976,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/branches`, + path: \`/repos/\${owner}/\${repo}/branches\`, method: "GET", format: "json", ...params, @@ -2989,7 +2992,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}`, + path: \`/repos/\${owner}/\${repo}/branches/\${branch}\`, method: "GET", format: "json", ...params, @@ -3003,7 +3006,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators`, + path: \`/repos/\${owner}/\${repo}/collaborators\`, method: "GET", format: "json", ...params, @@ -3017,7 +3020,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "DELETE", ...params, }), @@ -3032,7 +3035,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "GET", ...params, }), @@ -3045,7 +3048,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "PUT", ...params, }), @@ -3058,7 +3061,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments`, + path: \`/repos/\${owner}/\${repo}/comments\`, method: "GET", format: "json", ...params, @@ -3072,7 +3075,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3087,7 +3090,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -3107,7 +3110,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -3133,7 +3136,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits`, + path: \`/repos/\${owner}/\${repo}/commits\`, method: "GET", query: query, format: "json", @@ -3148,7 +3151,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/status`, + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/status\`, method: "GET", format: "json", ...params, @@ -3164,7 +3167,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3178,7 +3181,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "GET", format: "json", ...params, @@ -3198,7 +3201,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -3214,7 +3217,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + path: \`/repos/\${owner}/\${repo}/compare/\${baseId}...\${headId}\`, method: "GET", format: "json", ...params, @@ -3228,7 +3231,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "DELETE", body: body, type: ContentType.Json, @@ -3253,7 +3256,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "GET", query: query, format: "json", @@ -3268,7 +3271,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "PUT", body: body, type: ContentType.Json, @@ -3291,7 +3294,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contributors`, + path: \`/repos/\${owner}/\${repo}/contributors\`, method: "GET", query: query, format: "json", @@ -3306,7 +3309,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "GET", format: "json", ...params, @@ -3320,7 +3323,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "POST", body: body, type: ContentType.Json, @@ -3336,7 +3339,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "GET", format: "json", ...params, @@ -3356,7 +3359,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "POST", body: body, type: ContentType.Json, @@ -3372,7 +3375,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads`, + path: \`/repos/\${owner}/\${repo}/downloads\`, method: "GET", format: "json", ...params, @@ -3387,7 +3390,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "DELETE", ...params, }), @@ -3403,7 +3406,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "GET", format: "json", ...params, @@ -3417,7 +3420,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/events`, + path: \`/repos/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -3439,7 +3442,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "GET", query: query, format: "json", @@ -3454,7 +3457,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "POST", body: body, type: ContentType.Json, @@ -3470,7 +3473,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/blobs`, + path: \`/repos/\${owner}/\${repo}/git/blobs\`, method: "POST", body: body, type: ContentType.Json, @@ -3486,7 +3489,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/blobs/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3500,7 +3503,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/commits`, + path: \`/repos/\${owner}/\${repo}/git/commits\`, method: "POST", body: body, type: ContentType.Json, @@ -3516,7 +3519,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3530,7 +3533,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "GET", format: "json", ...params, @@ -3544,7 +3547,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "POST", body: body, type: ContentType.Json, @@ -3560,7 +3563,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "DELETE", ...params, }), @@ -3575,7 +3578,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "GET", format: "json", ...params, @@ -3589,7 +3592,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -3605,7 +3608,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/tags`, + path: \`/repos/\${owner}/\${repo}/git/tags\`, method: "POST", body: body, type: ContentType.Json, @@ -3621,7 +3624,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/tags/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3635,7 +3638,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/trees`, + path: \`/repos/\${owner}/\${repo}/git/trees\`, method: "POST", body: body, type: ContentType.Json, @@ -3659,7 +3662,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/trees/\${shaCode}\`, method: "GET", query: query, format: "json", @@ -3674,7 +3677,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "GET", format: "json", ...params, @@ -3688,7 +3691,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "POST", body: body, format: "json", @@ -3703,7 +3706,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "DELETE", ...params, }), @@ -3718,7 +3721,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "GET", format: "json", ...params, @@ -3732,7 +3735,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "PATCH", body: body, format: "json", @@ -3747,7 +3750,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/tests\`, method: "POST", ...params, }), @@ -3776,7 +3779,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "GET", query: query, format: "json", @@ -3791,7 +3794,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "POST", body: body, format: "json", @@ -3815,7 +3818,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, + path: \`/repos/\${owner}/\${repo}/issues/comments\`, method: "GET", query: query, format: "json", @@ -3830,7 +3833,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3845,7 +3848,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -3865,7 +3868,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -3880,7 +3883,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/events`, + path: \`/repos/\${owner}/\${repo}/issues/events\`, method: "GET", format: "json", ...params, @@ -3896,7 +3899,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + path: \`/repos/\${owner}/\${repo}/issues/events/\${eventId}\`, method: "GET", format: "json", ...params, @@ -3912,7 +3915,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "GET", format: "json", ...params, @@ -3926,7 +3929,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "PATCH", body: body, format: "json", @@ -3943,7 +3946,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -3963,7 +3966,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "POST", body: body, format: "json", @@ -3980,7 +3983,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/events`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/events\`, method: "GET", format: "json", ...params, @@ -3994,7 +3997,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "DELETE", ...params, }), @@ -4007,7 +4010,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4021,7 +4024,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "POST", body: body, format: "json", @@ -4036,7 +4039,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "PUT", body: body, format: "json", @@ -4053,7 +4056,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4066,7 +4069,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "GET", format: "json", ...params, @@ -4080,7 +4083,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "POST", body: body, format: "json", @@ -4095,7 +4098,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -4110,7 +4113,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -4124,7 +4127,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "GET", format: "json", ...params, @@ -4138,7 +4141,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "POST", body: body, format: "json", @@ -4153,7 +4156,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4168,7 +4171,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "GET", format: "json", ...params, @@ -4182,7 +4185,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "PATCH", body: body, format: "json", @@ -4197,7 +4200,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/languages`, + path: \`/repos/\${owner}/\${repo}/languages\`, method: "GET", format: "json", ...params, @@ -4211,7 +4214,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/merges`, + path: \`/repos/\${owner}/\${repo}/merges\`, method: "POST", body: body, type: ContentType.Json, @@ -4238,7 +4241,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "GET", query: query, format: "json", @@ -4253,7 +4256,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "POST", body: body, format: "json", @@ -4268,7 +4271,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "DELETE", ...params, }), @@ -4283,7 +4286,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "GET", format: "json", ...params, @@ -4303,7 +4306,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "PATCH", body: body, format: "json", @@ -4318,7 +4321,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4341,7 +4344,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "GET", query: query, format: "json", @@ -4356,7 +4359,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "PUT", body: body, ...params, @@ -4380,7 +4383,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "GET", query: query, format: "json", @@ -4395,7 +4398,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "POST", body: body, type: ContentType.Json, @@ -4420,7 +4423,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/comments\`, method: "GET", query: query, format: "json", @@ -4435,7 +4438,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -4450,7 +4453,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -4470,7 +4473,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -4487,7 +4490,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "GET", format: "json", ...params, @@ -4501,7 +4504,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -4519,7 +4522,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -4539,7 +4542,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -4555,7 +4558,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/commits\`, method: "GET", format: "json", ...params, @@ -4569,7 +4572,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/files`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/files\`, method: "GET", format: "json", ...params, @@ -4583,7 +4586,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "GET", ...params, }), @@ -4596,7 +4599,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "PUT", body: body, type: ContentType.Json, @@ -4619,7 +4622,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/readme`, + path: \`/repos/\${owner}/\${repo}/readme\`, method: "GET", query: query, format: "json", @@ -4634,7 +4637,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "GET", format: "json", ...params, @@ -4648,7 +4651,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "POST", body: body, format: "json", @@ -4663,7 +4666,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "DELETE", ...params, }), @@ -4676,7 +4679,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "GET", format: "json", ...params, @@ -4696,7 +4699,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -4712,7 +4715,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "DELETE", ...params, }), @@ -4727,7 +4730,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "GET", format: "json", ...params, @@ -4741,7 +4744,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "PATCH", body: body, format: "json", @@ -4758,7 +4761,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}/assets`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}/assets\`, method: "GET", format: "json", ...params, @@ -4772,7 +4775,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stargazers`, + path: \`/repos/\${owner}/\${repo}/stargazers\`, method: "GET", format: "json", ...params, @@ -4786,7 +4789,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/code_frequency`, + path: \`/repos/\${owner}/\${repo}/stats/code_frequency\`, method: "GET", format: "json", ...params, @@ -4800,7 +4803,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/commit_activity`, + path: \`/repos/\${owner}/\${repo}/stats/commit_activity\`, method: "GET", format: "json", ...params, @@ -4814,7 +4817,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/contributors`, + path: \`/repos/\${owner}/\${repo}/stats/contributors\`, method: "GET", format: "json", ...params, @@ -4828,7 +4831,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/participation`, + path: \`/repos/\${owner}/\${repo}/stats/participation\`, method: "GET", format: "json", ...params, @@ -4842,7 +4845,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/punch_card`, + path: \`/repos/\${owner}/\${repo}/stats/punch_card\`, method: "GET", format: "json", ...params, @@ -4856,7 +4859,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "GET", format: "json", ...params, @@ -4870,7 +4873,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "POST", body: body, type: ContentType.Json, @@ -4886,7 +4889,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscribers`, + path: \`/repos/\${owner}/\${repo}/subscribers\`, method: "GET", format: "json", ...params, @@ -4900,7 +4903,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "DELETE", ...params, }), @@ -4913,7 +4916,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "GET", format: "json", ...params, @@ -4927,7 +4930,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -4943,7 +4946,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/tags`, + path: \`/repos/\${owner}/\${repo}/tags\`, method: "GET", format: "json", ...params, @@ -4957,7 +4960,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/teams`, + path: \`/repos/\${owner}/\${repo}/teams\`, method: "GET", format: "json", ...params, @@ -4971,7 +4974,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/watchers`, + path: \`/repos/\${owner}/\${repo}/watchers\`, method: "GET", format: "json", ...params, @@ -4993,7 +4996,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + path: \`/repos/\${owner}/\${repo}/\${archiveFormat}/\${path}\`, method: "GET", ...params, }), @@ -5012,7 +5015,7 @@ export class Api extends HttpClient this.request({ - path: `/repositories`, + path: \`/repositories\`, method: "GET", query: query, format: "json", @@ -5036,7 +5039,7 @@ export class Api extends HttpClient this.request({ - path: `/search/code`, + path: \`/search/code\`, method: "GET", query: query, format: "json", @@ -5059,7 +5062,7 @@ export class Api extends HttpClient this.request({ - path: `/search/issues`, + path: \`/search/issues\`, method: "GET", query: query, format: "json", @@ -5082,7 +5085,7 @@ export class Api extends HttpClient this.request({ - path: `/search/repositories`, + path: \`/search/repositories\`, method: "GET", query: query, format: "json", @@ -5105,7 +5108,7 @@ export class Api extends HttpClient this.request({ - path: `/search/users`, + path: \`/search/users\`, method: "GET", query: query, format: "json", @@ -5121,7 +5124,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "DELETE", ...params, }), @@ -5134,7 +5137,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "GET", format: "json", ...params, @@ -5148,7 +5151,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5164,7 +5167,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members`, + path: \`/teams/\${teamId}/members\`, method: "GET", format: "json", ...params, @@ -5179,7 +5182,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "DELETE", ...params, }), @@ -5195,7 +5198,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "GET", ...params, }), @@ -5209,7 +5212,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "PUT", ...params, }), @@ -5222,7 +5225,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "DELETE", ...params, }), @@ -5235,7 +5238,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "GET", format: "json", ...params, @@ -5249,7 +5252,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "PUT", format: "json", ...params, @@ -5263,7 +5266,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos`, + path: \`/teams/\${teamId}/repos\`, method: "GET", format: "json", ...params, @@ -5277,7 +5280,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5292,7 +5295,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5305,7 +5308,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5319,7 +5322,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "GET", format: "json", ...params, @@ -5333,7 +5336,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5349,7 +5352,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "DELETE", body: body, type: ContentType.Json, @@ -5364,7 +5367,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "GET", ...params, }), @@ -5377,7 +5380,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "POST", body: body, ...params, @@ -5391,7 +5394,7 @@ export class Api extends HttpClient this.request({ - path: `/user/followers`, + path: \`/user/followers\`, method: "GET", format: "json", ...params, @@ -5405,7 +5408,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following`, + path: \`/user/following\`, method: "GET", format: "json", ...params, @@ -5419,7 +5422,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "DELETE", ...params, }), @@ -5432,7 +5435,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "GET", ...params, }), @@ -5445,7 +5448,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "PUT", ...params, }), @@ -5472,7 +5475,7 @@ export class Api extends HttpClient this.request({ - path: `/user/issues`, + path: \`/user/issues\`, method: "GET", query: query, format: "json", @@ -5487,7 +5490,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "GET", format: "json", ...params, @@ -5501,7 +5504,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "POST", body: body, format: "json", @@ -5516,7 +5519,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -5529,7 +5532,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -5543,7 +5546,7 @@ export class Api extends HttpClient this.request({ - path: `/user/orgs`, + path: \`/user/orgs\`, method: "GET", format: "json", ...params, @@ -5563,7 +5566,7 @@ export class Api extends HttpClient this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "GET", query: query, format: "json", @@ -5578,7 +5581,7 @@ export class Api extends HttpClient this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "POST", body: body, format: "json", @@ -5600,7 +5603,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred`, + path: \`/user/starred\`, method: "GET", query: query, format: "json", @@ -5615,7 +5618,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5628,7 +5631,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5641,7 +5644,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5654,7 +5657,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions`, + path: \`/user/subscriptions\`, method: "GET", format: "json", ...params, @@ -5669,7 +5672,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5683,7 +5686,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5697,7 +5700,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5710,7 +5713,7 @@ export class Api extends HttpClient this.request({ - path: `/user/teams`, + path: \`/user/teams\`, method: "GET", format: "json", ...params, @@ -5730,7 +5733,7 @@ export class Api extends HttpClient this.request({ - path: `/users`, + path: \`/users\`, method: "GET", query: query, format: "json", @@ -5745,7 +5748,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}`, + path: \`/users/\${username}\`, method: "GET", format: "json", ...params, @@ -5759,7 +5762,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/events`, + path: \`/users/\${username}/events\`, method: "GET", ...params, }), @@ -5772,7 +5775,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/events/orgs/${org}`, + path: \`/users/\${username}/events/orgs/\${org}\`, method: "GET", ...params, }), @@ -5785,7 +5788,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/followers`, + path: \`/users/\${username}/followers\`, method: "GET", format: "json", ...params, @@ -5799,7 +5802,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/following/${targetUser}`, + path: \`/users/\${username}/following/\${targetUser}\`, method: "GET", ...params, }), @@ -5818,7 +5821,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/gists`, + path: \`/users/\${username}/gists\`, method: "GET", query: query, format: "json", @@ -5833,7 +5836,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/keys`, + path: \`/users/\${username}/keys\`, method: "GET", format: "json", ...params, @@ -5847,7 +5850,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/orgs`, + path: \`/users/\${username}/orgs\`, method: "GET", format: "json", ...params, @@ -5861,7 +5864,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/received_events`, + path: \`/users/\${username}/received_events\`, method: "GET", ...params, }), @@ -5874,7 +5877,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/received_events/public`, + path: \`/users/\${username}/received_events/public\`, method: "GET", ...params, }), @@ -5894,7 +5897,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/repos`, + path: \`/users/\${username}/repos\`, method: "GET", query: query, format: "json", @@ -5909,7 +5912,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/starred`, + path: \`/users/\${username}/starred\`, method: "GET", ...params, }), @@ -5922,9 +5925,11 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/subscriptions`, + path: \`/users/\${username}/subscriptions\`, method: "GET", ...params, }), }; } +" +`; diff --git a/tests/spec/patch/basic.test.ts b/tests/spec/patch/basic.test.ts new file mode 100644 index 00000000..ef7bdf81 --- /dev/null +++ b/tests/spec/patch/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--patch", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + patch: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/patch/expected.ts b/tests/spec/patch/expected.ts deleted file mode 100644 index fd49a427..00000000 --- a/tests/spec/patch/expected.ts +++ /dev/null @@ -1,5930 +0,0 @@ -/* 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 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?: { - 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 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 = "https://api.github.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 - * @termsOfService https://help.github.com/articles/github-terms-of-service/#b-api-terms - * @baseUrl https://api.github.com - * @externalDocs https://developer.github.com/v3/ - */ -export class Api extends HttpClient { - someTest = { - /** - * No description - * - * @name SomeTestList - * @request GET:/some-test - */ - someTestList: (params: RequestParams = {}) => - this.request< - { - user: { - foo: number; - extra: { - id: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - }; - }; - }; - }; - }; - }; - }, - any - >({ - path: `/some-test`, - method: "GET", - format: "json", - ...params, - }), - }; - pathParams = { - /** - * No description - * - * @name PathParamsList - * @request GET:/path-params - */ - pathParamsList: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/path-params`, - 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: { - /** @default "all" */ - filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - 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} - * @deprecated - */ - 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} - * @deprecated - */ - reposSearchDetail: ( - keyword: string, - query?: { - /** @default "desc" */ - 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} - * @deprecated - */ - 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} - * @deprecated - */ - userSearchDetail: ( - keyword: string, - query?: { - /** @default "desc" */ - 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: { - /** @default "all" */ - filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - 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?: { - /** @default "all" */ - 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 - * @deprecated - */ - 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} - * @deprecated - */ - 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} - * @deprecated - * @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?: { - /** @default "newes" */ - 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: { - /** @default "all" */ - filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - 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?: { - /** @default "open" */ - state?: "open" | "closed"; - direction?: string; - /** @default "due_date" */ - 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?: { - /** @default "open" */ - 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: { - /** @default "desc" */ - 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: { - /** @default "desc" */ - 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: { - /** @default "desc" */ - 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: { - /** @default "desc" */ - 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} - * @deprecated - */ - 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} - * @deprecated - * @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} - * @deprecated - */ - 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: { - /** @default "all" */ - filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - 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?: { - /** @default "all" */ - 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; - /** @default "created" */ - 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} - * @deprecated - */ - 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} - * @deprecated - */ - 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} - * @deprecated - */ - 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?: { - /** @default "all" */ - 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/patch/test.js b/tests/spec/patch/test.js deleted file mode 100644 index bf18b20e..00000000 --- a/tests/spec/patch/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--patch option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - patch: true, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/primitive-type-constructs/another-array-type/expected.ts b/tests/spec/primitive-type-constructs/another-array-type/expected.ts deleted file mode 100644 index 89bf6246..00000000 --- a/tests/spec/primitive-type-constructs/another-array-type/expected.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type Type1 = Array; - -export type Type2 = Array; - -/** @format date-time */ -export type Type3 = Date; - -export type Type4 = String; - -export type Type5 = Record; diff --git a/tests/spec/primitive-type-constructs/another-array-type/schema.ts b/tests/spec/primitive-type-constructs/another-array-type/schema.ts deleted file mode 100644 index 89bf6246..00000000 --- a/tests/spec/primitive-type-constructs/another-array-type/schema.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type Type1 = Array; - -export type Type2 = Array; - -/** @format date-time */ -export type Type3 = Date; - -export type Type4 = String; - -export type Type5 = Record; diff --git a/tests/spec/primitive-type-constructs/base/expected.ts b/tests/spec/primitive-type-constructs/base/expected.ts deleted file mode 100644 index cd80bb0e..00000000 --- a/tests/spec/primitive-type-constructs/base/expected.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type Type1 = Date[]; - -export type Type2 = Date[]; - -/** @format date-time */ -export type Type3 = Date; - -export type Type4 = String; - -export type Type5 = Record; diff --git a/tests/spec/primitive-type-constructs/base/schema.ts b/tests/spec/primitive-type-constructs/base/schema.ts deleted file mode 100644 index cd80bb0e..00000000 --- a/tests/spec/primitive-type-constructs/base/schema.ts +++ /dev/null @@ -1,21 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type Type1 = Date[]; - -export type Type2 = Date[]; - -/** @format date-time */ -export type Type3 = Date; - -export type Type4 = String; - -export type Type5 = Record; diff --git a/tests/spec/primitive-type-constructs/schema.json b/tests/spec/primitive-type-constructs/schema.json deleted file mode 100644 index 05afe202..00000000 --- a/tests/spec/primitive-type-constructs/schema.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "swagger": "2.0", - "info": {}, - "parameters": {}, - "responses": {}, - "paths": {}, - "definitions": { - "Type1": { - "type": "array", - "items": [ - { - "type": "string", - "format": "date-time" - } - ] - }, - "Type2": { - "items": [ - { - "type": "string", - "format": "date-time" - } - ] - }, - "Type3": { - "type": "string", - "format": "date-time" - }, - "Type4": { - "type": "string" - }, - "Type5": { - "type": "object" - } - } -} diff --git a/tests/spec/primitive-type-constructs/test.js b/tests/spec/primitive-type-constructs/test.js deleted file mode 100644 index 069a8efc..00000000 --- a/tests/spec/primitive-type-constructs/test.js +++ /dev/null @@ -1,64 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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 }) => { - const primitiveTypeConstructs = (constructs) => ({ - string: { - $default: "String", - "date-time": "Date", - }, - }); - const codeGenConstructs = () => { - return { - Keyword: { - Object: "Record", - }, - }; - }; - - Promise.all([ - generateApiForTest({ - testName: "--primitive-type-constructs option test (with another-type)", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./another-array-type"), - generateClient: false, - anotherArrayType: true, - primitiveTypeConstructs, - codeGenConstructs, - }), - generateApiForTest({ - testName: "--primitive-type-constructs option test (base)", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./base"), - generateClient: false, - anotherArrayType: false, - primitiveTypeConstructs, - codeGenConstructs, - }), - ]).then((...args) => { - validateGeneratedModule( - resolve(__dirname, `./another-array-type/${apiFileName}`), - ); - assertGeneratedModule( - resolve(__dirname, `./another-array-type/${apiFileName}`), - resolve(__dirname, "./another-array-type/expected.ts"), - ); - - validateGeneratedModule(resolve(__dirname, `./base/${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./base/${apiFileName}`), - resolve(__dirname, "./base/expected.ts"), - ); - }); -}); diff --git a/tests/spec/readonly/expected.ts b/tests/spec/readonly/__snapshots__/basic.test.ts.snap similarity index 82% rename from tests/spec/readonly/expected.ts rename to tests/spec/readonly/__snapshots__/basic.test.ts.snap index c0f1b4d5..dd1ee322 100644 --- a/tests/spec/readonly/expected.ts +++ b/tests/spec/readonly/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > readonly 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -16,3 +19,5 @@ export interface Pet { readonly tag?: string; readonly multiple?: string | number; } +" +`; diff --git a/tests/spec/readonly/basic.test.ts b/tests/spec/readonly/basic.test.ts new file mode 100644 index 00000000..c40e53a1 --- /dev/null +++ b/tests/spec/readonly/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("readonly", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + addReadonly: true, + generateClient: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/readonly/schema.ts b/tests/spec/readonly/schema.ts deleted file mode 100644 index c0f1b4d5..00000000 --- a/tests/spec/readonly/schema.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface Pet { - /** @format int64 */ - readonly id: number; - readonly name: string; - readonly tag?: string; - readonly multiple?: string | number; -} diff --git a/tests/spec/readonly/test.js b/tests/spec/readonly/test.js deleted file mode 100644 index 1807c264..00000000 --- a/tests/spec/readonly/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "readonly option 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/responses/schema.ts b/tests/spec/responses/__snapshots__/basic.test.ts.snap similarity index 76% rename from tests/spec/responses/schema.ts rename to tests/spec/responses/__snapshots__/basic.test.ts.snap index d8cb1e97..7a0746de 100644 --- a/tests/spec/responses/schema.ts +++ b/tests/spec/responses/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > responses 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -53,7 +56,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -118,7 +121,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -140,7 +143,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -156,7 +159,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -220,7 +223,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -272,20 +275,20 @@ export class HttpClient { export class Api extends HttpClient { key = { /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. + * @description Revoke an Authentiq ID using email & phone. If called with \`email\` and \`phone\` only, a verification code will be sent by email. Do a second call adding \`code\` to complete the revocation. * * @tags key, delete * @name KeyRevokeNosecret * @request DELETE:/key - * @response `200` `{ - \** pending or done *\ + * @response \`200\` \`{ + \\** pending or done *\\ status?: string, -}` Successfully deleted - * @response `401` `Error` Authentication error `auth-error` - * @response `404` `Error` Unknown key `unknown-key` - * @response `409` `Error` Confirm with code sent `confirm-first` - * @response `default` `Error` +}\` Successfully deleted + * @response \`401\` \`Error\` Authentication error \`auth-error\` + * @response \`404\` \`Error\` Unknown key \`unknown-key\` + * @response \`409\` \`Error\` Confirm with code sent \`confirm-first\` + * @response \`default\` \`Error\` */ keyRevokeNosecret: ( query: { @@ -305,7 +308,7 @@ export class Api extends HttpClient({ - path: `/key`, + path: \`/key\`, method: "DELETE", query: query, format: "json", @@ -313,20 +316,20 @@ export class Api extends HttpClient this.request< @@ -338,7 +341,7 @@ export class Api extends HttpClient({ - path: `/key`, + path: \`/key\`, method: "POST", body: body, format: "json", @@ -351,14 +354,14 @@ export class Api extends HttpClient extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "DELETE", query: query, format: "json", @@ -388,17 +391,17 @@ export class Api extends HttpClient this.request< @@ -411,7 +414,7 @@ export class Api extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "GET", format: "json", ...params, @@ -423,14 +426,14 @@ export class Api extends HttpClient this.request({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "HEAD", ...params, }), @@ -441,13 +444,13 @@ export class Api extends HttpClient this.request< @@ -457,7 +460,7 @@ export class Api extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "POST", body: body, format: "json", @@ -465,19 +468,19 @@ export class Api extends HttpClient this.request< @@ -487,7 +490,7 @@ export class Api extends HttpClient({ - path: `/key/${pk}`, + path: \`/key/\${pk}\`, method: "PUT", body: body, format: "json", @@ -501,13 +504,13 @@ export class Api extends HttpClient extends HttpClient({ - path: `/login`, + path: \`/login\`, method: "POST", query: query, body: body, @@ -539,15 +542,15 @@ export class Api extends HttpClient extends HttpClient({ - path: `/scope`, + path: \`/scope\`, method: "POST", query: query, body: body, @@ -580,13 +583,13 @@ export class Api extends HttpClient this.request< @@ -596,7 +599,7 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "DELETE", format: "json", ...params, @@ -608,16 +611,16 @@ export class Api extends HttpClient this.request< @@ -629,7 +632,7 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "GET", format: "json", ...params, @@ -641,14 +644,14 @@ export class Api extends HttpClient this.request({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "HEAD", ...params, }), @@ -659,15 +662,15 @@ export class Api extends HttpClient this.request< @@ -677,7 +680,7 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "POST", type: ContentType.Json, format: "json", @@ -690,16 +693,16 @@ export class Api extends HttpClient this.request< @@ -711,9 +714,11 @@ export class Api extends HttpClient({ - path: `/scope/${job}`, + path: \`/scope/\${job}\`, method: "PUT", ...params, }), }; } +" +`; diff --git a/tests/spec/responses/basic.test.ts b/tests/spec/responses/basic.test.ts new file mode 100644 index 00000000..94072d3a --- /dev/null +++ b/tests/spec/responses/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("responses", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateResponses: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/responses/expected.ts b/tests/spec/responses/expected.ts deleted file mode 100644 index d8cb1e97..00000000 --- a/tests/spec/responses/expected.ts +++ /dev/null @@ -1,719 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** Authentiq ID in JWT format, self-signed. */ -export interface AuthentiqID { - /** device token for push messages */ - devtoken?: string; - /** UUID and public signing key */ - sub: string; -} - -/** Claim in JWT format, self- or issuer-signed. */ -export interface Claims { - email?: string; - phone?: string; - /** claim scope */ - scope: string; - /** UUID */ - sub: string; - type?: string; -} - -export interface Error { - detail?: string; - error: number; - title?: string; - /** unique uri for this error */ - type?: string; -} - -/** PushToken in JWT format, self-signed. */ -export interface PushToken { - /** audience (URI) */ - aud: string; - exp?: number; - iat?: number; - /** issuer (URI) */ - iss: string; - nbf?: number; - /** UUID and public signing key */ - sub: string; -} - -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://6-dot-authentiqio.appspot.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 Authentiq - * @version 6 - * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://authentiq.com/terms/ - * @baseUrl https://6-dot-authentiqio.appspot.com - * @contact Authentiq team (http://authentiq.io/support) - * - * Strong authentication, without the passwords. - */ -export class Api extends HttpClient { - key = { - /** - * @description Revoke an Authentiq ID using email & phone. If called with `email` and `phone` only, a verification code will be sent by email. Do a second call adding `code` to complete the revocation. - * - * @tags key, delete - * @name KeyRevokeNosecret - * @request DELETE:/key - * @response `200` `{ - \** pending or done *\ - status?: string, - -}` Successfully deleted - * @response `401` `Error` Authentication error `auth-error` - * @response `404` `Error` Unknown key `unknown-key` - * @response `409` `Error` Confirm with code sent `confirm-first` - * @response `default` `Error` - */ - keyRevokeNosecret: ( - query: { - /** primary email associated to Key (ID) */ - email: string; - /** primary phone number, international representation */ - phone: string; - /** verification code sent by email */ - code?: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** pending or done */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "DELETE", - query: query, - format: "json", - ...params, - }), - - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - * @response `201` `{ - \** revoke key *\ - secret?: string, - \** registered *\ - status?: string, - -}` Successfully registered - * @response `409` `Error` Key already registered `duplicate-key` - * @response `default` `Error` - */ - keyRegister: (body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - Error - >({ - path: `/key`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Revoke an Identity (Key) with a revocation secret - * - * @tags key, delete - * @name KeyRevoke - * @request DELETE:/key/{PK} - * @response `200` `{ - \** done *\ - status?: string, - -}` Successful response - * @response `401` `Error` Key not found / wrong code `auth-error` - * @response `404` `Error` Unknown key `unknown-key` - * @response `default` `Error` - */ - keyRevoke: ( - pk: string, - query: { - /** revokation secret */ - secret: string; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "DELETE", - query: query, - format: "json", - ...params, - }), - - /** - * @description Get public details of an Authentiq ID. - * - * @tags key, get - * @name GetKey - * @request GET:/key/{PK} - * @response `200` `{ - \** @format date-time *\ - since?: string, - status?: string, - \** base64safe encoded public signing key *\ - sub?: string, - -}` Successfully retrieved - * @response `404` `Error` Unknown key `unknown-key` - * @response `410` `Error` Key is revoked (gone). `revoked-key` - * @response `default` `Error` - */ - getKey: (pk: string, params: RequestParams = {}) => - this.request< - { - /** @format date-time */ - since?: string; - status?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description HEAD info on Authentiq ID - * - * @tags key, head - * @name HeadKey - * @request HEAD:/key/{PK} - * @response `200` `void` Key exists - * @response `404` `Error` Unknown key `unknown-key` - * @response `410` `Error` Key is revoked `revoked-key` - * @response `default` `Error` - */ - headKey: (pk: string, params: RequestParams = {}) => - this.request({ - path: `/key/${pk}`, - method: "HEAD", - ...params, - }), - - /** - * @description update properties of an Authentiq ID. (not operational in v4; use PUT for now) v5: POST issuer-signed email & phone scopes in a self-signed JWT See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyUpdate - * @request POST:/key/{PK} - * @response `200` `{ - \** confirmed *\ - status?: string, - -}` Successfully updated - * @response `404` `Error` Unknown key `unknown-key` - * @response `default` `Error` - */ - keyUpdate: (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * @description Update Authentiq ID by replacing the object. v4: `JWT(sub,email,phone)` to bind email/phone hash; v5: POST issuer-signed email & phone scopes and PUT to update registration `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, put - * @name KeyBind - * @request PUT:/key/{PK} - * @response `200` `{ - \** confirmed *\ - status?: string, - -}` Successfully updated - * @response `404` `Error` Unknown key `unknown-key` - * @response `409` `Error` Already bound to another key `duplicate-hash` - * @response `default` `Error` - */ - keyBind: (pk: string, body: AuthentiqID, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/key/${pk}`, - method: "PUT", - body: body, - format: "json", - ...params, - }), - }; - login = { - /** - * @description push sign-in request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags login, post - * @name PushLoginRequest - * @request POST:/login - * @response `200` `{ - \** sent *\ - status?: string, - -}` Successful response - * @response `401` `Error` Unauthorized for this callback audience `aud-error` or JWT should be self-signed `auth-error` - * @response `default` `Error` - */ - pushLoginRequest: ( - query: { - /** URI App will connect to */ - callback: string; - }, - body: PushToken, - params: RequestParams = {}, - ) => - this.request< - { - /** sent */ - status?: string; - }, - Error - >({ - path: `/login`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }), - }; - scope = { - /** - * @description scope verification request See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, post - * @name SignRequest - * @request POST:/scope - * @response `201` `{ - \** 20-character ID *\ - job?: string, - \** waiting *\ - status?: string, - -}` Successful response - * @response `429` `Error` Too Many Requests on same address / number `rate-limit` - * @response `default` `Error` - */ - signRequest: ( - body: Claims, - query?: { - /** test only mode, using test issuer */ - test?: number; - }, - params: RequestParams = {}, - ) => - this.request< - { - /** 20-character ID */ - job?: string; - /** waiting */ - status?: string; - }, - Error - >({ - path: `/scope`, - method: "POST", - query: query, - body: body, - format: "json", - ...params, - }), - - /** - * @description delete a verification job - * - * @tags scope, delete - * @name SignDelete - * @request DELETE:/scope/{job} - * @response `200` `{ - \** done *\ - status?: string, - -}` Successfully deleted - * @response `404` `Error` Job not found `unknown-job` - * @response `default` `Error` - */ - signDelete: (job: string, params: RequestParams = {}) => - this.request< - { - /** done */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "DELETE", - format: "json", - ...params, - }), - - /** - * @description get the status / current content of a verification job - * - * @tags scope, get - * @name SignRetrieve - * @request GET:/scope/{job} - * @response `200` `{ - exp?: number, - field?: string, - \** base64safe encoded public signing key *\ - sub?: string, - -}` Successful response (JWT) - * @response `204` `void` Confirmed, waiting for signing - * @response `404` `Error` Job not found `unknown-job` - * @response `default` `Error` - */ - signRetrieve: (job: string, params: RequestParams = {}) => - this.request< - { - exp?: number; - field?: string; - /** base64safe encoded public signing key */ - sub?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * @description HEAD to get the status of a verification job - * - * @tags scope, head - * @name SignRetrieveHead - * @request HEAD:/scope/{job} - * @response `200` `void` Confirmed and signed - * @response `204` `void` Confirmed, waiting for signing - * @response `404` `Error` Job not found `unknown-job` - * @response `default` `Error` - */ - signRetrieveHead: (job: string, params: RequestParams = {}) => - this.request({ - path: `/scope/${job}`, - method: "HEAD", - ...params, - }), - - /** - * @description this is a scope confirmation - * - * @tags scope, post - * @name SignConfirm - * @request POST:/scope/{job} - * @response `202` `{ - \** confirmed *\ - status?: string, - -}` Successfully confirmed - * @response `401` `Error` Confirmation error `auth-error` - * @response `404` `Error` Job not found `unknown-job` - * @response `405` `Error` JWT POSTed to scope `not-supported` - * @response `default` `Error` - */ - signConfirm: (job: string, params: RequestParams = {}) => - this.request< - { - /** confirmed */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "POST", - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * @description authority updates a JWT with its signature See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags scope, put - * @name SignUpdate - * @request PUT:/scope/{job} - * @response `200` `{ - \** result is JWT or JSON?? *\ - jwt?: string, - \** ready *\ - status?: string, - -}` Successfully updated - * @response `404` `Error` Job not found `unknown-job` - * @response `409` `Error` Job not confirmed yet `confirm-first` - * @response `default` `Error` - */ - signUpdate: (job: string, params: RequestParams = {}) => - this.request< - { - /** result is JWT or JSON?? */ - jwt?: string; - /** ready */ - status?: string; - }, - Error - >({ - path: `/scope/${job}`, - method: "PUT", - ...params, - }), - }; -} diff --git a/tests/spec/responses/test.js b/tests/spec/responses/test.js deleted file mode 100644 index 8d4a7416..00000000 --- a/tests/spec/responses/test.js +++ /dev/null @@ -1,30 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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({ - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - generateResponses: true, - }) - .then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }) - .catch((e) => { - console.error("responses option test failed."); - throw e; - }); -}); diff --git a/tests/spec/routeTypes/expected.ts b/tests/spec/routeTypes/__snapshots__/basic.test.ts.snap similarity index 99% rename from tests/spec/routeTypes/expected.ts rename to tests/spec/routeTypes/__snapshots__/basic.test.ts.snap index 0f3e1848..d77a8060 100644 --- a/tests/spec/routeTypes/expected.ts +++ b/tests/spec/routeTypes/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --route-types 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -7159,3 +7162,5 @@ export namespace Users { export type ResponseBody = any; } } +" +`; diff --git a/tests/spec/routeTypes/basic.test.ts b/tests/spec/routeTypes/basic.test.ts new file mode 100644 index 00000000..8db09064 --- /dev/null +++ b/tests/spec/routeTypes/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--route-types", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: false, + generateRouteTypes: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/routeTypes/schema.ts b/tests/spec/routeTypes/schema.ts deleted file mode 100644 index 0f3e1848..00000000 --- a/tests/spec/routeTypes/schema.ts +++ /dev/null @@ -1,7161 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** A user or organization */ -export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - 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; - /** The account username */ - login?: string; - /** The full account name */ - 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"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - 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?: { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601. */ - created_at?: string; - id?: number; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface Commit { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export interface CommitCommentBody { - body: string; - /** Deprecated - Use position parameter instead. */ - line?: string; - /** Line number in the file to comment on. Defaults to null. */ - number?: string; - /** Relative path of the file to comment on. */ - path?: string; - /** Line index in the diff to comment on. */ - position?: number; - /** SHA of the commit to comment on. */ - sha: string; -} - -export type Commits = { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -}[]; - -export interface CompareCommits { - ahead_by?: number; - base_commit?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - behind_by?: number; - commits?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - }; - /** The Total number of commits authored by the contributor. */ - total?: number; - weeks?: { - /** Number of additions. */ - a?: number; - /** Number of commits. */ - c?: number; - /** Number of deletions. */ - d?: number; - /** Start of the week. */ - 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; - /** A GitHub user */ - creator?: User; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -} - -export type DeploymentStatuses = { - created_at?: string; - /** A GitHub user */ - 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 { - /** A user or organization */ - actor?: Actor; - created_at?: object; - id?: number; - /** A GitHub organization */ - 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; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - description?: string; - files?: { - "ring.erl"?: { - filename?: string; - raw_url?: string; - size?: number; - }; - }; - forks?: { - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }[]; - git_pull_url?: string; - git_push_url?: string; - history?: { - change_status?: { - additions?: number; - deletions?: number; - total?: number; - }; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - committed_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - version?: string; - }[]; - html_url?: string; - id?: string; - public?: boolean; - url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - 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; - }; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** A user or organization */ - actor?: Actor; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - event?: string; - issue?: { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }; - url?: string; -} - -export type IssueEvents = IssueEvent[]; - -export type Issues = { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface IssuesComment { - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export type IssuesComments = { - _links?: { - html?: { - href?: string; - }; - pull_request?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - body?: string; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - 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 { - /** Error message */ - message?: string; -} - -export interface MergesSuccessful { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A user or organization */ - 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[]; -} - -/** A GitHub organization */ -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 address. This address is not publicized. */ - billing_email?: string; - company?: string; - /** Publicly visible email address. */ - email?: string; - location?: string; - name?: string; -} - -export interface PostGist { - description?: string; - files?: { - "file1.txt"?: { - content?: string; - }; - }; - public?: boolean; -} - -export interface PostRepo { - /** True to create an initial commit with empty README. Default is false. */ - auto_init?: boolean; - description?: string; - /** Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell" Ignored if auto_init parameter is not provided. */ - gitignore_template?: string; - /** True to enable downloads for this repository, false to disable them. Default is true. */ - has_downloads?: boolean; - /** True to enable issues for this repository, false to disable them. Default is true. */ - has_issues?: boolean; - /** True to enable the wiki for this repository, false to disable it. Default is true. */ - has_wiki?: boolean; - homepage?: string; - name: string; - /** True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. */ - private?: boolean; - /** The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization. */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - merged_at?: string; - number?: number; - patch_url?: string; - state?: "open" | "closed"; - title?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 = { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub organization */ - organization?: Organization; - /** A user or organization */ - owner?: Actor; - /** Is present when the repo is a fork. Parent is the repo this repo was forked from. */ - parent?: Repo; - private?: boolean; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - pushed_at?: string; - size?: number; - /** Is present when the repo is a fork. Source is the ultimate source for the network. */ - source?: Repo; - ssh_url?: string; - svn_url?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - watchers?: number; - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface RepoCommit { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 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; - /** A user or organization */ - 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; - /** A GitHub user */ - 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 { - /** A GitHub user */ - user?: User; -} - -export interface SearchUsers { - items?: Users; - total_count?: number; -} - -export interface SearchUsersByKeyword { - users?: Users; -} - -export interface Subscription { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** String of the tag message. */ - message?: string; - object?: { - sha?: string; - /** String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob. */ - type?: "commit" | "tree" | "blob"; - url?: string; - }; - sha?: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag?: string; - tagger?: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - url?: string; -} - -export interface TagBody { - /** String of the tag message. */ - message: string; - /** String of the SHA of the git object this is tagging. */ - object: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag: string; - tagger: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - /** 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 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?: { - /** One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink. */ - mode?: "100644" | "100755" | "040000" | "160000" | "120000"; - path?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - size?: number; - type?: "blob" | "tree" | "commit"; - url?: string; - }[]; - url?: string; -} - -export interface Trees { - base_tree?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - tree?: Tree[]; - url?: string; -} - -/** A GitHub user */ -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 namespace SomeTest { - /** - * @description This type should test bug https://github.com/acacode/swagger-typescript-api/issues/156 NOTE: all properties should be required - * @name SomeTestList - * @request GET:/some-test - */ - export namespace SomeTestList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = { - user: { - foo: number; - extra: { - id: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - }; - }; - }; - }; - }; - }; - }; - } -} - -export namespace PathParams { - /** - * @description Lists all the emojis available to use on GitHub. - * @name PathParamsList - * @request GET:/path-params - */ - export namespace PathParamsList { - export type RequestParams = { - /** - * ID of pet to return - * @format int64 - */ - petId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - /** Tik Token */ - "X-Auth": string; - }; - export type ResponseBody = Emojis; - } -} - -export namespace Events { - /** - * @description List public events. - * @name EventsList - * @request GET:/events - */ - export namespace EventsList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Events; - } -} - -export namespace Feeds { - /** - * @description List Feeds. GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticating user. - * @name FeedsList - * @request GET:/feeds - */ - export namespace FeedsList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Feeds; - } -} - -export namespace Gists { - /** - * @description List the authenticated user's gists or if called anonymously, this will return all public gists. - * @name GistsList - * @request GET:/gists - */ - export namespace GistsList { - export type RequestParams = {}; - export type RequestQuery = { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gists; - } - /** - * @description Create a gist. - * @name GistsCreate - * @request POST:/gists - */ - export namespace GistsCreate { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = PostGist; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gist; - } - /** - * @description List all public gists. - * @name PublicList - * @request GET:/gists/public - */ - export namespace PublicList { - export type RequestParams = {}; - export type RequestQuery = { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gists; - } - /** - * @description List the authenticated user's starred gists. - * @name StarredList - * @request GET:/gists/starred - */ - export namespace StarredList { - export type RequestParams = {}; - export type RequestQuery = { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gists; - } - /** - * @description Delete a gist. - * @name GistsDelete - * @request DELETE:/gists/{id} - */ - export namespace GistsDelete { - export type RequestParams = { - /** Id of gist. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a single gist. - * @name GistsDetail - * @request GET:/gists/{id} - */ - export namespace GistsDetail { - export type RequestParams = { - /** Id of gist. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gist; - } - /** - * @description Edit a gist. - * @name GistsPartialUpdate - * @request PATCH:/gists/{id} - */ - export namespace GistsPartialUpdate { - export type RequestParams = { - /** Id of gist. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = PatchGist; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gist; - } - /** - * @description List comments on a gist. - * @name CommentsDetail - * @request GET:/gists/{id}/comments - */ - export namespace CommentsDetail { - export type RequestParams = { - /** Id of gist. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Comments; - } - /** - * @description Create a commen - * @name CommentsCreate - * @request POST:/gists/{id}/comments - */ - export namespace CommentsCreate { - export type RequestParams = { - /** Id of gist. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = CommentBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Comment; - } - /** - * @description Delete a comment. - * @name CommentsDelete - * @request DELETE:/gists/{id}/comments/{commentId} - */ - export namespace CommentsDelete { - export type RequestParams = { - /** Id of gist. */ - id: number; - /** Id of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a single comment. - * @name CommentsDetail2 - * @request GET:/gists/{id}/comments/{commentId} - * @originalName commentsDetail - * @duplicate - */ - export namespace CommentsDetail2 { - export type RequestParams = { - /** Id of gist. */ - id: number; - /** Id of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Comment; - } - /** - * @description Edit a comment. - * @name CommentsPartialUpdate - * @request PATCH:/gists/{id}/comments/{commentId} - */ - export namespace CommentsPartialUpdate { - export type RequestParams = { - /** Id of gist. */ - id: number; - /** Id of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = Comment; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Comment; - } - /** - * @description Fork a gist. - * @name ForksCreate - * @request POST:/gists/{id}/forks - */ - export namespace ForksCreate { - export type RequestParams = { - /** Id of gist. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Unstar a gist. - * @name StarDelete - * @request DELETE:/gists/{id}/star - */ - export namespace StarDelete { - export type RequestParams = { - /** Id of gist. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Check if a gist is starred. - * @name StarDetail - * @request GET:/gists/{id}/star - */ - export namespace StarDetail { - export type RequestParams = { - /** Id of gist. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Star a gist. - * @name StarUpdate - * @request PUT:/gists/{id}/star - */ - export namespace StarUpdate { - export type RequestParams = { - /** Id of gist. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } -} - -export namespace Gitignore { - /** - * @description Listing available templates. List all templates available to pass as an option when creating a repository. - * @name TemplatesList - * @request GET:/gitignore/templates - */ - export namespace TemplatesList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gitignore; - } - /** - * @description Get a single template. - * @name TemplatesDetail - * @request GET:/gitignore/templates/{language} - */ - export namespace TemplatesDetail { - export type RequestParams = { - language: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = GitignoreLang; - } -} - -export namespace Issues { - /** - * @description List issues. List all issues across all the authenticated user's visible repositories. - * @name IssuesList - * @request GET:/issues - */ - export namespace IssuesList { - export type RequestParams = {}; - export type RequestQuery = { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Issues; - } -} - -export namespace Legacy { - /** - * @description Find issues by state and keyword. - * @name IssuesSearchDetail - * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} - * @deprecated - */ - export namespace IssuesSearchDetail { - export type RequestParams = { - /** The search term. */ - keyword: string; - /** Indicates the state of the issues to return. Can be either open or closed. */ - state: "open" | "closed"; - owner: string; - repository: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = SearchIssuesByKeyword; - } - /** - * @description Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter. - * @name ReposSearchDetail - * @request GET:/legacy/repos/search/{keyword} - * @deprecated - */ - export namespace ReposSearchDetail { - export type RequestParams = { - /** The search term */ - keyword: string; - }; - export type RequestQuery = { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** Filter results by language */ - language?: string; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = SearchRepositoriesByKeyword; - } - /** - * @description This API call is added for compatibility reasons only. - * @name UserEmailDetail - * @request GET:/legacy/user/email/{email} - * @deprecated - */ - export namespace UserEmailDetail { - export type RequestParams = { - /** The email address */ - email: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = SearchUserByEmail; - } - /** - * @description Find users by keyword. - * @name UserSearchDetail - * @request GET:/legacy/user/search/{keyword} - * @deprecated - */ - export namespace UserSearchDetail { - export type RequestParams = { - /** The search term */ - keyword: string; - }; - export type RequestQuery = { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = SearchUsersByKeyword; - } -} - -export namespace Markdown { - /** - * @description Render an arbitrary Markdown document - * @name MarkdownCreate - * @request POST:/markdown - */ - export namespace MarkdownCreate { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = Markdown; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Render a Markdown document in raw mode - * @name PostMarkdown - * @request POST:/markdown/raw - */ - export namespace PostMarkdown { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } -} - -export namespace Meta { - /** - * @description This gives some information about GitHub.com, the service. - * @name MetaList - * @request GET:/meta - */ - export namespace MetaList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Meta; - } -} - -export namespace Networks { - /** - * @description List public events for a network of repositories. - * @name EventsDetail - * @request GET:/networks/{owner}/{repo}/events - */ - export namespace EventsDetail { - export type RequestParams = { - /** Name of the owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Events; - } -} - -export namespace Notifications { - /** - * @description List your notifications. List all notifications for the current user, grouped by repository. - * @name NotificationsList - * @request GET:/notifications - */ - export namespace NotificationsList { - export type RequestParams = {}; - export type RequestQuery = { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Notifications; - } - /** - * @description Mark as read. Marking a notification as "read" removes it from the default view on GitHub.com. - * @name NotificationsUpdate - * @request PUT:/notifications - */ - export namespace NotificationsUpdate { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = NotificationMarkRead; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description View a single thread. - * @name ThreadsDetail - * @request GET:/notifications/threads/{id} - */ - export namespace ThreadsDetail { - export type RequestParams = { - /** Id of thread. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Notifications; - } - /** - * @description Mark a thread as read - * @name ThreadsPartialUpdate - * @request PATCH:/notifications/threads/{id} - */ - export namespace ThreadsPartialUpdate { - export type RequestParams = { - /** Id of thread. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Delete a Thread Subscription. - * @name ThreadsSubscriptionDelete - * @request DELETE:/notifications/threads/{id}/subscription - */ - export namespace ThreadsSubscriptionDelete { - export type RequestParams = { - /** Id of thread. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a Thread Subscription. - * @name ThreadsSubscriptionDetail - * @request GET:/notifications/threads/{id}/subscription - */ - export namespace ThreadsSubscriptionDetail { - export type RequestParams = { - /** Id of thread. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Subscription; - } - /** - * @description Set a Thread Subscription. This lets you subscribe to a thread, or ignore it. Subscribing to a thread is unnecessary if the user is already subscribed to the repository. Ignoring a thread will mute all future notifications (until you comment or get @mentioned). - * @name ThreadsSubscriptionUpdate - * @request PUT:/notifications/threads/{id}/subscription - */ - export namespace ThreadsSubscriptionUpdate { - export type RequestParams = { - /** Id of thread. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = PutSubscription; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Subscription; - } -} - -export namespace Orgs { - /** - * @description Get an Organization. - * @name OrgsDetail - * @request GET:/orgs/{org} - */ - export namespace OrgsDetail { - export type RequestParams = { - /** Name of organisation. */ - org: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Organization; - } - /** - * @description Edit an Organization. - * @name OrgsPartialUpdate - * @request PATCH:/orgs/{org} - */ - export namespace OrgsPartialUpdate { - export type RequestParams = { - /** Name of organisation. */ - org: string; - }; - export type RequestQuery = {}; - export type RequestBody = PatchOrg; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Organization; - } - /** - * @description List public events for an organization. - * @name EventsDetail - * @request GET:/orgs/{org}/events - */ - export namespace EventsDetail { - export type RequestParams = { - /** Name of organisation. */ - org: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Events; - } - /** - * @description List issues. List all issues for a given organization for the authenticated user. - * @name IssuesDetail - * @request GET:/orgs/{org}/issues - */ - export namespace IssuesDetail { - export type RequestParams = { - /** Name of organisation. */ - org: string; - }; - export type RequestQuery = { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Issues; - } - /** - * @description Members list. List all users who are members of an organization. A member is a user tha belongs to at least 1 team in the organization. If the authenticated user is also an owner of this organization then both concealed and public members will be returned. If the requester is not an owner of the organization the query will be redirected to the public members list. - * @name MembersDetail - * @request GET:/orgs/{org}/members - */ - export namespace MembersDetail { - export type RequestParams = { - /** Name of organisation. */ - org: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description Remove a member. Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. - * @name MembersDelete - * @request DELETE:/orgs/{org}/members/{username} - */ - export namespace MembersDelete { - export type RequestParams = { - /** Name of organisation. */ - org: string; - /** Name of the user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Check if a user is, publicly or privately, a member of the organization. - * @name MembersDetail2 - * @request GET:/orgs/{org}/members/{username} - * @originalName membersDetail - * @duplicate - */ - export namespace MembersDetail2 { - export type RequestParams = { - /** Name of organisation. */ - org: string; - /** Name of the user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Public members list. Members of an organization can choose to have their membership publicized or not. - * @name PublicMembersDetail - * @request GET:/orgs/{org}/public_members - */ - export namespace PublicMembersDetail { - export type RequestParams = { - /** Name of organisation. */ - org: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description Conceal a user's membership. - * @name PublicMembersDelete - * @request DELETE:/orgs/{org}/public_members/{username} - */ - export namespace PublicMembersDelete { - export type RequestParams = { - /** Name of organisation. */ - org: string; - /** Name of the user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Check public membership. - * @name PublicMembersDetail2 - * @request GET:/orgs/{org}/public_members/{username} - * @originalName publicMembersDetail - * @duplicate - */ - export namespace PublicMembersDetail2 { - export type RequestParams = { - /** Name of organisation. */ - org: string; - /** Name of the user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Publicize a user's membership. - * @name PublicMembersUpdate - * @request PUT:/orgs/{org}/public_members/{username} - */ - export namespace PublicMembersUpdate { - export type RequestParams = { - /** Name of organisation. */ - org: string; - /** Name of the user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description List repositories for the specified org. - * @name ReposDetail - * @request GET:/orgs/{org}/repos - */ - export namespace ReposDetail { - export type RequestParams = { - /** Name of organisation. */ - org: string; - }; - export type RequestQuery = { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repos; - } - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * @name ReposCreate - * @request POST:/orgs/{org}/repos - */ - export namespace ReposCreate { - export type RequestParams = { - /** Name of organisation. */ - org: string; - }; - export type RequestQuery = {}; - export type RequestBody = PostRepo; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repos; - } - /** - * @description List teams. - * @name TeamsDetail - * @request GET:/orgs/{org}/teams - */ - export namespace TeamsDetail { - export type RequestParams = { - /** Name of organisation. */ - org: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Teams; - } - /** - * @description Create team. In order to create a team, the authenticated user must be an owner of organization. - * @name TeamsCreate - * @request POST:/orgs/{org}/teams - */ - export namespace TeamsCreate { - export type RequestParams = { - /** Name of organisation. */ - org: string; - }; - export type RequestQuery = {}; - export type RequestBody = OrgTeamsPost; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Team; - } -} - -export namespace RateLimit { - /** - * @description Get your current rate limit status Note: Accessing this endpoint does not count against your rate limit. - * @name RateLimitList - * @request GET:/rate_limit - */ - export namespace RateLimitList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = RateLimit; - } -} - -export namespace Repos { - /** - * @description Delete a Repository. Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required. - * @name ReposDelete - * @request DELETE:/repos/{owner}/{repo} - */ - export namespace ReposDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get repository. - * @name ReposDetail - * @request GET:/repos/{owner}/{repo} - */ - export namespace ReposDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repo; - } - /** - * @description Edit repository. - * @name ReposPartialUpdate - * @request PATCH:/repos/{owner}/{repo} - */ - export namespace ReposPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = RepoEdit; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repo; - } - /** - * @description List assignees. This call lists all the available assignees (owner + collaborators) to which issues may be assigned. - * @name AssigneesDetail - * @request GET:/repos/{owner}/{repo}/assignees - */ - export namespace AssigneesDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Assignees; - } - /** - * @description Check assignee. You may also check to see if a particular user is an assignee for a repository. - * @name AssigneesDetail2 - * @request GET:/repos/{owner}/{repo}/assignees/{assignee} - * @originalName assigneesDetail - * @duplicate - */ - export namespace AssigneesDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Login of the assignee. */ - assignee: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get list of branches - * @name BranchesDetail - * @request GET:/repos/{owner}/{repo}/branches - */ - export namespace BranchesDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Branches; - } - /** - * @description Get Branch - * @name BranchesDetail2 - * @request GET:/repos/{owner}/{repo}/branches/{branch} - * @originalName branchesDetail - * @duplicate - */ - export namespace BranchesDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Name of the branch. */ - branch: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Branch; - } - /** - * @description List. When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list. - * @name CollaboratorsDetail - * @request GET:/repos/{owner}/{repo}/collaborators - */ - export namespace CollaboratorsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description Remove collaborator. - * @name CollaboratorsDelete - * @request DELETE:/repos/{owner}/{repo}/collaborators/{user} - */ - export namespace CollaboratorsDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Login of the user. */ - user: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Check if user is a collaborator - * @name CollaboratorsDetail2 - * @request GET:/repos/{owner}/{repo}/collaborators/{user} - * @originalName collaboratorsDetail - * @duplicate - */ - export namespace CollaboratorsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Login of the user. */ - user: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Add collaborator. - * @name CollaboratorsUpdate - * @request PUT:/repos/{owner}/{repo}/collaborators/{user} - */ - export namespace CollaboratorsUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Login of the user. */ - user: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description List commit comments for a repository. Comments are ordered by ascending ID. - * @name CommentsDetail - * @request GET:/repos/{owner}/{repo}/comments - */ - export namespace CommentsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = RepoComments; - } - /** - * @description Delete a commit comment - * @name CommentsDelete - * @request DELETE:/repos/{owner}/{repo}/comments/{commentId} - */ - export namespace CommentsDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a single commit comment. - * @name CommentsDetail2 - * @request GET:/repos/{owner}/{repo}/comments/{commentId} - * @originalName commentsDetail - * @duplicate - */ - export namespace CommentsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = CommitComment; - } - /** - * @description Update a commit comment. - * @name CommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/comments/{commentId} - */ - export namespace CommentsPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = CommentBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = CommitComment; - } - /** - * @description List commits on a repository. - * @name CommitsDetail - * @request GET:/repos/{owner}/{repo}/commits - */ - export namespace CommitsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - /** Sha or branch to start listing commits from. */ - sha?: string; - /** Only commits containing this file path will be returned. */ - path?: string; - /** GitHub login, name, or email by which to filter by commit author. */ - author?: string; - /** ISO 8601 Date - Only commits before this date will be returned. */ - until?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Commits; - } - /** - * @description Get the combined Status for a specific Ref The Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access this endpoint during the preview period, you must provide a custom media type in the Accept header: application/vnd.github.she-hulk-preview+json - * @name CommitsStatusDetail - * @request GET:/repos/{owner}/{repo}/commits/{ref}/status - */ - export namespace CommitsStatusDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - ref: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = RefStatus; - } - /** - * @description Get a single commit. - * @name CommitsDetail2 - * @request GET:/repos/{owner}/{repo}/commits/{shaCode} - * @originalName commitsDetail - * @duplicate - */ - export namespace CommitsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** SHA-1 code of the commit. */ - shaCode: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Commit; - } - /** - * @description List comments for a single commitList comments for a single commit. - * @name CommitsCommentsDetail - * @request GET:/repos/{owner}/{repo}/commits/{shaCode}/comments - */ - export namespace CommitsCommentsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** SHA-1 code of the commit. */ - shaCode: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = RepoComments; - } - /** - * @description Create a commit comment. - * @name CommitsCommentsCreate - * @request POST:/repos/{owner}/{repo}/commits/{shaCode}/comments - */ - export namespace CommitsCommentsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** SHA-1 code of the commit. */ - shaCode: string; - }; - export type RequestQuery = {}; - export type RequestBody = CommitCommentBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = CommitComment; - } - /** - * @description Compare two commits - * @name CompareDetail - * @request GET:/repos/{owner}/{repo}/compare/{baseId}...{headId} - */ - export namespace CompareDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - baseId: string; - headId: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = CompareCommits; - } - /** - * @description Delete a file. This method deletes a file in a repository. - * @name ContentsDelete - * @request DELETE:/repos/{owner}/{repo}/contents/{path} - */ - export namespace ContentsDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - path: string; - }; - export type RequestQuery = {}; - export type RequestBody = DeleteFileBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = DeleteFile; - } - /** - * @description Get contents. This method returns the contents of a file or directory in a repository. Files and symlinks support a custom media type for getting the raw content. Directories and submodules do not support custom media types. Note: This API supports files up to 1 megabyte in size. Here can be many outcomes. For details see "http://developer.github.com/v3/repos/contents/" - * @name ContentsDetail - * @request GET:/repos/{owner}/{repo}/contents/{path} - */ - export namespace ContentsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - path: string; - }; - export type RequestQuery = { - /** The content path. */ - path?: string; - /** The String name of the Commit/Branch/Tag. Defaults to 'master'. */ - ref?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = ContentsPath; - } - /** - * @description Create a file. - * @name ContentsUpdate - * @request PUT:/repos/{owner}/{repo}/contents/{path} - */ - export namespace ContentsUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - path: string; - }; - export type RequestQuery = {}; - export type RequestBody = CreateFileBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = CreateFile; - } - /** - * @description Get list of contributors. - * @name ContributorsDetail - * @request GET:/repos/{owner}/{repo}/contributors - */ - export namespace ContributorsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = { - /** Set to 1 or true to include anonymous contributors in results. */ - anon: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description Users with pull access can view deployments for a repository - * @name DeploymentsDetail - * @request GET:/repos/{owner}/{repo}/deployments - */ - export namespace DeploymentsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = RepoDeployments; - } - /** - * @description Users with push access can create a deployment for a given ref - * @name DeploymentsCreate - * @request POST:/repos/{owner}/{repo}/deployments - */ - export namespace DeploymentsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = Deployment; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = DeploymentResp; - } - /** - * @description Users with pull access can view deployment statuses for a deployment - * @name DeploymentsStatusesDetail - * @request GET:/repos/{owner}/{repo}/deployments/{id}/statuses - */ - export namespace DeploymentsStatusesDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** The Deployment ID to list the statuses from. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = DeploymentStatuses; - } - /** - * @description Create a Deployment Status Users with push access can create deployment statuses for a given deployment: - * @name DeploymentsStatusesCreate - * @request POST:/repos/{owner}/{repo}/deployments/{id}/statuses - */ - export namespace DeploymentsStatusesCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** The Deployment ID to list the statuses from. */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = DeploymentStatusesCreate; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Deprecated. List downloads for a repository. - * @name DownloadsDetail - * @request GET:/repos/{owner}/{repo}/downloads - * @deprecated - */ - export namespace DownloadsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Downloads; - } - /** - * @description Deprecated. Delete a download. - * @name DownloadsDelete - * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - */ - export namespace DownloadsDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of download. */ - downloadId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Deprecated. Get a single download. - * @name DownloadsDetail2 - * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - * @originalName downloadsDetail - * @duplicate - */ - export namespace DownloadsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of download. */ - downloadId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Download; - } - /** - * @description Get list of repository events. - * @name EventsDetail - * @request GET:/repos/{owner}/{repo}/events - */ - export namespace EventsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Events; - } - /** - * @description List forks. - * @name ForksDetail - * @request GET:/repos/{owner}/{repo}/forks - */ - export namespace ForksDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = { - /** @default "newes" */ - sort?: "newes" | "oldes" | "watchers"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Forks; - } - /** - * @description Create a fork. Forking a Repository happens asynchronously. Therefore, you may have to wai a short period before accessing the git objects. If this takes longer than 5 minutes, be sure to contact Support. - * @name ForksCreate - * @request POST:/repos/{owner}/{repo}/forks - */ - export namespace ForksCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = ForkBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repo; - } - /** - * @description Create a Blob. - * @name GitBlobsCreate - * @request POST:/repos/{owner}/{repo}/git/blobs - */ - export namespace GitBlobsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = Blob; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Blobs; - } - /** - * @description Get a Blob. Since blobs can be any arbitrary binary data, the input and responses for the blob API takes an encoding parameter that can be either utf-8 or base64. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it. - * @name GitBlobsDetail - * @request GET:/repos/{owner}/{repo}/git/blobs/{shaCode} - */ - export namespace GitBlobsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** SHA-1 code. */ - shaCode: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Blob; - } - /** - * @description Create a Commit. - * @name GitCommitsCreate - * @request POST:/repos/{owner}/{repo}/git/commits - */ - export namespace GitCommitsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = RepoCommitBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = GitCommit; - } - /** - * @description Get a Commit. - * @name GitCommitsDetail - * @request GET:/repos/{owner}/{repo}/git/commits/{shaCode} - */ - export namespace GitCommitsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** SHA-1 code. */ - shaCode: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = RepoCommit; - } - /** - * @description Get all References - * @name GitRefsDetail - * @request GET:/repos/{owner}/{repo}/git/refs - */ - export namespace GitRefsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Refs; - } - /** - * @description Create a Reference - * @name GitRefsCreate - * @request POST:/repos/{owner}/{repo}/git/refs - */ - export namespace GitRefsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = RefsBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = HeadBranch; - } - /** - * @description Delete a Reference Example: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a Example: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0 - * @name GitRefsDelete - * @request DELETE:/repos/{owner}/{repo}/git/refs/{ref} - */ - export namespace GitRefsDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - ref: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a Reference - * @name GitRefsDetail2 - * @request GET:/repos/{owner}/{repo}/git/refs/{ref} - * @originalName gitRefsDetail - * @duplicate - */ - export namespace GitRefsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - ref: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = HeadBranch; - } - /** - * @description Update a Reference - * @name GitRefsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/git/refs/{ref} - */ - export namespace GitRefsPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - ref: string; - }; - export type RequestQuery = {}; - export type RequestBody = GitRefPatch; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = HeadBranch; - } - /** - * @description Create a Tag Object. Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary. - * @name GitTagsCreate - * @request POST:/repos/{owner}/{repo}/git/tags - */ - export namespace GitTagsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = TagBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Tag; - } - /** - * @description Get a Tag. - * @name GitTagsDetail - * @request GET:/repos/{owner}/{repo}/git/tags/{shaCode} - */ - export namespace GitTagsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - shaCode: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Tag; - } - /** - * @description Create a Tree. The tree creation API will take nested entries as well. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out. - * @name GitTreesCreate - * @request POST:/repos/{owner}/{repo}/git/trees - */ - export namespace GitTreesCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = Tree; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Trees; - } - /** - * @description Get a Tree. - * @name GitTreesDetail - * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} - */ - export namespace GitTreesDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Tree SHA. */ - shaCode: string; - }; - export type RequestQuery = { - /** Get a Tree Recursively. (0 or 1) */ - recursive?: number; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Tree; - } - /** - * @description Get list of hooks. - * @name HooksDetail - * @request GET:/repos/{owner}/{repo}/hooks - */ - export namespace HooksDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Hook; - } - /** - * @description Create a hook. - * @name HooksCreate - * @request POST:/repos/{owner}/{repo}/hooks - */ - export namespace HooksCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = HookBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Hook; - } - /** - * @description Delete a hook. - * @name HooksDelete - * @request DELETE:/repos/{owner}/{repo}/hooks/{hookId} - */ - export namespace HooksDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of hook. */ - hookId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get single hook. - * @name HooksDetail2 - * @request GET:/repos/{owner}/{repo}/hooks/{hookId} - * @originalName hooksDetail - * @duplicate - */ - export namespace HooksDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of hook. */ - hookId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Hook; - } - /** - * @description Edit a hook. - * @name HooksPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/hooks/{hookId} - */ - export namespace HooksPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of hook. */ - hookId: number; - }; - export type RequestQuery = {}; - export type RequestBody = HookBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Hook; - } - /** - * @description Test a push hook. This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated. Note: Previously /repos/:owner/:repo/hooks/:id/tes - * @name HooksTestsCreate - * @request POST:/repos/{owner}/{repo}/hooks/{hookId}/tests - */ - export namespace HooksTestsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of hook. */ - hookId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description List issues for a repository. - * @name IssuesDetail - * @request GET:/repos/{owner}/{repo}/issues - */ - export namespace IssuesDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Issues; - } - /** - * @description Create an issue. Any user with pull access to a repository can create an issue. - * @name IssuesCreate - * @request POST:/repos/{owner}/{repo}/issues - */ - export namespace IssuesCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = Issue; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Issue; - } - /** - * @description List comments in a repository. - * @name IssuesCommentsDetail - * @request GET:/repos/{owner}/{repo}/issues/comments - */ - export namespace IssuesCommentsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = IssuesComments; - } - /** - * @description Delete a comment. - * @name IssuesCommentsDelete - * @request DELETE:/repos/{owner}/{repo}/issues/comments/{commentId} - */ - export namespace IssuesCommentsDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** ID of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a single comment. - * @name IssuesCommentsDetail2 - * @request GET:/repos/{owner}/{repo}/issues/comments/{commentId} - * @originalName issuesCommentsDetail - * @duplicate - */ - export namespace IssuesCommentsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** ID of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = IssuesComment; - } - /** - * @description Edit a comment. - * @name IssuesCommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/issues/comments/{commentId} - */ - export namespace IssuesCommentsPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** ID of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = CommentBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = IssuesComment; - } - /** - * @description List issue events for a repository. - * @name IssuesEventsDetail - * @request GET:/repos/{owner}/{repo}/issues/events - */ - export namespace IssuesEventsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = IssueEvents; - } - /** - * @description Get a single event. - * @name IssuesEventsDetail2 - * @request GET:/repos/{owner}/{repo}/issues/events/{eventId} - * @originalName issuesEventsDetail - * @duplicate - */ - export namespace IssuesEventsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of the event. */ - eventId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = IssueEvent; - } - /** - * @description Get a single issue - * @name IssuesDetail2 - * @request GET:/repos/{owner}/{repo}/issues/{number} - * @originalName issuesDetail - * @duplicate - */ - export namespace IssuesDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of issue. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Issue; - } - /** - * @description Edit an issue. Issue owners and users with push access can edit an issue. - * @name IssuesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/issues/{number} - */ - export namespace IssuesPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of issue. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = Issue; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Issue; - } - /** - * @description List comments on an issue. - * @name IssuesCommentsDetail3 - * @request GET:/repos/{owner}/{repo}/issues/{number}/comments - * @originalName issuesCommentsDetail - * @duplicate - */ - export namespace IssuesCommentsDetail3 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of issue. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = IssuesComments; - } - /** - * @description Create a comment. - * @name IssuesCommentsCreate - * @request POST:/repos/{owner}/{repo}/issues/{number}/comments - */ - export namespace IssuesCommentsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of issue. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = CommentBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = IssuesComment; - } - /** - * @description List events for an issue. - * @name IssuesEventsDetail3 - * @request GET:/repos/{owner}/{repo}/issues/{number}/events - * @originalName issuesEventsDetail - * @duplicate - */ - export namespace IssuesEventsDetail3 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of issue. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = IssueEvents; - } - /** - * @description Remove all labels from an issue. - * @name IssuesLabelsDelete - * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels - */ - export namespace IssuesLabelsDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of issue. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description List labels on an issue. - * @name IssuesLabelsDetail - * @request GET:/repos/{owner}/{repo}/issues/{number}/labels - */ - export namespace IssuesLabelsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of issue. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Labels; - } - /** - * @description Add labels to an issue. - * @name IssuesLabelsCreate - * @request POST:/repos/{owner}/{repo}/issues/{number}/labels - */ - export namespace IssuesLabelsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of issue. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = EmailsPost; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Label; - } - /** - * @description Replace all labels for an issue. Sending an empty array ([]) will remove all Labels from the Issue. - * @name IssuesLabelsUpdate - * @request PUT:/repos/{owner}/{repo}/issues/{number}/labels - */ - export namespace IssuesLabelsUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of issue. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = EmailsPost; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Label; - } - /** - * @description Remove a label from an issue. - * @name IssuesLabelsDelete2 - * @request DELETE:/repos/{owner}/{repo}/issues/{number}/labels/{name} - * @originalName issuesLabelsDelete - * @duplicate - */ - export namespace IssuesLabelsDelete2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of issue. */ - number: number; - /** Name of the label. */ - name: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get list of keys. - * @name KeysDetail - * @request GET:/repos/{owner}/{repo}/keys - */ - export namespace KeysDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Keys; - } - /** - * @description Create a key. - * @name KeysCreate - * @request POST:/repos/{owner}/{repo}/keys - */ - export namespace KeysCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = UserKeysPost; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = UserKeysKeyId; - } - /** - * @description Delete a key. - * @name KeysDelete - * @request DELETE:/repos/{owner}/{repo}/keys/{keyId} - */ - export namespace KeysDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of key. */ - keyId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a key - * @name KeysDetail2 - * @request GET:/repos/{owner}/{repo}/keys/{keyId} - * @originalName keysDetail - * @duplicate - */ - export namespace KeysDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of key. */ - keyId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = UserKeysKeyId; - } - /** - * @description List all labels for this repository. - * @name LabelsDetail - * @request GET:/repos/{owner}/{repo}/labels - */ - export namespace LabelsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Labels; - } - /** - * @description Create a label. - * @name LabelsCreate - * @request POST:/repos/{owner}/{repo}/labels - */ - export namespace LabelsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = EmailsPost; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Label; - } - /** - * @description Delete a label. - * @name LabelsDelete - * @request DELETE:/repos/{owner}/{repo}/labels/{name} - */ - export namespace LabelsDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Name of the label. */ - name: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a single label. - * @name LabelsDetail2 - * @request GET:/repos/{owner}/{repo}/labels/{name} - * @originalName labelsDetail - * @duplicate - */ - export namespace LabelsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Name of the label. */ - name: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Label; - } - /** - * @description Update a label. - * @name LabelsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/labels/{name} - */ - export namespace LabelsPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Name of the label. */ - name: string; - }; - export type RequestQuery = {}; - export type RequestBody = EmailsPost; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Label; - } - /** - * @description List languages. List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language. - * @name LanguagesDetail - * @request GET:/repos/{owner}/{repo}/languages - */ - export namespace LanguagesDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Languages; - } - /** - * @description Perform a merge. - * @name MergesCreate - * @request POST:/repos/{owner}/{repo}/merges - */ - export namespace MergesCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = MergesBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = MergesSuccessful; - } - /** - * @description List milestones for a repository. - * @name MilestonesDetail - * @request GET:/repos/{owner}/{repo}/milestones - */ - export namespace MilestonesDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "due_date" */ - sort?: "due_date" | "completeness"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Milestone; - } - /** - * @description Create a milestone. - * @name MilestonesCreate - * @request POST:/repos/{owner}/{repo}/milestones - */ - export namespace MilestonesCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = MilestoneUpdate; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Milestone; - } - /** - * @description Delete a milestone. - * @name MilestonesDelete - * @request DELETE:/repos/{owner}/{repo}/milestones/{number} - */ - export namespace MilestonesDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of milestone. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a single milestone. - * @name MilestonesDetail2 - * @request GET:/repos/{owner}/{repo}/milestones/{number} - * @originalName milestonesDetail - * @duplicate - */ - export namespace MilestonesDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of milestone. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Milestone; - } - /** - * @description Update a milestone. - * @name MilestonesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/milestones/{number} - */ - export namespace MilestonesPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of milestone. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = MilestoneUpdate; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Milestone; - } - /** - * @description Get labels for every issue in a milestone. - * @name MilestonesLabelsDetail - * @request GET:/repos/{owner}/{repo}/milestones/{number}/labels - */ - export namespace MilestonesLabelsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Number of milestone. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Labels; - } - /** - * @description List your notifications in a repository List all notifications for the current user. - * @name NotificationsDetail - * @request GET:/repos/{owner}/{repo}/notifications - */ - export namespace NotificationsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Notifications; - } - /** - * @description Mark notifications as read in a repository. Marking all notifications in a repository as "read" removes them from the default view on GitHub.com. - * @name NotificationsUpdate - * @request PUT:/repos/{owner}/{repo}/notifications - */ - export namespace NotificationsUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = NotificationMarkRead; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description List pull requests. - * @name PullsDetail - * @request GET:/repos/{owner}/{repo}/pulls - */ - export namespace PullsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** - * Filter pulls by head user and branch name in the format of 'user:ref-name'. - * Example: github:new-script-format. - */ - head?: string; - /** Filter pulls by base branch name. Example - gh-pages. */ - base?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Pulls; - } - /** - * @description Create a pull request. - * @name PullsCreate - * @request POST:/repos/{owner}/{repo}/pulls - */ - export namespace PullsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = PullsPost; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Pulls; - } - /** - * @description List comments in a repository. By default, Review Comments are ordered by ascending ID. - * @name PullsCommentsDetail - * @request GET:/repos/{owner}/{repo}/pulls/comments - */ - export namespace PullsCommentsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = IssuesComments; - } - /** - * @description Delete a comment. - * @name PullsCommentsDelete - * @request DELETE:/repos/{owner}/{repo}/pulls/comments/{commentId} - */ - export namespace PullsCommentsDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a single comment. - * @name PullsCommentsDetail2 - * @request GET:/repos/{owner}/{repo}/pulls/comments/{commentId} - * @originalName pullsCommentsDetail - * @duplicate - */ - export namespace PullsCommentsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = PullsComment; - } - /** - * @description Edit a comment. - * @name PullsCommentsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/pulls/comments/{commentId} - */ - export namespace PullsCommentsPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of comment. */ - commentId: number; - }; - export type RequestQuery = {}; - export type RequestBody = CommentBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = PullsComment; - } - /** - * @description Get a single pull request. - * @name PullsDetail2 - * @request GET:/repos/{owner}/{repo}/pulls/{number} - * @originalName pullsDetail - * @duplicate - */ - export namespace PullsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of pull. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = PullRequest; - } - /** - * @description Update a pull request. - * @name PullsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/pulls/{number} - */ - export namespace PullsPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of pull. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = PullUpdate; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repo; - } - /** - * @description List comments on a pull request. - * @name PullsCommentsDetail3 - * @request GET:/repos/{owner}/{repo}/pulls/{number}/comments - * @originalName pullsCommentsDetail - * @duplicate - */ - export namespace PullsCommentsDetail3 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of pull. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = PullsComment; - } - /** - * @description Create a comment. #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ ) description: | Alternative Input. Instead of passing commit_id, path, and position you can reply to an existing Pull Request Comment like this: body Required string in_reply_to Required number - Comment id to reply to. - * @name PullsCommentsCreate - * @request POST:/repos/{owner}/{repo}/pulls/{number}/comments - */ - export namespace PullsCommentsCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of pull. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = PullsCommentPost; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = PullsComment; - } - /** - * @description List commits on a pull request. - * @name PullsCommitsDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/commits - */ - export namespace PullsCommitsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of pull. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Commits; - } - /** - * @description List pull requests files. - * @name PullsFilesDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/files - */ - export namespace PullsFilesDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of pull. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Pulls; - } - /** - * @description Get if a pull request has been merged. - * @name PullsMergeDetail - * @request GET:/repos/{owner}/{repo}/pulls/{number}/merge - */ - export namespace PullsMergeDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of pull. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Merge a pull request (Merge Button's) - * @name PullsMergeUpdate - * @request PUT:/repos/{owner}/{repo}/pulls/{number}/merge - */ - export namespace PullsMergeUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Id of pull. */ - number: number; - }; - export type RequestQuery = {}; - export type RequestBody = MergePullBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Merge; - } - /** - * @description Get the README. This method returns the preferred README for a repository. - * @name ReadmeDetail - * @request GET:/repos/{owner}/{repo}/readme - */ - export namespace ReadmeDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = { - /** The String name of the Commit/Branch/Tag. Defaults to master. */ - ref?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = ContentsPath; - } - /** - * @description Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only - * @name ReleasesDetail - * @request GET:/repos/{owner}/{repo}/releases - */ - export namespace ReleasesDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Releases; - } - /** - * @description Create a release Users with push access to the repository can create a release. - * @name ReleasesCreate - * @request POST:/repos/{owner}/{repo}/releases - */ - export namespace ReleasesCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = ReleaseCreate; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Release; - } - /** - * @description Delete a release asset - * @name ReleasesAssetsDelete - * @request DELETE:/repos/{owner}/{repo}/releases/assets/{id} - */ - export namespace ReleasesAssetsDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - id: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a single release asset - * @name ReleasesAssetsDetail - * @request GET:/repos/{owner}/{repo}/releases/assets/{id} - */ - export namespace ReleasesAssetsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - id: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Asset; - } - /** - * @description Edit a release asset Users with push access to the repository can edit a release asset. - * @name ReleasesAssetsPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/releases/assets/{id} - */ - export namespace ReleasesAssetsPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - id: string; - }; - export type RequestQuery = {}; - export type RequestBody = AssetPatch; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Asset; - } - /** - * @description Users with push access to the repository can delete a release. - * @name ReleasesDelete - * @request DELETE:/repos/{owner}/{repo}/releases/{id} - */ - export namespace ReleasesDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - id: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a single release - * @name ReleasesDetail2 - * @request GET:/repos/{owner}/{repo}/releases/{id} - * @originalName releasesDetail - * @duplicate - */ - export namespace ReleasesDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - id: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Release; - } - /** - * @description Users with push access to the repository can edit a release - * @name ReleasesPartialUpdate - * @request PATCH:/repos/{owner}/{repo}/releases/{id} - */ - export namespace ReleasesPartialUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - id: string; - }; - export type RequestQuery = {}; - export type RequestBody = ReleaseCreate; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Release; - } - /** - * @description List assets for a release - * @name ReleasesAssetsDetail2 - * @request GET:/repos/{owner}/{repo}/releases/{id}/assets - * @originalName releasesAssetsDetail - * @duplicate - */ - export namespace ReleasesAssetsDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - id: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Assets; - } - /** - * @description List Stargazers. - * @name StargazersDetail - * @request GET:/repos/{owner}/{repo}/stargazers - */ - export namespace StargazersDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description Get the number of additions and deletions per week. Returns a weekly aggregate of the number of additions and deletions pushed to a repository. - * @name StatsCodeFrequencyDetail - * @request GET:/repos/{owner}/{repo}/stats/code_frequency - */ - export namespace StatsCodeFrequencyDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = CodeFrequencyStats; - } - /** - * @description Get the last year of commit activity data. Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday. - * @name StatsCommitActivityDetail - * @request GET:/repos/{owner}/{repo}/stats/commit_activity - */ - export namespace StatsCommitActivityDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = CommitActivityStats; - } - /** - * @description Get contributors list with additions, deletions, and commit counts. - * @name StatsContributorsDetail - * @request GET:/repos/{owner}/{repo}/stats/contributors - */ - export namespace StatsContributorsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = ContributorsStats; - } - /** - * @description Get the weekly commit count for the repo owner and everyone else. - * @name StatsParticipationDetail - * @request GET:/repos/{owner}/{repo}/stats/participation - */ - export namespace StatsParticipationDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = ParticipationStats; - } - /** - * @description Get the number of commits per hour in each day. Each array contains the day number, hour number, and number of commits 0-6 Sunday - Saturday 0-23 Hour of day Number of commits For example, [2, 14, 25] indicates that there were 25 total commits, during the 2.00pm hour on Tuesdays. All times are based on the time zone of individual commits. - * @name StatsPunchCardDetail - * @request GET:/repos/{owner}/{repo}/stats/punch_card - */ - export namespace StatsPunchCardDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = CodeFrequencyStats; - } - /** - * @description List Statuses for a specific Ref. - * @name StatusesDetail - * @request GET:/repos/{owner}/{repo}/statuses/{ref} - */ - export namespace StatusesDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Ref to list the statuses from. It can be a SHA, a branch name, or a tag name. */ - ref: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Ref; - } - /** - * @description Create a Status. - * @name StatusesCreate - * @request POST:/repos/{owner}/{repo}/statuses/{ref} - */ - export namespace StatusesCreate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - /** Ref to list the statuses from. It can be a SHA, a branch name, or a tag name. */ - ref: string; - }; - export type RequestQuery = {}; - export type RequestBody = HeadBranch; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Ref; - } - /** - * @description List watchers. - * @name SubscribersDetail - * @request GET:/repos/{owner}/{repo}/subscribers - */ - export namespace SubscribersDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description Delete a Repository Subscription. - * @name SubscriptionDelete - * @request DELETE:/repos/{owner}/{repo}/subscription - */ - export namespace SubscriptionDelete { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a Repository Subscription. - * @name SubscriptionDetail - * @request GET:/repos/{owner}/{repo}/subscription - */ - export namespace SubscriptionDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Subscription; - } - /** - * @description Set a Repository Subscription - * @name SubscriptionUpdate - * @request PUT:/repos/{owner}/{repo}/subscription - */ - export namespace SubscriptionUpdate { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = SubscriptionBody; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Subscription; - } - /** - * @description Get list of tags. - * @name TagsDetail - * @request GET:/repos/{owner}/{repo}/tags - */ - export namespace TagsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Tags; - } - /** - * @description Get list of teams - * @name TeamsDetail - * @request GET:/repos/{owner}/{repo}/teams - */ - export namespace TeamsDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Teams; - } - /** - * @description List Stargazers. New implementation. - * @name WatchersDetail - * @request GET:/repos/{owner}/{repo}/watchers - */ - export namespace WatchersDetail { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description Get archive link. This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. Note: For private repositories, these links are temporary and expire quickly. - * @name ReposDetail2 - * @request GET:/repos/{owner}/{repo}/{archive_format}/{path} - * @originalName reposDetail - * @duplicate - */ - export namespace ReposDetail2 { - export type RequestParams = { - /** Name of repository owner. */ - owner: string; - /** Name of repository. */ - repo: string; - archiveFormat: "tarball" | "zipball"; - /** Valid Git reference, defaults to 'master'. */ - path: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = any; - } -} - -export namespace Repositories { - /** - * @description List all public repositories. This provides a dump of every public repository, in the order that they were created. Note: Pagination is powered exclusively by the since parameter. is the Link header to get the URL for the next page of repositories. - * @name RepositoriesList - * @request GET:/repositories - */ - export namespace RepositoriesList { - export type RequestParams = {}; - export type RequestQuery = { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repos; - } -} - -export namespace Search { - /** - * @description Search code. - * @name CodeList - * @request GET:/search/code - */ - export namespace CodeList { - export type RequestParams = {}; - export type RequestQuery = { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported code - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier - * you can restrict the search to just the file contents, the file path, - * or both. - * 'Languages' Searches code based on the language it's written in. - * 'Forks' Filters repositories based on the number of forks, and/or - * whether code from forked repositories should be included in the results - * at all. - * 'Size' Finds files that match a certain size (in bytes). - * 'Path' Specifies the path that the resulting file must be at. - * 'Extension' Matches files with a certain extension. - * 'Users' or 'Repositories' Limits searches to a specific user or repository. - */ - q: string; - /** - * Can only be 'indexed', which indicates how recently a file has been indexed - * by the GitHub search infrastructure. If not provided, results are sorted - * by best match. - */ - sort?: "indexed"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = SearchCode; - } - /** - * @description Find issues by state and keyword. (This method returns up to 100 results per page.) - * @name IssuesList - * @request GET:/search/issues - */ - export namespace IssuesList { - export type RequestParams = {}; - export type RequestQuery = { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The q search term can also contain any combination of the supported issue search qualifiers: */ - q: string; - /** The sort field. Can be comments, created, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "created" | "comments"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = SearchIssues; - } - /** - * @description Search repositories. - * @name RepositoriesList - * @request GET:/search/repositories - */ - export namespace RepositoriesList { - export type RequestParams = {}; - export type RequestQuery = { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported repository - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the repository name, description, readme, - * or any combination of these. - * 'Size' Finds repositories that match a certain size (in kilobytes). - * 'Forks' Filters repositories based on the number of forks, and/or whether - * forked repositories should be included in the results at all. - * 'Created' and 'Last Updated' Filters repositories based on times of - * creation, or when they were last updated. - * 'Users or Repositories' Limits searches to a specific user or repository. - * 'Languages' Searches repositories based on the language they are written in. - * 'Stars' Searches repositories based on the number of stars. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "stars" | "forks" | "updated"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = SearchRepositories; - } - /** - * @description Search users. - * @name UsersList - * @request GET:/search/users - */ - export namespace UsersList { - export type RequestParams = {}; - export type RequestQuery = { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported user - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the username, public email, full name, - * location, or any combination of these. - * 'Repository count' Filters users based on the number of repositories they - * have. - * 'Location' Filter users by the location indicated in their profile. - * 'Language' Search for users that have repositories that match a certain - * language. - * 'Created' Filter users based on when they joined. - * 'Followers' Filter users based on the number of followers they have. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "followers" | "repositories" | "joined"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = SearchUsers; - } -} - -export namespace Teams { - /** - * @description Delete team. In order to delete a team, the authenticated user must be an owner of the org that the team is associated with. - * @name TeamsDelete - * @request DELETE:/teams/{teamId} - */ - export namespace TeamsDelete { - export type RequestParams = { - /** Id of team. */ - teamId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get team. - * @name TeamsDetail - * @request GET:/teams/{teamId} - */ - export namespace TeamsDetail { - export type RequestParams = { - /** Id of team. */ - teamId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Team; - } - /** - * @description Edit team. In order to edit a team, the authenticated user must be an owner of the org that the team is associated with. - * @name TeamsPartialUpdate - * @request PATCH:/teams/{teamId} - */ - export namespace TeamsPartialUpdate { - export type RequestParams = { - /** Id of team. */ - teamId: number; - }; - export type RequestQuery = {}; - export type RequestBody = EditTeam; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Team; - } - /** - * @description List team members. In order to list members in a team, the authenticated user must be a member of the team. - * @name MembersDetail - * @request GET:/teams/{teamId}/members - */ - export namespace MembersDetail { - export type RequestParams = { - /** Id of team. */ - teamId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description The "Remove team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships. Remove team member. In order to remove a user from a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. NOTE This does not delete the user, it just remove them from the team. - * @name MembersDelete - * @request DELETE:/teams/{teamId}/members/{username} - * @deprecated - */ - export namespace MembersDelete { - export type RequestParams = { - /** Id of team. */ - teamId: number; - /** Name of a member. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description The "Get team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships. Get team member. In order to get if a user is a member of a team, the authenticated user mus be a member of the team. - * @name MembersDetail2 - * @request GET:/teams/{teamId}/members/{username} - * @deprecated - * @originalName membersDetail - * @duplicate - */ - export namespace MembersDetail2 { - export type RequestParams = { - /** Id of team. */ - teamId: number; - /** Name of a member. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams. Add team member. In order to add a user to a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. - * @name MembersUpdate - * @request PUT:/teams/{teamId}/members/{username} - * @deprecated - */ - export namespace MembersUpdate { - export type RequestParams = { - /** Id of team. */ - teamId: number; - /** Name of a member. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Remove team membership. In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team. - * @name MembershipsDelete - * @request DELETE:/teams/{teamId}/memberships/{username} - */ - export namespace MembershipsDelete { - export type RequestParams = { - /** Id of team. */ - teamId: number; - /** Name of a member. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get team membership. In order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization. - * @name MembershipsDetail - * @request GET:/teams/{teamId}/memberships/{username} - */ - export namespace MembershipsDetail { - export type RequestParams = { - /** Id of team. */ - teamId: number; - /** Name of a member. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = TeamMembership; - } - /** - * @description Add team membership. In order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. If the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team. If the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the 'pending' state until the user accepts the invitation, at which point the membership will transition to the 'active' state and the user will be added as a member of the team. - * @name MembershipsUpdate - * @request PUT:/teams/{teamId}/memberships/{username} - */ - export namespace MembershipsUpdate { - export type RequestParams = { - /** Id of team. */ - teamId: number; - /** Name of a member. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = TeamMembership; - } - /** - * @description List team repos - * @name ReposDetail - * @request GET:/teams/{teamId}/repos - */ - export namespace ReposDetail { - export type RequestParams = { - /** Id of team. */ - teamId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = TeamRepos; - } - /** - * @description In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team. - * @name ReposDelete - * @request DELETE:/teams/{teamId}/repos/{owner}/{repo} - */ - export namespace ReposDelete { - export type RequestParams = { - /** Id of team. */ - teamId: number; - /** Name of a repository owner. */ - owner: string; - /** Name of a repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Check if a team manages a repository - * @name ReposDetail2 - * @request GET:/teams/{teamId}/repos/{owner}/{repo} - * @originalName reposDetail - * @duplicate - */ - export namespace ReposDetail2 { - export type RequestParams = { - /** Id of team. */ - teamId: number; - /** Name of a repository owner. */ - owner: string; - /** Name of a repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = any; - } - /** - * @description In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization. - * @name ReposUpdate - * @request PUT:/teams/{teamId}/repos/{owner}/{repo} - */ - export namespace ReposUpdate { - export type RequestParams = { - /** Id of team. */ - teamId: number; - /** Name of a organization. */ - owner: string; - /** Name of a repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = any; - } -} - -export namespace User { - /** - * @description Get the authenticated user. - * @name UserList - * @request GET:/user - */ - export namespace UserList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = User; - } - /** - * @description Update the authenticated user. - * @name UserPartialUpdate - * @request PATCH:/user - */ - export namespace UserPartialUpdate { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = UserUpdate; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = User; - } - /** - * @description Delete email address(es). You can include a single email address or an array of addresses. - * @name EmailsDelete - * @request DELETE:/user/emails - */ - export namespace EmailsDelete { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = UserEmails; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description List email addresses for a user. In the final version of the API, this method will return an array of hashes with extended information for each email address indicating if the address has been verified and if it's primary email address for GitHub. Until API v3 is finalized, use the application/vnd.github.v3 media type to get other response format. - * @name EmailsList - * @request GET:/user/emails - */ - export namespace EmailsList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = UserEmails; - } - /** - * @description Add email address(es). You can post a single email address or an array of addresses. - * @name EmailsCreate - * @request POST:/user/emails - */ - export namespace EmailsCreate { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = EmailsPost; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = any; - } - /** - * @description List the authenticated user's followers - * @name FollowersList - * @request GET:/user/followers - */ - export namespace FollowersList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description List who the authenticated user is following. - * @name FollowingList - * @request GET:/user/following - */ - export namespace FollowingList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description Unfollow a user. Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * @name FollowingDelete - * @request DELETE:/user/following/{username} - */ - export namespace FollowingDelete { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Check if you are following a user. - * @name FollowingDetail - * @request GET:/user/following/{username} - */ - export namespace FollowingDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Follow a user. Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * @name FollowingUpdate - * @request PUT:/user/following/{username} - */ - export namespace FollowingUpdate { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description List issues. List all issues across owned and member repositories for the authenticated user. - * @name IssuesList - * @request GET:/user/issues - */ - export namespace IssuesList { - export type RequestParams = {}; - export type RequestQuery = { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Issues; - } - /** - * @description List your public keys. Lists the current user's keys. Management of public keys via the API requires that you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes. - * @name KeysList - * @request GET:/user/keys - */ - export namespace KeysList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gitignore; - } - /** - * @description Create a public key. - * @name KeysCreate - * @request POST:/user/keys - */ - export namespace KeysCreate { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = UserKeysPost; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = UserKeysKeyId; - } - /** - * @description Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope. - * @name KeysDelete - * @request DELETE:/user/keys/{keyId} - */ - export namespace KeysDelete { - export type RequestParams = { - /** ID of key. */ - keyId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Get a single public key. - * @name KeysDetail - * @request GET:/user/keys/{keyId} - */ - export namespace KeysDetail { - export type RequestParams = { - /** ID of key. */ - keyId: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = UserKeysKeyId; - } - /** - * @description List public and private organizations for the authenticated user. - * @name OrgsList - * @request GET:/user/orgs - */ - export namespace OrgsList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gitignore; - } - /** - * @description List repositories for the authenticated user. Note that this does not include repositories owned by organizations which the user can access. You can lis user organizations and list organization repositories separately. - * @name ReposList - * @request GET:/user/repos - */ - export namespace ReposList { - export type RequestParams = {}; - export type RequestQuery = { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repos; - } - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * @name ReposCreate - * @request POST:/user/repos - */ - export namespace ReposCreate { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = PostRepo; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repos; - } - /** - * @description List repositories being starred by the authenticated user. - * @name StarredList - * @request GET:/user/starred - */ - export namespace StarredList { - export type RequestParams = {}; - export type RequestQuery = { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "created" */ - sort?: "created" | "updated"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gitignore; - } - /** - * @description Unstar a repository - * @name StarredDelete - * @request DELETE:/user/starred/{owner}/{repo} - */ - export namespace StarredDelete { - export type RequestParams = { - /** Name of a repository owner. */ - owner: string; - /** Name of a repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Check if you are starring a repository. - * @name StarredDetail - * @request GET:/user/starred/{owner}/{repo} - */ - export namespace StarredDetail { - export type RequestParams = { - /** Name of a repository owner. */ - owner: string; - /** Name of a repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Star a repository. - * @name StarredUpdate - * @request PUT:/user/starred/{owner}/{repo} - */ - export namespace StarredUpdate { - export type RequestParams = { - /** Name of a repository owner. */ - owner: string; - /** Name of a repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description List repositories being watched by the authenticated user. - * @name SubscriptionsList - * @request GET:/user/subscriptions - */ - export namespace SubscriptionsList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repos; - } - /** - * @description Stop watching a repository - * @name SubscriptionsDelete - * @request DELETE:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - export namespace SubscriptionsDelete { - export type RequestParams = { - /** Name of the owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Check if you are watching a repository. - * @name SubscriptionsDetail - * @request GET:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - export namespace SubscriptionsDetail { - export type RequestParams = { - /** Name of the owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description Watch a repository. - * @name SubscriptionsUpdate - * @request PUT:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - export namespace SubscriptionsUpdate { - export type RequestParams = { - /** Name of the owner. */ - owner: string; - /** Name of repository. */ - repo: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth. - * @name TeamsList - * @request GET:/user/teams - */ - export namespace TeamsList { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = TeamsList; - } -} - -export namespace Users { - /** - * @description Get all users. This provides a dump of every user, in the order that they signed up for GitHub. Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users. - * @name UsersList - * @request GET:/users - */ - export namespace UsersList { - export type RequestParams = {}; - export type RequestQuery = { - /** The integer ID of the last user that you've seen. */ - since?: number; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description Get a single user. - * @name UsersDetail - * @request GET:/users/{username} - */ - export namespace UsersDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = User; - } - /** - * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. - * @name EventsDetail - * @request GET:/users/{username}/events - */ - export namespace EventsDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = any; - } - /** - * @description This is the user's organization dashboard. You must be authenticated as the user to view this. - * @name EventsOrgsDetail - * @request GET:/users/{username}/events/orgs/{org} - */ - export namespace EventsOrgsDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - org: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = any; - } - /** - * @description List a user's followers - * @name FollowersDetail - * @request GET:/users/{username}/followers - */ - export namespace FollowersDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Users; - } - /** - * @description Check if one user follows another. - * @name FollowingDetail - * @request GET:/users/{username}/following/{targetUser} - */ - export namespace FollowingDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - /** Name of user. */ - targetUser: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = void; - } - /** - * @description List a users gists. - * @name GistsDetail - * @request GET:/users/{username}/gists - */ - export namespace GistsDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gists; - } - /** - * @description List public keys for a user. Lists the verified public keys for a user. This is accessible by anyone. - * @name KeysDetail - * @request GET:/users/{username}/keys - */ - export namespace KeysDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gitignore; - } - /** - * @description List all public organizations for a user. - * @name OrgsDetail - * @request GET:/users/{username}/orgs - */ - export namespace OrgsDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Gitignore; - } - /** - * @description These are events that you'll only see public events. - * @name ReceivedEventsDetail - * @request GET:/users/{username}/received_events - */ - export namespace ReceivedEventsDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = any; - } - /** - * @description List public events that a user has received - * @name ReceivedEventsPublicDetail - * @request GET:/users/{username}/received_events/public - */ - export namespace ReceivedEventsPublicDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = any; - } - /** - * @description List public repositories for the specified user. - * @name ReposDetail - * @request GET:/users/{username}/repos - */ - export namespace ReposDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = Repos; - } - /** - * @description List repositories being starred by a user. - * @name StarredDetail - * @request GET:/users/{username}/starred - */ - export namespace StarredDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = any; - } - /** - * @description List repositories being watched by a user. - * @name SubscriptionsDetail - * @request GET:/users/{username}/subscriptions - */ - export namespace SubscriptionsDetail { - export type RequestParams = { - /** Name of user. */ - username: string; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = { - /** Is used to set specified media type. */ - Accept?: string; - }; - export type ResponseBody = any; - } -} diff --git a/tests/spec/routeTypes/test.js b/tests/spec/routeTypes/test.js deleted file mode 100644 index 2cd01b0b..00000000 --- a/tests/spec/routeTypes/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--route-types option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - generateRouteTypes: true, - generateClient: false, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/singleHttpClient/schema.ts b/tests/spec/singleHttpClient/__snapshots__/basic.test.ts.snap similarity index 91% rename from tests/spec/singleHttpClient/schema.ts rename to tests/spec/singleHttpClient/__snapshots__/basic.test.ts.snap index 50362b5e..d8ae13d8 100644 --- a/tests/spec/singleHttpClient/schema.ts +++ b/tests/spec/singleHttpClient/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --single-http-client 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -13,7 +16,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -78,7 +81,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -100,7 +103,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -116,7 +119,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -180,7 +183,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -238,7 +241,7 @@ export class Api { key = { /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples + * @description Register a new ID \`JWT(sub, devtoken)\` v5: \`JWT(sub, pk, devtoken, ...)\` See: https://github.com/skion/authentiq/wiki/JWT-Examples * * @tags key, post * @name KeyRegister @@ -254,7 +257,7 @@ export class Api { }, any >({ - path: `/key`, + path: \`/key\`, method: "POST", body: body, format: "json", @@ -262,3 +265,5 @@ export class Api { }), }; } +" +`; diff --git a/tests/spec/singleHttpClient/basic.test.ts b/tests/spec/singleHttpClient/basic.test.ts new file mode 100644 index 00000000..e45e3070 --- /dev/null +++ b/tests/spec/singleHttpClient/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--single-http-client", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + singleHttpClient: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/singleHttpClient/expected.ts b/tests/spec/singleHttpClient/expected.ts deleted file mode 100644 index 50362b5e..00000000 --- a/tests/spec/singleHttpClient/expected.ts +++ /dev/null @@ -1,264 +0,0 @@ -/* 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://6-dot-authentiqio.appspot.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 Authentiq - * @version 6 - * @license Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html) - * @termsOfService http://authentiq.com/terms/ - * @baseUrl https://6-dot-authentiqio.appspot.com - * @contact Authentiq team (http://authentiq.io/support) - * - * Strong authentication, without the passwords. - */ -export class Api { - http: HttpClient; - - constructor(http: HttpClient) { - this.http = http; - } - - key = { - /** - * @description Register a new ID `JWT(sub, devtoken)` v5: `JWT(sub, pk, devtoken, ...)` See: https://github.com/skion/authentiq/wiki/JWT-Examples - * - * @tags key, post - * @name KeyRegister - * @request POST:/key - */ - keyRegister: (body: any, params: RequestParams = {}) => - this.http.request< - { - /** revoke key */ - secret?: string; - /** registered */ - status?: string; - }, - any - >({ - path: `/key`, - method: "POST", - body: body, - format: "json", - ...params, - }), - }; -} diff --git a/tests/spec/singleHttpClient/test.js b/tests/spec/singleHttpClient/test.js deleted file mode 100644 index 42f71165..00000000 --- a/tests/spec/singleHttpClient/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--single-http-client option test", - silent: true, - name: apiFileName, - spec: require(absolutePath), - output: resolve(__dirname, "./"), - singleHttpClient: true, - }).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-false/__snapshots__/basic.test.ts.snap similarity index 90% rename from tests/spec/sortTypes/expected.ts rename to tests/spec/sortTypes-false/__snapshots__/basic.test.ts.snap index 4587ef32..00daa650 100644 --- a/tests/spec/sortTypes/expected.ts +++ b/tests/spec/sortTypes-false/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --sort-types=false 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -10,20 +13,19 @@ */ export interface Actor { - avatar_url?: string; - bio?: string; + created_at?: string; + gravatar_id?: string; + email?: string; blog?: string; collaborators?: number; - company?: string; - created_at?: string; disk_usage?: number; - email?: string; followers?: number; + avatar_url?: string; followers_url?: string; following?: number; following_url?: string; + bio?: string; gists_url?: string; - gravatar_id?: string; hireable?: boolean; html_url?: string; id?: number; @@ -32,6 +34,7 @@ export interface Actor { name?: string; organizations_url?: string; owned_private_repos?: number; + company?: string; plan?: { collaborators?: number; name?: string; @@ -1265,41 +1268,41 @@ export interface PutSubscription { export interface RateLimit { rate?: { - limit?: number; remaining?: number; + limit?: number; reset?: number; }; } export type Ref = { + state?: string; + target_url?: string; + updated_at?: string; created_at?: string; creator?: { - avatar_url?: string; - gravatar_id?: string; id?: number; login?: string; + avatar_url?: string; + gravatar_id?: string; url?: string; }; description?: string; id?: number; - state?: string; - target_url?: string; - updated_at?: string; url?: string; }[]; export type RefStatus = { + sha?: string; + state?: string; commit_url?: string; name?: string; repository_url?: string; - sha?: string; - state?: string; statuses?: { + id?: number; + state?: string; context?: string; created_at?: string; description?: string; - id?: number; - state?: string; target_url?: string; updated_at?: string; url?: string; @@ -1307,12 +1310,12 @@ export type RefStatus = { }[]; export type Refs = { + ref?: string; object?: { - sha?: string; type?: string; + sha?: string; url?: string; }; - ref?: string; url?: string; }[]; @@ -1322,12 +1325,14 @@ export interface RefsBody { } export interface Release { + tarball_url?: string; + target_commitish?: string; assets?: { + id?: number; + label?: string; content_type?: string; created_at?: string; download_count?: number; - id?: number; - label?: string; name?: string; size?: number; state?: string; @@ -1346,28 +1351,27 @@ export interface Release { 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 { + prerelease?: boolean; body?: string; draft?: boolean; name?: string; - prerelease?: boolean; tag_name?: string; target_commitish?: string; } export type Releases = { + created_at?: string; assets?: { + id?: number; content_type?: string; created_at?: string; download_count?: number; - id?: number; label?: string; name?: string; size?: number; @@ -1379,7 +1383,6 @@ export type Releases = { assets_url?: string; author?: User; body?: string; - created_at?: string; draft?: boolean; html_url?: string; id?: number; @@ -1395,11 +1398,12 @@ export type Releases = { }[]; export interface Repo { + forks?: number; + organization?: Organization; clone_url?: string; created_at?: string; description?: string; fork?: boolean; - forks?: number; forks_count?: number; full_name?: string; git_url?: string; @@ -1415,7 +1419,6 @@ export interface Repo { name?: string; open_issues?: number; open_issues_count?: number; - organization?: Organization; owner?: Actor; parent?: Repo; private?: boolean; @@ -1430,6 +1433,18 @@ export interface Repo { 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; @@ -1457,8 +1472,8 @@ export interface RepoCommit { }; message?: string; parents?: { - sha?: string; url?: string; + sha?: string; }[]; sha?: string; tree?: { @@ -1470,30 +1485,18 @@ export interface RepoCommit { export interface RepoCommitBody { author?: { + name?: string; 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; + description?: string; has_issues?: boolean; has_wiki?: boolean; homepage?: string; @@ -1505,17 +1508,17 @@ export type Repos = Repo[]; export interface SearchCode { items?: { - git_url?: string; html_url?: string; + git_url?: string; name?: string; path?: string; repository?: { - archive_url?: string; + comments_url?: string; assignees_url?: string; + archive_url?: string; blobs_url?: string; branches_url?: string; collaborators_url?: string; - comments_url?: string; commits_url?: string; compare_url?: string; contents_url?: string; @@ -1562,10 +1565,11 @@ export interface SearchCode { } export interface SearchIssues { + total_count?: number; items?: { - assignee?: any; - body?: string; closed_at?: any; + body?: string; + assignee?: any; comments?: number; comments_url?: string; created_at?: string; @@ -1592,19 +1596,18 @@ export interface SearchIssues { url?: string; user?: User; }[]; - total_count?: number; } export interface SearchIssuesByKeyword { issues?: { - body?: string; + gravatar_id?: string; comments?: number; created_at?: string; - gravatar_id?: string; html_url?: string; labels?: string[]; number?: number; position?: number; + body?: string; state?: string; title?: string; updated_at?: string; @@ -1627,8 +1630,8 @@ export interface SearchUserByEmail { } export interface SearchUsers { - items?: Users; total_count?: number; + items?: Users; } export interface SearchUsersByKeyword { @@ -1636,21 +1639,22 @@ export interface SearchUsersByKeyword { } export interface Subscription { - created_at?: string; + thread_url?: string; ignored?: boolean; reason?: string; + created_at?: string; repository_url?: string; subscribed?: boolean; - thread_url?: string; url?: string; } export interface SubscriptionBody { - ignored?: boolean; subscribed?: boolean; + ignored?: boolean; } export interface Tag { + url?: string; message?: string; object?: { sha?: string; @@ -1660,20 +1664,19 @@ export interface Tag { sha?: string; tag?: string; tagger?: { - date?: string; email?: string; name?: string; + date?: string; }; - url?: string; } export interface TagBody { + tag: string; message: string; object: string; - tag: string; tagger: { - date?: string; email?: string; + date?: string; name?: string; }; type: "commit" | "tree" | "blob"; @@ -1682,31 +1685,32 @@ export interface TagBody { export type Tags = Tag[]; export interface Team { + name?: string; + url?: string; id?: number; members_count?: number; - name?: string; permission?: string; repos_count?: number; - url?: string; } export interface TeamMembership { - state?: string; url?: string; + state?: string; } export type TeamRepos = Repos; export type Teams = { - id?: number; - name?: string; url?: string; + name?: string; + id?: number; }[]; export type TeamsList = { - id?: number; + repos_count?: number; members_count?: number; name?: string; + id?: number; organization?: { avatar_url?: string; id?: number; @@ -1714,12 +1718,10 @@ export type TeamsList = { url?: string; }; permission?: string; - repos_count?: number; url?: string; }[]; export interface Tree { - sha?: string; tree?: { mode?: "100644" | "100755" | "040000" | "160000" | "120000"; path?: string; @@ -1728,14 +1730,15 @@ export interface Tree { type?: "blob" | "tree" | "commit"; url?: string; }[]; + sha?: string; url?: string; } export interface Trees { - base_tree?: string; sha?: string; - tree?: Tree[]; url?: string; + tree?: Tree[]; + base_tree?: string; } export type User = Actor; @@ -1743,25 +1746,25 @@ export type User = Actor; export type UserEmails = string[]; export interface UserKeysKeyId { - id?: number; - key?: string; title?: string; + key?: string; + id?: number; url?: string; } export interface UserKeysPost { - key?: string; title?: string; + key?: string; } export interface UserUpdate { - bio?: string; - blog?: string; company?: string; + blog?: string; email?: string; - hireable?: boolean; location?: string; + hireable?: boolean; name?: string; + bio?: string; } export type Users = User[]; @@ -1770,7 +1773,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -1835,7 +1838,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -1857,7 +1860,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -1873,7 +1876,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -1937,7 +1940,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -1993,15 +1996,15 @@ export class Api extends HttpClient this.request({ - path: `/someop`, + path: \`/someop\`, method: "POST", query: query, body: data, @@ -2027,7 +2030,7 @@ export class Api extends HttpClient this.request({ - path: `/someop/${fooId}/bars/bar-bar`, + path: \`/someop/\${fooId}/bars/bar-bar\`, method: "POST", query: query, body: data, @@ -2044,7 +2047,7 @@ export class Api extends HttpClient this.request({ - path: `/emojis`, + path: \`/emojis\`, method: "GET", format: "json", ...params, @@ -2059,7 +2062,7 @@ export class Api extends HttpClient this.request({ - path: `/events`, + path: \`/events\`, method: "GET", format: "json", ...params, @@ -2074,7 +2077,7 @@ export class Api extends HttpClient this.request({ - path: `/feeds`, + path: \`/feeds\`, method: "GET", format: "json", ...params, @@ -2094,7 +2097,7 @@ export class Api extends HttpClient this.request({ - path: `/gists`, + path: \`/gists\`, method: "GET", query: query, format: "json", @@ -2109,7 +2112,7 @@ export class Api extends HttpClient this.request({ - path: `/gists`, + path: \`/gists\`, method: "POST", body: body, type: ContentType.Json, @@ -2130,7 +2133,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/public`, + path: \`/gists/public\`, method: "GET", query: query, format: "json", @@ -2150,7 +2153,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/starred`, + path: \`/gists/starred\`, method: "GET", query: query, format: "json", @@ -2165,7 +2168,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "DELETE", ...params, }), @@ -2178,7 +2181,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "GET", format: "json", ...params, @@ -2192,7 +2195,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2208,7 +2211,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "GET", format: "json", ...params, @@ -2222,7 +2225,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "POST", body: body, format: "json", @@ -2237,7 +2240,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -2252,7 +2255,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -2266,7 +2269,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2282,7 +2285,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/forks`, + path: \`/gists/\${id}/forks\`, method: "POST", ...params, }), @@ -2295,7 +2298,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "DELETE", ...params, }), @@ -2308,7 +2311,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "GET", ...params, }), @@ -2321,7 +2324,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "PUT", ...params, }), @@ -2335,7 +2338,7 @@ export class Api extends HttpClient this.request({ - path: `/gitignore/templates`, + path: \`/gitignore/templates\`, method: "GET", format: "json", ...params, @@ -2349,7 +2352,7 @@ export class Api extends HttpClient this.request({ - path: `/gitignore/templates/${language}`, + path: \`/gitignore/templates/\${language}\`, method: "GET", format: "json", ...params, @@ -2364,17 +2367,17 @@ export class Api extends HttpClient this.request({ - path: `/issues`, + path: \`/issues\`, method: "GET", query: query, format: "json", @@ -2396,7 +2399,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + path: \`/legacy/issues/search/\${owner}/\${repository}/\${state}/\${keyword}\`, method: "GET", format: "json", ...params, @@ -2411,15 +2414,15 @@ export class Api extends HttpClient this.request({ - path: `/legacy/repos/search/${keyword}`, + path: \`/legacy/repos/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2434,7 +2437,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/user/email/${email}`, + path: \`/legacy/user/email/\${email}\`, method: "GET", format: "json", ...params, @@ -2450,13 +2453,13 @@ export class Api extends HttpClient this.request({ - path: `/legacy/user/search/${keyword}`, + path: \`/legacy/user/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2472,7 +2475,7 @@ export class Api extends HttpClient this.request({ - path: `/markdown`, + path: \`/markdown\`, method: "POST", body: body, type: ContentType.Json, @@ -2487,7 +2490,7 @@ export class Api extends HttpClient this.request({ - path: `/markdown/raw`, + path: \`/markdown/raw\`, method: "POST", type: ContentType.Text, ...params, @@ -2502,7 +2505,7 @@ export class Api extends HttpClient this.request({ - path: `/meta`, + path: \`/meta\`, method: "GET", format: "json", ...params, @@ -2517,7 +2520,7 @@ export class Api extends HttpClient this.request({ - path: `/networks/${owner}/${repo}/events`, + path: \`/networks/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -2539,7 +2542,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "GET", query: query, format: "json", @@ -2554,7 +2557,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "PUT", body: body, ...params, @@ -2568,7 +2571,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "GET", format: "json", ...params, @@ -2582,7 +2585,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "PATCH", ...params, }), @@ -2595,7 +2598,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "DELETE", ...params, }), @@ -2608,7 +2611,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "GET", format: "json", ...params, @@ -2622,7 +2625,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -2639,7 +2642,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "GET", format: "json", ...params, @@ -2653,7 +2656,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2669,7 +2672,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/events`, + path: \`/orgs/\${org}/events\`, method: "GET", format: "json", ...params, @@ -2684,17 +2687,17 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/issues`, + path: \`/orgs/\${org}/issues\`, method: "GET", query: query, format: "json", @@ -2709,7 +2712,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members`, + path: \`/orgs/\${org}/members\`, method: "GET", format: "json", ...params, @@ -2723,7 +2726,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "DELETE", ...params, }), @@ -2738,7 +2741,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "GET", ...params, }), @@ -2751,7 +2754,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members`, + path: \`/orgs/\${org}/public_members\`, method: "GET", format: "json", ...params, @@ -2765,7 +2768,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "DELETE", ...params, }), @@ -2780,7 +2783,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "GET", ...params, }), @@ -2793,7 +2796,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "PUT", ...params, }), @@ -2812,7 +2815,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "GET", query: query, format: "json", @@ -2827,7 +2830,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "POST", body: body, format: "json", @@ -2842,7 +2845,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "GET", format: "json", ...params, @@ -2856,7 +2859,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "POST", body: body, type: ContentType.Json, @@ -2873,7 +2876,7 @@ export class Api extends HttpClient this.request({ - path: `/rate_limit`, + path: \`/rate_limit\`, method: "GET", format: "json", ...params, @@ -2888,7 +2891,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -2901,7 +2904,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "GET", format: "json", ...params, @@ -2915,7 +2918,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2931,7 +2934,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/assignees`, + path: \`/repos/\${owner}/\${repo}/assignees\`, method: "GET", format: "json", ...params, @@ -2947,7 +2950,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/assignees/${assignee}`, + path: \`/repos/\${owner}/\${repo}/assignees/\${assignee}\`, method: "GET", ...params, }), @@ -2960,7 +2963,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/branches`, + path: \`/repos/\${owner}/\${repo}/branches\`, method: "GET", format: "json", ...params, @@ -2976,7 +2979,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}`, + path: \`/repos/\${owner}/\${repo}/branches/\${branch}\`, method: "GET", format: "json", ...params, @@ -2990,7 +2993,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators`, + path: \`/repos/\${owner}/\${repo}/collaborators\`, method: "GET", format: "json", ...params, @@ -3004,7 +3007,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "DELETE", ...params, }), @@ -3019,7 +3022,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "GET", ...params, }), @@ -3032,7 +3035,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "PUT", ...params, }), @@ -3045,7 +3048,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments`, + path: \`/repos/\${owner}/\${repo}/comments\`, method: "GET", format: "json", ...params, @@ -3059,7 +3062,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3074,7 +3077,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -3094,7 +3097,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -3111,16 +3114,16 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits`, + path: \`/repos/\${owner}/\${repo}/commits\`, method: "GET", query: query, format: "json", @@ -3135,7 +3138,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/status`, + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/status\`, method: "GET", format: "json", ...params, @@ -3151,7 +3154,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3165,7 +3168,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "GET", format: "json", ...params, @@ -3185,7 +3188,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -3201,7 +3204,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + path: \`/repos/\${owner}/\${repo}/compare/\${baseId}...\${headId}\`, method: "GET", format: "json", ...params, @@ -3215,7 +3218,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "DELETE", body: body, type: ContentType.Json, @@ -3240,7 +3243,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "GET", query: query, format: "json", @@ -3255,7 +3258,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "PUT", body: body, type: ContentType.Json, @@ -3278,7 +3281,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contributors`, + path: \`/repos/\${owner}/\${repo}/contributors\`, method: "GET", query: query, format: "json", @@ -3293,7 +3296,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "GET", format: "json", ...params, @@ -3307,7 +3310,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "POST", body: body, type: ContentType.Json, @@ -3323,7 +3326,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "GET", format: "json", ...params, @@ -3343,7 +3346,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "POST", body: body, type: ContentType.Json, @@ -3358,7 +3361,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads`, + path: \`/repos/\${owner}/\${repo}/downloads\`, method: "GET", format: "json", ...params, @@ -3372,7 +3375,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "DELETE", ...params, }), @@ -3387,7 +3390,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "GET", format: "json", ...params, @@ -3401,7 +3404,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/events`, + path: \`/repos/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -3422,7 +3425,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "GET", query: query, format: "json", @@ -3437,7 +3440,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "POST", body: body, type: ContentType.Json, @@ -3453,7 +3456,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/blobs`, + path: \`/repos/\${owner}/\${repo}/git/blobs\`, method: "POST", body: body, type: ContentType.Json, @@ -3469,7 +3472,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/blobs/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3483,7 +3486,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/commits`, + path: \`/repos/\${owner}/\${repo}/git/commits\`, method: "POST", body: body, type: ContentType.Json, @@ -3499,7 +3502,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3513,7 +3516,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "GET", format: "json", ...params, @@ -3527,7 +3530,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "POST", body: body, type: ContentType.Json, @@ -3543,7 +3546,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "DELETE", ...params, }), @@ -3558,7 +3561,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "GET", format: "json", ...params, @@ -3572,7 +3575,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -3588,7 +3591,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/tags`, + path: \`/repos/\${owner}/\${repo}/git/tags\`, method: "POST", body: body, type: ContentType.Json, @@ -3604,7 +3607,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/tags/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3618,7 +3621,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/trees`, + path: \`/repos/\${owner}/\${repo}/git/trees\`, method: "POST", body: body, type: ContentType.Json, @@ -3642,7 +3645,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/trees/\${shaCode}\`, method: "GET", query: query, format: "json", @@ -3657,7 +3660,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "GET", format: "json", ...params, @@ -3671,7 +3674,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "POST", body: body, format: "json", @@ -3686,7 +3689,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "DELETE", ...params, }), @@ -3701,7 +3704,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "GET", format: "json", ...params, @@ -3715,7 +3718,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "PATCH", body: body, format: "json", @@ -3730,7 +3733,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/tests\`, method: "POST", ...params, }), @@ -3745,17 +3748,17 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "GET", query: query, format: "json", @@ -3770,7 +3773,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "POST", body: body, format: "json", @@ -3788,13 +3791,13 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, + path: \`/repos/\${owner}/\${repo}/issues/comments\`, method: "GET", query: query, format: "json", @@ -3809,7 +3812,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3824,7 +3827,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -3844,7 +3847,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -3859,7 +3862,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/events`, + path: \`/repos/\${owner}/\${repo}/issues/events\`, method: "GET", format: "json", ...params, @@ -3875,7 +3878,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + path: \`/repos/\${owner}/\${repo}/issues/events/\${eventId}\`, method: "GET", format: "json", ...params, @@ -3891,7 +3894,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "GET", format: "json", ...params, @@ -3905,7 +3908,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "PATCH", body: body, format: "json", @@ -3922,7 +3925,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -3942,7 +3945,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "POST", body: body, format: "json", @@ -3959,7 +3962,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/events`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/events\`, method: "GET", format: "json", ...params, @@ -3973,7 +3976,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "DELETE", ...params, }), @@ -3986,7 +3989,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4000,7 +4003,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "POST", body: body, format: "json", @@ -4015,7 +4018,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "PUT", body: body, format: "json", @@ -4032,7 +4035,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4045,7 +4048,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "GET", format: "json", ...params, @@ -4059,7 +4062,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "POST", body: body, format: "json", @@ -4074,7 +4077,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -4089,7 +4092,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -4103,7 +4106,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "GET", format: "json", ...params, @@ -4117,7 +4120,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "POST", body: body, format: "json", @@ -4132,7 +4135,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4147,7 +4150,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "GET", format: "json", ...params, @@ -4161,7 +4164,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "PATCH", body: body, format: "json", @@ -4176,7 +4179,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/languages`, + path: \`/repos/\${owner}/\${repo}/languages\`, method: "GET", format: "json", ...params, @@ -4190,7 +4193,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/merges`, + path: \`/repos/\${owner}/\${repo}/merges\`, method: "POST", body: body, type: ContentType.Json, @@ -4208,14 +4211,14 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "GET", query: query, format: "json", @@ -4230,7 +4233,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "POST", body: body, format: "json", @@ -4245,7 +4248,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "DELETE", ...params, }), @@ -4260,7 +4263,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "GET", format: "json", ...params, @@ -4280,7 +4283,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "PATCH", body: body, format: "json", @@ -4295,7 +4298,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4318,7 +4321,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "GET", query: query, format: "json", @@ -4333,7 +4336,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "PUT", body: body, ...params, @@ -4349,14 +4352,14 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "GET", query: query, format: "json", @@ -4371,7 +4374,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "POST", body: body, type: ContentType.Json, @@ -4390,13 +4393,13 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/comments\`, method: "GET", query: query, format: "json", @@ -4411,7 +4414,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -4426,7 +4429,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -4446,7 +4449,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -4463,7 +4466,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "GET", format: "json", ...params, @@ -4477,7 +4480,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -4495,7 +4498,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -4515,7 +4518,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -4531,7 +4534,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/commits\`, method: "GET", format: "json", ...params, @@ -4545,7 +4548,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/files`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/files\`, method: "GET", format: "json", ...params, @@ -4559,7 +4562,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "GET", ...params, }), @@ -4572,7 +4575,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "PUT", body: body, type: ContentType.Json, @@ -4595,7 +4598,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/readme`, + path: \`/repos/\${owner}/\${repo}/readme\`, method: "GET", query: query, format: "json", @@ -4610,7 +4613,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "GET", format: "json", ...params, @@ -4624,7 +4627,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "POST", body: body, format: "json", @@ -4639,7 +4642,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "DELETE", ...params, }), @@ -4652,7 +4655,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "GET", format: "json", ...params, @@ -4672,7 +4675,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -4688,7 +4691,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "DELETE", ...params, }), @@ -4703,7 +4706,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "GET", format: "json", ...params, @@ -4717,7 +4720,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "PATCH", body: body, format: "json", @@ -4734,7 +4737,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}/assets`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}/assets\`, method: "GET", format: "json", ...params, @@ -4748,7 +4751,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stargazers`, + path: \`/repos/\${owner}/\${repo}/stargazers\`, method: "GET", format: "json", ...params, @@ -4762,7 +4765,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/code_frequency`, + path: \`/repos/\${owner}/\${repo}/stats/code_frequency\`, method: "GET", format: "json", ...params, @@ -4776,7 +4779,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/commit_activity`, + path: \`/repos/\${owner}/\${repo}/stats/commit_activity\`, method: "GET", format: "json", ...params, @@ -4790,7 +4793,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/contributors`, + path: \`/repos/\${owner}/\${repo}/stats/contributors\`, method: "GET", format: "json", ...params, @@ -4804,7 +4807,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/participation`, + path: \`/repos/\${owner}/\${repo}/stats/participation\`, method: "GET", format: "json", ...params, @@ -4818,7 +4821,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/punch_card`, + path: \`/repos/\${owner}/\${repo}/stats/punch_card\`, method: "GET", format: "json", ...params, @@ -4832,7 +4835,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "GET", format: "json", ...params, @@ -4846,7 +4849,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "POST", body: body, type: ContentType.Json, @@ -4862,7 +4865,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscribers`, + path: \`/repos/\${owner}/\${repo}/subscribers\`, method: "GET", format: "json", ...params, @@ -4876,7 +4879,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "DELETE", ...params, }), @@ -4889,7 +4892,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "GET", format: "json", ...params, @@ -4903,7 +4906,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -4919,7 +4922,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/tags`, + path: \`/repos/\${owner}/\${repo}/tags\`, method: "GET", format: "json", ...params, @@ -4933,7 +4936,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/teams`, + path: \`/repos/\${owner}/\${repo}/teams\`, method: "GET", format: "json", ...params, @@ -4947,7 +4950,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/watchers`, + path: \`/repos/\${owner}/\${repo}/watchers\`, method: "GET", format: "json", ...params, @@ -4969,7 +4972,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + path: \`/repos/\${owner}/\${repo}/\${archiveFormat}/\${path}\`, method: "GET", ...params, }), @@ -4988,7 +4991,7 @@ export class Api extends HttpClient this.request({ - path: `/repositories`, + path: \`/repositories\`, method: "GET", query: query, format: "json", @@ -5011,7 +5014,7 @@ export class Api extends HttpClient this.request({ - path: `/search/code`, + path: \`/search/code\`, method: "GET", query: query, format: "json", @@ -5033,7 +5036,7 @@ export class Api extends HttpClient this.request({ - path: `/search/issues`, + path: \`/search/issues\`, method: "GET", query: query, format: "json", @@ -5055,7 +5058,7 @@ export class Api extends HttpClient this.request({ - path: `/search/repositories`, + path: \`/search/repositories\`, method: "GET", query: query, format: "json", @@ -5077,7 +5080,7 @@ export class Api extends HttpClient this.request({ - path: `/search/users`, + path: \`/search/users\`, method: "GET", query: query, format: "json", @@ -5093,7 +5096,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "DELETE", ...params, }), @@ -5106,7 +5109,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "GET", format: "json", ...params, @@ -5120,7 +5123,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5136,7 +5139,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members`, + path: \`/teams/\${teamId}/members\`, method: "GET", format: "json", ...params, @@ -5150,7 +5153,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "DELETE", ...params, }), @@ -5165,7 +5168,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "GET", ...params, }), @@ -5178,7 +5181,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "PUT", ...params, }), @@ -5191,7 +5194,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "DELETE", ...params, }), @@ -5204,7 +5207,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "GET", format: "json", ...params, @@ -5218,7 +5221,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "PUT", format: "json", ...params, @@ -5232,7 +5235,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos`, + path: \`/teams/\${teamId}/repos\`, method: "GET", format: "json", ...params, @@ -5246,7 +5249,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5261,7 +5264,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5274,7 +5277,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5288,7 +5291,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "GET", format: "json", ...params, @@ -5302,7 +5305,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5318,7 +5321,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "DELETE", body: body, type: ContentType.Json, @@ -5333,7 +5336,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "GET", ...params, }), @@ -5346,7 +5349,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "POST", body: body, ...params, @@ -5360,7 +5363,7 @@ export class Api extends HttpClient this.request({ - path: `/user/followers`, + path: \`/user/followers\`, method: "GET", format: "json", ...params, @@ -5374,7 +5377,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following`, + path: \`/user/following\`, method: "GET", format: "json", ...params, @@ -5388,7 +5391,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "DELETE", ...params, }), @@ -5401,7 +5404,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "GET", ...params, }), @@ -5414,7 +5417,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "PUT", ...params, }), @@ -5427,17 +5430,17 @@ export class Api extends HttpClient this.request({ - path: `/user/issues`, + path: \`/user/issues\`, method: "GET", query: query, format: "json", @@ -5452,7 +5455,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "GET", format: "json", ...params, @@ -5466,7 +5469,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "POST", body: body, format: "json", @@ -5481,7 +5484,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -5494,7 +5497,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -5508,7 +5511,7 @@ export class Api extends HttpClient this.request({ - path: `/user/orgs`, + path: \`/user/orgs\`, method: "GET", format: "json", ...params, @@ -5527,7 +5530,7 @@ export class Api extends HttpClient this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "GET", query: query, format: "json", @@ -5542,7 +5545,7 @@ export class Api extends HttpClient this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "POST", body: body, format: "json", @@ -5563,7 +5566,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred`, + path: \`/user/starred\`, method: "GET", query: query, format: "json", @@ -5578,7 +5581,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5591,7 +5594,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5604,7 +5607,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5617,7 +5620,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions`, + path: \`/user/subscriptions\`, method: "GET", format: "json", ...params, @@ -5631,7 +5634,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5644,7 +5647,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5657,7 +5660,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5670,7 +5673,7 @@ export class Api extends HttpClient this.request({ - path: `/user/teams`, + path: \`/user/teams\`, method: "GET", format: "json", ...params, @@ -5690,7 +5693,7 @@ export class Api extends HttpClient this.request({ - path: `/users`, + path: \`/users\`, method: "GET", query: query, format: "json", @@ -5705,7 +5708,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}`, + path: \`/users/\${username}\`, method: "GET", format: "json", ...params, @@ -5719,7 +5722,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/events`, + path: \`/users/\${username}/events\`, method: "GET", ...params, }), @@ -5732,7 +5735,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/events/orgs/${org}`, + path: \`/users/\${username}/events/orgs/\${org}\`, method: "GET", ...params, }), @@ -5745,7 +5748,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/followers`, + path: \`/users/\${username}/followers\`, method: "GET", format: "json", ...params, @@ -5759,7 +5762,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/following/${targetUser}`, + path: \`/users/\${username}/following/\${targetUser}\`, method: "GET", ...params, }), @@ -5778,7 +5781,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/gists`, + path: \`/users/\${username}/gists\`, method: "GET", query: query, format: "json", @@ -5793,7 +5796,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/keys`, + path: \`/users/\${username}/keys\`, method: "GET", format: "json", ...params, @@ -5807,7 +5810,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/orgs`, + path: \`/users/\${username}/orgs\`, method: "GET", format: "json", ...params, @@ -5821,7 +5824,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/received_events`, + path: \`/users/\${username}/received_events\`, method: "GET", ...params, }), @@ -5834,7 +5837,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/received_events/public`, + path: \`/users/\${username}/received_events/public\`, method: "GET", ...params, }), @@ -5853,7 +5856,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/repos`, + path: \`/users/\${username}/repos\`, method: "GET", query: query, format: "json", @@ -5868,7 +5871,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/starred`, + path: \`/users/\${username}/starred\`, method: "GET", ...params, }), @@ -5881,9 +5884,11 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/subscriptions`, + path: \`/users/\${username}/subscriptions\`, method: "GET", ...params, }), }; } +" +`; diff --git a/tests/spec/sortTypes-false/basic.test.ts b/tests/spec/sortTypes-false/basic.test.ts new file mode 100644 index 00000000..ec1ff172 --- /dev/null +++ b/tests/spec/sortTypes-false/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--sort-types=false", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: true, + sortTypes: false, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/sortTypes-false/expected.ts b/tests/spec/sortTypes-false/expected.ts deleted file mode 100644 index 0bfe0161..00000000 --- a/tests/spec/sortTypes-false/expected.ts +++ /dev/null @@ -1,5889 +0,0 @@ -/* 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.clone() 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 deleted file mode 100644 index 46a6e81b..00000000 --- a/tests/spec/sortTypes-false/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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-false/schema.ts b/tests/spec/sortTypes/__snapshots__/basic.test.ts.snap similarity index 90% rename from tests/spec/sortTypes-false/schema.ts rename to tests/spec/sortTypes/__snapshots__/basic.test.ts.snap index 0bfe0161..ab7e8ad1 100644 --- a/tests/spec/sortTypes-false/schema.ts +++ b/tests/spec/sortTypes/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --sort-types 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -10,19 +13,20 @@ */ export interface Actor { - created_at?: string; - gravatar_id?: string; - email?: string; + avatar_url?: string; + bio?: string; blog?: string; collaborators?: number; + company?: string; + created_at?: string; disk_usage?: number; + email?: string; followers?: number; - avatar_url?: string; followers_url?: string; following?: number; following_url?: string; - bio?: string; gists_url?: string; + gravatar_id?: string; hireable?: boolean; html_url?: string; id?: number; @@ -31,7 +35,6 @@ export interface Actor { name?: string; organizations_url?: string; owned_private_repos?: number; - company?: string; plan?: { collaborators?: number; name?: string; @@ -1265,41 +1268,41 @@ export interface PutSubscription { export interface RateLimit { rate?: { - remaining?: number; limit?: number; + remaining?: 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; + id?: number; + login?: string; url?: string; }; description?: string; id?: number; + state?: string; + target_url?: string; + updated_at?: string; url?: string; }[]; export type RefStatus = { - sha?: string; - state?: string; commit_url?: string; name?: string; repository_url?: string; + sha?: string; + state?: string; statuses?: { - id?: number; - state?: string; context?: string; created_at?: string; description?: string; + id?: number; + state?: string; target_url?: string; updated_at?: string; url?: string; @@ -1307,12 +1310,12 @@ export type RefStatus = { }[]; export type Refs = { - ref?: string; object?: { - type?: string; sha?: string; + type?: string; url?: string; }; + ref?: string; url?: string; }[]; @@ -1322,14 +1325,12 @@ export interface RefsBody { } export interface Release { - tarball_url?: string; - target_commitish?: string; assets?: { - id?: number; - label?: string; content_type?: string; created_at?: string; download_count?: number; + id?: number; + label?: string; name?: string; size?: number; state?: string; @@ -1348,27 +1349,28 @@ export interface Release { 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 { - prerelease?: boolean; body?: string; draft?: boolean; name?: string; + prerelease?: boolean; tag_name?: string; target_commitish?: string; } export type Releases = { - created_at?: string; assets?: { - id?: number; content_type?: string; created_at?: string; download_count?: number; + id?: number; label?: string; name?: string; size?: number; @@ -1380,6 +1382,7 @@ export type Releases = { assets_url?: string; author?: User; body?: string; + created_at?: string; draft?: boolean; html_url?: string; id?: number; @@ -1395,12 +1398,11 @@ export type Releases = { }[]; export interface Repo { - forks?: number; - organization?: Organization; clone_url?: string; created_at?: string; description?: string; fork?: boolean; + forks?: number; forks_count?: number; full_name?: string; git_url?: string; @@ -1416,6 +1418,7 @@ export interface Repo { name?: string; open_issues?: number; open_issues_count?: number; + organization?: Organization; owner?: Actor; parent?: Repo; private?: boolean; @@ -1430,18 +1433,6 @@ export interface Repo { 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; @@ -1469,8 +1460,8 @@ export interface RepoCommit { }; message?: string; parents?: { - url?: string; sha?: string; + url?: string; }[]; sha?: string; tree?: { @@ -1482,18 +1473,30 @@ export interface RepoCommit { export interface RepoCommitBody { author?: { - name?: string; 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 { - has_downloads?: boolean; description?: string; + has_downloads?: boolean; has_issues?: boolean; has_wiki?: boolean; homepage?: string; @@ -1505,17 +1508,17 @@ export type Repos = Repo[]; export interface SearchCode { items?: { - html_url?: string; git_url?: string; + html_url?: string; name?: string; path?: string; repository?: { - comments_url?: string; - assignees_url?: string; 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; @@ -1562,11 +1565,10 @@ export interface SearchCode { } export interface SearchIssues { - total_count?: number; items?: { - closed_at?: any; - body?: string; assignee?: any; + body?: string; + closed_at?: any; comments?: number; comments_url?: string; created_at?: string; @@ -1593,18 +1595,19 @@ export interface SearchIssues { url?: string; user?: User; }[]; + total_count?: number; } export interface SearchIssuesByKeyword { issues?: { - gravatar_id?: string; + body?: string; comments?: number; created_at?: string; + gravatar_id?: string; html_url?: string; labels?: string[]; number?: number; position?: number; - body?: string; state?: string; title?: string; updated_at?: string; @@ -1627,8 +1630,8 @@ export interface SearchUserByEmail { } export interface SearchUsers { - total_count?: number; items?: Users; + total_count?: number; } export interface SearchUsersByKeyword { @@ -1636,22 +1639,21 @@ export interface SearchUsersByKeyword { } export interface Subscription { - thread_url?: string; + created_at?: string; ignored?: boolean; reason?: string; - created_at?: string; repository_url?: string; subscribed?: boolean; + thread_url?: string; url?: string; } export interface SubscriptionBody { - subscribed?: boolean; ignored?: boolean; + subscribed?: boolean; } export interface Tag { - url?: string; message?: string; object?: { sha?: string; @@ -1661,19 +1663,20 @@ export interface Tag { sha?: string; tag?: string; tagger?: { + date?: string; email?: string; name?: string; - date?: string; }; + url?: string; } export interface TagBody { - tag: string; message: string; object: string; + tag: string; tagger: { - email?: string; date?: string; + email?: string; name?: string; }; type: "commit" | "tree" | "blob"; @@ -1682,32 +1685,31 @@ export interface TagBody { export type Tags = Tag[]; export interface Team { - name?: string; - url?: string; id?: number; members_count?: number; + name?: string; permission?: string; repos_count?: number; + url?: string; } export interface TeamMembership { - url?: string; state?: string; + url?: string; } export type TeamRepos = Repos; export type Teams = { - url?: string; - name?: string; id?: number; + name?: string; + url?: string; }[]; export type TeamsList = { - repos_count?: number; + id?: number; members_count?: number; name?: string; - id?: number; organization?: { avatar_url?: string; id?: number; @@ -1715,10 +1717,12 @@ export type TeamsList = { url?: string; }; permission?: string; + repos_count?: number; url?: string; }[]; export interface Tree { + sha?: string; tree?: { mode?: "100644" | "100755" | "040000" | "160000" | "120000"; path?: string; @@ -1727,15 +1731,14 @@ export interface Tree { type?: "blob" | "tree" | "commit"; url?: string; }[]; - sha?: string; url?: string; } export interface Trees { + base_tree?: string; sha?: string; - url?: string; tree?: Tree[]; - base_tree?: string; + url?: string; } export type User = Actor; @@ -1743,25 +1746,25 @@ export type User = Actor; export type UserEmails = string[]; export interface UserKeysKeyId { - title?: string; - key?: string; id?: number; + key?: string; + title?: string; url?: string; } export interface UserKeysPost { - title?: string; key?: string; + title?: string; } export interface UserUpdate { - company?: string; + bio?: string; blog?: string; + company?: string; email?: string; - location?: string; hireable?: boolean; + location?: string; name?: string; - bio?: string; } export type Users = User[]; @@ -1770,7 +1773,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -1835,7 +1838,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -1857,7 +1860,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -1873,7 +1876,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -1937,7 +1940,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -1993,15 +1996,15 @@ export class Api extends HttpClient this.request({ - path: `/someop`, + path: \`/someop\`, method: "POST", query: query, body: data, @@ -2027,7 +2030,7 @@ export class Api extends HttpClient this.request({ - path: `/someop/${fooId}/bars/bar-bar`, + path: \`/someop/\${fooId}/bars/bar-bar\`, method: "POST", query: query, body: data, @@ -2044,7 +2047,7 @@ export class Api extends HttpClient this.request({ - path: `/emojis`, + path: \`/emojis\`, method: "GET", format: "json", ...params, @@ -2059,7 +2062,7 @@ export class Api extends HttpClient this.request({ - path: `/events`, + path: \`/events\`, method: "GET", format: "json", ...params, @@ -2074,7 +2077,7 @@ export class Api extends HttpClient this.request({ - path: `/feeds`, + path: \`/feeds\`, method: "GET", format: "json", ...params, @@ -2094,7 +2097,7 @@ export class Api extends HttpClient this.request({ - path: `/gists`, + path: \`/gists\`, method: "GET", query: query, format: "json", @@ -2109,7 +2112,7 @@ export class Api extends HttpClient this.request({ - path: `/gists`, + path: \`/gists\`, method: "POST", body: body, type: ContentType.Json, @@ -2130,7 +2133,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/public`, + path: \`/gists/public\`, method: "GET", query: query, format: "json", @@ -2150,7 +2153,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/starred`, + path: \`/gists/starred\`, method: "GET", query: query, format: "json", @@ -2165,7 +2168,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "DELETE", ...params, }), @@ -2178,7 +2181,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "GET", format: "json", ...params, @@ -2192,7 +2195,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2208,7 +2211,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "GET", format: "json", ...params, @@ -2222,7 +2225,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "POST", body: body, format: "json", @@ -2237,7 +2240,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -2252,7 +2255,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -2266,7 +2269,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2282,7 +2285,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/forks`, + path: \`/gists/\${id}/forks\`, method: "POST", ...params, }), @@ -2295,7 +2298,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "DELETE", ...params, }), @@ -2308,7 +2311,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "GET", ...params, }), @@ -2321,7 +2324,7 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "PUT", ...params, }), @@ -2335,7 +2338,7 @@ export class Api extends HttpClient this.request({ - path: `/gitignore/templates`, + path: \`/gitignore/templates\`, method: "GET", format: "json", ...params, @@ -2349,7 +2352,7 @@ export class Api extends HttpClient this.request({ - path: `/gitignore/templates/${language}`, + path: \`/gitignore/templates/\${language}\`, method: "GET", format: "json", ...params, @@ -2364,17 +2367,17 @@ export class Api extends HttpClient this.request({ - path: `/issues`, + path: \`/issues\`, method: "GET", query: query, format: "json", @@ -2396,7 +2399,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + path: \`/legacy/issues/search/\${owner}/\${repository}/\${state}/\${keyword}\`, method: "GET", format: "json", ...params, @@ -2411,15 +2414,15 @@ export class Api extends HttpClient this.request({ - path: `/legacy/repos/search/${keyword}`, + path: \`/legacy/repos/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2434,7 +2437,7 @@ export class Api extends HttpClient this.request({ - path: `/legacy/user/email/${email}`, + path: \`/legacy/user/email/\${email}\`, method: "GET", format: "json", ...params, @@ -2450,13 +2453,13 @@ export class Api extends HttpClient this.request({ - path: `/legacy/user/search/${keyword}`, + path: \`/legacy/user/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2472,7 +2475,7 @@ export class Api extends HttpClient this.request({ - path: `/markdown`, + path: \`/markdown\`, method: "POST", body: body, type: ContentType.Json, @@ -2487,7 +2490,7 @@ export class Api extends HttpClient this.request({ - path: `/markdown/raw`, + path: \`/markdown/raw\`, method: "POST", type: ContentType.Text, ...params, @@ -2502,7 +2505,7 @@ export class Api extends HttpClient this.request({ - path: `/meta`, + path: \`/meta\`, method: "GET", format: "json", ...params, @@ -2517,7 +2520,7 @@ export class Api extends HttpClient this.request({ - path: `/networks/${owner}/${repo}/events`, + path: \`/networks/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -2539,7 +2542,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "GET", query: query, format: "json", @@ -2554,7 +2557,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "PUT", body: body, ...params, @@ -2568,7 +2571,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "GET", format: "json", ...params, @@ -2582,7 +2585,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "PATCH", ...params, }), @@ -2595,7 +2598,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "DELETE", ...params, }), @@ -2608,7 +2611,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "GET", format: "json", ...params, @@ -2622,7 +2625,7 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -2639,7 +2642,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "GET", format: "json", ...params, @@ -2653,7 +2656,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2669,7 +2672,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/events`, + path: \`/orgs/\${org}/events\`, method: "GET", format: "json", ...params, @@ -2684,17 +2687,17 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/issues`, + path: \`/orgs/\${org}/issues\`, method: "GET", query: query, format: "json", @@ -2709,7 +2712,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members`, + path: \`/orgs/\${org}/members\`, method: "GET", format: "json", ...params, @@ -2723,7 +2726,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "DELETE", ...params, }), @@ -2738,7 +2741,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "GET", ...params, }), @@ -2751,7 +2754,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members`, + path: \`/orgs/\${org}/public_members\`, method: "GET", format: "json", ...params, @@ -2765,7 +2768,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "DELETE", ...params, }), @@ -2780,7 +2783,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "GET", ...params, }), @@ -2793,7 +2796,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "PUT", ...params, }), @@ -2812,7 +2815,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "GET", query: query, format: "json", @@ -2827,7 +2830,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "POST", body: body, format: "json", @@ -2842,7 +2845,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "GET", format: "json", ...params, @@ -2856,7 +2859,7 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "POST", body: body, type: ContentType.Json, @@ -2873,7 +2876,7 @@ export class Api extends HttpClient this.request({ - path: `/rate_limit`, + path: \`/rate_limit\`, method: "GET", format: "json", ...params, @@ -2888,7 +2891,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -2901,7 +2904,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "GET", format: "json", ...params, @@ -2915,7 +2918,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2931,7 +2934,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/assignees`, + path: \`/repos/\${owner}/\${repo}/assignees\`, method: "GET", format: "json", ...params, @@ -2947,7 +2950,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/assignees/${assignee}`, + path: \`/repos/\${owner}/\${repo}/assignees/\${assignee}\`, method: "GET", ...params, }), @@ -2960,7 +2963,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/branches`, + path: \`/repos/\${owner}/\${repo}/branches\`, method: "GET", format: "json", ...params, @@ -2976,7 +2979,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}`, + path: \`/repos/\${owner}/\${repo}/branches/\${branch}\`, method: "GET", format: "json", ...params, @@ -2990,7 +2993,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators`, + path: \`/repos/\${owner}/\${repo}/collaborators\`, method: "GET", format: "json", ...params, @@ -3004,7 +3007,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "DELETE", ...params, }), @@ -3019,7 +3022,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "GET", ...params, }), @@ -3032,7 +3035,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "PUT", ...params, }), @@ -3045,7 +3048,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments`, + path: \`/repos/\${owner}/\${repo}/comments\`, method: "GET", format: "json", ...params, @@ -3059,7 +3062,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3074,7 +3077,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -3094,7 +3097,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -3111,16 +3114,16 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits`, + path: \`/repos/\${owner}/\${repo}/commits\`, method: "GET", query: query, format: "json", @@ -3135,7 +3138,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/status`, + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/status\`, method: "GET", format: "json", ...params, @@ -3151,7 +3154,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3165,7 +3168,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "GET", format: "json", ...params, @@ -3185,7 +3188,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -3201,7 +3204,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + path: \`/repos/\${owner}/\${repo}/compare/\${baseId}...\${headId}\`, method: "GET", format: "json", ...params, @@ -3215,7 +3218,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "DELETE", body: body, type: ContentType.Json, @@ -3240,7 +3243,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "GET", query: query, format: "json", @@ -3255,7 +3258,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "PUT", body: body, type: ContentType.Json, @@ -3278,7 +3281,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contributors`, + path: \`/repos/\${owner}/\${repo}/contributors\`, method: "GET", query: query, format: "json", @@ -3293,7 +3296,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "GET", format: "json", ...params, @@ -3307,7 +3310,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "POST", body: body, type: ContentType.Json, @@ -3323,7 +3326,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "GET", format: "json", ...params, @@ -3343,7 +3346,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "POST", body: body, type: ContentType.Json, @@ -3358,7 +3361,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads`, + path: \`/repos/\${owner}/\${repo}/downloads\`, method: "GET", format: "json", ...params, @@ -3372,7 +3375,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "DELETE", ...params, }), @@ -3387,7 +3390,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "GET", format: "json", ...params, @@ -3401,7 +3404,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/events`, + path: \`/repos/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -3422,7 +3425,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "GET", query: query, format: "json", @@ -3437,7 +3440,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "POST", body: body, type: ContentType.Json, @@ -3453,7 +3456,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/blobs`, + path: \`/repos/\${owner}/\${repo}/git/blobs\`, method: "POST", body: body, type: ContentType.Json, @@ -3469,7 +3472,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/blobs/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3483,7 +3486,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/commits`, + path: \`/repos/\${owner}/\${repo}/git/commits\`, method: "POST", body: body, type: ContentType.Json, @@ -3499,7 +3502,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3513,7 +3516,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "GET", format: "json", ...params, @@ -3527,7 +3530,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "POST", body: body, type: ContentType.Json, @@ -3543,7 +3546,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "DELETE", ...params, }), @@ -3558,7 +3561,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "GET", format: "json", ...params, @@ -3572,7 +3575,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -3588,7 +3591,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/tags`, + path: \`/repos/\${owner}/\${repo}/git/tags\`, method: "POST", body: body, type: ContentType.Json, @@ -3604,7 +3607,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/tags/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3618,7 +3621,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/trees`, + path: \`/repos/\${owner}/\${repo}/git/trees\`, method: "POST", body: body, type: ContentType.Json, @@ -3642,7 +3645,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/trees/\${shaCode}\`, method: "GET", query: query, format: "json", @@ -3657,7 +3660,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "GET", format: "json", ...params, @@ -3671,7 +3674,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "POST", body: body, format: "json", @@ -3686,7 +3689,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "DELETE", ...params, }), @@ -3701,7 +3704,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "GET", format: "json", ...params, @@ -3715,7 +3718,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "PATCH", body: body, format: "json", @@ -3730,7 +3733,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/tests\`, method: "POST", ...params, }), @@ -3745,17 +3748,17 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "GET", query: query, format: "json", @@ -3770,7 +3773,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "POST", body: body, format: "json", @@ -3788,13 +3791,13 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, + path: \`/repos/\${owner}/\${repo}/issues/comments\`, method: "GET", query: query, format: "json", @@ -3809,7 +3812,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3824,7 +3827,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -3844,7 +3847,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -3859,7 +3862,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/events`, + path: \`/repos/\${owner}/\${repo}/issues/events\`, method: "GET", format: "json", ...params, @@ -3875,7 +3878,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + path: \`/repos/\${owner}/\${repo}/issues/events/\${eventId}\`, method: "GET", format: "json", ...params, @@ -3891,7 +3894,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "GET", format: "json", ...params, @@ -3905,7 +3908,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "PATCH", body: body, format: "json", @@ -3922,7 +3925,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -3942,7 +3945,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "POST", body: body, format: "json", @@ -3959,7 +3962,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/events`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/events\`, method: "GET", format: "json", ...params, @@ -3973,7 +3976,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "DELETE", ...params, }), @@ -3986,7 +3989,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4000,7 +4003,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "POST", body: body, format: "json", @@ -4015,7 +4018,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "PUT", body: body, format: "json", @@ -4032,7 +4035,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4045,7 +4048,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "GET", format: "json", ...params, @@ -4059,7 +4062,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "POST", body: body, format: "json", @@ -4074,7 +4077,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -4089,7 +4092,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -4103,7 +4106,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "GET", format: "json", ...params, @@ -4117,7 +4120,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "POST", body: body, format: "json", @@ -4132,7 +4135,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4147,7 +4150,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "GET", format: "json", ...params, @@ -4161,7 +4164,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "PATCH", body: body, format: "json", @@ -4176,7 +4179,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/languages`, + path: \`/repos/\${owner}/\${repo}/languages\`, method: "GET", format: "json", ...params, @@ -4190,7 +4193,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/merges`, + path: \`/repos/\${owner}/\${repo}/merges\`, method: "POST", body: body, type: ContentType.Json, @@ -4208,14 +4211,14 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "GET", query: query, format: "json", @@ -4230,7 +4233,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "POST", body: body, format: "json", @@ -4245,7 +4248,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "DELETE", ...params, }), @@ -4260,7 +4263,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "GET", format: "json", ...params, @@ -4280,7 +4283,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "PATCH", body: body, format: "json", @@ -4295,7 +4298,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4318,7 +4321,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "GET", query: query, format: "json", @@ -4333,7 +4336,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "PUT", body: body, ...params, @@ -4349,14 +4352,14 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "GET", query: query, format: "json", @@ -4371,7 +4374,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "POST", body: body, type: ContentType.Json, @@ -4390,13 +4393,13 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/comments\`, method: "GET", query: query, format: "json", @@ -4411,7 +4414,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -4426,7 +4429,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -4446,7 +4449,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -4463,7 +4466,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "GET", format: "json", ...params, @@ -4477,7 +4480,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -4495,7 +4498,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -4515,7 +4518,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -4531,7 +4534,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/commits\`, method: "GET", format: "json", ...params, @@ -4545,7 +4548,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/files`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/files\`, method: "GET", format: "json", ...params, @@ -4559,7 +4562,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "GET", ...params, }), @@ -4572,7 +4575,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "PUT", body: body, type: ContentType.Json, @@ -4595,7 +4598,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/readme`, + path: \`/repos/\${owner}/\${repo}/readme\`, method: "GET", query: query, format: "json", @@ -4610,7 +4613,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "GET", format: "json", ...params, @@ -4624,7 +4627,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "POST", body: body, format: "json", @@ -4639,7 +4642,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "DELETE", ...params, }), @@ -4652,7 +4655,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "GET", format: "json", ...params, @@ -4672,7 +4675,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -4688,7 +4691,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "DELETE", ...params, }), @@ -4703,7 +4706,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "GET", format: "json", ...params, @@ -4717,7 +4720,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "PATCH", body: body, format: "json", @@ -4734,7 +4737,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}/assets`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}/assets\`, method: "GET", format: "json", ...params, @@ -4748,7 +4751,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stargazers`, + path: \`/repos/\${owner}/\${repo}/stargazers\`, method: "GET", format: "json", ...params, @@ -4762,7 +4765,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/code_frequency`, + path: \`/repos/\${owner}/\${repo}/stats/code_frequency\`, method: "GET", format: "json", ...params, @@ -4776,7 +4779,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/commit_activity`, + path: \`/repos/\${owner}/\${repo}/stats/commit_activity\`, method: "GET", format: "json", ...params, @@ -4790,7 +4793,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/contributors`, + path: \`/repos/\${owner}/\${repo}/stats/contributors\`, method: "GET", format: "json", ...params, @@ -4804,7 +4807,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/participation`, + path: \`/repos/\${owner}/\${repo}/stats/participation\`, method: "GET", format: "json", ...params, @@ -4818,7 +4821,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/punch_card`, + path: \`/repos/\${owner}/\${repo}/stats/punch_card\`, method: "GET", format: "json", ...params, @@ -4832,7 +4835,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "GET", format: "json", ...params, @@ -4846,7 +4849,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "POST", body: body, type: ContentType.Json, @@ -4862,7 +4865,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscribers`, + path: \`/repos/\${owner}/\${repo}/subscribers\`, method: "GET", format: "json", ...params, @@ -4876,7 +4879,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "DELETE", ...params, }), @@ -4889,7 +4892,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "GET", format: "json", ...params, @@ -4903,7 +4906,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -4919,7 +4922,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/tags`, + path: \`/repos/\${owner}/\${repo}/tags\`, method: "GET", format: "json", ...params, @@ -4933,7 +4936,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/teams`, + path: \`/repos/\${owner}/\${repo}/teams\`, method: "GET", format: "json", ...params, @@ -4947,7 +4950,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/watchers`, + path: \`/repos/\${owner}/\${repo}/watchers\`, method: "GET", format: "json", ...params, @@ -4969,7 +4972,7 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + path: \`/repos/\${owner}/\${repo}/\${archiveFormat}/\${path}\`, method: "GET", ...params, }), @@ -4988,7 +4991,7 @@ export class Api extends HttpClient this.request({ - path: `/repositories`, + path: \`/repositories\`, method: "GET", query: query, format: "json", @@ -5011,7 +5014,7 @@ export class Api extends HttpClient this.request({ - path: `/search/code`, + path: \`/search/code\`, method: "GET", query: query, format: "json", @@ -5033,7 +5036,7 @@ export class Api extends HttpClient this.request({ - path: `/search/issues`, + path: \`/search/issues\`, method: "GET", query: query, format: "json", @@ -5055,7 +5058,7 @@ export class Api extends HttpClient this.request({ - path: `/search/repositories`, + path: \`/search/repositories\`, method: "GET", query: query, format: "json", @@ -5077,7 +5080,7 @@ export class Api extends HttpClient this.request({ - path: `/search/users`, + path: \`/search/users\`, method: "GET", query: query, format: "json", @@ -5093,7 +5096,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "DELETE", ...params, }), @@ -5106,7 +5109,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "GET", format: "json", ...params, @@ -5120,7 +5123,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5136,7 +5139,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members`, + path: \`/teams/\${teamId}/members\`, method: "GET", format: "json", ...params, @@ -5150,7 +5153,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "DELETE", ...params, }), @@ -5165,7 +5168,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "GET", ...params, }), @@ -5178,7 +5181,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "PUT", ...params, }), @@ -5191,7 +5194,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "DELETE", ...params, }), @@ -5204,7 +5207,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "GET", format: "json", ...params, @@ -5218,7 +5221,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "PUT", format: "json", ...params, @@ -5232,7 +5235,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos`, + path: \`/teams/\${teamId}/repos\`, method: "GET", format: "json", ...params, @@ -5246,7 +5249,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5261,7 +5264,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5274,7 +5277,7 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5288,7 +5291,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "GET", format: "json", ...params, @@ -5302,7 +5305,7 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5318,7 +5321,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "DELETE", body: body, type: ContentType.Json, @@ -5333,7 +5336,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "GET", ...params, }), @@ -5346,7 +5349,7 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "POST", body: body, ...params, @@ -5360,7 +5363,7 @@ export class Api extends HttpClient this.request({ - path: `/user/followers`, + path: \`/user/followers\`, method: "GET", format: "json", ...params, @@ -5374,7 +5377,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following`, + path: \`/user/following\`, method: "GET", format: "json", ...params, @@ -5388,7 +5391,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "DELETE", ...params, }), @@ -5401,7 +5404,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "GET", ...params, }), @@ -5414,7 +5417,7 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "PUT", ...params, }), @@ -5427,17 +5430,17 @@ export class Api extends HttpClient this.request({ - path: `/user/issues`, + path: \`/user/issues\`, method: "GET", query: query, format: "json", @@ -5452,7 +5455,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "GET", format: "json", ...params, @@ -5466,7 +5469,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "POST", body: body, format: "json", @@ -5481,7 +5484,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -5494,7 +5497,7 @@ export class Api extends HttpClient this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -5508,7 +5511,7 @@ export class Api extends HttpClient this.request({ - path: `/user/orgs`, + path: \`/user/orgs\`, method: "GET", format: "json", ...params, @@ -5527,7 +5530,7 @@ export class Api extends HttpClient this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "GET", query: query, format: "json", @@ -5542,7 +5545,7 @@ export class Api extends HttpClient this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "POST", body: body, format: "json", @@ -5563,7 +5566,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred`, + path: \`/user/starred\`, method: "GET", query: query, format: "json", @@ -5578,7 +5581,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5591,7 +5594,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5604,7 +5607,7 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5617,7 +5620,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions`, + path: \`/user/subscriptions\`, method: "GET", format: "json", ...params, @@ -5631,7 +5634,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5644,7 +5647,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5657,7 +5660,7 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5670,7 +5673,7 @@ export class Api extends HttpClient this.request({ - path: `/user/teams`, + path: \`/user/teams\`, method: "GET", format: "json", ...params, @@ -5690,7 +5693,7 @@ export class Api extends HttpClient this.request({ - path: `/users`, + path: \`/users\`, method: "GET", query: query, format: "json", @@ -5705,7 +5708,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}`, + path: \`/users/\${username}\`, method: "GET", format: "json", ...params, @@ -5719,7 +5722,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/events`, + path: \`/users/\${username}/events\`, method: "GET", ...params, }), @@ -5732,7 +5735,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/events/orgs/${org}`, + path: \`/users/\${username}/events/orgs/\${org}\`, method: "GET", ...params, }), @@ -5745,7 +5748,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/followers`, + path: \`/users/\${username}/followers\`, method: "GET", format: "json", ...params, @@ -5759,7 +5762,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/following/${targetUser}`, + path: \`/users/\${username}/following/\${targetUser}\`, method: "GET", ...params, }), @@ -5778,7 +5781,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/gists`, + path: \`/users/\${username}/gists\`, method: "GET", query: query, format: "json", @@ -5793,7 +5796,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/keys`, + path: \`/users/\${username}/keys\`, method: "GET", format: "json", ...params, @@ -5807,7 +5810,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/orgs`, + path: \`/users/\${username}/orgs\`, method: "GET", format: "json", ...params, @@ -5821,7 +5824,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/received_events`, + path: \`/users/\${username}/received_events\`, method: "GET", ...params, }), @@ -5834,7 +5837,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/received_events/public`, + path: \`/users/\${username}/received_events/public\`, method: "GET", ...params, }), @@ -5853,7 +5856,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/repos`, + path: \`/users/\${username}/repos\`, method: "GET", query: query, format: "json", @@ -5868,7 +5871,7 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/starred`, + path: \`/users/\${username}/starred\`, method: "GET", ...params, }), @@ -5881,9 +5884,11 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/subscriptions`, + path: \`/users/\${username}/subscriptions\`, method: "GET", ...params, }), }; } +" +`; diff --git a/tests/spec/sortTypes/basic.test.ts b/tests/spec/sortTypes/basic.test.ts new file mode 100644 index 00000000..3c858b04 --- /dev/null +++ b/tests/spec/sortTypes/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--sort-types", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: true, + sortTypes: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/sortTypes/schema.ts b/tests/spec/sortTypes/schema.ts deleted file mode 100644 index 4587ef32..00000000 --- a/tests/spec/sortTypes/schema.ts +++ /dev/null @@ -1,5889 +0,0 @@ -/* 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.clone() 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 deleted file mode 100644 index 77b3a16b..00000000 --- a/tests/spec/sortTypes/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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/specProperty/expected.ts b/tests/spec/specProperty/__snapshots__/basic.test.ts.snap similarity index 97% rename from tests/spec/specProperty/expected.ts rename to tests/spec/specProperty/__snapshots__/basic.test.ts.snap index 5503bfbf..86766f4a 100644 --- a/tests/spec/specProperty/expected.ts +++ b/tests/spec/specProperty/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > specProperty 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -115,3 +118,5 @@ export namespace Pets { export type ResponseBody = void; } } +" +`; diff --git a/tests/spec/specProperty/basic.test.ts b/tests/spec/specProperty/basic.test.ts new file mode 100644 index 00000000..74529555 --- /dev/null +++ b/tests/spec/specProperty/basic.test.ts @@ -0,0 +1,37 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("specProperty", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: false, + generateRouteTypes: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/specProperty/schema.ts b/tests/spec/specProperty/schema.ts deleted file mode 100644 index 5503bfbf..00000000 --- a/tests/spec/specProperty/schema.ts +++ /dev/null @@ -1,117 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type Pet = NewPet & { - /** @format int64 */ - id: number; -}; - -export interface NewPet { - name: string; - tag?: string; -} - -export interface Error { - /** @format int32 */ - code: number; - message: string; -} - -/** Page«TemplateResponseDto» */ -export interface PageTemplateResponseDto { - content?: any[]; - empty?: boolean; - first?: boolean; - last?: boolean; - /** @format int32 */ - number?: number; - /** @format int32 */ - numberOfElements?: number; - pageable?: any; - /** @format int32 */ - size?: number; - sort?: any; - /** @format int64 */ - totalElements?: number; - /** @format int32 */ - totalPages?: number; -} - -export namespace Pets { - /** - * @description Returns all pets from the system that the user has access to Nam sed condimentum est. Maecenas tempor sagittis sapien, nec rhoncus sem sagittis sit amet. Aenean at gravida augue, ac iaculis sem. Curabitur odio lorem, ornare eget elementum nec, cursus id lectus. Duis mi turpis, pulvinar ac eros ac, tincidunt varius justo. In hac habitasse platea dictumst. Integer at adipiscing ante, a sagittis ligula. Aenean pharetra tempor ante molestie imperdiet. Vivamus id aliquam diam. Cras quis velit non tortor eleifend sagittis. Praesent at enim pharetra urna volutpat venenatis eget eget mauris. In eleifend fermentum facilisis. Praesent enim enim, gravida ac sodales sed, placerat id erat. Suspendisse lacus dolor, consectetur non augue vel, vehicula interdum libero. Morbi euismod sagittis libero sed lacinia. Sed tempus felis lobortis leo pulvinar rutrum. Nam mattis velit nisl, eu condimentum ligula luctus nec. Phasellus semper velit eget aliquet faucibus. In a mattis elit. Phasellus vel urna viverra, condimentum lorem id, rhoncus nibh. Ut pellentesque posuere elementum. Sed a varius odio. Morbi rhoncus ligula libero, vel eleifend nunc tristique vitae. Fusce et sem dui. Aenean nec scelerisque tortor. Fusce malesuada accumsan magna vel tempus. Quisque mollis felis eu dolor tristique, sit amet auctor felis gravida. Sed libero lorem, molestie sed nisl in, accumsan tempor nisi. Fusce sollicitudin massa ut lacinia mattis. Sed vel eleifend lorem. Pellentesque vitae felis pretium, pulvinar elit eu, euismod sapien. - * @name FindPets - * @request GET:/pets - */ - export namespace FindPets { - export type RequestParams = {}; - export type RequestQuery = { - /** tags to filter by */ - tags?: string[]; - /** - * maximum number of results to return - * @format int32 - */ - limit?: number; - }; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = Pet[]; - } - /** - * @description Creates a new pet in the store. Duplicates are allowed - * @name AddPet - * @request POST:/pets - */ - export namespace AddPet { - export type RequestParams = {}; - export type RequestQuery = {}; - export type RequestBody = NewPet; - export type RequestHeaders = {}; - export type ResponseBody = Pet; - } - /** - * @description Returns a user based on a single ID, if the user does not have access to the pet - * @name FindPetById - * @request GET:/pets/{id} - */ - export namespace FindPetById { - export type RequestParams = { - /** - * ID of pet to fetch - * @format int64 - */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = Pet; - } - /** - * @description deletes a single pet based on the ID supplied - * @name DeletePet - * @request DELETE:/pets/{id} - */ - export namespace DeletePet { - export type RequestParams = { - /** - * ID of pet to delete - * @format int64 - */ - id: number; - }; - export type RequestQuery = {}; - export type RequestBody = never; - export type RequestHeaders = {}; - export type ResponseBody = void; - } -} diff --git a/tests/spec/specProperty/test.js b/tests/spec/specProperty/test.js deleted file mode 100644 index 9e28de0d..00000000 --- a/tests/spec/specProperty/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "specProperty test", - silent: true, - name: apiFileName, - spec: require(absolutePath), - output: resolve(__dirname, "./"), - generateRouteTypes: true, - generateClient: false, - }).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 deleted file mode 100644 index 06022066..00000000 --- a/tests/spec/templates/expected.ts +++ /dev/null @@ -1,6710 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** - * A user or organization - */ -export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - 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; - /** The account username */ - login?: string; - /** The full account name */ - 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"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - 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?: { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601. */ - created_at?: string; - id?: number; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface Commit { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export interface CommitCommentBody { - body: string; - /** Deprecated - Use position parameter instead. */ - line?: string; - /** Line number in the file to comment on. Defaults to null. */ - number?: string; - /** Relative path of the file to comment on. */ - path?: string; - /** Line index in the diff to comment on. */ - position?: number; - /** SHA of the commit to comment on. */ - sha: string; -} - -export type Commits = { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -}[]; - -export interface CompareCommits { - ahead_by?: number; - base_commit?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - behind_by?: number; - commits?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - }; - /** The Total number of commits authored by the contributor. */ - total?: number; - weeks?: { - /** Number of additions. */ - a?: number; - /** Number of commits. */ - c?: number; - /** Number of deletions. */ - d?: number; - /** Start of the week. */ - 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; - /** A GitHub user */ - creator?: User; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -} - -export type DeploymentStatuses = { - created_at?: string; - /** A GitHub user */ - 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 { - /** A user or organization */ - actor?: Actor; - created_at?: object; - id?: number; - /** A GitHub organization */ - 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; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - description?: string; - files?: { - "ring.erl"?: { - filename?: string; - raw_url?: string; - size?: number; - }; - }; - forks?: { - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }[]; - git_pull_url?: string; - git_push_url?: string; - history?: { - change_status?: { - additions?: number; - deletions?: number; - total?: number; - }; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - committed_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - version?: string; - }[]; - html_url?: string; - id?: string; - public?: boolean; - url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - 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; - }; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** A user or organization */ - actor?: Actor; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - event?: string; - issue?: { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }; - url?: string; -} - -export type IssueEvents = IssueEvent[]; - -export type Issues = { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface IssuesComment { - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export type IssuesComments = { - _links?: { - html?: { - href?: string; - }; - pull_request?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - body?: string; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - 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 { - /** Error message */ - message?: string; -} - -export interface MergesSuccessful { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A user or organization */ - 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[]; -} - -/** - * A GitHub organization - */ -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 address. This address is not publicized. */ - billing_email?: string; - company?: string; - /** Publicly visible email address. */ - email?: string; - location?: string; - name?: string; -} - -export interface PostGist { - description?: string; - files?: { - "file1.txt"?: { - content?: string; - }; - }; - public?: boolean; -} - -export interface PostRepo { - /** True to create an initial commit with empty README. Default is false. */ - auto_init?: boolean; - description?: string; - /** Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell" Ignored if auto_init parameter is not provided. */ - gitignore_template?: string; - /** True to enable downloads for this repository, false to disable them. Default is true. */ - has_downloads?: boolean; - /** True to enable issues for this repository, false to disable them. Default is true. */ - has_issues?: boolean; - /** True to enable the wiki for this repository, false to disable it. Default is true. */ - has_wiki?: boolean; - homepage?: string; - name: string; - /** True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. */ - private?: boolean; - /** The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization. */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - merged_at?: string; - number?: number; - patch_url?: string; - state?: "open" | "closed"; - title?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 = { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub organization */ - organization?: Organization; - /** A user or organization */ - owner?: Actor; - /** Is present when the repo is a fork. Parent is the repo this repo was forked from. */ - parent?: Repo; - private?: boolean; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - pushed_at?: string; - size?: number; - /** Is present when the repo is a fork. Source is the ultimate source for the network. */ - source?: Repo; - ssh_url?: string; - svn_url?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - watchers?: number; - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface RepoCommit { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 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; - /** A user or organization */ - 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; - /** A GitHub user */ - 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 { - /** A GitHub user */ - user?: User; -} - -export interface SearchUsers { - items?: Users; - total_count?: number; -} - -export interface SearchUsersByKeyword { - users?: Users; -} - -export interface Subscription { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** String of the tag message. */ - message?: string; - object?: { - sha?: string; - /** String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob. */ - type?: "commit" | "tree" | "blob"; - url?: string; - }; - sha?: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag?: string; - tagger?: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - url?: string; -} - -export interface TagBody { - /** String of the tag message. */ - message: string; - /** String of the SHA of the git object this is tagging. */ - object: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag: string; - tagger: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - /** 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 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?: { - /** One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink. */ - mode?: "100644" | "100755" | "040000" | "160000" | "120000"; - path?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - size?: number; - type?: "blob" | "tree" | "commit"; - url?: string; - }[]; - url?: string; -} - -export interface Trees { - base_tree?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - tree?: Tree[]; - url?: string; -} - -/** - * A GitHub user - */ -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[]; - -/* CUSTOM TEMPLATE */ - -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://api.github.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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; - }); - }; -} - -/* HTTP CLIENT TEMPLATE */ - -/** - * @title GitHub - * @version v3 - * @termsOfService https://help.github.com/articles/github-terms-of-service/#b-api-terms - * @baseUrl https://api.github.com - * @externalDocs https://developer.github.com/v3/ - * - * Powerful collaboration, code review, and code management for open source and private projects. - */ -export class Api extends HttpClient { - emojis = { - /** - * @description Lists all the emojis available to use on GitHub. - * - * @name EmojisList - * @request GET:/emojis - */ - emojisList: (params: RequestParams = {}) => - this.request({ - path: `/emojis`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - events = { - /** - * @description List public events. - * - * @name EventsList - * @request GET:/events - */ - eventsList: (params: RequestParams = {}) => - this.request({ - path: `/events`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - feeds = { - /** - * @description List Feeds. GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticating user. - * - * @name FeedsList - * @request GET:/feeds - */ - feedsList: (params: RequestParams = {}) => - this.request({ - path: `/feeds`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - gists = { - /** - * @description List the authenticated user's gists or if called anonymously, this will return all public gists. - * - * @name GistsList - * @request GET:/gists - */ - gistsList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a gist. - * - * @name GistsCreate - * @request POST:/gists - */ - gistsCreate: (body: PostGist, params: RequestParams = {}) => - this.request({ - path: `/gists`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List all public gists. - * - * @name PublicList - * @request GET:/gists/public - */ - publicList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists/public`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List the authenticated user's starred gists. - * - * @name StarredList - * @request GET:/gists/starred - */ - starredList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists/starred`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a gist. - * - * @name GistsDelete - * @request DELETE:/gists/{id} - */ - gistsDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single gist. - * - * @name GistsDetail - * @request GET:/gists/{id} - */ - gistsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a gist. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments on a gist. - * - * @name CommentsDetail - * @request GET:/gists/{id}/comments - */ - commentsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/comments`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a commen - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Fork a gist. - * - * @name ForksCreate - * @request POST:/gists/{id}/forks - */ - forksCreate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/forks`, - method: "POST", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Unstar a gist. - * - * @name StarDelete - * @request DELETE:/gists/{id}/star - */ - starDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if a gist is starred. - * - * @name StarDetail - * @request GET:/gists/{id}/star - */ - starDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Star a gist. - * - * @name StarUpdate - * @request PUT:/gists/{id}/star - */ - starUpdate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "PUT", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - gitignore = { - /** - * @description Listing available templates. List all templates available to pass as an option when creating a repository. - * - * @name TemplatesList - * @request GET:/gitignore/templates - */ - templatesList: (params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single template. - * - * @name TemplatesDetail - * @request GET:/gitignore/templates/{language} - */ - templatesDetail: (language: string, params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates/${language}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - issues = { - /** - * @description List issues. List all issues across all the authenticated user's visible repositories. - * - * @name IssuesList - * @request GET:/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - legacy = { - /** - * @description Find issues by state and keyword. - * - * @name IssuesSearchDetail - * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} - * @deprecated - */ - 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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter. - * - * @name ReposSearchDetail - * @request GET:/legacy/repos/search/{keyword} - * @deprecated - */ - reposSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** Filter results by language */ - language?: string; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/legacy/repos/search/${keyword}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description This API call is added for compatibility reasons only. - * - * @name UserEmailDetail - * @request GET:/legacy/user/email/{email} - * @deprecated - */ - userEmailDetail: (email: string, params: RequestParams = {}) => - this.request({ - path: `/legacy/user/email/${email}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Find users by keyword. - * - * @name UserSearchDetail - * @request GET:/legacy/user/search/{keyword} - * @deprecated - */ - userSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/legacy/user/search/${keyword}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - markdown = { - /** - * @description Render an arbitrary Markdown document - * - * @name MarkdownCreate - * @request POST:/markdown - */ - markdownCreate: (body: Markdown, params: RequestParams = {}) => - this.request({ - path: `/markdown`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Render a Markdown document in raw mode - * - * @name PostMarkdown - * @request POST:/markdown/raw - */ - postMarkdown: (params: RequestParams = {}) => - this.request({ - path: `/markdown/raw`, - method: "POST", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - meta = { - /** - * @description This gives some information about GitHub.com, the service. - * - * @name MetaList - * @request GET:/meta - */ - metaList: (params: RequestParams = {}) => - this.request({ - path: `/meta`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - networks = { - /** - * @description List public events for a network of repositories. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - }; - notifications = { - /** - * @description List your notifications. List all notifications for the current user, grouped by repository. - * - * @name NotificationsList - * @request GET:/notifications - */ - notificationsList: ( - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/notifications`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Mark as read. Marking a notification as "read" removes it from the default view on GitHub.com. - * - * @name NotificationsUpdate - * @request PUT:/notifications - */ - notificationsUpdate: (body: NotificationMarkRead, params: RequestParams = {}) => - this.request({ - path: `/notifications`, - method: "PUT", - body: body, - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description View a single thread. - * - * @name ThreadsDetail - * @request GET:/notifications/threads/{id} - */ - threadsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Mark a thread as read - * - * @name ThreadsPartialUpdate - * @request PATCH:/notifications/threads/{id} - */ - threadsPartialUpdate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}`, - method: "PATCH", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a Thread Subscription. - * - * @name ThreadsSubscriptionDelete - * @request DELETE:/notifications/threads/{id}/subscription - */ - threadsSubscriptionDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}/subscription`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Thread Subscription. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Set a Thread Subscription. This lets you subscribe to a thread, or ignore it. Subscribing to a thread is unnecessary if the user is already subscribed to the repository. Ignoring a thread will mute all future notifications (until you comment or get @mentioned). - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - }; - orgs = { - /** - * @description Get an Organization. - * - * @name OrgsDetail - * @request GET:/orgs/{org} - */ - orgsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit an Organization. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List public events for an organization. - * - * @name EventsDetail - * @request GET:/orgs/{org}/events - */ - eventsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/events`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List issues. List all issues for a given organization for the authenticated user. - * - * @name IssuesDetail - * @request GET:/orgs/{org}/issues - */ - issuesDetail: ( - org: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Members list. List all users who are members of an organization. A member is a user tha belongs to at least 1 team in the organization. If the authenticated user is also an owner of this organization then both concealed and public members will be returned. If the requester is not an owner of the organization the query will be redirected to the public members list. - * - * @name MembersDetail - * @request GET:/orgs/{org}/members - */ - membersDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/members`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Remove a member. Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if a user is, publicly or privately, a member of the organization. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Public members list. Members of an organization can choose to have their membership publicized or not. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Conceal a user's membership. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check public membership. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Publicize a user's membership. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories for the specified org. - * - * @name ReposDetail - * @request GET:/orgs/{org}/repos - */ - reposDetail: ( - org: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List teams. - * - * @name TeamsDetail - * @request GET:/orgs/{org}/teams - */ - teamsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/teams`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create team. In order to create a team, the authenticated user must be an owner of organization. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - }; - rateLimit = { - /** - * @description Get your current rate limit status Note: Accessing this endpoint does not count against your rate limit. - * - * @name RateLimitList - * @request GET:/rate_limit - */ - rateLimitList: (params: RequestParams = {}) => - this.request({ - path: `/rate_limit`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - repos = { - /** - * @description Delete a Repository. Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required. - * - * @name ReposDelete - * @request DELETE:/repos/{owner}/{repo} - */ - reposDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List assignees. This call lists all the available assignees (owner + collaborators) to which issues may be assigned. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check assignee. You may also check to see if a particular user is an assignee for a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of branches - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get Branch - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List. When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Remove collaborator. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if user is a collaborator - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Add collaborator. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List commit comments for a repository. Comments are ordered by ascending ID. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a commit comment - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single commit comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update a commit comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List commits on a repository. - * - * @name CommitsDetail - * @request GET:/repos/{owner}/{repo}/commits - */ - commitsDetail: ( - owner: string, - repo: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - /** Sha or branch to start listing commits from. */ - sha?: string; - /** Only commits containing this file path will be returned. */ - path?: string; - /** GitHub login, name, or email by which to filter by commit author. */ - author?: string; - /** ISO 8601 Date - Only commits before this date will be returned. */ - until?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/commits`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the combined Status for a specific Ref The Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access this endpoint during the preview period, you must provide a custom media type in the Accept header: application/vnd.github.she-hulk-preview+json - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single commit. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments for a single commitList comments for a single commit. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a commit comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Compare two commits - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a file. This method deletes a file in a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get contents. This method returns the contents of a file or directory in a repository. Files and symlinks support a custom media type for getting the raw content. Directories and submodules do not support custom media types. Note: This API supports files up to 1 megabyte in size. Here can be many outcomes. For details see "http://developer.github.com/v3/repos/contents/" - * - * @name ContentsDetail - * @request GET:/repos/{owner}/{repo}/contents/{path} - */ - contentsDetail: ( - owner: string, - repo: string, - path: string, - query?: { - /** The content path. */ - path?: string; - /** The String name of the Commit/Branch/Tag. Defaults to 'master'. */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a file. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of contributors. - * - * @name ContributorsDetail - * @request GET:/repos/{owner}/{repo}/contributors - */ - contributorsDetail: ( - owner: string, - repo: string, - query: { - /** Set to 1 or true to include anonymous contributors in results. */ - anon: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/contributors`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with pull access can view deployments for a repository - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with push access can create a deployment for a given ref - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with pull access can view deployment statuses for a deployment - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Deployment Status Users with push access can create deployment statuses for a given deployment: - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Deprecated. List downloads for a repository. - * - * @name DownloadsDetail - * @request GET:/repos/{owner}/{repo}/downloads - * @deprecated - */ - downloadsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/downloads`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Deprecated. Delete a download. - * - * @name DownloadsDelete - * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - */ - downloadsDelete: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Deprecated. Get a single download. - * - * @name DownloadsDetail2 - * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of repository events. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List forks. - * - * @name ForksDetail - * @request GET:/repos/{owner}/{repo}/forks - */ - forksDetail: ( - owner: string, - repo: string, - query?: { - /** @default "newes" */ - sort?: "newes" | "oldes" | "watchers"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/forks`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a fork. Forking a Repository happens asynchronously. Therefore, you may have to wai a short period before accessing the git objects. If this takes longer than 5 minutes, be sure to contact Support. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Blob. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Blob. Since blobs can be any arbitrary binary data, the input and responses for the blob API takes an encoding parameter that can be either utf-8 or base64. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Commit. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Commit. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get all References - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Reference - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a Reference Example: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a Example: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0 - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Reference - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update a Reference - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Tag Object. Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Tag. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Tree. The tree creation API will take nested entries as well. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Tree. - * - * @name GitTreesDetail - * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} - */ - gitTreesDetail: ( - owner: string, - repo: string, - shaCode: string, - query?: { - /** Get a Tree Recursively. (0 or 1) */ - recursive?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of hooks. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a hook. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a hook. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get single hook. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a hook. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Test a push hook. This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated. Note: Previously /repos/:owner/:repo/hooks/:id/tes - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List issues for a repository. - * - * @name IssuesDetail - * @request GET:/repos/{owner}/{repo}/issues - */ - issuesDetail: ( - owner: string, - repo: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create an issue. Any user with pull access to a repository can create an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments in a repository. - * - * @name IssuesCommentsDetail - * @request GET:/repos/{owner}/{repo}/issues/comments - */ - issuesCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List issue events for a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single event. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single issue - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit an issue. Issue owners and users with push access can edit an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments on an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List events for an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Remove all labels from an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List labels on an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Add labels to an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Replace all labels for an issue. Sending an empty array ([]) will remove all Labels from the Issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Remove a label from an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of keys. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a key. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a key. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a key - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List all labels for this repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a label. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a label. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single label. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update a label. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List languages. List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Perform a merge. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List milestones for a repository. - * - * @name MilestonesDetail - * @request GET:/repos/{owner}/{repo}/milestones - */ - milestonesDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "due_date" */ - sort?: "due_date" | "completeness"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/milestones`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a milestone. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a milestone. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single milestone. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update a milestone. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get labels for every issue in a milestone. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List your notifications in a repository List all notifications for the current user. - * - * @name NotificationsDetail - * @request GET:/repos/{owner}/{repo}/notifications - */ - notificationsDetail: ( - owner: string, - repo: string, - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/notifications`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Mark notifications as read in a repository. Marking all notifications in a repository as "read" removes them from the default view on GitHub.com. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List pull requests. - * - * @name PullsDetail - * @request GET:/repos/{owner}/{repo}/pulls - */ - pullsDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** - * Filter pulls by head user and branch name in the format of 'user:ref-name'. - * Example: github:new-script-format. - */ - head?: string; - /** Filter pulls by base branch name. Example - gh-pages. */ - base?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a pull request. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments in a repository. By default, Review Comments are ordered by ascending ID. - * - * @name PullsCommentsDetail - * @request GET:/repos/{owner}/{repo}/pulls/comments - */ - pullsCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single pull request. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update a pull request. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments on a pull request. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a comment. #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ ) description: | Alternative Input. Instead of passing commit_id, path, and position you can reply to an existing Pull Request Comment like this: body Required string in_reply_to Required number - Comment id to reply to. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List commits on a pull request. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List pull requests files. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get if a pull request has been merged. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Merge a pull request (Merge Button's) - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the README. This method returns the preferred README for a repository. - * - * @name ReadmeDetail - * @request GET:/repos/{owner}/{repo}/readme - */ - readmeDetail: ( - owner: string, - repo: string, - query?: { - /** The String name of the Commit/Branch/Tag. Defaults to master. */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/readme`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a release Users with push access to the repository can create a release. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a release asset - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single release asset - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a release asset Users with push access to the repository can edit a release asset. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with push access to the repository can delete a release. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single release - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with push access to the repository can edit a release - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List assets for a release - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List Stargazers. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the number of additions and deletions per week. Returns a weekly aggregate of the number of additions and deletions pushed to a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the last year of commit activity data. Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get contributors list with additions, deletions, and commit counts. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the weekly commit count for the repo owner and everyone else. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the number of commits per hour in each day. Each array contains the day number, hour number, and number of commits 0-6 Sunday - Saturday 0-23 Hour of day Number of commits For example, [2, 14, 25] indicates that there were 25 total commits, during the 2.00pm hour on Tuesdays. All times are based on the time zone of individual commits. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List Statuses for a specific Ref. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Status. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List watchers. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a Repository Subscription. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Repository Subscription. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Set a Repository Subscription - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of tags. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of teams - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List Stargazers. New implementation. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get archive link. This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. Note: For private repositories, these links are temporary and expire quickly. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - }; - repositories = { - /** - * @description List all public repositories. This provides a dump of every public repository, in the order that they were created. Note: Pagination is powered exclusively by the since parameter. is the Link header to get the URL for the next page of repositories. - * - * @name RepositoriesList - * @request GET:/repositories - */ - repositoriesList: ( - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - search = { - /** - * @description Search code. - * - * @name CodeList - * @request GET:/search/code - */ - codeList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported code - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier - * you can restrict the search to just the file contents, the file path, - * or both. - * 'Languages' Searches code based on the language it's written in. - * 'Forks' Filters repositories based on the number of forks, and/or - * whether code from forked repositories should be included in the results - * at all. - * 'Size' Finds files that match a certain size (in bytes). - * 'Path' Specifies the path that the resulting file must be at. - * 'Extension' Matches files with a certain extension. - * 'Users' or 'Repositories' Limits searches to a specific user or repository. - */ - q: string; - /** - * Can only be 'indexed', which indicates how recently a file has been indexed - * by the GitHub search infrastructure. If not provided, results are sorted - * by best match. - */ - sort?: "indexed"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/code`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Find issues by state and keyword. (This method returns up to 100 results per page.) - * - * @name IssuesList - * @request GET:/search/issues - */ - issuesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The q search term can also contain any combination of the supported issue search qualifiers: */ - q: string; - /** The sort field. Can be comments, created, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "created" | "comments"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Search repositories. - * - * @name RepositoriesList - * @request GET:/search/repositories - */ - repositoriesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported repository - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the repository name, description, readme, - * or any combination of these. - * 'Size' Finds repositories that match a certain size (in kilobytes). - * 'Forks' Filters repositories based on the number of forks, and/or whether - * forked repositories should be included in the results at all. - * 'Created' and 'Last Updated' Filters repositories based on times of - * creation, or when they were last updated. - * 'Users or Repositories' Limits searches to a specific user or repository. - * 'Languages' Searches repositories based on the language they are written in. - * 'Stars' Searches repositories based on the number of stars. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "stars" | "forks" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Search users. - * - * @name UsersList - * @request GET:/search/users - */ - usersList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported user - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the username, public email, full name, - * location, or any combination of these. - * 'Repository count' Filters users based on the number of repositories they - * have. - * 'Location' Filter users by the location indicated in their profile. - * 'Language' Search for users that have repositories that match a certain - * language. - * 'Created' Filter users based on when they joined. - * 'Followers' Filter users based on the number of followers they have. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "followers" | "repositories" | "joined"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - teams = { - /** - * @description Delete team. In order to delete a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @name TeamsDelete - * @request DELETE:/teams/{teamId} - */ - teamsDelete: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get team. - * - * @name TeamsDetail - * @request GET:/teams/{teamId} - */ - teamsDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit team. In order to edit a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List team members. In order to list members in a team, the authenticated user must be a member of the team. - * - * @name MembersDetail - * @request GET:/teams/{teamId}/members - */ - membersDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description The "Remove team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships. Remove team member. In order to remove a user from a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. NOTE This does not delete the user, it just remove them from the team. - * - * @name MembersDelete - * @request DELETE:/teams/{teamId}/members/{username} - * @deprecated - */ - membersDelete: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description The "Get team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships. Get team member. In order to get if a user is a member of a team, the authenticated user mus be a member of the team. - * - * @name MembersDetail2 - * @request GET:/teams/{teamId}/members/{username} - * @deprecated - * @originalName membersDetail - * @duplicate - */ - membersDetail2: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams. Add team member. In order to add a user to a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. - * - * @name MembersUpdate - * @request PUT:/teams/{teamId}/members/{username} - * @deprecated - */ - membersUpdate: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "PUT", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Remove team membership. In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get team membership. In order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Add team membership. In order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. If the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team. If the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the 'pending' state until the user accepts the invitation, at which point the membership will transition to the 'active' state and the user will be added as a member of the team. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List team repos - * - * @name ReposDetail - * @request GET:/teams/{teamId}/repos - */ - reposDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/repos`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if a team manages a repository - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - }; - user = { - /** - * @description Get the authenticated user. - * - * @name UserList - * @request GET:/user - */ - userList: (params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update the authenticated user. - * - * @name UserPartialUpdate - * @request PATCH:/user - */ - userPartialUpdate: (body: UserUpdate, params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete email address(es). You can include a single email address or an array of addresses. - * - * @name EmailsDelete - * @request DELETE:/user/emails - */ - emailsDelete: (body: UserEmails, params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "DELETE", - body: body, - type: ContentType.Json, - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List email addresses for a user. In the final version of the API, this method will return an array of hashes with extended information for each email address indicating if the address has been verified and if it's primary email address for GitHub. Until API v3 is finalized, use the application/vnd.github.v3 media type to get other response format. - * - * @name EmailsList - * @request GET:/user/emails - */ - emailsList: (params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Add email address(es). You can post a single email address or an array of addresses. - * - * @name EmailsCreate - * @request POST:/user/emails - */ - emailsCreate: (body: EmailsPost, params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "POST", - body: body, - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List the authenticated user's followers - * - * @name FollowersList - * @request GET:/user/followers - */ - followersList: (params: RequestParams = {}) => - this.request({ - path: `/user/followers`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List who the authenticated user is following. - * - * @name FollowingList - * @request GET:/user/following - */ - followingList: (params: RequestParams = {}) => - this.request({ - path: `/user/following`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Unfollow a user. Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingDelete - * @request DELETE:/user/following/{username} - */ - followingDelete: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if you are following a user. - * - * @name FollowingDetail - * @request GET:/user/following/{username} - */ - followingDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Follow a user. Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingUpdate - * @request PUT:/user/following/{username} - */ - followingUpdate: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "PUT", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List issues. List all issues across owned and member repositories for the authenticated user. - * - * @name IssuesList - * @request GET:/user/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List your public keys. Lists the current user's keys. Management of public keys via the API requires that you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes. - * - * @name KeysList - * @request GET:/user/keys - */ - keysList: (params: RequestParams = {}) => - this.request({ - path: `/user/keys`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a public key. - * - * @name KeysCreate - * @request POST:/user/keys - */ - keysCreate: (body: UserKeysPost, params: RequestParams = {}) => - this.request({ - path: `/user/keys`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope. - * - * @name KeysDelete - * @request DELETE:/user/keys/{keyId} - */ - keysDelete: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single public key. - * - * @name KeysDetail - * @request GET:/user/keys/{keyId} - */ - keysDetail: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List public and private organizations for the authenticated user. - * - * @name OrgsList - * @request GET:/user/orgs - */ - orgsList: (params: RequestParams = {}) => - this.request({ - path: `/user/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories for the authenticated user. Note that this does not include repositories owned by organizations which the user can access. You can lis user organizations and list organization repositories separately. - * - * @name ReposList - * @request GET:/user/repos - */ - reposList: ( - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @name ReposCreate - * @request POST:/user/repos - */ - reposCreate: (body: PostRepo, params: RequestParams = {}) => - this.request({ - path: `/user/repos`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories being starred by the authenticated user. - * - * @name StarredList - * @request GET:/user/starred - */ - starredList: ( - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "created" */ - sort?: "created" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/starred`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Unstar a repository - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if you are starring a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Star a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories being watched by the authenticated user. - * - * @name SubscriptionsList - * @request GET:/user/subscriptions - */ - subscriptionsList: (params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Stop watching a repository - * - * @name SubscriptionsDelete - * @request DELETE:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if you are watching a repository. - * - * @name SubscriptionsDetail - * @request GET:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Watch a repository. - * - * @name SubscriptionsUpdate - * @request PUT:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsUpdate: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "PUT", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth. - * - * @name TeamsList - * @request GET:/user/teams - */ - teamsList: (params: RequestParams = {}) => - this.request({ - path: `/user/teams`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - users = { - /** - * @description Get all users. This provides a dump of every user, in the order that they signed up for GitHub. Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users. - * - * @name UsersList - * @request GET:/users - */ - usersList: ( - query?: { - /** The integer ID of the last user that you've seen. */ - since?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single user. - * - * @name UsersDetail - * @request GET:/users/{username} - */ - usersDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. - * - * @name EventsDetail - * @request GET:/users/{username}/events - */ - eventsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/events`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description This is the user's organization dashboard. You must be authenticated as the user to view this. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List a user's followers - * - * @name FollowersDetail - * @request GET:/users/{username}/followers - */ - followersDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/followers`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if one user follows another. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List a users gists. - * - * @name GistsDetail - * @request GET:/users/{username}/gists - */ - gistsDetail: ( - username: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List public keys for a user. Lists the verified public keys for a user. This is accessible by anyone. - * - * @name KeysDetail - * @request GET:/users/{username}/keys - */ - keysDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/keys`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List all public organizations for a user. - * - * @name OrgsDetail - * @request GET:/users/{username}/orgs - */ - orgsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description These are events that you'll only see public events. - * - * @name ReceivedEventsDetail - * @request GET:/users/{username}/received_events - */ - receivedEventsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/received_events`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List public events that a user has received - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List public repositories for the specified user. - * - * @name ReposDetail - * @request GET:/users/{username}/repos - */ - reposDetail: ( - username: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories being starred by a user. - * - * @name StarredDetail - * @request GET:/users/{username}/starred - */ - starredDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/starred`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories being watched by a user. - * - * @name SubscriptionsDetail - * @request GET:/users/{username}/subscriptions - */ - subscriptionsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/subscriptions`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; -} - -/* CUSTOM TEMPLATE */ diff --git a/tests/spec/templates/schema.json b/tests/spec/templates/schema.json deleted file mode 100644 index 05dfe7d5..00000000 --- a/tests/spec/templates/schema.json +++ /dev/null @@ -1,23683 +0,0 @@ -{ - "swagger": "2.0", - "schemes": ["https"], - "host": "api.github.com", - "basePath": "/", - "info": { - "description": "Powerful collaboration, code review, and code management for open source and private projects.\n", - "termsOfService": "https://help.github.com/articles/github-terms-of-service/#b-api-terms", - "title": "GitHub", - "version": "v3", - "x-apisguru-categories": ["collaboration", "developer_tools"], - "x-logo": { - "url": "https://api.apis.guru/v2/cache/logo/https_twitter.com_github_profile_image.jpeg" - }, - "x-origin": [ - { - "format": "swagger", - "url": "https://raw.githubusercontent.com/APIs-guru/unofficial_openapi_specs/master/github.com/v3/swagger.yaml", - "version": "2.0" - } - ], - "x-preferred": false, - "x-providerName": "github.com", - "x-unofficialSpec": true - }, - "externalDocs": { - "url": "https://developer.github.com/v3/" - }, - "consumes": ["application/json"], - "produces": ["application/json"], - "securityDefinitions": { - "oauth_2_0": { - "authorizationUrl": "https://github.com/login/oauth/authorize", - "description": "OAuth2 is a protocol that lets external apps request authorization to private\ndetails in a user's GitHub account without getting their password. This is\npreferred over Basic Authentication because tokens can be limited to specific\ntypes of data, and can be revoked by users at any time.\n", - "flow": "accessCode", - "scopes": { - "admin:org": "", - "admin:org_hook": "", - "admin:public_key": "", - "admin:repo_hook": "", - "delete_repo": "", - "gist": "", - "notifications": "", - "public_repo": "", - "read:org": "", - "read:public_key": "", - "read:repo_hook": "", - "repo": "", - "repo:status": "", - "repo_deployment": "", - "user": "", - "user:email": "", - "user:follow": "", - "write:org": "", - "write:public_key": "", - "write:repo_hook": "" - }, - "tokenUrl": "https://github.com/login/oauth/access_token", - "type": "oauth2" - } - }, - "paths": { - "/emojis": { - "get": { - "description": "Lists all the emojis available to use on GitHub.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/emojis" - } - }, - "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" - } - } - } - } - } - }, - "/events": { - "get": { - "description": "List public events.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/events" - } - }, - "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" - } - } - } - } - } - }, - "/feeds": { - "get": { - "description": "List Feeds.\nGitHub provides several timeline resources in Atom format. The Feeds API\n lists all the feeds available to the authenticating user.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/feeds" - } - }, - "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" - } - } - } - } - } - }, - "/gists": { - "get": { - "description": "List the authenticated user's gists or if called anonymously, this will\nreturn all public gists.\n", - "parameters": [ - { - "description": "Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ.\nOnly gists updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gists" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a gist.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/postGist" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/gist" - } - }, - "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" - } - } - } - } - } - }, - "/gists/public": { - "get": { - "description": "List all public gists.", - "parameters": [ - { - "description": "Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ.\nOnly gists updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gists" - } - }, - "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" - } - } - } - } - } - }, - "/gists/starred": { - "get": { - "description": "List the authenticated user's starred gists.", - "parameters": [ - { - "description": "Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ.\nOnly gists updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gists" - } - }, - "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" - } - } - } - } - } - }, - "/gists/{id}": { - "delete": { - "description": "Delete a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gist" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/patchGist" - } - } - ], - "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/gist" - } - }, - "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" - } - } - } - } - } - }, - "/gists/{id}/comments": { - "get": { - "description": "List comments on a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/comments" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a commen", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commentBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/comment" - } - }, - "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" - } - } - } - } - } - }, - "/gists/{id}/comments/{commentId}": { - "delete": { - "description": "Delete a comment.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single comment.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/comment" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a comment.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/comment" - } - } - ], - "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/comment" - } - }, - "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" - } - } - } - } - } - }, - "/gists/{id}/forks": { - "post": { - "description": "Fork a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Exists.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Not exists.", - "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" - } - } - } - } - } - }, - "/gists/{id}/star": { - "delete": { - "description": "Unstar a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Item removed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if a gist is starred.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Exists.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Not exists.", - "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" - } - } - } - } - }, - "put": { - "description": "Star a gist.", - "parameters": [ - { - "description": "Id of gist.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Starred.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/gitignore/templates": { - "get": { - "description": "Listing available templates.\nList all templates available to pass as an option when creating a repository.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - } - }, - "/gitignore/templates/{language}": { - "get": { - "description": "Get a single template.", - "parameters": [ - { - "in": "path", - "name": "language", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore-lang" - } - }, - "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" - } - } - } - } - } - }, - "/issues": { - "get": { - "description": "List issues.\nList all issues across all the authenticated user's visible repositories.\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" - }, - { - "description": "String list of comma separated Label names. Example - bug,ui,@high.", - "in": "query", - "name": "labels", - "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" - }, - { - "description": "Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nOnly issues updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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" - } - } - } - } - } - }, - "/legacy/issues/search/{owner}/{repository}/{state}/{keyword}": { - "get": { - "deprecated": true, - "description": "Find issues by state and keyword.", - "parameters": [ - { - "description": "The search term.", - "in": "path", - "name": "keyword", - "required": true, - "type": "string" - }, - { - "description": "Indicates the state of the issues to return. Can be either open or closed.", - "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" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-issues-by-keyword" - } - }, - "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" - } - } - } - } - } - }, - "/legacy/repos/search/{keyword}": { - "get": { - "deprecated": true, - "description": "Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter.", - "parameters": [ - { - "description": "The search term", - "in": "path", - "name": "keyword", - "required": true, - "type": "string" - }, - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "Filter results by language", - "in": "query", - "name": "language", - "type": "string" - }, - { - "description": "The page number to fetch", - "in": "query", - "name": "start_page", - "type": "string" - }, - { - "description": "The sort field. One of stars, forks, or updated. Default: results are sorted by best match.", - "enum": ["updated", "stars", "forks"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-repositories-by-keyword" - } - }, - "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" - } - } - } - } - } - }, - "/legacy/user/email/{email}": { - "get": { - "deprecated": true, - "description": "This API call is added for compatibility reasons only.", - "parameters": [ - { - "description": "The email address", - "in": "path", - "name": "email", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-user-by-email" - } - }, - "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" - } - } - } - } - } - }, - "/legacy/user/search/{keyword}": { - "get": { - "deprecated": true, - "description": "Find users by keyword.", - "parameters": [ - { - "description": "The search term", - "in": "path", - "name": "keyword", - "required": true, - "type": "string" - }, - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "The page number to fetch", - "in": "query", - "name": "start_page", - "type": "string" - }, - { - "description": "The sort field. One of stars, forks, or updated. Default: results are sorted by best match.", - "enum": ["updated", "stars", "forks"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-users-by-keyword" - } - }, - "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" - } - } - } - } - } - }, - "/markdown": { - "post": { - "description": "Render an arbitrary Markdown document", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/markdown" - } - } - ], - "produces": ["text/html"], - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/markdown/raw": { - "post": { - "consumes": ["text/plain"], - "description": "Render a Markdown document in raw mode", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "produces": ["text/html"], - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/meta": { - "get": { - "description": "This gives some information about GitHub.com, the service.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/meta" - } - }, - "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" - } - } - } - } - } - }, - "/networks/{owner}/{repo}/events": { - "get": { - "description": "List public events for a network of repositories.", - "parameters": [ - { - "description": "Name of the owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/events" - } - }, - "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" - } - } - } - } - } - }, - "/notifications": { - "get": { - "description": "List your notifications.\nList all notifications for the current user, grouped by repository.\n", - "parameters": [ - { - "description": "True to show notifications marked as read.", - "in": "query", - "name": "all", - "type": "boolean" - }, - { - "description": "True to show only notifications in which the user is directly participating\nor mentioned.\n", - "in": "query", - "name": "participating", - "type": "boolean" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/notifications" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Mark as read.\nMarking a notification as \"read\" removes it from the default view on GitHub.com.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/notificationMarkRead" - } - } - ], - "responses": { - "205": { - "description": "Marked as read.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/notifications/threads/{id}": { - "get": { - "description": "View a single thread.", - "parameters": [ - { - "description": "Id of thread.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/notifications" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Mark a thread as read", - "parameters": [ - { - "description": "Id of thread.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "205": { - "description": "Thread marked as read.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/notifications/threads/{id}/subscription": { - "delete": { - "description": "Delete a Thread Subscription.", - "parameters": [ - { - "description": "Id of thread.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No Content\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a Thread Subscription.", - "parameters": [ - { - "description": "Id of thread.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/subscription" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Set a Thread Subscription.\nThis lets you subscribe to a thread, or ignore it. Subscribing to a thread\nis unnecessary if the user is already subscribed to the repository. Ignoring\na thread will mute all future notifications (until you comment or get @mentioned).\n", - "parameters": [ - { - "description": "Id of thread.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/putSubscription" - } - } - ], - "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/subscription" - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}": { - "get": { - "description": "Get an Organization.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/organization" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit an Organization.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/patchOrg" - } - } - ], - "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/organization" - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/events": { - "get": { - "description": "List public events for an organization.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/events" - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/issues": { - "get": { - "description": "List issues.\nList all issues for a given organization for the authenticated user.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "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" - }, - { - "description": "String list of comma separated Label names. Example - bug,ui,@high.", - "in": "query", - "name": "labels", - "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" - }, - { - "description": "Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nOnly issues updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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" - } - } - } - } - } - }, - "/orgs/{org}/members": { - "get": { - "description": "Members list.\nList all users who are members of an organization. A member is a user tha\nbelongs to at least 1 team in the organization. If the authenticated user\nis also an owner of this organization then both concealed and public members\nwill be returned. If the requester is not an owner of the organization the\nquery will be redirected to the public members list.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "302": { - "description": "Response if requester is not an organization member.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/members/{username}": { - "delete": { - "description": "Remove a member.\nRemoving a user from this list will remove them from all teams and they\nwill no longer have any access to the organization's repositories.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Name of the user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if a user is, publicly or privately, a member of the organization.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Name of the user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content. Response if requester is an organization member and user is a member\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" - } - } - }, - "302": { - "description": "Found. Response if requester is not an organization member\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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Not Found.\na. Response if requester is an organization member and user is not a member\nb. Response if requester is not an organization member and is inquiring about themselves\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" - } - } - } - } - } - }, - "/orgs/{org}/public_members": { - "get": { - "description": "Public members list.\nMembers of an organization can choose to have their membership publicized\nor not.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/public_members/{username}": { - "delete": { - "description": "Conceal a user's membership.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Name of the user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Concealed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check public membership.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Name of the user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "User is a public member.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "User is not a public member.", - "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" - } - } - } - } - }, - "put": { - "description": "Publicize a user's membership.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Name of the user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Publicized.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/repos": { - "get": { - "description": "List repositories for the specified org.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "default": "all", - "enum": ["all", "public", "private", "forks", "sources", "member"], - "in": "query", - "name": "type", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repos" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a new repository for the authenticated user. OAuth users must supply\nrepo scope.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/postRepo" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/repos" - } - }, - "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" - } - } - } - } - } - }, - "/orgs/{org}/teams": { - "get": { - "description": "List teams.", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/teams" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create team.\nIn order to create a team, the authenticated user must be an owner of organization.\n", - "parameters": [ - { - "description": "Name of organisation.", - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/orgTeamsPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/team" - } - }, - "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" - } - } - } - } - } - }, - "/rate_limit": { - "get": { - "description": "Get your current rate limit status\nNote: Accessing this endpoint does not count against your rate limit.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/rate_limit" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}": { - "delete": { - "description": "Delete a Repository.\nDeleting a repository requires admin access. If OAuth is used, the delete_repo\nscope is required.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Item removed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repo" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/repoEdit" - } - } - ], - "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/repo" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/assignees": { - "get": { - "description": "List assignees.\nThis call lists all the available assignees (owner + collaborators) to which\nissues may be assigned.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/assignees" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/assignees/{assignee}": { - "get": { - "description": "Check assignee.\nYou may also check to see if a particular user is an assignee for a repository.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Login of the assignee.", - "in": "path", - "name": "assignee", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "User is an assignee.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "User isn't an assignee.", - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/branches": { - "get": { - "description": "Get list of branches", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/branches" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/branches/{branch}": { - "get": { - "description": "Get Branch", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Name of the branch.", - "in": "path", - "name": "branch", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/branch" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/collaborators": { - "get": { - "description": "List.\nWhen authenticating as an organization owner of an organization-owned\nrepository, all organization owners are included in the list of\ncollaborators. Otherwise, only users with access to the repository are\nreturned in the collaborators list.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/collaborators/{user}": { - "delete": { - "description": "Remove collaborator.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Login of the user.", - "in": "path", - "name": "user", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Collaborator removed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if user is a collaborator", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Login of the user.", - "in": "path", - "name": "user", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "User is a collaborator.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "User is not a collaborator.", - "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" - } - } - } - } - }, - "put": { - "description": "Add collaborator.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Login of the user.", - "in": "path", - "name": "user", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Collaborator added.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/comments": { - "get": { - "description": "List commit comments for a repository.\nComments are ordered by ascending ID.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repoComments" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/comments/{commentId}": { - "delete": { - "description": "Delete a commit comment", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single commit comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/commitComment" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update a commit comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commentBody" - } - } - ], - "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/commitComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/commits": { - "get": { - "description": "List commits on a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Sha or branch to start listing commits from.", - "in": "query", - "name": "sha", - "type": "string" - }, - { - "description": "Only commits containing this file path will be returned.", - "in": "query", - "name": "path", - "type": "string" - }, - { - "description": "GitHub login, name, or email by which to filter by commit author.", - "in": "query", - "name": "author", - "type": "string" - }, - { - "description": "ISO 8601 Date - Only commits before this date will be returned.", - "in": "query", - "name": "until", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/commits" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/commits/{ref}/status": { - "get": { - "description": "Get the combined Status for a specific Ref\nThe Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details.\nTo access this endpoint during the preview period, you must provide a custom media type in the Accept header:\napplication/vnd.github.she-hulk-preview+json\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/refStatus" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/commits/{shaCode}": { - "get": { - "description": "Get a single commit.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "SHA-1 code of the commit.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/commit" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/commits/{shaCode}/comments": { - "get": { - "description": "List comments for a single commitList comments for a single commit.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "SHA-1 code of the commit.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repoComments" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a commit comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "SHA-1 code of the commit.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commitCommentBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/commitComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/compare/{baseId}...{headId}": { - "get": { - "description": "Compare two commits", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "baseId", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "headId", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/compare-commits" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/contents/{path}": { - "delete": { - "description": "Delete a file.\nThis method deletes a file in a repository.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "path", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/deleteFileBody" - } - } - ], - "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/deleteFile" - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get contents.\nThis method returns the contents of a file or directory in a repository.\nFiles and symlinks support a custom media type for getting the raw content.\nDirectories and submodules do not support custom media types.\nNote: This API supports files up to 1 megabyte in size.\nHere can be many outcomes. For details see \"http://developer.github.com/v3/repos/contents/\"\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "path", - "required": true, - "type": "string" - }, - { - "description": "The content path.", - "in": "query", - "name": "path", - "type": "string" - }, - { - "description": "The String name of the Commit/Branch/Tag. Defaults to 'master'.", - "in": "query", - "name": "ref", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/contents-path" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Create a file.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "path", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/createFileBody" - } - } - ], - "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/createFile" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/contributors": { - "get": { - "description": "Get list of contributors.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Set to 1 or true to include anonymous contributors in results.", - "in": "query", - "name": "anon", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/deployments": { - "get": { - "description": "Users with pull access can view deployments for a repository", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repo-deployments" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Users with push access can create a deployment for a given ref", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/deployment" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/deployment-resp" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/deployments/{id}/statuses": { - "get": { - "description": "Users with pull access can view deployment statuses for a deployment", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "The Deployment ID to list the statuses from.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/deployment-statuses" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a Deployment Status\nUsers with push access can create deployment statuses for a given deployment:\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "The Deployment ID to list the statuses from.", - "in": "path", - "name": "id", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/deployment-statuses-create" - } - } - ], - "responses": { - "201": { - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/downloads": { - "get": { - "deprecated": true, - "description": "Deprecated. List downloads for a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/downloads" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/downloads/{downloadId}": { - "delete": { - "deprecated": true, - "description": "Deprecated. Delete a download.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of download.", - "in": "path", - "name": "downloadId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "deprecated": true, - "description": "Deprecated. Get a single download.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of download.", - "in": "path", - "name": "downloadId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/download" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/events": { - "get": { - "description": "Get list of repository events.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/events" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/forks": { - "get": { - "description": "List forks.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "default": "newes", - "enum": ["newes", "oldes", "watchers"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/forks" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a fork.\nForking a Repository happens asynchronously. Therefore, you may have to wai\na short period before accessing the git objects. If this takes longer than 5\nminutes, be sure to contact Support.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/forkBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/repo" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/blobs": { - "post": { - "description": "Create a Blob.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/blob" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/blobs" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/blobs/{shaCode}": { - "get": { - "description": "Get a Blob.\nSince blobs can be any arbitrary binary data, the input and responses for\nthe blob API takes an encoding parameter that can be either utf-8 or\nbase64. If your data cannot be losslessly sent as a UTF-8 string, you can\nbase64 encode it.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "SHA-1 code.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/blob" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/commits": { - "post": { - "description": "Create a Commit.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/repoCommitBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/gitCommit" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/commits/{shaCode}": { - "get": { - "description": "Get a Commit.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "SHA-1 code.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repoCommit" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/refs": { - "get": { - "description": "Get all References", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/refs" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a Reference", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/refsBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/headBranch" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/refs/{ref}": { - "delete": { - "description": "Delete a Reference\nExample: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a\nExample: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No Content", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a Reference", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/headBranch" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update a Reference", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/gitRefPatch" - } - } - ], - "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/headBranch" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/tags": { - "post": { - "description": "Create a Tag Object.\nNote that creating a tag object does not create the reference that makes a\ntag in Git. If you want to create an annotated tag in Git, you have to do\nthis call to create the tag object, and then create the refs/tags/[tag]\nreference. If you want to create a lightweight tag, you only have to create\nthe tag reference - this call would be unnecessary.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tagBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/tag" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/tags/{shaCode}": { - "get": { - "description": "Get a Tag.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/tag" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/trees": { - "post": { - "description": "Create a Tree.\nThe tree creation API will take nested entries as well. If both a tree and\na nested path modifying that tree are specified, it will overwrite the\ncontents of that tree with the new path contents and write a new tree out.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/tree" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/trees" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/git/trees/{shaCode}": { - "get": { - "description": "Get a Tree.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Tree SHA.", - "in": "path", - "name": "shaCode", - "required": true, - "type": "string" - }, - { - "description": "Get a Tree Recursively. (0 or 1)", - "in": "query", - "name": "recursive", - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/tree" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/hooks": { - "get": { - "description": "Get list of hooks.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/hook" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a hook.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/hookBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/hook" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/hooks/{hookId}": { - "delete": { - "description": "Delete a hook.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of hook.", - "in": "path", - "name": "hookId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get single hook.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of hook.", - "in": "path", - "name": "hookId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/hook" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a hook.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of hook.", - "in": "path", - "name": "hookId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/hookBody" - } - } - ], - "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/hook" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/hooks/{hookId}/tests": { - "post": { - "description": "Test a push hook.\nThis will trigger the hook with the latest push to the current repository\nif the hook is subscribed to push events. If the hook is not subscribed\nto push events, the server will respond with 204 but no test POST will\nbe generated.\nNote: Previously /repos/:owner/:repo/hooks/:id/tes\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of hook.", - "in": "path", - "name": "hookId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Hook is triggered.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues": { - "get": { - "description": "List issues for a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "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" - }, - { - "description": "String list of comma separated Label names. Example - bug,ui,@high.", - "in": "query", - "name": "labels", - "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" - }, - { - "description": "Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nOnly issues updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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" - } - } - } - } - }, - "post": { - "description": "Create an issue.\nAny user with pull access to a repository can create an issue.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/issue" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/issue" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/comments": { - "get": { - "description": "List comments in a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Ignored without 'sort' parameter.", - "in": "query", - "name": "direction", - "type": "string" - }, - { - "description": "", - "enum": ["created", "updated"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issuesComments" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/comments/{commentId}": { - "delete": { - "description": "Delete a comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "ID of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "ID of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issuesComment" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "ID of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commentBody" - } - } - ], - "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/issuesComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/events": { - "get": { - "description": "List issue events for a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issueEvents" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/events/{eventId}": { - "get": { - "description": "Get a single event.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of the event.", - "in": "path", - "name": "eventId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issueEvent" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/{number}": { - "get": { - "description": "Get a single issue", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issue" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit an issue.\nIssue owners and users with push access can edit an issue.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/issue" - } - } - ], - "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/issue" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/{number}/comments": { - "get": { - "description": "List comments on an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issuesComments" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commentBody" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/issuesComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/{number}/events": { - "get": { - "description": "List events for an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issueEvents" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/{number}/labels": { - "delete": { - "description": "Remove all labels from an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "List labels on an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/labels" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Add labels to an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/emailsPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/label" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Replace all labels for an issue.\nSending an empty array ([]) will remove all Labels from the Issue.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/emailsPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/label" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/issues/{number}/labels/{name}": { - "delete": { - "description": "Remove a label from an issue.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of issue.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Name of the label.", - "in": "path", - "name": "name", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Item removed.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/keys": { - "get": { - "description": "Get list of keys.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/keys" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a key.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/user-keys-post" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/user-keys-keyId" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/keys/{keyId}": { - "delete": { - "description": "Delete a key.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of key.", - "in": "path", - "name": "keyId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a key", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of key.", - "in": "path", - "name": "keyId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/user-keys-keyId" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/labels": { - "get": { - "description": "List all labels for this repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/labels" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a label.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/emailsPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/label" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/labels/{name}": { - "delete": { - "description": "Delete a label.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Name of the label.", - "in": "path", - "name": "name", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single label.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Name of the label.", - "in": "path", - "name": "name", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/label" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update a label.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Name of the label.", - "in": "path", - "name": "name", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/emailsPost" - } - } - ], - "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/label" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/languages": { - "get": { - "description": "List languages.\nList languages for the specified repository. The value on the right of a\nlanguage is the number of bytes of code written in that language.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/languages" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/merges": { - "post": { - "description": "Perform a merge.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/mergesBody" - } - } - ], - "responses": { - "201": { - "description": "Successful Response (The resulting merge commit)", - "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/mergesSuccessful" - } - }, - "204": { - "description": "No-op response (base already contains the head, nothing to merge)", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Missing base response or missing head response", - "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/mergesConflict" - } - }, - "409": { - "description": "Merge conflict response.", - "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/mergesConflict" - } - } - } - } - }, - "/repos/{owner}/{repo}/milestones": { - "get": { - "description": "List milestones for a repository.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "default": "open", - "description": "String to filter by state.", - "enum": ["open", "closed"], - "in": "query", - "name": "state", - "type": "string" - }, - { - "description": "Ignored without 'sort' parameter.", - "in": "query", - "name": "direction", - "type": "string" - }, - { - "default": "due_date", - "description": "", - "enum": ["due_date", "completeness"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/milestone" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a milestone.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/milestoneUpdate" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/milestone" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/milestones/{number}": { - "delete": { - "description": "Delete a milestone.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of milestone.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single milestone.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of milestone.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/milestone" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update a milestone.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of milestone.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/milestoneUpdate" - } - } - ], - "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/milestone" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/milestones/{number}/labels": { - "get": { - "description": "Get labels for every issue in a milestone.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Number of milestone.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/labels" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/notifications": { - "get": { - "description": "List your notifications in a repository\nList all notifications for the current user.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "True to show notifications marked as read.", - "in": "query", - "name": "all", - "type": "boolean" - }, - { - "description": "True to show only notifications in which the user is directly participating\nor mentioned.\n", - "in": "query", - "name": "participating", - "type": "boolean" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/notifications" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Mark notifications as read in a repository.\nMarking all notifications in a repository as \"read\" removes them from the\ndefault view on GitHub.com.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/notificationMarkRead" - } - } - ], - "responses": { - "205": { - "description": "Marked as read.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls": { - "get": { - "description": "List pull requests.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "default": "open", - "description": "String to filter by state.", - "enum": ["open", "closed"], - "in": "query", - "name": "state", - "type": "string" - }, - { - "description": "Filter pulls by head user and branch name in the format of 'user:ref-name'.\nExample: github:new-script-format.\n", - "in": "query", - "name": "head", - "type": "string" - }, - { - "description": "Filter pulls by base branch name. Example - gh-pages.", - "in": "query", - "name": "base", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/pulls" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a pull request.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/pullsPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/pulls" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/comments": { - "get": { - "description": "List comments in a repository.\nBy default, Review Comments are ordered by ascending ID.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Ignored without 'sort' parameter.", - "in": "query", - "name": "direction", - "type": "string" - }, - { - "description": "", - "enum": ["created", "updated"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/issuesComments" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/comments/{commentId}": { - "delete": { - "description": "Delete a comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/pullsComment" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a comment.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of comment.", - "in": "path", - "name": "commentId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/commentBody" - } - } - ], - "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/pullsComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/{number}": { - "get": { - "description": "Get a single pull request.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/pullRequest" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update a pull request.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/pullUpdate" - } - } - ], - "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/repo" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/{number}/comments": { - "get": { - "description": "List comments on a pull request.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/pullsComment" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a comment.\n #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ )\n description: |\n Alternative Input.\n Instead of passing commit_id, path, and position you can reply to an\n existing Pull Request Comment like this:\n\n body\n Required string\n in_reply_to\n Required number - Comment id to reply to.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/pullsCommentPost" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/pullsComment" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/{number}/commits": { - "get": { - "description": "List commits on a pull request.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/commits" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/{number}/files": { - "get": { - "description": "List pull requests files.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/pulls" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/pulls/{number}/merge": { - "get": { - "description": "Get if a pull request has been merged.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Pull request has been merged.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Pull request has not been merged.", - "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" - } - } - } - } - }, - "put": { - "description": "Merge a pull request (Merge Button's)", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Id of pull.", - "in": "path", - "name": "number", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/mergePullBody" - } - } - ], - "responses": { - "200": { - "description": "Response if merge was successful.", - "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/merge" - } - }, - "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" - } - } - }, - "405": { - "description": "Response if merge cannot be performed.", - "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/merge" - } - } - } - } - }, - "/repos/{owner}/{repo}/readme": { - "get": { - "description": "Get the README.\nThis method returns the preferred README for a repository.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "The String name of the Commit/Branch/Tag. Defaults to master.", - "in": "query", - "name": "ref", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/contents-path" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/releases": { - "get": { - "description": "Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/releases" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a release\nUsers with push access to the repository can create a release.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/release-create" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/release" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/releases/assets/{id}": { - "delete": { - "description": "Delete a release asset", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No Content", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single release asset", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/asset" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit a release asset\nUsers with push access to the repository can edit a release asset.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/assetPatch" - } - } - ], - "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/asset" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/releases/{id}": { - "delete": { - "description": "Users with push access to the repository can delete a release.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No Content", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single release", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/release" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Users with push access to the repository can edit a release", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/release-create" - } - } - ], - "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/release" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/releases/{id}/assets": { - "get": { - "description": "List assets for a release", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "id", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/assets" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stargazers": { - "get": { - "description": "List Stargazers.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stats/code_frequency": { - "get": { - "description": "Get the number of additions and deletions per week.\nReturns a weekly aggregate of the number of additions and deletions pushed\nto a repository.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/codeFrequencyStats" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stats/commit_activity": { - "get": { - "description": "Get the last year of commit activity data.\nReturns the last year of commit activity grouped by week. The days array\nis a group of commits per day, starting on Sunday.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/commitActivityStats" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stats/contributors": { - "get": { - "description": "Get contributors list with additions, deletions, and commit counts.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/contributorsStats" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stats/participation": { - "get": { - "description": "Get the weekly commit count for the repo owner and everyone else.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/participationStats" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/stats/punch_card": { - "get": { - "description": "Get the number of commits per hour in each day.\nEach array contains the day number, hour number, and number of commits\n0-6 Sunday - Saturday\n0-23 Hour of day\nNumber of commits\n\nFor example, [2, 14, 25] indicates that there were 25 total commits, during\nthe 2.00pm hour on Tuesdays. All times are based on the time zone of\nindividual commits.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/codeFrequencyStats" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/statuses/{ref}": { - "get": { - "description": "List Statuses for a specific Ref.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Ref to list the statuses from. It can be a SHA, a branch name, or a tag name.\n", - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/ref" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a Status.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Ref to list the statuses from. It can be a SHA, a branch name, or a tag name.\n", - "in": "path", - "name": "ref", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/headBranch" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/ref" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/subscribers": { - "get": { - "description": "List watchers.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/subscription": { - "delete": { - "description": "Delete a Repository Subscription.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a Repository Subscription.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/subscription" - } - }, - "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" - } - } - } - } - }, - "put": { - "description": "Set a Repository Subscription", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/subscriptionBody" - } - } - ], - "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/subscription" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/tags": { - "get": { - "description": "Get list of tags.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/tags" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/teams": { - "get": { - "description": "Get list of teams", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/teams" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/watchers": { - "get": { - "description": "List Stargazers. New implementation.", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/repos/{owner}/{repo}/{archive_format}/{path}": { - "get": { - "description": "Get archive link.\nThis method will return a 302 to a URL to download a tarball or zipball\narchive for a repository. Please make sure your HTTP framework is\nconfigured to follow redirects or you will need to use the Location header\nto make a second GET request.\nNote: For private repositories, these links are temporary and expire quickly.\n", - "parameters": [ - { - "description": "Name of repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "enum": ["tarball", "zipball"], - "in": "path", - "name": "archive_format", - "required": true, - "type": "string" - }, - { - "description": "Valid Git reference, defaults to 'master'.", - "in": "path", - "name": "path", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "302": { - "description": "Found.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/repositories": { - "get": { - "description": "List all public repositories.\nThis provides a dump of every public repository, in the order that they\nwere created.\nNote: Pagination is powered exclusively by the since parameter. is the\nLink header to get the URL for the next page of repositories.\n", - "parameters": [ - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repos" - } - }, - "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" - } - } - } - } - } - }, - "/search/code": { - "get": { - "description": "Search code.", - "parameters": [ - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "The search terms. This can be any combination of the supported code\nsearch parameters:\n'Search In' Qualifies which fields are searched. With this qualifier\nyou can restrict the search to just the file contents, the file path,\nor both.\n'Languages' Searches code based on the language it's written in.\n'Forks' Filters repositories based on the number of forks, and/or\nwhether code from forked repositories should be included in the results\nat all.\n'Size' Finds files that match a certain size (in bytes).\n'Path' Specifies the path that the resulting file must be at.\n'Extension' Matches files with a certain extension.\n'Users' or 'Repositories' Limits searches to a specific user or repository.\n", - "in": "query", - "name": "q", - "required": true, - "type": "string" - }, - { - "description": "Can only be 'indexed', which indicates how recently a file has been indexed\nby the GitHub search infrastructure. If not provided, results are sorted\nby best match.\n", - "enum": ["indexed"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-code" - } - }, - "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" - } - } - } - } - } - }, - "/search/issues": { - "get": { - "description": "Find issues by state and keyword. (This method returns up to 100 results per page.)", - "parameters": [ - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "The q search term can also contain any combination of the supported issue search qualifiers:", - "in": "query", - "name": "q", - "required": true, - "type": "string" - }, - { - "description": "The sort field. Can be comments, created, or updated. Default: results are sorted by best match.", - "enum": ["updated", "created", "comments"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-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" - } - } - } - } - } - }, - "/search/repositories": { - "get": { - "description": "Search repositories.", - "parameters": [ - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "The search terms. This can be any combination of the supported repository\nsearch parameters:\n'Search In' Qualifies which fields are searched. With this qualifier you\ncan restrict the search to just the repository name, description, readme,\nor any combination of these.\n'Size' Finds repositories that match a certain size (in kilobytes).\n'Forks' Filters repositories based on the number of forks, and/or whether\nforked repositories should be included in the results at all.\n'Created' and 'Last Updated' Filters repositories based on times of\ncreation, or when they were last updated.\n'Users or Repositories' Limits searches to a specific user or repository.\n'Languages' Searches repositories based on the language they are written in.\n'Stars' Searches repositories based on the number of stars.\n", - "in": "query", - "name": "q", - "required": true, - "type": "string" - }, - { - "description": "If not provided, results are sorted by best match.", - "enum": ["stars", "forks", "updated"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-repositories" - } - }, - "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" - } - } - } - } - } - }, - "/search/users": { - "get": { - "description": "Search users.", - "parameters": [ - { - "default": "desc", - "description": "The sort field. if sort param is provided. Can be either asc or desc.", - "enum": ["desc", "asc"], - "in": "query", - "name": "order", - "type": "string" - }, - { - "description": "The search terms. This can be any combination of the supported user\nsearch parameters:\n'Search In' Qualifies which fields are searched. With this qualifier you\ncan restrict the search to just the username, public email, full name,\nlocation, or any combination of these.\n'Repository count' Filters users based on the number of repositories they\nhave.\n'Location' Filter users by the location indicated in their profile.\n'Language' Search for users that have repositories that match a certain\nlanguage.\n'Created' Filter users based on when they joined.\n'Followers' Filter users based on the number of followers they have.\n", - "in": "query", - "name": "q", - "required": true, - "type": "string" - }, - { - "description": "If not provided, results are sorted by best match.", - "enum": ["followers", "repositories", "joined"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/search-users" - } - }, - "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" - } - } - } - } - } - }, - "/teams/{teamId}": { - "delete": { - "description": "Delete team.\nIn order to delete a team, the authenticated user must be an owner of the\norg that the team is associated with.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get team.", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/team" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Edit team.\nIn order to edit a team, the authenticated user must be an owner of the org\nthat the team is associated with.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/editTeam" - } - } - ], - "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/team" - } - }, - "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" - } - } - } - } - } - }, - "/teams/{teamId}/members": { - "get": { - "description": "List team members.\nIn order to list members in a team, the authenticated user must be a member\nof the team.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/teams/{teamId}/members/{username}": { - "delete": { - "deprecated": true, - "description": "The \"Remove team member\" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships.\n\nRemove team member.\nIn order to remove a user from a team, the authenticated user must have 'admin'\npermissions to the team or be an owner of the org that the team is associated\nwith.\nNOTE This does not delete the user, it just remove them from the team.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Team member removed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "deprecated": true, - "description": "The \"Get team member\" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships.\n\nGet team member.\nIn order to get if a user is a member of a team, the authenticated user mus\nbe a member of the team.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "User is a member.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "User is not a member.", - "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" - } - } - } - } - }, - "put": { - "deprecated": true, - "description": "The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams.\n\nAdd team member.\nIn order to add a user to a team, the authenticated user must have 'admin'\npermissions to the team or be an owner of the org that the team is associated\nwith.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Team member added.", - "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" - } - } - }, - "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" - } - } - }, - "422": { - "description": "If you attempt to add an organization to a team, you will get this.", - "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/organizationAsTeamMember" - } - } - } - } - }, - "/teams/{teamId}/memberships/{username}": { - "delete": { - "description": "Remove team membership.\nIn order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Team member removed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get team membership.\nIn order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "200": { - "description": "User is a member.", - "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/teamMembership" - } - }, - "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" - } - } - }, - "404": { - "description": "User has no membership with team", - "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" - } - } - } - } - }, - "put": { - "description": "Add team membership.\nIn order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with.\n\nIf the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team.\n\nIf the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the 'pending' state until the user accepts the invitation, at which point the membership will transition to the 'active' state and the user will be added as a member of the team.\n", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a member.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "200": { - "description": "Team member added.", - "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/teamMembership" - } - }, - "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" - } - } - }, - "422": { - "description": "If you attempt to add an organization to a team, you will get this.", - "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/organizationAsTeamMember" - } - } - } - } - }, - "/teams/{teamId}/repos": { - "get": { - "description": "List team repos", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/teamRepos" - } - }, - "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" - } - } - } - } - } - }, - "/teams/{teamId}/repos/{owner}/{repo}": { - "delete": { - "description": "In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team.", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if a team manages a repository", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - }, - "put": { - "description": "In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization.", - "parameters": [ - { - "description": "Id of team.", - "in": "path", - "name": "teamId", - "required": true, - "type": "integer" - }, - { - "description": "Name of a organization.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/user": { - "get": { - "description": "Get the authenticated user.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/user" - } - }, - "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" - } - } - } - } - }, - "patch": { - "description": "Update the authenticated user.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/user-update" - } - } - ], - "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/user" - } - }, - "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" - } - } - } - } - } - }, - "/user/emails": { - "delete": { - "description": "Delete email address(es).\nYou can include a single email address or an array of addresses.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/user-emails" - } - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "List email addresses for a user.\nIn the final version of the API, this method will return an array of hashes\nwith extended information for each email address indicating if the address\nhas been verified and if it's primary email address for GitHub.\nUntil API v3 is finalized, use the application/vnd.github.v3 media type to\nget other response format.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "produces": ["application/vnd.github.v3"], - "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/user-emails" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Add email address(es).\nYou can post a single email address or an array of addresses.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/emailsPost" - } - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/user/followers": { - "get": { - "description": "List the authenticated user's followers", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/user/following": { - "get": { - "description": "List who the authenticated user is following.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/user/following/{username}": { - "delete": { - "description": "Unfollow a user.\nUnfollowing a user requires the user to be logged in and authenticated with\nbasic auth or OAuth with the user:follow scope.\n", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "User unfollowed.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if you are following a user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Response if you are following this user.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Response if you are not following this user.", - "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" - } - } - } - } - }, - "put": { - "description": "Follow a user.\nFollowing a user requires the user to be logged in and authenticated with\nbasic auth or OAuth with the user:follow scope.\n", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "You are now following the user.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/user/issues": { - "get": { - "description": "List issues.\nList all issues across owned and member repositories for the authenticated\nuser.\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" - }, - { - "description": "String list of comma separated Label names. Example - bug,ui,@high.", - "in": "query", - "name": "labels", - "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" - }, - { - "description": "Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nOnly issues updated at or after this time are returned.\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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" - } - } - } - } - } - }, - "/user/keys": { - "get": { - "description": "List your public keys.\nLists the current user's keys. Management of public keys via the API requires\nthat you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a public key.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/user-keys-post" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/user-keys-keyId" - } - }, - "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" - } - } - } - } - } - }, - "/user/keys/{keyId}": { - "delete": { - "description": "Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope.", - "parameters": [ - { - "description": "ID of key.", - "in": "path", - "name": "keyId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "No content.\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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Get a single public key.", - "parameters": [ - { - "description": "ID of key.", - "in": "path", - "name": "keyId", - "required": true, - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/user-keys-keyId" - } - }, - "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" - } - } - } - } - } - }, - "/user/orgs": { - "get": { - "description": "List public and private organizations for the authenticated user.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - } - }, - "/user/repos": { - "get": { - "description": "List repositories for the authenticated user. Note that this does not include\nrepositories owned by organizations which the user can access. You can lis\nuser organizations and list organization repositories separately.\n", - "parameters": [ - { - "default": "all", - "enum": ["all", "public", "private", "forks", "sources", "member"], - "in": "query", - "name": "type", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repos" - } - }, - "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" - } - } - } - } - }, - "post": { - "description": "Create a new repository for the authenticated user. OAuth users must supply\nrepo scope.\n", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - }, - { - "in": "body", - "name": "body", - "required": true, - "schema": { - "$ref": "#/definitions/postRepo" - } - } - ], - "responses": { - "201": { - "description": "Created", - "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/repos" - } - }, - "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" - } - } - } - } - } - }, - "/user/starred": { - "get": { - "description": "List repositories being starred by the authenticated user.", - "parameters": [ - { - "description": "Ignored without 'sort' parameter.", - "in": "query", - "name": "direction", - "type": "string" - }, - { - "default": "created", - "description": "", - "enum": ["created", "updated"], - "in": "query", - "name": "sort", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - } - }, - "/user/starred/{owner}/{repo}": { - "delete": { - "description": "Unstar a repository", - "parameters": [ - { - "description": "Name of a repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Unstarred.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "description": "Check if you are starring a repository.", - "parameters": [ - { - "description": "Name of a repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "This repository is starred by you.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "This repository is not starred by you.", - "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" - } - } - } - } - }, - "put": { - "description": "Star a repository.", - "parameters": [ - { - "description": "Name of a repository owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of a repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Repository starred.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/user/subscriptions": { - "get": { - "description": "List repositories being watched by the authenticated user.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repos" - } - }, - "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" - } - } - } - } - } - }, - "/user/subscriptions/{owner}/{repo}": { - "delete": { - "deprecated": true, - "description": "Stop watching a repository", - "parameters": [ - { - "description": "Name of the owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Unwatched.", - "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" - } - } - }, - "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" - } - } - } - } - }, - "get": { - "deprecated": true, - "description": "Check if you are watching a repository.", - "parameters": [ - { - "description": "Name of the owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Repository is watched by you.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Repository is not watched by you.", - "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" - } - } - } - } - }, - "put": { - "deprecated": true, - "description": "Watch a repository.", - "parameters": [ - { - "description": "Name of the owner.", - "in": "path", - "name": "owner", - "required": true, - "type": "string" - }, - { - "description": "Name of repository.", - "in": "path", - "name": "repo", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Repository is watched.", - "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" - } - } - }, - "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" - } - } - } - } - } - }, - "/user/teams": { - "get": { - "description": "List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth.", - "parameters": [ - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/teams-list" - } - }, - "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" - } - } - } - } - } - }, - "/users": { - "get": { - "description": "Get all users.\nThis provides a dump of every user, in the order that they signed up for GitHub.\nNote: Pagination is powered exclusively by the since parameter. Use the Link\nheader to get the URL for the next page of users.\n", - "parameters": [ - { - "description": "The integer ID of the last user that you've seen.", - "in": "query", - "name": "since", - "type": "integer" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}": { - "get": { - "description": "Get a single user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/user" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/events": { - "get": { - "description": "If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/users/{username}/events/orgs/{org}": { - "get": { - "description": "This is the user's organization dashboard. You must be authenticated as the user to view this.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "in": "path", - "name": "org", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/users/{username}/followers": { - "get": { - "description": "List a user's followers", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/users" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/following/{targetUser}": { - "get": { - "description": "Check if one user follows another.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Name of user.", - "in": "path", - "name": "targetUser", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "204": { - "description": "Response if user follows target user.", - "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" - } - } - }, - "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" - } - } - }, - "404": { - "description": "Response if user does not follow target user.", - "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" - } - } - } - } - } - }, - "/users/{username}/gists": { - "get": { - "description": "List a users gists.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.\nExample: \"2012-10-09T23:39:01Z\".\n", - "in": "query", - "name": "since", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gists" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/keys": { - "get": { - "description": "List public keys for a user.\nLists the verified public keys for a user. This is accessible by anyone.\n", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/orgs": { - "get": { - "description": "List all public organizations for a user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/gitignore" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/received_events": { - "get": { - "description": "These are events that you'll only see public events.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/users/{username}/received_events/public": { - "get": { - "description": "List public events that a user has received", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/users/{username}/repos": { - "get": { - "description": "List public repositories for the specified user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "default": "all", - "enum": ["all", "public", "private", "forks", "sources", "member"], - "in": "query", - "name": "type", - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "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/repos" - } - }, - "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" - } - } - } - } - } - }, - "/users/{username}/starred": { - "get": { - "description": "List repositories being starred by a user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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" - } - } - } - } - } - }, - "/users/{username}/subscriptions": { - "get": { - "description": "List repositories being watched by a user.", - "parameters": [ - { - "description": "Name of user.", - "in": "path", - "name": "username", - "required": true, - "type": "string" - }, - { - "description": "Is used to set specified media type.", - "in": "header", - "name": "Accept", - "type": "string" - } - ], - "responses": { - "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": { - "actor": { - "description": "A user or organization", - "properties": { - "avatar_url": { - "type": "string" - }, - "bio": { - "type": "string" - }, - "blog": { - "description": "The website URL from the profile page", - "type": "string" - }, - "collaborators": { - "type": "integer" - }, - "company": { - "type": "string" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "disk_usage": { - "type": "integer" - }, - "email": { - "description": "Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile).", - "type": "string" - }, - "followers": { - "type": "integer" - }, - "followers_url": { - "type": "string" - }, - "following": { - "type": "integer" - }, - "following_url": { - "type": "string" - }, - "gists_url": { - "type": "string" - }, - "gravatar_id": { - "type": "string" - }, - "hireable": { - "type": "boolean" - }, - "html_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "location": { - "type": "string" - }, - "login": { - "description": "The account username", - "type": "string" - }, - "name": { - "description": "The full account name", - "type": "string" - }, - "organizations_url": { - "type": "string" - }, - "owned_private_repos": { - "type": "integer" - }, - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "committer": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601.", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "committer": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "html_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "line": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "url": { - "type": "string" - }, - "user": { - "$ref": "#/definitions/user" - } - }, - "type": "object" - }, - "commitCommentBody": { - "properties": { - "body": { - "type": "string" - }, - "line": { - "description": "Deprecated - Use position parameter instead.", - "type": "string" - }, - "number": { - "description": "Line number in the file to comment on. Defaults to null.", - "type": "string" - }, - "path": { - "description": "Relative path of the file to comment on.", - "type": "string" - }, - "position": { - "description": "Line index in the diff to comment on.", - "type": "integer" - }, - "sha": { - "description": "SHA of the commit to comment on.", - "type": "string" - } - }, - "required": ["sha", "body"], - "type": "object" - }, - "commits": { - "items": { - "properties": { - "author": { - "$ref": "#/definitions/user" - }, - "commit": { - "properties": { - "author": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "committer": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "The Total number of commits authored by the contributor.", - "type": "integer" - }, - "weeks": { - "items": { - "properties": { - "a": { - "description": "Number of additions.", - "type": "integer" - }, - "c": { - "description": "Number of commits.", - "type": "integer" - }, - "d": { - "description": "Number of deletions.", - "type": "integer" - }, - "w": { - "description": "Start of the week.", - "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": { - "description": "A URL for an image representing this emoji", - "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": { - "description": "Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.", - "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": { - "description": "Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.", - "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": { - "description": "Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "event": { - "type": "string" - }, - "issue": { - "properties": { - "assignee": { - "$ref": "#/definitions/user" - }, - "body": { - "type": "string" - }, - "closed_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "comments": { - "type": "integer" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "creator": { - "$ref": "#/definitions/user" - }, - "description": { - "type": "string" - }, - "due_on": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "comments": { - "type": "integer" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "creator": { - "$ref": "#/definitions/user" - }, - "description": { - "type": "string" - }, - "due_on": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "url": { - "type": "string" - }, - "user": { - "$ref": "#/definitions/user" - } - }, - "type": "object" - }, - "type": "array" - }, - "issuesComment": { - "properties": { - "body": { - "type": "string" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "html_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "id": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "Error 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": { - "description": "An Array of IP addresses in CIDR format specifying the Git servers at GitHub.", - "type": "string" - }, - "type": "array" - }, - "hooks": { - "items": { - "description": "An Array of IP addresses in CIDR format specifying the addresses that incoming service hooks will originate from.", - "type": "string" - }, - "type": "array" - } - }, - "type": "object" - }, - "milestone": { - "properties": { - "closed_issues": { - "type": "integer" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "creator": { - "$ref": "#/definitions/user" - }, - "description": { - "type": "string" - }, - "due_on": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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" - }, - { - "description": "A GitHub organization" - } - ], - "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": { - "description": "Billing email address. This address is not publicized.", - "type": "string" - }, - "company": { - "type": "string" - }, - "email": { - "description": "Publicly visible email address.", - "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": { - "description": "True to create an initial commit with empty README. Default is false.", - "type": "boolean" - }, - "description": { - "type": "string" - }, - "gitignore_template": { - "description": "Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, \"Haskell\" Ignored if auto_init parameter is not provided. ", - "type": "string" - }, - "has_downloads": { - "description": "True to enable downloads for this repository, false to disable them. Default is true.", - "type": "boolean" - }, - "has_issues": { - "description": "True to enable issues for this repository, false to disable them. Default is true.", - "type": "boolean" - }, - "has_wiki": { - "description": "True to enable the wiki for this repository, false to disable it. Default is true.", - "type": "boolean" - }, - "homepage": { - "type": "string" - }, - "name": { - "type": "string" - }, - "private": { - "description": "True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account.", - "type": "boolean" - }, - "team_id": { - "description": "The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization.", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "number": { - "type": "integer" - }, - "patch_url": { - "type": "string" - }, - "state": { - "enum": ["open", "closed"] - }, - "title": { - "type": "string" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "id": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "id": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "limit": { - "type": "integer" - }, - "remaining": { - "type": "integer" - }, - "reset": { - "type": "integer" - } - } - } - }, - "type": "object" - }, - "ref": { - "items": { - "properties": { - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "creator": { - "properties": { - "avatar_url": { - "type": "string" - }, - "gravatar_id": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "login": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "description": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "state": { - "type": "string" - }, - "target_url": { - "type": "string" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "refStatus": { - "items": { - "properties": { - "commit_url": { - "type": "string" - }, - "name": { - "type": "string" - }, - "repository_url": { - "type": "string" - }, - "sha": { - "type": "string" - }, - "state": { - "type": "string" - }, - "statuses": { - "items": { - "properties": { - "context": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "description": { - "type": "string" - }, - "id": { - "type": "number" - }, - "state": { - "type": "string" - }, - "target_url": { - "type": "string" - }, - "updated_at": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - } - }, - "type": "object" - }, - "type": "array" - }, - "refs": { - "items": { - "properties": { - "object": { - "properties": { - "sha": { - "type": "string" - }, - "type": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "ref": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "refsBody": { - "properties": { - "ref": { - "type": "string" - }, - "sha": { - "type": "string" - } - }, - "type": "object" - }, - "release": { - "properties": { - "assets": { - "items": { - "properties": { - "content_type": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "download_count": { - "type": "integer" - }, - "id": { - "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" - }, - "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" - }, - "tarball_url": { - "type": "string" - }, - "target_commitish": { - "type": "string" - }, - "upload_url": { - "type": "string" - }, - "url": { - "type": "string" - }, - "zipball_url": { - "type": "string" - } - }, - "type": "object" - }, - "release-create": { - "properties": { - "body": { - "type": "string" - }, - "draft": { - "type": "boolean" - }, - "name": { - "type": "string" - }, - "prerelease": { - "type": "boolean" - }, - "tag_name": { - "type": "string" - }, - "target_commitish": { - "type": "string" - } - }, - "type": "object" - }, - "releases": { - "items": { - "properties": { - "assets": { - "items": { - "properties": { - "content_type": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "download_count": { - "type": "integer" - }, - "id": { - "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" - }, - "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" - }, - "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": { - "clone_url": { - "type": "string" - }, - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "description": { - "type": "string" - }, - "fork": { - "type": "boolean" - }, - "forks": { - "type": "integer" - }, - "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" - }, - "organization": { - "$ref": "#/definitions/organization" - }, - "owner": { - "$ref": "#/definitions/actor" - }, - "parent": { - "allOf": [ - { - "$ref": "#/definitions/repo" - }, - { - "description": "Is present when the repo is a fork. Parent is the repo this repo was forked from." - } - ] - }, - "private": { - "type": "boolean" - }, - "pushed_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "size": { - "type": "integer" - }, - "source": { - "allOf": [ - { - "$ref": "#/definitions/repo" - }, - { - "description": "Is present when the repo is a fork. Source is the ultimate source for the network." - } - ] - }, - "ssh_url": { - "type": "string" - }, - "svn_url": { - "type": "string" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "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": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "html_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "line": { - "type": "integer" - }, - "path": { - "type": "string" - }, - "position": { - "type": "integer" - }, - "updated_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "url": { - "type": "string" - }, - "user": { - "$ref": "#/definitions/user" - } - }, - "type": "object" - }, - "type": "array" - }, - "repoCommit": { - "properties": { - "author": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "committer": { - "properties": { - "date": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "message": { - "type": "string" - }, - "parents": { - "items": { - "properties": { - "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" - }, - "repoCommitBody": { - "properties": { - "author": { - "properties": { - "date": { - "type": "string" - }, - "email": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "message": { - "type": "string" - }, - "parents": { - "items": { - "type": "string" - }, - "type": "array" - }, - "tree": { - "type": "string" - } - }, - "required": ["message", "parents", "tree"], - "type": "object" - }, - "repoEdit": { - "properties": { - "description": { - "type": "string" - }, - "has_downloads": { - "type": "boolean" - }, - "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": { - "git_url": { - "type": "string" - }, - "html_url": { - "type": "string" - }, - "name": { - "type": "string" - }, - "path": { - "type": "string" - }, - "repository": { - "properties": { - "archive_url": { - "type": "string" - }, - "assignees_url": { - "type": "string" - }, - "blobs_url": { - "type": "string" - }, - "branches_url": { - "type": "string" - }, - "collaborators_url": { - "type": "string" - }, - "comments_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": { - "items": { - "items": { - "properties": { - "assignee": { - "type": "null" - }, - "body": { - "type": "string" - }, - "closed_at": { - "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" - }, - "total_count": { - "type": "integer" - } - }, - "type": "object" - }, - "search-issues-by-keyword": { - "properties": { - "issues": { - "items": { - "properties": { - "body": { - "type": "string" - }, - "comments": { - "type": "integer" - }, - "created_at": { - "type": "string" - }, - "gravatar_id": { - "type": "string" - }, - "html_url": { - "type": "string" - }, - "labels": { - "items": { - "type": "string" - }, - "type": "array" - }, - "number": { - "type": "integer" - }, - "position": { - "type": "integer" - }, - "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": { - "items": { - "$ref": "#/definitions/users" - }, - "total_count": { - "type": "integer" - } - }, - "type": "object" - }, - "search-users-by-keyword": { - "properties": { - "users": { - "$ref": "#/definitions/users" - } - }, - "type": "object" - }, - "subscription": { - "properties": { - "created_at": { - "description": "ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "ignored": { - "type": "boolean" - }, - "reason": { - "type": "string" - }, - "repository_url": { - "type": "string" - }, - "subscribed": { - "type": "boolean" - }, - "thread_url": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "subscriptionBody": { - "properties": { - "ignored": { - "type": "boolean" - }, - "subscribed": { - "type": "boolean" - } - }, - "type": "object" - }, - "tag": { - "properties": { - "message": { - "description": "String of the tag message.", - "type": "string" - }, - "object": { - "properties": { - "sha": { - "type": "string" - }, - "type": { - "description": "String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob.", - "enum": ["commit", "tree", "blob"] - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "sha": { - "type": "string" - }, - "tag": { - "description": "The tag's name. This is typically a version (e.g., \"v0.0.1\").", - "type": "string" - }, - "tagger": { - "properties": { - "date": { - "description": "Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "description": "String of the email of the author of the tag.", - "type": "string" - }, - "name": { - "description": "String of the name of the author of the tag.", - "type": "string" - } - }, - "type": "object" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "tagBody": { - "properties": { - "message": { - "description": "String of the tag message.", - "type": "string" - }, - "object": { - "description": "String of the SHA of the git object this is tagging.", - "type": "string" - }, - "tag": { - "description": "The tag's name. This is typically a version (e.g., \"v0.0.1\").", - "type": "string" - }, - "tagger": { - "properties": { - "date": { - "description": "Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", - "type": "string" - }, - "email": { - "description": "String of the email of the author of the tag.", - "type": "string" - }, - "name": { - "description": "String of the name of the author of the tag.", - "type": "string" - } - }, - "type": "object" - }, - "type": { - "description": "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.", - "enum": ["commit", "tree", "blob"] - } - }, - "required": ["tag", "message", "object", "type", "tagger"], - "type": "object" - }, - "tags": { - "items": { - "$ref": "#/definitions/tag" - }, - "type": "array" - }, - "team": { - "properties": { - "id": { - "type": "integer" - }, - "members_count": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "permission": { - "type": "string" - }, - "repos_count": { - "type": "integer" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "teamMembership": { - "properties": { - "state": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "teamRepos": { - "$ref": "#/definitions/repos" - }, - "teams": { - "items": { - "properties": { - "id": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "teams-list": { - "items": { - "properties": { - "id": { - "type": "integer" - }, - "members_count": { - "type": "integer" - }, - "name": { - "type": "string" - }, - "organization": { - "properties": { - "avatar_url": { - "type": "string" - }, - "id": { - "type": "integer" - }, - "login": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "permission": { - "type": "string" - }, - "repos_count": { - "type": "integer" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "tree": { - "properties": { - "sha": { - "type": "string" - }, - "tree": { - "items": { - "properties": { - "mode": { - "description": "One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink.", - "enum": ["100644", "100755", "040000", "160000", "120000"], - "type": "string" - }, - "path": { - "type": "string" - }, - "sha": { - "description": "SHA1 checksum ID of the object in the tree.", - "type": "string" - }, - "size": { - "type": "integer" - }, - "type": { - "enum": ["blob", "tree", "commit"], - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "type": "array" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "trees": { - "properties": { - "base_tree": { - "type": "string" - }, - "sha": { - "description": "SHA1 checksum ID of the object in the tree.", - "type": "string" - }, - "tree": { - "items": { - "$ref": "#/definitions/tree" - }, - "type": "array" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "user": { - "allOf": [ - { - "$ref": "#/definitions/actor" - }, - { - "description": "A GitHub user" - } - ], - "type": "object" - }, - "user-emails": { - "items": { - "type": "string" - }, - "type": "array" - }, - "user-keys-keyId": { - "properties": { - "id": { - "type": "integer" - }, - "key": { - "type": "string" - }, - "title": { - "type": "string" - }, - "url": { - "type": "string" - } - }, - "type": "object" - }, - "user-keys-post": { - "properties": { - "key": { - "type": "string" - }, - "title": { - "type": "string" - } - }, - "type": "object" - }, - "user-update": { - "properties": { - "bio": { - "type": "string" - }, - "blog": { - "type": "string" - }, - "company": { - "type": "string" - }, - "email": { - "type": "string" - }, - "hireable": { - "type": "boolean" - }, - "location": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "type": "object" - }, - "users": { - "items": { - "$ref": "#/definitions/user" - }, - "type": "array" - } - } -} diff --git a/tests/spec/templates/schema.ts b/tests/spec/templates/schema.ts deleted file mode 100644 index 06022066..00000000 --- a/tests/spec/templates/schema.ts +++ /dev/null @@ -1,6710 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -/** - * A user or organization - */ -export interface Actor { - avatar_url?: string; - bio?: string; - /** The website URL from the profile page */ - blog?: string; - collaborators?: number; - company?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - disk_usage?: number; - /** Note: The returned email is the user’s publicly visible email address (or null if the user has not specified a public email address in their profile). */ - 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; - /** The account username */ - login?: string; - /** The full account name */ - 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"; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - 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?: { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601. */ - created_at?: string; - id?: number; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface Commit { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export interface CommitCommentBody { - body: string; - /** Deprecated - Use position parameter instead. */ - line?: string; - /** Line number in the file to comment on. Defaults to null. */ - number?: string; - /** Relative path of the file to comment on. */ - path?: string; - /** Line index in the diff to comment on. */ - position?: number; - /** SHA of the commit to comment on. */ - sha: string; -} - -export type Commits = { - /** A GitHub user */ - author?: User; - commit?: { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - message?: string; - tree?: { - sha?: string; - url?: string; - }; - url?: string; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -}[]; - -export interface CompareCommits { - ahead_by?: number; - base_commit?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - committer?: User; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - behind_by?: number; - commits?: { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - }; - /** The Total number of commits authored by the contributor. */ - total?: number; - weeks?: { - /** Number of additions. */ - a?: number; - /** Number of commits. */ - c?: number; - /** Number of deletions. */ - d?: number; - /** Start of the week. */ - 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; - /** A GitHub user */ - creator?: User; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -} - -export type DeploymentStatuses = { - created_at?: string; - /** A GitHub user */ - 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 { - /** A user or organization */ - actor?: Actor; - created_at?: object; - id?: number; - /** A GitHub organization */ - 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; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - description?: string; - files?: { - "ring.erl"?: { - filename?: string; - raw_url?: string; - size?: number; - }; - }; - forks?: { - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - created_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }[]; - git_pull_url?: string; - git_push_url?: string; - history?: { - change_status?: { - additions?: number; - deletions?: number; - total?: number; - }; - /** Timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. */ - committed_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - version?: string; - }[]; - html_url?: string; - id?: string; - public?: boolean; - url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - 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; - }; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** A user or organization */ - actor?: Actor; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - event?: string; - issue?: { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; - }; - url?: string; -} - -export type IssueEvents = IssueEvent[]; - -export type Issues = { - /** A GitHub user */ - assignee?: User; - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - comments?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - labels?: { - color?: string; - name?: string; - url?: string; - }[]; - milestone?: { - closed_issues?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface IssuesComment { - body?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -} - -export type IssuesComments = { - _links?: { - html?: { - href?: string; - }; - pull_request?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - body?: string; - commit_id?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - 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 { - /** Error message */ - message?: string; -} - -export interface MergesSuccessful { - /** A GitHub user */ - 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; - }; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - /** A GitHub user */ - creator?: User; - description?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A user or organization */ - 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[]; -} - -/** - * A GitHub organization - */ -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 address. This address is not publicized. */ - billing_email?: string; - company?: string; - /** Publicly visible email address. */ - email?: string; - location?: string; - name?: string; -} - -export interface PostGist { - description?: string; - files?: { - "file1.txt"?: { - content?: string; - }; - }; - public?: boolean; -} - -export interface PostRepo { - /** True to create an initial commit with empty README. Default is false. */ - auto_init?: boolean; - description?: string; - /** Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, "Haskell" Ignored if auto_init parameter is not provided. */ - gitignore_template?: string; - /** True to enable downloads for this repository, false to disable them. Default is true. */ - has_downloads?: boolean; - /** True to enable issues for this repository, false to disable them. Default is true. */ - has_issues?: boolean; - /** True to enable the wiki for this repository, false to disable it. Default is true. */ - has_wiki?: boolean; - homepage?: string; - name: string; - /** True to create a private repository, false to create a public one. Creating private repositories requires a paid GitHub account. */ - private?: boolean; - /** The id of the team that will be granted access to this repository. This is only valid when creating a repo in an organization. */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - closed_at?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - merged_at?: string; - number?: number; - patch_url?: string; - state?: "open" | "closed"; - title?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - id?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 = { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** A GitHub user */ - uploader?: User; - url?: string; - }[]; - assets_url?: string; - /** A GitHub user */ - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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; - /** A GitHub organization */ - organization?: Organization; - /** A user or organization */ - owner?: Actor; - /** Is present when the repo is a fork. Parent is the repo this repo was forked from. */ - parent?: Repo; - private?: boolean; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - pushed_at?: string; - size?: number; - /** Is present when the repo is a fork. Source is the ultimate source for the network. */ - source?: Repo; - ssh_url?: string; - svn_url?: string; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - watchers?: number; - 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; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - created_at?: string; - html_url?: string; - id?: number; - line?: number; - path?: string; - position?: number; - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - updated_at?: string; - url?: string; - /** A GitHub user */ - user?: User; -}[]; - -export interface RepoCommit { - author?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - email?: string; - name?: string; - }; - committer?: { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 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; - /** A user or organization */ - 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; - /** A GitHub user */ - 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 { - /** A GitHub user */ - user?: User; -} - -export interface SearchUsers { - items?: Users; - total_count?: number; -} - -export interface SearchUsersByKeyword { - users?: Users; -} - -export interface Subscription { - /** ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - 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 { - /** String of the tag message. */ - message?: string; - object?: { - sha?: string; - /** String of the type of the tagged object. Normally this is a commit but it can also be a tree or a blob. */ - type?: "commit" | "tree" | "blob"; - url?: string; - }; - sha?: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag?: string; - tagger?: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - url?: string; -} - -export interface TagBody { - /** String of the tag message. */ - message: string; - /** String of the SHA of the git object this is tagging. */ - object: string; - /** The tag's name. This is typically a version (e.g., "v0.0.1"). */ - tag: string; - tagger: { - /** Timestamp of when this object was tagged, in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ */ - date?: string; - /** String of the email of the author of the tag. */ - email?: string; - /** String of the name of the author of the tag. */ - name?: string; - }; - /** 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 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?: { - /** One of 100644 for file (blob), 100755 for executable (blob), 040000 for subdirectory (tree), 160000 for submodule (commit) or 120000 for a blob that specifies the path of a symlink. */ - mode?: "100644" | "100755" | "040000" | "160000" | "120000"; - path?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - size?: number; - type?: "blob" | "tree" | "commit"; - url?: string; - }[]; - url?: string; -} - -export interface Trees { - base_tree?: string; - /** SHA1 checksum ID of the object in the tree. */ - sha?: string; - tree?: Tree[]; - url?: string; -} - -/** - * A GitHub user - */ -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[]; - -/* CUSTOM TEMPLATE */ - -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://api.github.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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; - }); - }; -} - -/* HTTP CLIENT TEMPLATE */ - -/** - * @title GitHub - * @version v3 - * @termsOfService https://help.github.com/articles/github-terms-of-service/#b-api-terms - * @baseUrl https://api.github.com - * @externalDocs https://developer.github.com/v3/ - * - * Powerful collaboration, code review, and code management for open source and private projects. - */ -export class Api extends HttpClient { - emojis = { - /** - * @description Lists all the emojis available to use on GitHub. - * - * @name EmojisList - * @request GET:/emojis - */ - emojisList: (params: RequestParams = {}) => - this.request({ - path: `/emojis`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - events = { - /** - * @description List public events. - * - * @name EventsList - * @request GET:/events - */ - eventsList: (params: RequestParams = {}) => - this.request({ - path: `/events`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - feeds = { - /** - * @description List Feeds. GitHub provides several timeline resources in Atom format. The Feeds API lists all the feeds available to the authenticating user. - * - * @name FeedsList - * @request GET:/feeds - */ - feedsList: (params: RequestParams = {}) => - this.request({ - path: `/feeds`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - gists = { - /** - * @description List the authenticated user's gists or if called anonymously, this will return all public gists. - * - * @name GistsList - * @request GET:/gists - */ - gistsList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a gist. - * - * @name GistsCreate - * @request POST:/gists - */ - gistsCreate: (body: PostGist, params: RequestParams = {}) => - this.request({ - path: `/gists`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List all public gists. - * - * @name PublicList - * @request GET:/gists/public - */ - publicList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists/public`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List the authenticated user's starred gists. - * - * @name StarredList - * @request GET:/gists/starred - */ - starredList: ( - query?: { - /** - * Timestamp in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ. - * Only gists updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists/starred`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a gist. - * - * @name GistsDelete - * @request DELETE:/gists/{id} - */ - gistsDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single gist. - * - * @name GistsDetail - * @request GET:/gists/{id} - */ - gistsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a gist. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments on a gist. - * - * @name CommentsDetail - * @request GET:/gists/{id}/comments - */ - commentsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/comments`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a commen - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Fork a gist. - * - * @name ForksCreate - * @request POST:/gists/{id}/forks - */ - forksCreate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/forks`, - method: "POST", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Unstar a gist. - * - * @name StarDelete - * @request DELETE:/gists/{id}/star - */ - starDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if a gist is starred. - * - * @name StarDetail - * @request GET:/gists/{id}/star - */ - starDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Star a gist. - * - * @name StarUpdate - * @request PUT:/gists/{id}/star - */ - starUpdate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "PUT", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - gitignore = { - /** - * @description Listing available templates. List all templates available to pass as an option when creating a repository. - * - * @name TemplatesList - * @request GET:/gitignore/templates - */ - templatesList: (params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single template. - * - * @name TemplatesDetail - * @request GET:/gitignore/templates/{language} - */ - templatesDetail: (language: string, params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates/${language}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - issues = { - /** - * @description List issues. List all issues across all the authenticated user's visible repositories. - * - * @name IssuesList - * @request GET:/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - legacy = { - /** - * @description Find issues by state and keyword. - * - * @name IssuesSearchDetail - * @request GET:/legacy/issues/search/{owner}/{repository}/{state}/{keyword} - * @deprecated - */ - 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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Find repositories by keyword. Note, this legacy method does not follow the v3 pagination pattern. This method returns up to 100 results per page and pages can be fetched using the start_page parameter. - * - * @name ReposSearchDetail - * @request GET:/legacy/repos/search/{keyword} - * @deprecated - */ - reposSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** Filter results by language */ - language?: string; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/legacy/repos/search/${keyword}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description This API call is added for compatibility reasons only. - * - * @name UserEmailDetail - * @request GET:/legacy/user/email/{email} - * @deprecated - */ - userEmailDetail: (email: string, params: RequestParams = {}) => - this.request({ - path: `/legacy/user/email/${email}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Find users by keyword. - * - * @name UserSearchDetail - * @request GET:/legacy/user/search/{keyword} - * @deprecated - */ - userSearchDetail: ( - keyword: string, - query?: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The page number to fetch */ - start_page?: string; - /** The sort field. One of stars, forks, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "stars" | "forks"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/legacy/user/search/${keyword}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - markdown = { - /** - * @description Render an arbitrary Markdown document - * - * @name MarkdownCreate - * @request POST:/markdown - */ - markdownCreate: (body: Markdown, params: RequestParams = {}) => - this.request({ - path: `/markdown`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Render a Markdown document in raw mode - * - * @name PostMarkdown - * @request POST:/markdown/raw - */ - postMarkdown: (params: RequestParams = {}) => - this.request({ - path: `/markdown/raw`, - method: "POST", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - meta = { - /** - * @description This gives some information about GitHub.com, the service. - * - * @name MetaList - * @request GET:/meta - */ - metaList: (params: RequestParams = {}) => - this.request({ - path: `/meta`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - networks = { - /** - * @description List public events for a network of repositories. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - }; - notifications = { - /** - * @description List your notifications. List all notifications for the current user, grouped by repository. - * - * @name NotificationsList - * @request GET:/notifications - */ - notificationsList: ( - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/notifications`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Mark as read. Marking a notification as "read" removes it from the default view on GitHub.com. - * - * @name NotificationsUpdate - * @request PUT:/notifications - */ - notificationsUpdate: (body: NotificationMarkRead, params: RequestParams = {}) => - this.request({ - path: `/notifications`, - method: "PUT", - body: body, - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description View a single thread. - * - * @name ThreadsDetail - * @request GET:/notifications/threads/{id} - */ - threadsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Mark a thread as read - * - * @name ThreadsPartialUpdate - * @request PATCH:/notifications/threads/{id} - */ - threadsPartialUpdate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}`, - method: "PATCH", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a Thread Subscription. - * - * @name ThreadsSubscriptionDelete - * @request DELETE:/notifications/threads/{id}/subscription - */ - threadsSubscriptionDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}/subscription`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Thread Subscription. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Set a Thread Subscription. This lets you subscribe to a thread, or ignore it. Subscribing to a thread is unnecessary if the user is already subscribed to the repository. Ignoring a thread will mute all future notifications (until you comment or get @mentioned). - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - }; - orgs = { - /** - * @description Get an Organization. - * - * @name OrgsDetail - * @request GET:/orgs/{org} - */ - orgsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit an Organization. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List public events for an organization. - * - * @name EventsDetail - * @request GET:/orgs/{org}/events - */ - eventsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/events`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List issues. List all issues for a given organization for the authenticated user. - * - * @name IssuesDetail - * @request GET:/orgs/{org}/issues - */ - issuesDetail: ( - org: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Members list. List all users who are members of an organization. A member is a user tha belongs to at least 1 team in the organization. If the authenticated user is also an owner of this organization then both concealed and public members will be returned. If the requester is not an owner of the organization the query will be redirected to the public members list. - * - * @name MembersDetail - * @request GET:/orgs/{org}/members - */ - membersDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/members`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Remove a member. Removing a user from this list will remove them from all teams and they will no longer have any access to the organization's repositories. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if a user is, publicly or privately, a member of the organization. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Public members list. Members of an organization can choose to have their membership publicized or not. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Conceal a user's membership. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check public membership. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Publicize a user's membership. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories for the specified org. - * - * @name ReposDetail - * @request GET:/orgs/{org}/repos - */ - reposDetail: ( - org: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/orgs/${org}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List teams. - * - * @name TeamsDetail - * @request GET:/orgs/{org}/teams - */ - teamsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/teams`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create team. In order to create a team, the authenticated user must be an owner of organization. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - }; - rateLimit = { - /** - * @description Get your current rate limit status Note: Accessing this endpoint does not count against your rate limit. - * - * @name RateLimitList - * @request GET:/rate_limit - */ - rateLimitList: (params: RequestParams = {}) => - this.request({ - path: `/rate_limit`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - repos = { - /** - * @description Delete a Repository. Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required. - * - * @name ReposDelete - * @request DELETE:/repos/{owner}/{repo} - */ - reposDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List assignees. This call lists all the available assignees (owner + collaborators) to which issues may be assigned. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check assignee. You may also check to see if a particular user is an assignee for a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of branches - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get Branch - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List. When authenticating as an organization owner of an organization-owned repository, all organization owners are included in the list of collaborators. Otherwise, only users with access to the repository are returned in the collaborators list. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Remove collaborator. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if user is a collaborator - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Add collaborator. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List commit comments for a repository. Comments are ordered by ascending ID. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a commit comment - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single commit comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update a commit comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List commits on a repository. - * - * @name CommitsDetail - * @request GET:/repos/{owner}/{repo}/commits - */ - commitsDetail: ( - owner: string, - repo: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - /** Sha or branch to start listing commits from. */ - sha?: string; - /** Only commits containing this file path will be returned. */ - path?: string; - /** GitHub login, name, or email by which to filter by commit author. */ - author?: string; - /** ISO 8601 Date - Only commits before this date will be returned. */ - until?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/commits`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the combined Status for a specific Ref The Combined status endpoint is currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the blog post for full details. To access this endpoint during the preview period, you must provide a custom media type in the Accept header: application/vnd.github.she-hulk-preview+json - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single commit. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments for a single commitList comments for a single commit. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a commit comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Compare two commits - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a file. This method deletes a file in a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get contents. This method returns the contents of a file or directory in a repository. Files and symlinks support a custom media type for getting the raw content. Directories and submodules do not support custom media types. Note: This API supports files up to 1 megabyte in size. Here can be many outcomes. For details see "http://developer.github.com/v3/repos/contents/" - * - * @name ContentsDetail - * @request GET:/repos/{owner}/{repo}/contents/{path} - */ - contentsDetail: ( - owner: string, - repo: string, - path: string, - query?: { - /** The content path. */ - path?: string; - /** The String name of the Commit/Branch/Tag. Defaults to 'master'. */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a file. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of contributors. - * - * @name ContributorsDetail - * @request GET:/repos/{owner}/{repo}/contributors - */ - contributorsDetail: ( - owner: string, - repo: string, - query: { - /** Set to 1 or true to include anonymous contributors in results. */ - anon: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/contributors`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with pull access can view deployments for a repository - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with push access can create a deployment for a given ref - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with pull access can view deployment statuses for a deployment - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Deployment Status Users with push access can create deployment statuses for a given deployment: - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Deprecated. List downloads for a repository. - * - * @name DownloadsDetail - * @request GET:/repos/{owner}/{repo}/downloads - * @deprecated - */ - downloadsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/downloads`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Deprecated. Delete a download. - * - * @name DownloadsDelete - * @request DELETE:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - */ - downloadsDelete: (owner: string, repo: string, downloadId: number, params: RequestParams = {}) => - this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Deprecated. Get a single download. - * - * @name DownloadsDetail2 - * @request GET:/repos/{owner}/{repo}/downloads/{downloadId} - * @deprecated - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of repository events. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List forks. - * - * @name ForksDetail - * @request GET:/repos/{owner}/{repo}/forks - */ - forksDetail: ( - owner: string, - repo: string, - query?: { - /** @default "newes" */ - sort?: "newes" | "oldes" | "watchers"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/forks`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a fork. Forking a Repository happens asynchronously. Therefore, you may have to wai a short period before accessing the git objects. If this takes longer than 5 minutes, be sure to contact Support. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Blob. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Blob. Since blobs can be any arbitrary binary data, the input and responses for the blob API takes an encoding parameter that can be either utf-8 or base64. If your data cannot be losslessly sent as a UTF-8 string, you can base64 encode it. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Commit. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Commit. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get all References - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Reference - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a Reference Example: Deleting a branch: DELETE /repos/octocat/Hello-World/git/refs/heads/feature-a Example: Deleting a tag: DELETE /repos/octocat/Hello-World/git/refs/tags/v1.0 - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Reference - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update a Reference - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Tag Object. Note that creating a tag object does not create the reference that makes a tag in Git. If you want to create an annotated tag in Git, you have to do this call to create the tag object, and then create the refs/tags/[tag] reference. If you want to create a lightweight tag, you only have to create the tag reference - this call would be unnecessary. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Tag. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Tree. The tree creation API will take nested entries as well. If both a tree and a nested path modifying that tree are specified, it will overwrite the contents of that tree with the new path contents and write a new tree out. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Tree. - * - * @name GitTreesDetail - * @request GET:/repos/{owner}/{repo}/git/trees/{shaCode} - */ - gitTreesDetail: ( - owner: string, - repo: string, - shaCode: string, - query?: { - /** Get a Tree Recursively. (0 or 1) */ - recursive?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of hooks. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a hook. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a hook. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get single hook. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a hook. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Test a push hook. This will trigger the hook with the latest push to the current repository if the hook is subscribed to push events. If the hook is not subscribed to push events, the server will respond with 204 but no test POST will be generated. Note: Previously /repos/:owner/:repo/hooks/:id/tes - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List issues for a repository. - * - * @name IssuesDetail - * @request GET:/repos/{owner}/{repo}/issues - */ - issuesDetail: ( - owner: string, - repo: string, - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create an issue. Any user with pull access to a repository can create an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments in a repository. - * - * @name IssuesCommentsDetail - * @request GET:/repos/{owner}/{repo}/issues/comments - */ - issuesCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List issue events for a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single event. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single issue - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit an issue. Issue owners and users with push access can edit an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments on an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List events for an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Remove all labels from an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List labels on an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Add labels to an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Replace all labels for an issue. Sending an empty array ([]) will remove all Labels from the Issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Remove a label from an issue. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of keys. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a key. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a key. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a key - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List all labels for this repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a label. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a label. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single label. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update a label. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List languages. List languages for the specified repository. The value on the right of a language is the number of bytes of code written in that language. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Perform a merge. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List milestones for a repository. - * - * @name MilestonesDetail - * @request GET:/repos/{owner}/{repo}/milestones - */ - milestonesDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "due_date" */ - sort?: "due_date" | "completeness"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/milestones`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a milestone. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a milestone. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single milestone. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update a milestone. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get labels for every issue in a milestone. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List your notifications in a repository List all notifications for the current user. - * - * @name NotificationsDetail - * @request GET:/repos/{owner}/{repo}/notifications - */ - notificationsDetail: ( - owner: string, - repo: string, - query?: { - /** True to show notifications marked as read. */ - all?: boolean; - /** - * True to show only notifications in which the user is directly participating - * or mentioned. - */ - participating?: boolean; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/notifications`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Mark notifications as read in a repository. Marking all notifications in a repository as "read" removes them from the default view on GitHub.com. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List pull requests. - * - * @name PullsDetail - * @request GET:/repos/{owner}/{repo}/pulls - */ - pullsDetail: ( - owner: string, - repo: string, - query?: { - /** - * String to filter by state. - * @default "open" - */ - state?: "open" | "closed"; - /** - * Filter pulls by head user and branch name in the format of 'user:ref-name'. - * Example: github:new-script-format. - */ - head?: string; - /** Filter pulls by base branch name. Example - gh-pages. */ - base?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a pull request. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments in a repository. By default, Review Comments are ordered by ascending ID. - * - * @name PullsCommentsDetail - * @request GET:/repos/{owner}/{repo}/pulls/comments - */ - pullsCommentsDetail: ( - owner: string, - repo: string, - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - sort?: "created" | "updated"; - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a comment. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single pull request. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update a pull request. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List comments on a pull request. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a comment. #TODO Alternative input ( http://developer.github.com/v3/pulls/comments/ ) description: | Alternative Input. Instead of passing commit_id, path, and position you can reply to an existing Pull Request Comment like this: body Required string in_reply_to Required number - Comment id to reply to. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List commits on a pull request. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List pull requests files. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get if a pull request has been merged. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Merge a pull request (Merge Button's) - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the README. This method returns the preferred README for a repository. - * - * @name ReadmeDetail - * @request GET:/repos/{owner}/{repo}/readme - */ - readmeDetail: ( - owner: string, - repo: string, - query?: { - /** The String name of the Commit/Branch/Tag. Defaults to master. */ - ref?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/readme`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with push access to the repository will receive all releases (i.e., published releases and draft releases). Users with pull access will receive published releases only - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a release Users with push access to the repository can create a release. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a release asset - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single release asset - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit a release asset Users with push access to the repository can edit a release asset. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with push access to the repository can delete a release. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single release - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Users with push access to the repository can edit a release - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List assets for a release - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List Stargazers. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the number of additions and deletions per week. Returns a weekly aggregate of the number of additions and deletions pushed to a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the last year of commit activity data. Returns the last year of commit activity grouped by week. The days array is a group of commits per day, starting on Sunday. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get contributors list with additions, deletions, and commit counts. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the weekly commit count for the repo owner and everyone else. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get the number of commits per hour in each day. Each array contains the day number, hour number, and number of commits 0-6 Sunday - Saturday 0-23 Hour of day Number of commits For example, [2, 14, 25] indicates that there were 25 total commits, during the 2.00pm hour on Tuesdays. All times are based on the time zone of individual commits. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List Statuses for a specific Ref. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a Status. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List watchers. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a Repository Subscription. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a Repository Subscription. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Set a Repository Subscription - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of tags. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get list of teams - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List Stargazers. New implementation. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get archive link. This method will return a 302 to a URL to download a tarball or zipball archive for a repository. Please make sure your HTTP framework is configured to follow redirects or you will need to use the Location header to make a second GET request. Note: For private repositories, these links are temporary and expire quickly. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - }; - repositories = { - /** - * @description List all public repositories. This provides a dump of every public repository, in the order that they were created. Note: Pagination is powered exclusively by the since parameter. is the Link header to get the URL for the next page of repositories. - * - * @name RepositoriesList - * @request GET:/repositories - */ - repositoriesList: ( - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - search = { - /** - * @description Search code. - * - * @name CodeList - * @request GET:/search/code - */ - codeList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported code - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier - * you can restrict the search to just the file contents, the file path, - * or both. - * 'Languages' Searches code based on the language it's written in. - * 'Forks' Filters repositories based on the number of forks, and/or - * whether code from forked repositories should be included in the results - * at all. - * 'Size' Finds files that match a certain size (in bytes). - * 'Path' Specifies the path that the resulting file must be at. - * 'Extension' Matches files with a certain extension. - * 'Users' or 'Repositories' Limits searches to a specific user or repository. - */ - q: string; - /** - * Can only be 'indexed', which indicates how recently a file has been indexed - * by the GitHub search infrastructure. If not provided, results are sorted - * by best match. - */ - sort?: "indexed"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/code`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Find issues by state and keyword. (This method returns up to 100 results per page.) - * - * @name IssuesList - * @request GET:/search/issues - */ - issuesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** The q search term can also contain any combination of the supported issue search qualifiers: */ - q: string; - /** The sort field. Can be comments, created, or updated. Default: results are sorted by best match. */ - sort?: "updated" | "created" | "comments"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Search repositories. - * - * @name RepositoriesList - * @request GET:/search/repositories - */ - repositoriesList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported repository - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the repository name, description, readme, - * or any combination of these. - * 'Size' Finds repositories that match a certain size (in kilobytes). - * 'Forks' Filters repositories based on the number of forks, and/or whether - * forked repositories should be included in the results at all. - * 'Created' and 'Last Updated' Filters repositories based on times of - * creation, or when they were last updated. - * 'Users or Repositories' Limits searches to a specific user or repository. - * 'Languages' Searches repositories based on the language they are written in. - * 'Stars' Searches repositories based on the number of stars. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "stars" | "forks" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/repositories`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Search users. - * - * @name UsersList - * @request GET:/search/users - */ - usersList: ( - query: { - /** - * The sort field. if sort param is provided. Can be either asc or desc. - * @default "desc" - */ - order?: "desc" | "asc"; - /** - * The search terms. This can be any combination of the supported user - * search parameters: - * 'Search In' Qualifies which fields are searched. With this qualifier you - * can restrict the search to just the username, public email, full name, - * location, or any combination of these. - * 'Repository count' Filters users based on the number of repositories they - * have. - * 'Location' Filter users by the location indicated in their profile. - * 'Language' Search for users that have repositories that match a certain - * language. - * 'Created' Filter users based on when they joined. - * 'Followers' Filter users based on the number of followers they have. - */ - q: string; - /** If not provided, results are sorted by best match. */ - sort?: "followers" | "repositories" | "joined"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/search/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - teams = { - /** - * @description Delete team. In order to delete a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @name TeamsDelete - * @request DELETE:/teams/{teamId} - */ - teamsDelete: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get team. - * - * @name TeamsDetail - * @request GET:/teams/{teamId} - */ - teamsDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Edit team. In order to edit a team, the authenticated user must be an owner of the org that the team is associated with. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List team members. In order to list members in a team, the authenticated user must be a member of the team. - * - * @name MembersDetail - * @request GET:/teams/{teamId}/members - */ - membersDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description The "Remove team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Remove team membership API instead. It allows you to remove both active and pending memberships. Remove team member. In order to remove a user from a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. NOTE This does not delete the user, it just remove them from the team. - * - * @name MembersDelete - * @request DELETE:/teams/{teamId}/members/{username} - * @deprecated - */ - membersDelete: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description The "Get team member" API is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Get team membership API instead. It allows you to get both active and pending memberships. Get team member. In order to get if a user is a member of a team, the authenticated user mus be a member of the team. - * - * @name MembersDetail2 - * @request GET:/teams/{teamId}/members/{username} - * @deprecated - * @originalName membersDetail - * @duplicate - */ - membersDetail2: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description The API (described below) is deprecated and is scheduled for removal in the next major version of the API. We recommend using the Add team membership API instead. It allows you to invite new organization members to your teams. Add team member. In order to add a user to a team, the authenticated user must have 'admin' permissions to the team or be an owner of the org that the team is associated with. - * - * @name MembersUpdate - * @request PUT:/teams/{teamId}/members/{username} - * @deprecated - */ - membersUpdate: (teamId: number, username: string, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/members/${username}`, - method: "PUT", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Remove team membership. In order to remove a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. NOTE: This does not delete the user, it just removes their membership from the team. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get team membership. In order to get a user's membership with a team, the authenticated user must be a member of the team or an owner of the team's organization. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Add team membership. In order to add a membership between a user and a team, the authenticated user must have 'admin' permissions to the team or be an owner of the organization that the team is associated with. If the user is already a part of the team's organization (meaning they're on at least one other team in the organization), this endpoint will add the user to the team. If the user is completely unaffiliated with the team's organization (meaning they're on none of the organization's teams), this endpoint will send an invitation to the user via email. This newly-created membership will be in the 'pending' state until the user accepts the invitation, at which point the membership will transition to the 'active' state and the user will be added as a member of the team. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List team repos - * - * @name ReposDetail - * @request GET:/teams/{teamId}/repos - */ - reposDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}/repos`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description In order to remove a repository from a team, the authenticated user must be an owner of the org that the team is associated with. NOTE: This does not delete the repository, it just removes it from the team. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if a team manages a repository - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description In order to add a repository to a team, the authenticated user must be an owner of the org that the team is associated with. Also, the repository must be owned by the organization, or a direct fork of a repository owned by the organization. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - }; - user = { - /** - * @description Get the authenticated user. - * - * @name UserList - * @request GET:/user - */ - userList: (params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Update the authenticated user. - * - * @name UserPartialUpdate - * @request PATCH:/user - */ - userPartialUpdate: (body: UserUpdate, params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete email address(es). You can include a single email address or an array of addresses. - * - * @name EmailsDelete - * @request DELETE:/user/emails - */ - emailsDelete: (body: UserEmails, params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "DELETE", - body: body, - type: ContentType.Json, - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List email addresses for a user. In the final version of the API, this method will return an array of hashes with extended information for each email address indicating if the address has been verified and if it's primary email address for GitHub. Until API v3 is finalized, use the application/vnd.github.v3 media type to get other response format. - * - * @name EmailsList - * @request GET:/user/emails - */ - emailsList: (params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Add email address(es). You can post a single email address or an array of addresses. - * - * @name EmailsCreate - * @request POST:/user/emails - */ - emailsCreate: (body: EmailsPost, params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "POST", - body: body, - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List the authenticated user's followers - * - * @name FollowersList - * @request GET:/user/followers - */ - followersList: (params: RequestParams = {}) => - this.request({ - path: `/user/followers`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List who the authenticated user is following. - * - * @name FollowingList - * @request GET:/user/following - */ - followingList: (params: RequestParams = {}) => - this.request({ - path: `/user/following`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Unfollow a user. Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingDelete - * @request DELETE:/user/following/{username} - */ - followingDelete: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if you are following a user. - * - * @name FollowingDetail - * @request GET:/user/following/{username} - */ - followingDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Follow a user. Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope. - * - * @name FollowingUpdate - * @request PUT:/user/following/{username} - */ - followingUpdate: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "PUT", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List issues. List all issues across owned and member repositories for the authenticated user. - * - * @name IssuesList - * @request GET:/user/issues - */ - issuesList: ( - query: { - /** - * 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: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - /** String list of comma separated Label names. Example - bug,ui,@high. */ - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - direction: "asc" | "desc"; - /** - * Optional string of a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Only issues updated at or after this time are returned. - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/issues`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List your public keys. Lists the current user's keys. Management of public keys via the API requires that you are authenticated through basic auth, or OAuth with the 'user', 'write:public_key' scopes. - * - * @name KeysList - * @request GET:/user/keys - */ - keysList: (params: RequestParams = {}) => - this.request({ - path: `/user/keys`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a public key. - * - * @name KeysCreate - * @request POST:/user/keys - */ - keysCreate: (body: UserKeysPost, params: RequestParams = {}) => - this.request({ - path: `/user/keys`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Delete a public key. Removes a public key. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope. - * - * @name KeysDelete - * @request DELETE:/user/keys/{keyId} - */ - keysDelete: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single public key. - * - * @name KeysDetail - * @request GET:/user/keys/{keyId} - */ - keysDetail: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List public and private organizations for the authenticated user. - * - * @name OrgsList - * @request GET:/user/orgs - */ - orgsList: (params: RequestParams = {}) => - this.request({ - path: `/user/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories for the authenticated user. Note that this does not include repositories owned by organizations which the user can access. You can lis user organizations and list organization repositories separately. - * - * @name ReposList - * @request GET:/user/repos - */ - reposList: ( - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Create a new repository for the authenticated user. OAuth users must supply repo scope. - * - * @name ReposCreate - * @request POST:/user/repos - */ - reposCreate: (body: PostRepo, params: RequestParams = {}) => - this.request({ - path: `/user/repos`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories being starred by the authenticated user. - * - * @name StarredList - * @request GET:/user/starred - */ - starredList: ( - query?: { - /** Ignored without 'sort' parameter. */ - direction?: string; - /** @default "created" */ - sort?: "created" | "updated"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/user/starred`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Unstar a repository - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if you are starring a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Star a repository. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories being watched by the authenticated user. - * - * @name SubscriptionsList - * @request GET:/user/subscriptions - */ - subscriptionsList: (params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Stop watching a repository - * - * @name SubscriptionsDelete - * @request DELETE:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDelete: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "DELETE", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if you are watching a repository. - * - * @name SubscriptionsDetail - * @request GET:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsDetail: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Watch a repository. - * - * @name SubscriptionsUpdate - * @request PUT:/user/subscriptions/{owner}/{repo} - * @deprecated - */ - subscriptionsUpdate: (owner: string, repo: string, params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions/${owner}/${repo}`, - method: "PUT", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List all of the teams across all of the organizations to which the authenticated user belongs. This method requires user or repo scope when authenticating via OAuth. - * - * @name TeamsList - * @request GET:/user/teams - */ - teamsList: (params: RequestParams = {}) => - this.request({ - path: `/user/teams`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; - users = { - /** - * @description Get all users. This provides a dump of every user, in the order that they signed up for GitHub. Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users. - * - * @name UsersList - * @request GET:/users - */ - usersList: ( - query?: { - /** The integer ID of the last user that you've seen. */ - since?: number; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Get a single user. - * - * @name UsersDetail - * @request GET:/users/{username} - */ - usersDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description If you are authenticated as the given user, you will see your private events. Otherwise, you'll only see public events. - * - * @name EventsDetail - * @request GET:/users/{username}/events - */ - eventsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/events`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description This is the user's organization dashboard. You must be authenticated as the user to view this. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List a user's followers - * - * @name FollowersDetail - * @request GET:/users/{username}/followers - */ - followersDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/followers`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description Check if one user follows another. - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List a users gists. - * - * @name GistsDetail - * @request GET:/users/{username}/gists - */ - gistsDetail: ( - username: string, - query?: { - /** - * The time should be passed in as UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. - * Example: "2012-10-09T23:39:01Z". - */ - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List public keys for a user. Lists the verified public keys for a user. This is accessible by anyone. - * - * @name KeysDetail - * @request GET:/users/{username}/keys - */ - keysDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/keys`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List all public organizations for a user. - * - * @name OrgsDetail - * @request GET:/users/{username}/orgs - */ - orgsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description These are events that you'll only see public events. - * - * @name ReceivedEventsDetail - * @request GET:/users/{username}/received_events - */ - receivedEventsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/received_events`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List public events that a user has received - * - * @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, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List public repositories for the specified user. - * - * @name ReposDetail - * @request GET:/users/{username}/repos - */ - reposDetail: ( - username: string, - query?: { - /** @default "all" */ - type?: "all" | "public" | "private" | "forks" | "sources" | "member"; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/users/${username}/repos`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories being starred by a user. - * - * @name StarredDetail - * @request GET:/users/{username}/starred - */ - starredDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/starred`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - - /** - * @description List repositories being watched by a user. - * - * @name SubscriptionsDetail - * @request GET:/users/{username}/subscriptions - */ - subscriptionsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/subscriptions`, - method: "GET", - ...params, - }), - - /* CUSTOM TEMPLATE */ - }; -} - -/* CUSTOM TEMPLATE */ diff --git a/tests/spec/templates/spec_templates/api.eta b/tests/spec/templates/spec_templates/api.eta deleted file mode 100644 index bcd21d95..00000000 --- a/tests/spec/templates/spec_templates/api.eta +++ /dev/null @@ -1,63 +0,0 @@ -<% -const { apiConfig, routes, utils, config } = it; -const { info, servers, externalDocs } = apiConfig; -const { _, require, formatDescription } = utils; - -const server = (servers && servers[0]) || { url: "" }; - -const descriptionLines = _.compact([ - `@title ${info.title || "No title"}`, - info.version && `@version ${info.version}`, - info.license && `@license ${_.compact([ - info.license.name, - info.license.url && `(${info.license.url})`, - ]).join(" ")}`, - info.termsOfService && `@termsOfService ${info.termsOfService}`, - server.url && `@baseUrl ${server.url}`, - externalDocs.url && `@externalDocs ${externalDocs.url}`, - info.contact && `@contact ${_.compact([ - info.contact.name, - info.contact.email && `<${info.contact.email}>`, - info.contact.url && `(${info.contact.url})`, - ]).join(" ")}`, - info.description && " ", - info.description && _.replace(formatDescription(info.description), /\n/g, "\n * "), -]); - -%> - -<% if (config.httpClientType === config.constants.HTTP_CLIENT.AXIOS) { %> import { AxiosRequestConfig, AxiosResponse } from "axios"; <% } %> - -<% if (descriptionLines.length) { %> -/** -<% descriptionLines.forEach((descriptionLine) => { %> -* <%~ descriptionLine %> - -<% }) %> -*/ -<% } %> -export class Api<% if (!config.singleHttpClient) { %> extends HttpClient <% } %> { - -<% if(config.singleHttpClient) { %> - constructor (private http: HttpClient) {} -<% } %> - - -<% routes.outOfModule && routes.outOfModule.forEach((route) => { %> - - <%~ includeFile('./procedure-call.eta', { ...it, route }) %> - -<% }) %> - -<% routes.combined && routes.combined.forEach(({ routes = [], moduleName }) => { %> - <%~ moduleName %> = { - <% routes.forEach((route) => { %> - - <%~ includeFile('./procedure-call.eta', { ...it, route }) %> - - <% }) %> - } -<% }) %> -} - -/* CUSTOM TEMPLATE */ diff --git a/tests/spec/templates/spec_templates/data-contracts.eta b/tests/spec/templates/spec_templates/data-contracts.eta deleted file mode 100644 index e62465ee..00000000 --- a/tests/spec/templates/spec_templates/data-contracts.eta +++ /dev/null @@ -1,30 +0,0 @@ -<% - const { modelTypes, utils } = it; - const { formatDescription } = utils; - - - const dataContractTemplates = { - enum: (contract) => { - return `enum ${contract.name} {\r\n${contract.content} \r\n }`; - }, - interface: (contract) => { - return `interface ${contract.name} {\r\n${contract.content}}`; - }, - type: (contract) => { - return `type ${contract.name} = ${contract.content}`; - }, - } -%> -<% modelTypes.forEach((contract) => { %> -<% if (contract.description) { %> -/** -* <%~ formatDescription(contract.description) %> - -*/ -<% } %> -export <%~ (dataContractTemplates[contract.typeIdentifier] || dataContractTemplates.type)(contract) %> - - -<% }) %> - -/* CUSTOM TEMPLATE */ \ No newline at end of file diff --git a/tests/spec/templates/spec_templates/http-client.eta b/tests/spec/templates/spec_templates/http-client.eta deleted file mode 100644 index 3b7e1a5f..00000000 --- a/tests/spec/templates/spec_templates/http-client.eta +++ /dev/null @@ -1,5 +0,0 @@ -<% const { config } = it; %> -<% /* https://github.com/acacode/swagger-typescript-api/tree/next/templates/base/http-clients/ */ %> -<%~ includeFile(`@base/http-clients/${config.httpClientType}-http-client`, it) %> - -/* HTTP CLIENT TEMPLATE */ \ No newline at end of file diff --git a/tests/spec/templates/spec_templates/procedure-call.eta b/tests/spec/templates/spec_templates/procedure-call.eta deleted file mode 100644 index d5a85b00..00000000 --- a/tests/spec/templates/spec_templates/procedure-call.eta +++ /dev/null @@ -1,102 +0,0 @@ -<% -const { utils, route, config } = it; -const { requestBodyInfo, responseBodyInfo, specificArgNameResolver } = route; -const { _, getInlineParseContent, getParseContent, parseSchema, getComponentByRef, require } = utils; -const { parameters, path, method, payload, query, formData, security, requestParams } = route.request; -const { type, errorType, contentTypes } = route.response; -const { HTTP_CLIENT, RESERVED_REQ_PARAMS_ARG_NAMES } = config.constants; -const routeDocs = includeFile("@base/route-docs", { config, route, utils }); -const queryName = (query && query.name) || "query"; -const pathParams = _.values(parameters); -const pathParamsNames = _.map(pathParams, "name"); - -const isFetchTemplate = config.httpClientType === HTTP_CLIENT.FETCH; - -const requestConfigParam = { - name: specificArgNameResolver.resolve(RESERVED_REQ_PARAMS_ARG_NAMES), - optional: true, - type: "RequestParams", - defaultValue: "{}", -} - -const argToTmpl = ({ name, optional, type, defaultValue }) => `${name}${!defaultValue && optional ? '?' : ''}: ${type}${defaultValue ? ` = ${defaultValue}` : ''}`; - -const rawWrapperArgs = config.extractRequestParams ? - _.compact([ - requestParams && { - name: pathParams.length ? `{ ${_.join(pathParamsNames, ", ")}, ...${queryName} }` : queryName, - optional: false, - type: getInlineParseContent(requestParams), - }, - ...(!requestParams ? pathParams : []), - payload, - requestConfigParam, - ]) : - _.compact([ - ...pathParams, - query, - payload, - requestConfigParam, - ]) - -const wrapperArgs = _ - // Sort by optionality - .sortBy(rawWrapperArgs, [o => o.optional]) - .map(argToTmpl) - .join(', ') - -// RequestParams["type"] -const requestContentKind = { - "JSON": "ContentType.Json", - "URL_ENCODED": "ContentType.UrlEncoded", - "FORM_DATA": "ContentType.FormData", -} -// RequestParams["format"] -const responseContentKind = { - "JSON": '"json"', - "IMAGE": '"blob"', - "FORM_DATA": isFetchTemplate ? '"formData"' : '"document"' -} - -const bodyTmpl = _.get(payload, "name") || null; -const queryTmpl = (query != null && queryName) || null; -const bodyContentKindTmpl = requestContentKind[requestBodyInfo.contentKind] || null; -const responseFormatTmpl = responseContentKind[responseBodyInfo.success && responseBodyInfo.success.schema && responseBodyInfo.success.schema.contentKind] || null; -const securityTmpl = security ? 'true' : null; - -const describeReturnType = () => { - if (!config.toJS) return ""; - - switch(config.httpClientType) { - case HTTP_CLIENT.AXIOS: { - return `Promise>` - } - default: { - return `Promise` - } - } -} - -%> -/** -<%~ routeDocs.description %> - - * <% /* Here you can add some other JSDoc tags */ %> - -<%~ routeDocs.lines %> - - */ -<%~ route.routeName.usage %><%~ route.namespace ? ': ' : ' = ' %>(<%~ wrapperArgs %>)<%~ config.toJS ? `: ${describeReturnType()}` : "" %> => - <%~ config.singleHttpClient ? 'this.http.request' : 'this.request' %><<%~ type %>, <%~ errorType %>>({ - path: `<%~ path %>`, - method: '<%~ _.upperCase(method) %>', - <%~ queryTmpl ? `query: ${queryTmpl},` : '' %> - <%~ bodyTmpl ? `body: ${bodyTmpl},` : '' %> - <%~ securityTmpl ? `secure: ${securityTmpl},` : '' %> - <%~ bodyContentKindTmpl ? `type: ${bodyContentKindTmpl},` : '' %> - <%~ responseFormatTmpl ? `format: ${responseFormatTmpl},` : '' %> - ...<%~ _.get(requestConfigParam, "name") %>, - })<%~ route.namespace ? ',' : '' %> - - -/* CUSTOM TEMPLATE */ \ No newline at end of file diff --git a/tests/spec/templates/spec_templates/route-docs.eta b/tests/spec/templates/spec_templates/route-docs.eta deleted file mode 100644 index 3c37ff0e..00000000 --- a/tests/spec/templates/spec_templates/route-docs.eta +++ /dev/null @@ -1,31 +0,0 @@ -<% -const { config, route, utils } = it; -const { _, formatDescription, fmtToJSDocLine, pascalCase } = utils; -const { raw, request, routeName } = route; -const jsDocDescription = raw.description ? - ` * @description ${formatDescription(raw.description, true)}` : - fmtToJSDocLine('No description', { eol: false }); -const jsDocLines = _.compact([ - _.size(raw.tags) && ` * @tags ${raw.tags.join(", ")}`, - ` * @name ${pascalCase(routeName.usage)}`, - raw.summary && ` * @summary ${raw.summary}`, - ` * @request ${_.upperCase(request.method)}:${raw.route}`, - routeName.duplicate && ` * @originalName ${routeName.original}\n`, - routeName.duplicate && ` * @duplicate\n`, - request.security && ` * @secure`, - ...(config.generateResponses && raw.responsesTypes.length - ? raw.responsesTypes.map( - ({ type, status, description, isSuccess }) => - ` * @response \`${status}\` \`${type}\` ${description}`, - ) - : []), -]).join("\n"); - - -return { - description: jsDocDescription, - lines: jsDocLines, -} -%> - -/* CUSTOM TEMPLATE */ \ No newline at end of file diff --git a/tests/spec/templates/spec_templates/route-name.eta b/tests/spec/templates/spec_templates/route-name.eta deleted file mode 100644 index f62e2e11..00000000 --- a/tests/spec/templates/spec_templates/route-name.eta +++ /dev/null @@ -1,44 +0,0 @@ -<% -const { routeInfo, utils } = it; -const { - operationId, - method, - route, - moduleName, - responsesTypes, - description, - tags, - summary, -} = routeInfo; -const { _, fmtToJSDocLine } = utils; - -const methodAliases = { - get: (pathName, hasPathInserts) => - _.camelCase(`${pathName}_${hasPathInserts ? "detail" : "list"}`), - post: (pathName, hasPathInserts) => _.camelCase(`${pathName}_create`), - put: (pathName, hasPathInserts) => _.camelCase(`${pathName}_update`), - patch: (pathName, hasPathInserts) => _.camelCase(`${pathName}_partial_update`), - delete: (pathName, hasPathInserts) => _.camelCase(`${pathName}_delete`), -}; - -const createCustomOperationId = (method, route, moduleName) => { - const hasPathInserts = /\{(\w){1,}\}/g.test(route); - const splittedRouteBySlash = _.compact(_.replace(route, /\{(\w){1,}\}/g, "").split("/")); - const routeParts = (splittedRouteBySlash.length > 1 - ? splittedRouteBySlash.splice(1) - : splittedRouteBySlash - ).join("_"); - return routeParts.length > 3 && methodAliases[method] - ? methodAliases[method](routeParts, hasPathInserts) - : _.camelCase(_.lowerCase(method) + "_" + [moduleName].join("_")) || "index"; -}; - -if (operationId) - return _.camelCase(operationId); -if (route === "/") - return _.camelCase(`${_.lowerCase(method)}Root`); - -return createCustomOperationId(method, route, moduleName); -%> - -/* CUSTOM TEMPLATE */ \ No newline at end of file diff --git a/tests/spec/templates/spec_templates/route-type.eta b/tests/spec/templates/spec_templates/route-type.eta deleted file mode 100644 index 1c7b84c6..00000000 --- a/tests/spec/templates/spec_templates/route-type.eta +++ /dev/null @@ -1,26 +0,0 @@ -<% -const { route, utils, config } = it; -const { _, pascalCase } = utils -const { query, payload } = route.request -const { type: responseType } = route.response - -const routeDocs = includeFile("./route-docs", { config, route, utils }); -const routeNamespace = pascalCase(route.routeName.usage) -const queryType = (query && query.type) || '{}' -const bodyType = (payload && payload.type) || 'never' -%> -/** -<%~ routeDocs.description %> - -* <% /* Here you can add some other JSDoc tags */ %> - -<%~ routeDocs.lines %> - -*/ -export namespace <%~ routeNamespace %> { -export type RequestQuery = <%~ queryType %>; -export type RequestBody = <%~ bodyType %>; -export type ResponseBody = <%~ responseType %>; -} - -/* CUSTOM TEMPLATE */ \ No newline at end of file diff --git a/tests/spec/templates/spec_templates/route-types.eta b/tests/spec/templates/spec_templates/route-types.eta deleted file mode 100644 index 286141e7..00000000 --- a/tests/spec/templates/spec_templates/route-types.eta +++ /dev/null @@ -1,23 +0,0 @@ -<% -const { utils, config, routes } = it; -%> -<% -/* 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('./route-type.eta', { route, utils, config }) %> - <% }) %> -<% }) %> - -<% routes.combined && routes.combined.forEach(({ routes = [], moduleName }) => { %> - export namespace <%~ moduleName %> { - <% routes.forEach((route) => { %> - <%~ includeFile('./route-type.eta', { route, utils, config }) %> - <% }) %> - } - -<% }) %> - -/* CUSTOM TEMPLATE */ diff --git a/tests/spec/templates/test.js b/tests/spec/templates/test.js deleted file mode 100644 index 0a1be656..00000000 --- a/tests/spec/templates/test.js +++ /dev/null @@ -1,27 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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, Exception }) => { - generateApiForTest({ - testName: "--templates option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - // because this script was called from package.json folder - templates: "./tests/spec/templates/spec_templates", - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/typeSuffixPrefix/expected.ts b/tests/spec/typeSuffixPrefix/__snapshots__/basic.test.ts.snap similarity index 79% rename from tests/spec/typeSuffixPrefix/expected.ts rename to tests/spec/typeSuffixPrefix/__snapshots__/basic.test.ts.snap index 01f6f8d8..2a0c78ef 100644 --- a/tests/spec/typeSuffixPrefix/expected.ts +++ b/tests/spec/typeSuffixPrefix/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --type-prefix and --type-suffix 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -1770,7 +1773,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -1835,7 +1838,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -1857,7 +1860,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -1873,7 +1876,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -1937,7 +1940,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -1990,7 +1993,7 @@ export class Api extends HttpClient extends HttpClient this.request< @@ -2066,7 +2069,7 @@ export class Api extends HttpClient({ - path: `/some-test`, + path: \`/some-test\`, method: "GET", format: "json", ...params, @@ -2078,12 +2081,12 @@ export class Api extends HttpClient this.request({ - path: `/path-params`, + path: \`/path-params\`, method: "GET", format: "json", ...params, @@ -2095,12 +2098,12 @@ export class Api extends HttpClient this.request({ - path: `/events`, + path: \`/events\`, method: "GET", format: "json", ...params, @@ -2112,12 +2115,12 @@ export class Api extends HttpClient this.request({ - path: `/feeds`, + path: \`/feeds\`, method: "GET", format: "json", ...params, @@ -2129,8 +2132,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/gists`, + path: \`/gists\`, method: "GET", query: query, format: "json", @@ -2151,12 +2154,12 @@ export class Api extends HttpClient this.request({ - path: `/gists`, + path: \`/gists\`, method: "POST", body: body, type: ContentType.Json, @@ -2169,8 +2172,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/gists/public`, + path: \`/gists/public\`, method: "GET", query: query, format: "json", @@ -2191,8 +2194,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/gists/starred`, + path: \`/gists/starred\`, method: "GET", query: query, format: "json", @@ -2213,12 +2216,12 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "DELETE", ...params, }), @@ -2228,12 +2231,12 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "GET", format: "json", ...params, @@ -2244,12 +2247,12 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}`, + path: \`/gists/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2262,12 +2265,12 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "GET", format: "json", ...params, @@ -2278,12 +2281,12 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments`, + path: \`/gists/\${id}/comments\`, method: "POST", body: body, format: "json", @@ -2295,12 +2298,12 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -2312,12 +2315,12 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -2328,8 +2331,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/gists/${id}/comments/${commentId}`, + path: \`/gists/\${id}/comments/\${commentId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2351,13 +2354,13 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/forks`, + path: \`/gists/\${id}/forks\`, method: "POST", ...params, }), @@ -2367,12 +2370,12 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "DELETE", ...params, }), @@ -2382,13 +2385,13 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "GET", ...params, }), @@ -2398,12 +2401,12 @@ export class Api extends HttpClient this.request({ - path: `/gists/${id}/star`, + path: \`/gists/\${id}/star\`, method: "PUT", ...params, }), @@ -2414,12 +2417,12 @@ export class Api extends HttpClient this.request({ - path: `/gitignore/templates`, + path: \`/gitignore/templates\`, method: "GET", format: "json", ...params, @@ -2430,12 +2433,12 @@ export class Api extends HttpClient this.request({ - path: `/gitignore/templates/${language}`, + path: \`/gitignore/templates/\${language}\`, method: "GET", format: "json", ...params, @@ -2447,8 +2450,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/issues`, + path: \`/issues\`, method: "GET", query: query, format: "json", @@ -2480,8 +2483,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/legacy/issues/search/${owner}/${repository}/${state}/${keyword}`, + path: \`/legacy/issues/search/\${owner}/\${repository}/\${state}/\${keyword}\`, method: "GET", format: "json", ...params, @@ -2503,8 +2506,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/legacy/repos/search/${keyword}`, + path: \`/legacy/repos/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2531,12 +2534,12 @@ export class Api extends HttpClient this.request({ - path: `/legacy/user/email/${email}`, + path: \`/legacy/user/email/\${email}\`, method: "GET", format: "json", ...params, @@ -2548,8 +2551,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/legacy/user/search/${keyword}`, + path: \`/legacy/user/search/\${keyword}\`, method: "GET", query: query, format: "json", @@ -2575,12 +2578,12 @@ export class Api extends HttpClient this.request({ - path: `/markdown`, + path: \`/markdown\`, method: "POST", body: body, type: ContentType.Json, @@ -2592,12 +2595,12 @@ export class Api extends HttpClient this.request({ - path: `/markdown/raw`, + path: \`/markdown/raw\`, method: "POST", type: ContentType.Text, ...params, @@ -2609,12 +2612,12 @@ export class Api extends HttpClient this.request({ - path: `/meta`, + path: \`/meta\`, method: "GET", format: "json", ...params, @@ -2626,12 +2629,12 @@ export class Api extends HttpClient this.request({ - path: `/networks/${owner}/${repo}/events`, + path: \`/networks/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -2643,8 +2646,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "GET", query: query, format: "json", @@ -2667,12 +2670,12 @@ export class Api extends HttpClient this.request({ - path: `/notifications`, + path: \`/notifications\`, method: "PUT", body: body, ...params, @@ -2683,12 +2686,12 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "GET", format: "json", ...params, @@ -2699,12 +2702,12 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}`, + path: \`/notifications/threads/\${id}\`, method: "PATCH", ...params, }), @@ -2714,12 +2717,12 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "DELETE", ...params, }), @@ -2729,12 +2732,12 @@ export class Api extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "GET", format: "json", ...params, @@ -2745,8 +2748,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/notifications/threads/${id}/subscription`, + path: \`/notifications/threads/\${id}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -2768,12 +2771,12 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "GET", format: "json", ...params, @@ -2784,12 +2787,12 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}`, + path: \`/orgs/\${org}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -2802,12 +2805,12 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/events`, + path: \`/orgs/\${org}/events\`, method: "GET", format: "json", ...params, @@ -2818,8 +2821,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/orgs/${org}/issues`, + path: \`/orgs/\${org}/issues\`, method: "GET", query: query, format: "json", @@ -2850,13 +2853,13 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members`, + path: \`/orgs/\${org}/members\`, method: "GET", format: "json", ...params, @@ -2867,12 +2870,12 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "DELETE", ...params, }), @@ -2884,14 +2887,14 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/members/${username}`, + path: \`/orgs/\${org}/members/\${username}\`, method: "GET", ...params, }), @@ -2901,12 +2904,12 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members`, + path: \`/orgs/\${org}/public_members\`, method: "GET", format: "json", ...params, @@ -2917,12 +2920,12 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "DELETE", ...params, }), @@ -2934,13 +2937,13 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "GET", ...params, }), @@ -2950,12 +2953,12 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/public_members/${username}`, + path: \`/orgs/\${org}/public_members/\${username}\`, method: "PUT", ...params, }), @@ -2965,8 +2968,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "GET", query: query, format: "json", @@ -2989,12 +2992,12 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/repos`, + path: \`/orgs/\${org}/repos\`, method: "POST", body: body, format: "json", @@ -3006,12 +3009,12 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "GET", format: "json", ...params, @@ -3022,12 +3025,12 @@ export class Api extends HttpClient this.request({ - path: `/orgs/${org}/teams`, + path: \`/orgs/\${org}/teams\`, method: "POST", body: body, type: ContentType.Json, @@ -3041,12 +3044,12 @@ export class Api extends HttpClient this.request({ - path: `/rate_limit`, + path: \`/rate_limit\`, method: "GET", format: "json", ...params, @@ -3058,12 +3061,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -3073,12 +3076,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "GET", format: "json", ...params, @@ -3089,8 +3092,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}`, + path: \`/repos/\${owner}/\${repo}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -3112,12 +3115,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/assignees`, + path: \`/repos/\${owner}/\${repo}/assignees\`, method: "GET", format: "json", ...params, @@ -3130,13 +3133,13 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/assignees/${assignee}`, + path: \`/repos/\${owner}/\${repo}/assignees/\${assignee}\`, method: "GET", ...params, }), @@ -3146,12 +3149,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/branches`, + path: \`/repos/\${owner}/\${repo}/branches\`, method: "GET", format: "json", ...params, @@ -3164,12 +3167,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/branches/${branch}`, + path: \`/repos/\${owner}/\${repo}/branches/\${branch}\`, method: "GET", format: "json", ...params, @@ -3180,12 +3183,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators`, + path: \`/repos/\${owner}/\${repo}/collaborators\`, method: "GET", format: "json", ...params, @@ -3196,12 +3199,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "DELETE", ...params, }), @@ -3213,13 +3216,13 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "GET", ...params, }), @@ -3229,12 +3232,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/collaborators/${user}`, + path: \`/repos/\${owner}/\${repo}/collaborators/\${user}\`, method: "PUT", ...params, }), @@ -3244,12 +3247,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments`, + path: \`/repos/\${owner}/\${repo}/comments\`, method: "GET", format: "json", ...params, @@ -3260,12 +3263,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -3277,12 +3280,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -3293,8 +3296,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -3316,8 +3319,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits`, + path: \`/repos/\${owner}/\${repo}/commits\`, method: "GET", query: query, format: "json", @@ -3344,12 +3347,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${ref}/status`, + path: \`/repos/\${owner}/\${repo}/commits/\${ref}/status\`, method: "GET", format: "json", ...params, @@ -3362,12 +3365,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3378,12 +3381,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "GET", format: "json", ...params, @@ -3394,8 +3397,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/commits/${shaCode}/comments`, + path: \`/repos/\${owner}/\${repo}/commits/\${shaCode}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -3418,12 +3421,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/compare/${baseId}...${headId}`, + path: \`/repos/\${owner}/\${repo}/compare/\${baseId}...\${headId}\`, method: "GET", format: "json", ...params, @@ -3434,8 +3437,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "DELETE", body: body, type: ContentType.Json, @@ -3458,8 +3461,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "GET", query: query, format: "json", @@ -3484,8 +3487,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contents/${path}`, + path: \`/repos/\${owner}/\${repo}/contents/\${path}\`, method: "PUT", body: body, type: ContentType.Json, @@ -3508,8 +3511,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/contributors`, + path: \`/repos/\${owner}/\${repo}/contributors\`, method: "GET", query: query, format: "json", @@ -3532,12 +3535,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "GET", format: "json", ...params, @@ -3548,8 +3551,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments`, + path: \`/repos/\${owner}/\${repo}/deployments\`, method: "POST", body: body, type: ContentType.Json, @@ -3571,12 +3574,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "GET", format: "json", ...params, @@ -3587,8 +3590,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/deployments/${id}/statuses`, + path: \`/repos/\${owner}/\${repo}/deployments/\${id}/statuses\`, method: "POST", body: body, type: ContentType.Json, @@ -3611,12 +3614,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads`, + path: \`/repos/\${owner}/\${repo}/downloads\`, method: "GET", format: "json", ...params, @@ -3628,12 +3631,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "DELETE", ...params, }), @@ -3646,12 +3649,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/downloads/${downloadId}`, + path: \`/repos/\${owner}/\${repo}/downloads/\${downloadId}\`, method: "GET", format: "json", ...params, @@ -3662,12 +3665,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/events`, + path: \`/repos/\${owner}/\${repo}/events\`, method: "GET", format: "json", ...params, @@ -3678,8 +3681,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "GET", query: query, format: "json", @@ -3703,8 +3706,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/forks`, + path: \`/repos/\${owner}/\${repo}/forks\`, method: "POST", body: body, type: ContentType.Json, @@ -3726,8 +3729,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/blobs`, + path: \`/repos/\${owner}/\${repo}/git/blobs\`, method: "POST", body: body, type: ContentType.Json, @@ -3749,12 +3752,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/blobs/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/blobs/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3765,8 +3768,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/commits`, + path: \`/repos/\${owner}/\${repo}/git/commits\`, method: "POST", body: body, type: ContentType.Json, @@ -3788,12 +3791,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/commits/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/commits/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3804,12 +3807,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "GET", format: "json", ...params, @@ -3820,8 +3823,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs`, + path: \`/repos/\${owner}/\${repo}/git/refs\`, method: "POST", body: body, type: ContentType.Json, @@ -3843,12 +3846,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "DELETE", ...params, }), @@ -3860,12 +3863,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "GET", format: "json", ...params, @@ -3876,8 +3879,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/refs/${ref}`, + path: \`/repos/\${owner}/\${repo}/git/refs/\${ref}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -3900,8 +3903,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/tags`, + path: \`/repos/\${owner}/\${repo}/git/tags\`, method: "POST", body: body, type: ContentType.Json, @@ -3923,12 +3926,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/tags/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/tags/\${shaCode}\`, method: "GET", format: "json", ...params, @@ -3939,8 +3942,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/trees`, + path: \`/repos/\${owner}/\${repo}/git/trees\`, method: "POST", body: body, type: ContentType.Json, @@ -3962,8 +3965,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/git/trees/${shaCode}`, + path: \`/repos/\${owner}/\${repo}/git/trees/\${shaCode}\`, method: "GET", query: query, format: "json", @@ -3987,12 +3990,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "GET", format: "json", ...params, @@ -4003,8 +4006,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks`, + path: \`/repos/\${owner}/\${repo}/hooks\`, method: "POST", body: body, format: "json", @@ -4025,12 +4028,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "DELETE", ...params, }), @@ -4042,12 +4045,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "GET", format: "json", ...params, @@ -4058,8 +4061,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}\`, method: "PATCH", body: body, format: "json", @@ -4081,12 +4084,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/hooks/${hookId}/tests`, + path: \`/repos/\${owner}/\${repo}/hooks/\${hookId}/tests\`, method: "POST", ...params, }), @@ -4096,8 +4099,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "GET", query: query, format: "json", @@ -4129,8 +4132,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues`, + path: \`/repos/\${owner}/\${repo}/issues\`, method: "POST", body: body, format: "json", @@ -4151,8 +4154,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments`, + path: \`/repos/\${owner}/\${repo}/issues/comments\`, method: "GET", query: query, format: "json", @@ -4177,12 +4180,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -4194,12 +4197,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -4210,8 +4213,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/issues/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -4233,12 +4236,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/events`, + path: \`/repos/\${owner}/\${repo}/issues/events\`, method: "GET", format: "json", ...params, @@ -4251,12 +4254,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/events/${eventId}`, + path: \`/repos/\${owner}/\${repo}/issues/events/\${eventId}\`, method: "GET", format: "json", ...params, @@ -4269,12 +4272,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "GET", format: "json", ...params, @@ -4285,8 +4288,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}\`, method: "PATCH", body: body, format: "json", @@ -4310,12 +4313,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -4326,8 +4329,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/comments\`, method: "POST", body: body, format: "json", @@ -4351,12 +4354,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/events`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/events\`, method: "GET", format: "json", ...params, @@ -4367,12 +4370,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "DELETE", ...params, }), @@ -4382,12 +4385,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4398,8 +4401,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "POST", body: body, format: "json", @@ -4421,8 +4424,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels\`, method: "PUT", body: body, format: "json", @@ -4446,12 +4449,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/issues/${number}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/issues/\${number}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4461,12 +4464,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "GET", format: "json", ...params, @@ -4477,8 +4480,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys`, + path: \`/repos/\${owner}/\${repo}/keys\`, method: "POST", body: body, format: "json", @@ -4499,12 +4502,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -4516,12 +4519,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/keys/${keyId}`, + path: \`/repos/\${owner}/\${repo}/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -4532,12 +4535,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "GET", format: "json", ...params, @@ -4548,8 +4551,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels`, + path: \`/repos/\${owner}/\${repo}/labels\`, method: "POST", body: body, format: "json", @@ -4570,12 +4573,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "DELETE", ...params, }), @@ -4587,12 +4590,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "GET", format: "json", ...params, @@ -4603,8 +4606,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/labels/${name}`, + path: \`/repos/\${owner}/\${repo}/labels/\${name}\`, method: "PATCH", body: body, format: "json", @@ -4626,12 +4629,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/languages`, + path: \`/repos/\${owner}/\${repo}/languages\`, method: "GET", format: "json", ...params, @@ -4642,11 +4645,11 @@ export class Api extends HttpClient extends HttpClient({ - path: `/repos/${owner}/${repo}/merges`, + path: \`/repos/\${owner}/\${repo}/merges\`, method: "POST", body: body, type: ContentType.Json, @@ -4671,8 +4674,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "GET", query: query, format: "json", @@ -4699,8 +4702,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones`, + path: \`/repos/\${owner}/\${repo}/milestones\`, method: "POST", body: body, format: "json", @@ -4721,12 +4724,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "DELETE", ...params, }), @@ -4738,12 +4741,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "GET", format: "json", ...params, @@ -4754,8 +4757,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}\`, method: "PATCH", body: body, format: "json", @@ -4777,12 +4780,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/milestones/${number}/labels`, + path: \`/repos/\${owner}/\${repo}/milestones/\${number}/labels\`, method: "GET", format: "json", ...params, @@ -4793,8 +4796,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "GET", query: query, format: "json", @@ -4819,8 +4822,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/notifications`, + path: \`/repos/\${owner}/\${repo}/notifications\`, method: "PUT", body: body, ...params, @@ -4840,8 +4843,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "GET", query: query, format: "json", @@ -4867,8 +4870,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls`, + path: \`/repos/\${owner}/\${repo}/pulls\`, method: "POST", body: body, type: ContentType.Json, @@ -4890,8 +4893,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/comments\`, method: "GET", query: query, format: "json", @@ -4916,12 +4919,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "DELETE", ...params, }), @@ -4933,12 +4936,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "GET", format: "json", ...params, @@ -4949,8 +4952,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/comments/${commentId}`, + path: \`/repos/\${owner}/\${repo}/pulls/comments/\${commentId}\`, method: "PATCH", body: body, format: "json", @@ -4974,12 +4977,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "GET", format: "json", ...params, @@ -4990,8 +4993,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5016,12 +5019,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "GET", format: "json", ...params, @@ -5032,8 +5035,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/comments`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/comments\`, method: "POST", body: body, type: ContentType.Json, @@ -5056,12 +5059,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/commits`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/commits\`, method: "GET", format: "json", ...params, @@ -5072,12 +5075,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/files`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/files\`, method: "GET", format: "json", ...params, @@ -5088,13 +5091,13 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "GET", ...params, }), @@ -5104,9 +5107,9 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/pulls/${number}/merge`, + path: \`/repos/\${owner}/\${repo}/pulls/\${number}/merge\`, method: "PUT", body: body, type: ContentType.Json, @@ -5129,8 +5132,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/readme`, + path: \`/repos/\${owner}/\${repo}/readme\`, method: "GET", query: query, format: "json", @@ -5153,12 +5156,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "GET", format: "json", ...params, @@ -5169,8 +5172,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases`, + path: \`/repos/\${owner}/\${repo}/releases\`, method: "POST", body: body, format: "json", @@ -5191,12 +5194,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "DELETE", ...params, }), @@ -5206,12 +5209,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "GET", format: "json", ...params, @@ -5222,8 +5225,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/assets/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/assets/\${id}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5246,12 +5249,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "DELETE", ...params, }), @@ -5263,12 +5266,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "GET", format: "json", ...params, @@ -5279,8 +5282,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}\`, method: "PATCH", body: body, format: "json", @@ -5304,12 +5307,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/releases/${id}/assets`, + path: \`/repos/\${owner}/\${repo}/releases/\${id}/assets\`, method: "GET", format: "json", ...params, @@ -5320,12 +5323,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stargazers`, + path: \`/repos/\${owner}/\${repo}/stargazers\`, method: "GET", format: "json", ...params, @@ -5336,12 +5339,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/code_frequency`, + path: \`/repos/\${owner}/\${repo}/stats/code_frequency\`, method: "GET", format: "json", ...params, @@ -5352,12 +5355,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/commit_activity`, + path: \`/repos/\${owner}/\${repo}/stats/commit_activity\`, method: "GET", format: "json", ...params, @@ -5368,12 +5371,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/contributors`, + path: \`/repos/\${owner}/\${repo}/stats/contributors\`, method: "GET", format: "json", ...params, @@ -5384,12 +5387,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/participation`, + path: \`/repos/\${owner}/\${repo}/stats/participation\`, method: "GET", format: "json", ...params, @@ -5400,12 +5403,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/stats/punch_card`, + path: \`/repos/\${owner}/\${repo}/stats/punch_card\`, method: "GET", format: "json", ...params, @@ -5416,12 +5419,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "GET", format: "json", ...params, @@ -5432,8 +5435,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/statuses/${ref}`, + path: \`/repos/\${owner}/\${repo}/statuses/\${ref}\`, method: "POST", body: body, type: ContentType.Json, @@ -5456,12 +5459,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscribers`, + path: \`/repos/\${owner}/\${repo}/subscribers\`, method: "GET", format: "json", ...params, @@ -5472,12 +5475,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "DELETE", ...params, }), @@ -5487,12 +5490,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "GET", format: "json", ...params, @@ -5503,8 +5506,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/subscription`, + path: \`/repos/\${owner}/\${repo}/subscription\`, method: "PUT", body: body, type: ContentType.Json, @@ -5526,12 +5529,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/tags`, + path: \`/repos/\${owner}/\${repo}/tags\`, method: "GET", format: "json", ...params, @@ -5542,12 +5545,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/teams`, + path: \`/repos/\${owner}/\${repo}/teams\`, method: "GET", format: "json", ...params, @@ -5558,12 +5561,12 @@ export class Api extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/watchers`, + path: \`/repos/\${owner}/\${repo}/watchers\`, method: "GET", format: "json", ...params, @@ -5576,8 +5579,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repos/${owner}/${repo}/${archiveFormat}/${path}`, + path: \`/repos/\${owner}/\${repo}/\${archiveFormat}/\${path}\`, method: "GET", ...params, }), @@ -5598,8 +5601,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/repositories`, + path: \`/repositories\`, method: "GET", query: query, format: "json", @@ -5621,8 +5624,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/search/code`, + path: \`/search/code\`, method: "GET", query: query, format: "json", @@ -5646,8 +5649,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/search/issues`, + path: \`/search/issues\`, method: "GET", query: query, format: "json", @@ -5671,8 +5674,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/search/repositories`, + path: \`/search/repositories\`, method: "GET", query: query, format: "json", @@ -5696,8 +5699,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/search/users`, + path: \`/search/users\`, method: "GET", query: query, format: "json", @@ -5722,12 +5725,12 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "DELETE", ...params, }), @@ -5737,12 +5740,12 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "GET", format: "json", ...params, @@ -5753,12 +5756,12 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}`, + path: \`/teams/\${teamId}\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5771,12 +5774,12 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members`, + path: \`/teams/\${teamId}/members\`, method: "GET", format: "json", ...params, @@ -5788,12 +5791,12 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "DELETE", ...params, }), @@ -5806,13 +5809,13 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "GET", ...params, }), @@ -5823,13 +5826,13 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/members/${username}`, + path: \`/teams/\${teamId}/members/\${username}\`, method: "PUT", ...params, }), @@ -5839,12 +5842,12 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "DELETE", ...params, }), @@ -5854,13 +5857,13 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "GET", format: "json", ...params, @@ -5871,16 +5874,16 @@ export class Api extends HttpClient this.request< SwaggerTypeTeamMembershipGeneratedDataContract, void | SwaggerTypeOrganizationAsTeamMemberGeneratedDataContract >({ - path: `/teams/${teamId}/memberships/${username}`, + path: \`/teams/\${teamId}/memberships/\${username}\`, method: "PUT", format: "json", ...params, @@ -5891,12 +5894,12 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos`, + path: \`/teams/\${teamId}/repos\`, method: "GET", format: "json", ...params, @@ -5907,12 +5910,12 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -5924,11 +5927,11 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -5938,11 +5941,11 @@ export class Api extends HttpClient this.request({ - path: `/teams/${teamId}/repos/${owner}/${repo}`, + path: \`/teams/\${teamId}/repos/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -5953,12 +5956,12 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "GET", format: "json", ...params, @@ -5969,12 +5972,12 @@ export class Api extends HttpClient this.request({ - path: `/user`, + path: \`/user\`, method: "PATCH", body: body, type: ContentType.Json, @@ -5987,12 +5990,12 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "DELETE", body: body, type: ContentType.Json, @@ -6004,12 +6007,12 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "GET", ...params, }), @@ -6019,11 +6022,11 @@ export class Api extends HttpClient this.request({ - path: `/user/emails`, + path: \`/user/emails\`, method: "POST", body: body, ...params, @@ -6034,12 +6037,12 @@ export class Api extends HttpClient this.request({ - path: `/user/followers`, + path: \`/user/followers\`, method: "GET", format: "json", ...params, @@ -6050,12 +6053,12 @@ export class Api extends HttpClient this.request({ - path: `/user/following`, + path: \`/user/following\`, method: "GET", format: "json", ...params, @@ -6066,12 +6069,12 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "DELETE", ...params, }), @@ -6081,13 +6084,13 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "GET", ...params, }), @@ -6097,12 +6100,12 @@ export class Api extends HttpClient this.request({ - path: `/user/following/${username}`, + path: \`/user/following/\${username}\`, method: "PUT", ...params, }), @@ -6112,8 +6115,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/user/issues`, + path: \`/user/issues\`, method: "GET", query: query, format: "json", @@ -6143,12 +6146,12 @@ export class Api extends HttpClient this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "GET", format: "json", ...params, @@ -6159,12 +6162,12 @@ export class Api extends HttpClient this.request({ - path: `/user/keys`, + path: \`/user/keys\`, method: "POST", body: body, format: "json", @@ -6176,12 +6179,12 @@ export class Api extends HttpClient this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "DELETE", ...params, }), @@ -6191,12 +6194,12 @@ export class Api extends HttpClient this.request({ - path: `/user/keys/${keyId}`, + path: \`/user/keys/\${keyId}\`, method: "GET", format: "json", ...params, @@ -6207,12 +6210,12 @@ export class Api extends HttpClient this.request({ - path: `/user/orgs`, + path: \`/user/orgs\`, method: "GET", format: "json", ...params, @@ -6223,8 +6226,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "GET", query: query, format: "json", @@ -6246,12 +6249,12 @@ export class Api extends HttpClient this.request({ - path: `/user/repos`, + path: \`/user/repos\`, method: "POST", body: body, format: "json", @@ -6263,8 +6266,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/user/starred`, + path: \`/user/starred\`, method: "GET", query: query, format: "json", @@ -6287,12 +6290,12 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -6302,13 +6305,13 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -6318,12 +6321,12 @@ export class Api extends HttpClient this.request({ - path: `/user/starred/${owner}/${repo}`, + path: \`/user/starred/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -6333,12 +6336,12 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions`, + path: \`/user/subscriptions\`, method: "GET", format: "json", ...params, @@ -6350,12 +6353,12 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "DELETE", ...params, }), @@ -6366,13 +6369,13 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "GET", ...params, }), @@ -6383,12 +6386,12 @@ export class Api extends HttpClient this.request({ - path: `/user/subscriptions/${owner}/${repo}`, + path: \`/user/subscriptions/\${owner}/\${repo}\`, method: "PUT", ...params, }), @@ -6398,12 +6401,12 @@ export class Api extends HttpClient this.request({ - path: `/user/teams`, + path: \`/user/teams\`, method: "GET", format: "json", ...params, @@ -6415,8 +6418,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/users`, + path: \`/users\`, method: "GET", query: query, format: "json", @@ -6437,12 +6440,12 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}`, + path: \`/users/\${username}\`, method: "GET", format: "json", ...params, @@ -6453,11 +6456,11 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/events`, + path: \`/users/\${username}/events\`, method: "GET", ...params, }), @@ -6467,11 +6470,11 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/events/orgs/${org}`, + path: \`/users/\${username}/events/orgs/\${org}\`, method: "GET", ...params, }), @@ -6481,12 +6484,12 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/followers`, + path: \`/users/\${username}/followers\`, method: "GET", format: "json", ...params, @@ -6497,13 +6500,13 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/following/${targetUser}`, + path: \`/users/\${username}/following/\${targetUser}\`, method: "GET", ...params, }), @@ -6513,8 +6516,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/users/${username}/gists`, + path: \`/users/\${username}/gists\`, method: "GET", query: query, format: "json", @@ -6536,12 +6539,12 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/keys`, + path: \`/users/\${username}/keys\`, method: "GET", format: "json", ...params, @@ -6552,12 +6555,12 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/orgs`, + path: \`/users/\${username}/orgs\`, method: "GET", format: "json", ...params, @@ -6568,11 +6571,11 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/received_events`, + path: \`/users/\${username}/received_events\`, method: "GET", ...params, }), @@ -6582,11 +6585,11 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/received_events/public`, + path: \`/users/\${username}/received_events/public\`, method: "GET", ...params, }), @@ -6596,8 +6599,8 @@ export class Api extends HttpClient extends HttpClient this.request({ - path: `/users/${username}/repos`, + path: \`/users/\${username}/repos\`, method: "GET", query: query, format: "json", @@ -6620,11 +6623,11 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/starred`, + path: \`/users/\${username}/starred\`, method: "GET", ...params, }), @@ -6634,13 +6637,15 @@ export class Api extends HttpClient this.request({ - path: `/users/${username}/subscriptions`, + path: \`/users/\${username}/subscriptions\`, method: "GET", ...params, }), }; } +" +`; diff --git a/tests/spec/typeSuffixPrefix/basic.test.ts b/tests/spec/typeSuffixPrefix/basic.test.ts new file mode 100644 index 00000000..7af2c2b2 --- /dev/null +++ b/tests/spec/typeSuffixPrefix/basic.test.ts @@ -0,0 +1,39 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--type-prefix and --type-suffix", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateClient: true, + generateResponses: true, + typePrefix: "SwaggerType", + typeSuffix: "GeneratedDataContract", + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/typeSuffixPrefix/schema.ts b/tests/spec/typeSuffixPrefix/schema.ts deleted file mode 100644 index 01f6f8d8..00000000 --- a/tests/spec/typeSuffixPrefix/schema.ts +++ /dev/null @@ -1,6646 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export interface SwaggerTypeActorGeneratedDataContract { - 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 SwaggerTypeAssetGeneratedDataContract { - content_type?: string; - created_at?: string; - download_count?: number; - id?: number; - label?: string; - name?: string; - size?: number; - state?: string; - updated_at?: string; - uploader?: SwaggerTypeUserGeneratedDataContract; - url?: string; -} - -export interface SwaggerTypeAssetPatchGeneratedDataContract { - label?: string; - name: string; -} - -export type SwaggerTypeAssetsGeneratedDataContract = SwaggerTypeAssetGeneratedDataContract[]; - -export type SwaggerTypeAssigneesGeneratedDataContract = SwaggerTypeUserGeneratedDataContract[]; - -export interface SwaggerTypeBlobGeneratedDataContract { - content?: string; - encoding?: "utf-8" | "base64"; - sha?: string; - size?: number; -} - -export interface SwaggerTypeBlobsGeneratedDataContract { - sha?: string; -} - -export interface SwaggerTypeBranchGeneratedDataContract { - _links?: { - html?: string; - self?: string; - }; - commit?: { - author?: SwaggerTypeUserGeneratedDataContract; - 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?: SwaggerTypeUserGeneratedDataContract; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - name?: string; -} - -export type SwaggerTypeBranchesGeneratedDataContract = { - commit?: { - sha?: string; - url?: string; - }; - name?: string; -}[]; - -export type SwaggerTypeCodeFrequencyStatsGeneratedDataContract = number[]; - -export interface SwaggerTypeCommentGeneratedDataContract { - body?: string; -} - -export interface SwaggerTypeCommentBodyGeneratedDataContract { - body: string; -} - -export type SwaggerTypeCommentsGeneratedDataContract = { - body?: string; - created_at?: string; - id?: number; - url?: string; - user?: SwaggerTypeUserGeneratedDataContract; -}[]; - -export interface SwaggerTypeCommitGeneratedDataContract { - author?: SwaggerTypeUserGeneratedDataContract; - 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?: SwaggerTypeUserGeneratedDataContract; - 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 SwaggerTypeCommitActivityStatsGeneratedDataContract = { - days?: number[]; - total?: number; - week?: number; -}[]; - -export interface SwaggerTypeCommitCommentGeneratedDataContract { - 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?: SwaggerTypeUserGeneratedDataContract; -} - -export interface SwaggerTypeCommitCommentBodyGeneratedDataContract { - body: string; - line?: string; - number?: string; - path?: string; - position?: number; - sha: string; -} - -export type SwaggerTypeCommitsGeneratedDataContract = { - author?: SwaggerTypeUserGeneratedDataContract; - 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?: SwaggerTypeUserGeneratedDataContract; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -}[]; - -export interface SwaggerTypeCompareCommitsGeneratedDataContract { - ahead_by?: number; - base_commit?: { - author?: SwaggerTypeUserGeneratedDataContract; - 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?: SwaggerTypeUserGeneratedDataContract; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; - }; - behind_by?: number; - commits?: { - author?: SwaggerTypeUserGeneratedDataContract; - 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?: SwaggerTypeUserGeneratedDataContract; - 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 SwaggerTypeContentsPathGeneratedDataContract { - _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 SwaggerTypeContributorsStatsGeneratedDataContract = { - 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 SwaggerTypeCreateFileGeneratedDataContract { - 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 SwaggerTypeCreateFileBodyGeneratedDataContract { - committer?: { - email?: string; - name?: string; - }; - content?: string; - message?: string; -} - -export interface SwaggerTypeDeleteFileGeneratedDataContract { - 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 SwaggerTypeDeleteFileBodyGeneratedDataContract { - committer?: { - email?: string; - name?: string; - }; - message?: string; - sha?: string; -} - -export interface SwaggerTypeDeploymentGeneratedDataContract { - description?: string; - payload?: { - deploy_user?: string; - environment?: string; - room_id?: number; - }; - ref?: string; -} - -export interface SwaggerTypeDeploymentRespGeneratedDataContract { - created_at?: string; - creator?: SwaggerTypeUserGeneratedDataContract; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -} - -export type SwaggerTypeDeploymentStatusesGeneratedDataContract = { - created_at?: string; - creator?: SwaggerTypeUserGeneratedDataContract; - description?: string; - id?: number; - payload?: string; - state?: string; - target_url?: string; - updated_at?: string; - url?: string; -}[]; - -export interface SwaggerTypeDeploymentStatusesCreateGeneratedDataContract { - description?: string; - state?: string; - target_url?: string; -} - -export interface SwaggerTypeDownloadGeneratedDataContract { - content_type?: string; - description?: string; - download_count?: number; - html_url?: string; - id?: number; - name?: string; - size?: number; - url?: string; -} - -export type SwaggerTypeDownloadsGeneratedDataContract = SwaggerTypeDownloadGeneratedDataContract[]; - -export interface SwaggerTypeEditTeamGeneratedDataContract { - name: string; - permission?: "pull" | "push" | "admin"; -} - -export type SwaggerTypeEmailsPostGeneratedDataContract = string[]; - -export type SwaggerTypeEmojisGeneratedDataContract = Record; - -export interface SwaggerTypeEventGeneratedDataContract { - actor?: SwaggerTypeActorGeneratedDataContract; - created_at?: object; - id?: number; - org?: SwaggerTypeOrganizationGeneratedDataContract; - payload?: object; - public?: boolean; - repo?: { - id?: number; - name?: string; - url?: string; - }; - type?: string; -} - -export type SwaggerTypeEventsGeneratedDataContract = SwaggerTypeEventGeneratedDataContract[]; - -export interface SwaggerTypeFeedsGeneratedDataContract { - _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 SwaggerTypeForkBodyGeneratedDataContract { - organization?: string; -} - -export type SwaggerTypeForksGeneratedDataContract = SwaggerTypeReposGeneratedDataContract; - -export interface SwaggerTypeGistGeneratedDataContract { - 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?: SwaggerTypeUserGeneratedDataContract; - }[]; - git_pull_url?: string; - git_push_url?: string; - history?: { - change_status?: { - additions?: number; - deletions?: number; - total?: number; - }; - committed_at?: string; - url?: string; - user?: SwaggerTypeUserGeneratedDataContract; - version?: string; - }[]; - html_url?: string; - id?: string; - public?: boolean; - url?: string; - user?: SwaggerTypeUserGeneratedDataContract; -} - -export type SwaggerTypeGistsGeneratedDataContract = { - 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?: SwaggerTypeUserGeneratedDataContract; -}[]; - -export interface SwaggerTypeGitCommitGeneratedDataContract { - author?: { - date?: string; - email?: string; - name?: string; - }; - message?: string; - parents?: string; - tree?: string; -} - -export interface SwaggerTypeGitRefPatchGeneratedDataContract { - force?: boolean; - sha?: string; -} - -export type SwaggerTypeGitignoreGeneratedDataContract = any[]; - -export interface SwaggerTypeGitignoreLangGeneratedDataContract { - name?: string; - source?: string; -} - -export interface SwaggerTypeHeadBranchGeneratedDataContract { - object?: { - sha?: string; - type?: string; - url?: string; - }; - ref?: string; - url?: string; -} - -export type SwaggerTypeHookGeneratedDataContract = { - 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 SwaggerTypeHookBodyGeneratedDataContract { - active?: boolean; - add_events?: string[]; -} - -export interface SwaggerTypeIssueGeneratedDataContract { - assignee?: string; - body?: string; - labels?: string[]; - milestone?: number; - title?: string; -} - -export interface SwaggerTypeIssueEventGeneratedDataContract { - actor?: SwaggerTypeActorGeneratedDataContract; - commit_id?: string; - created_at?: string; - event?: string; - issue?: { - assignee?: SwaggerTypeUserGeneratedDataContract; - 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?: SwaggerTypeUserGeneratedDataContract; - 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?: SwaggerTypeUserGeneratedDataContract; - }; - url?: string; -} - -export type SwaggerTypeIssueEventsGeneratedDataContract = SwaggerTypeIssueEventGeneratedDataContract[]; - -export type SwaggerTypeIssuesGeneratedDataContract = { - assignee?: SwaggerTypeUserGeneratedDataContract; - 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?: SwaggerTypeUserGeneratedDataContract; - 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?: SwaggerTypeUserGeneratedDataContract; -}[]; - -export interface SwaggerTypeIssuesCommentGeneratedDataContract { - body?: string; - created_at?: string; - html_url?: string; - id?: number; - updated_at?: string; - url?: string; - user?: SwaggerTypeUserGeneratedDataContract; -} - -export type SwaggerTypeIssuesCommentsGeneratedDataContract = { - _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?: SwaggerTypeUserGeneratedDataContract; -}[]; - -export type SwaggerTypeKeysGeneratedDataContract = { - id?: number; - key?: string; - title?: string; - url?: string; -}[]; - -export interface SwaggerTypeLabelGeneratedDataContract { - /** - * @minLength 6 - * @maxLength 6 - */ - color?: string; - name?: string; - url?: string; -} - -export type SwaggerTypeLabelsGeneratedDataContract = { - /** - * @minLength 6 - * @maxLength 6 - */ - color?: string; - name?: string; - url?: string; -}[]; - -export type SwaggerTypeLanguagesGeneratedDataContract = Record; - -export interface SwaggerTypeMarkdownGeneratedDataContract { - context?: string; - mode?: string; - text?: string; -} - -export interface SwaggerTypeMergeGeneratedDataContract { - merged?: boolean; - message?: string; - sha?: string; -} - -export interface SwaggerTypeMergePullBodyGeneratedDataContract { - commit_message?: string; -} - -export interface SwaggerTypeMergesBodyGeneratedDataContract { - base?: string; - commit_message?: string; - head?: string; -} - -export interface SwaggerTypeMergesConflictGeneratedDataContract { - message?: string; -} - -export interface SwaggerTypeMergesSuccessfulGeneratedDataContract { - author?: SwaggerTypeUserGeneratedDataContract; - 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?: SwaggerTypeUserGeneratedDataContract; - merged?: boolean; - message?: string; - parents?: { - sha?: string; - url?: string; - }[]; - sha?: string; - url?: string; -} - -export interface SwaggerTypeMetaGeneratedDataContract { - git?: string[]; - hooks?: string[]; -} - -export interface SwaggerTypeMilestoneGeneratedDataContract { - closed_issues?: number; - created_at?: string; - creator?: SwaggerTypeUserGeneratedDataContract; - description?: string; - due_on?: string; - number?: number; - open_issues?: number; - state?: "open" | "closed"; - title?: string; - url?: string; -} - -export interface SwaggerTypeMilestoneUpdateGeneratedDataContract { - description?: string; - due_on?: string; - state?: string; - title?: string; -} - -export interface SwaggerTypeNotificationMarkReadGeneratedDataContract { - last_read_at?: string; -} - -export interface SwaggerTypeNotificationsGeneratedDataContract { - id?: number; - last_read_at?: string; - reason?: string; - repository?: { - description?: string; - fork?: boolean; - full_name?: string; - html_url?: string; - id?: number; - name?: string; - owner?: SwaggerTypeActorGeneratedDataContract; - private?: boolean; - url?: string; - }; - subject?: { - latest_comment_url?: string; - title?: string; - type?: string; - url?: string; - }; - unread?: boolean; - updated_at?: string; - url?: string; -} - -export interface SwaggerTypeOrgTeamsPostGeneratedDataContract { - name: string; - permission?: "pull" | "push" | "admin"; - repo_names?: string[]; -} - -export type SwaggerTypeOrganizationGeneratedDataContract = SwaggerTypeActorGeneratedDataContract; - -export interface SwaggerTypeOrganizationAsTeamMemberGeneratedDataContract { - errors?: { - code?: string; - field?: string; - resource?: string; - }[]; - message?: string; -} - -export interface SwaggerTypeParticipationStatsGeneratedDataContract { - all?: number[]; - owner?: number[]; -} - -export interface SwaggerTypePatchGistGeneratedDataContract { - 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 SwaggerTypePatchOrgGeneratedDataContract { - billing_email?: string; - company?: string; - email?: string; - location?: string; - name?: string; -} - -export interface SwaggerTypePostGistGeneratedDataContract { - description?: string; - files?: { - "file1.txt"?: { - content?: string; - }; - }; - public?: boolean; -} - -export interface SwaggerTypePostRepoGeneratedDataContract { - 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 SwaggerTypePullRequestGeneratedDataContract { - _links?: { - comments?: { - href?: string; - }; - html?: { - href?: string; - }; - review_comments?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - additions?: number; - base?: { - label?: string; - ref?: string; - repo?: SwaggerTypeRepoGeneratedDataContract; - 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?: SwaggerTypeRepoGeneratedDataContract; - 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 SwaggerTypePullUpdateGeneratedDataContract { - body?: string; - state?: string; - title?: string; -} - -export type SwaggerTypePullsGeneratedDataContract = { - _links?: { - comments?: { - href?: string; - }; - html?: { - href?: string; - }; - review_comments?: { - href?: string; - }; - self?: { - href?: string; - }; - }; - base?: { - label?: string; - ref?: string; - repo?: SwaggerTypeRepoGeneratedDataContract; - 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?: SwaggerTypeRepoGeneratedDataContract; - 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 SwaggerTypePullsCommentGeneratedDataContract { - _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 SwaggerTypePullsCommentPostGeneratedDataContract { - body?: string; - commit_id?: string; - path?: string; - position?: number; -} - -export type SwaggerTypePullsCommentsGeneratedDataContract = { - _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 SwaggerTypePullsPostGeneratedDataContract { - base?: string; - body?: string; - head?: string; - title?: string; -} - -export interface SwaggerTypePutSubscriptionGeneratedDataContract { - created_at?: string; - ignored?: boolean; - reason?: object; - subscribed?: boolean; - thread_url?: string; - url?: string; -} - -export interface SwaggerTypeRateLimitGeneratedDataContract { - rate?: { - limit?: number; - remaining?: number; - reset?: number; - }; -} - -export type SwaggerTypeRefGeneratedDataContract = { - 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 SwaggerTypeRefStatusGeneratedDataContract = { - 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 SwaggerTypeRefsGeneratedDataContract = { - object?: { - sha?: string; - type?: string; - url?: string; - }; - ref?: string; - url?: string; -}[]; - -export interface SwaggerTypeRefsBodyGeneratedDataContract { - ref?: string; - sha?: string; -} - -export interface SwaggerTypeReleaseGeneratedDataContract { - assets?: { - content_type?: string; - created_at?: string; - download_count?: number; - id?: number; - label?: string; - name?: string; - size?: number; - state?: string; - updated_at?: string; - uploader?: SwaggerTypeUserGeneratedDataContract; - url?: string; - }[]; - assets_url?: string; - author?: SwaggerTypeUserGeneratedDataContract; - 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 SwaggerTypeReleaseCreateGeneratedDataContract { - body?: string; - draft?: boolean; - name?: string; - prerelease?: boolean; - tag_name?: string; - target_commitish?: string; -} - -export type SwaggerTypeReleasesGeneratedDataContract = { - assets?: { - content_type?: string; - created_at?: string; - download_count?: number; - id?: number; - label?: string; - name?: string; - size?: number; - state?: string; - updated_at?: string; - uploader?: SwaggerTypeUserGeneratedDataContract; - url?: string; - }[]; - assets_url?: string; - author?: SwaggerTypeUserGeneratedDataContract; - 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 SwaggerTypeRepoGeneratedDataContract { - 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?: SwaggerTypeOrganizationGeneratedDataContract; - owner?: SwaggerTypeActorGeneratedDataContract; - parent?: SwaggerTypeRepoGeneratedDataContract; - private?: boolean; - pushed_at?: string; - size?: number; - source?: SwaggerTypeRepoGeneratedDataContract; - ssh_url?: string; - svn_url?: string; - updated_at?: string; - url?: string; - watchers?: number; - watchers_count?: number; -} - -export type SwaggerTypeRepoDeploymentsGeneratedDataContract = { - created_at?: string; - creator?: SwaggerTypeUserGeneratedDataContract; - description?: string; - id?: number; - payload?: string; - sha?: string; - statuses_url?: string; - updated_at?: string; - url?: string; -}[]; - -export type SwaggerTypeRepoCommentsGeneratedDataContract = { - 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?: SwaggerTypeUserGeneratedDataContract; -}[]; - -export interface SwaggerTypeRepoCommitGeneratedDataContract { - 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 SwaggerTypeRepoCommitBodyGeneratedDataContract { - author?: { - date?: string; - email?: string; - name?: string; - }; - message: string; - parents: string[]; - tree: string; -} - -export interface SwaggerTypeRepoEditGeneratedDataContract { - description?: string; - has_downloads?: boolean; - has_issues?: boolean; - has_wiki?: boolean; - homepage?: string; - name?: string; - private?: boolean; -} - -export type SwaggerTypeReposGeneratedDataContract = SwaggerTypeRepoGeneratedDataContract[]; - -export interface SwaggerTypeSearchCodeGeneratedDataContract { - 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?: SwaggerTypeActorGeneratedDataContract; - 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 SwaggerTypeSearchIssuesGeneratedDataContract { - 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?: SwaggerTypeUserGeneratedDataContract; - }[]; - total_count?: number; -} - -export interface SwaggerTypeSearchIssuesByKeywordGeneratedDataContract { - 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 SwaggerTypeSearchRepositoriesGeneratedDataContract { - items?: SwaggerTypeRepoGeneratedDataContract[]; - total_count?: number; -} - -export interface SwaggerTypeSearchRepositoriesByKeywordGeneratedDataContract { - repositories?: SwaggerTypeRepoGeneratedDataContract[]; -} - -export interface SwaggerTypeSearchUserByEmailGeneratedDataContract { - user?: SwaggerTypeUserGeneratedDataContract; -} - -export interface SwaggerTypeSearchUsersGeneratedDataContract { - items?: SwaggerTypeUsersGeneratedDataContract; - total_count?: number; -} - -export interface SwaggerTypeSearchUsersByKeywordGeneratedDataContract { - users?: SwaggerTypeUsersGeneratedDataContract; -} - -export interface SwaggerTypeSubscriptionGeneratedDataContract { - created_at?: string; - ignored?: boolean; - reason?: string; - repository_url?: string; - subscribed?: boolean; - thread_url?: string; - url?: string; -} - -export interface SwaggerTypeSubscriptionBodyGeneratedDataContract { - ignored?: boolean; - subscribed?: boolean; -} - -export interface SwaggerTypeTagGeneratedDataContract { - 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 SwaggerTypeTagBodyGeneratedDataContract { - message: string; - object: string; - tag: string; - tagger: { - date?: string; - email?: string; - name?: string; - }; - type: "commit" | "tree" | "blob"; -} - -export type SwaggerTypeTagsGeneratedDataContract = SwaggerTypeTagGeneratedDataContract[]; - -export interface SwaggerTypeTeamGeneratedDataContract { - id?: number; - members_count?: number; - name?: string; - permission?: string; - repos_count?: number; - url?: string; -} - -export interface SwaggerTypeTeamMembershipGeneratedDataContract { - state?: string; - url?: string; -} - -export type SwaggerTypeTeamReposGeneratedDataContract = SwaggerTypeReposGeneratedDataContract; - -export type SwaggerTypeTeamsGeneratedDataContract = { - id?: number; - name?: string; - url?: string; -}[]; - -export type SwaggerTypeTeamsListGeneratedDataContract = { - 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 SwaggerTypeTreeGeneratedDataContract { - 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 SwaggerTypeTreesGeneratedDataContract { - base_tree?: string; - sha?: string; - tree?: SwaggerTypeTreeGeneratedDataContract[]; - url?: string; -} - -export type SwaggerTypeUserGeneratedDataContract = SwaggerTypeActorGeneratedDataContract; - -export type SwaggerTypeUserEmailsGeneratedDataContract = string[]; - -export interface SwaggerTypeUserKeysKeyIdGeneratedDataContract { - id?: number; - key?: string; - title?: string; - url?: string; -} - -export interface SwaggerTypeUserKeysPostGeneratedDataContract { - key?: string; - title?: string; -} - -export interface SwaggerTypeUserUpdateGeneratedDataContract { - bio?: string; - blog?: string; - company?: string; - email?: string; - hireable?: boolean; - location?: string; - name?: string; -} - -export type SwaggerTypeUsersGeneratedDataContract = SwaggerTypeUserGeneratedDataContract[]; - -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://api.github.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) || null, - body: typeof body === "undefined" || body === null ? null : payloadFormatter(body), - }).then(async (response) => { - const r = response.clone() 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 - * @termsOfService https://help.github.com/articles/github-terms-of-service/#b-api-terms - * @baseUrl https://api.github.com - * @externalDocs https://developer.github.com/v3/ - */ -export class Api extends HttpClient { - someTest = { - /** - * No description - * - * @name SomeTestList - * @request GET:/some-test - * @response `200` `{ - user: { - foo: number, - extra: { - id: number, - extra: { - foo: string, - bar: number, - baz: string, - bad: number, - extra: { - foo: string, - bar: number, - baz: string, - bad: number, - extra: { - foo: string, - bar: number, - baz: string, - bad: number, - extra: { - foo: string, - bar: number, - baz: string, - bad: number, - -}, - -}, - -}, - -}, - -}, - -}, - -}` - */ - someTestList: (params: RequestParams = {}) => - this.request< - { - user: { - foo: number; - extra: { - id: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - extra: { - foo: string; - bar: number; - baz: string; - bad: number; - }; - }; - }; - }; - }; - }; - }, - any - >({ - path: `/some-test`, - method: "GET", - format: "json", - ...params, - }), - }; - pathParams = { - /** - * No description - * - * @name PathParamsList - * @request GET:/path-params - * @response `200` `SwaggerTypeEmojisGeneratedDataContract` - * @response `403` `void` - */ - pathParamsList: (petId: number, params: RequestParams = {}) => - this.request({ - path: `/path-params`, - method: "GET", - format: "json", - ...params, - }), - }; - events = { - /** - * No description - * - * @name EventsList - * @request GET:/events - * @response `200` `SwaggerTypeEventsGeneratedDataContract` - * @response `403` `void` - */ - eventsList: (params: RequestParams = {}) => - this.request({ - path: `/events`, - method: "GET", - format: "json", - ...params, - }), - }; - feeds = { - /** - * No description - * - * @name FeedsList - * @request GET:/feeds - * @response `200` `SwaggerTypeFeedsGeneratedDataContract` - * @response `403` `void` - */ - feedsList: (params: RequestParams = {}) => - this.request({ - path: `/feeds`, - method: "GET", - format: "json", - ...params, - }), - }; - gists = { - /** - * No description - * - * @name GistsList - * @request GET:/gists - * @response `200` `SwaggerTypeGistsGeneratedDataContract` - * @response `403` `void` - */ - gistsList: ( - query?: { - since?: string; - }, - params: RequestParams = {}, - ) => - this.request({ - path: `/gists`, - method: "GET", - query: query, - format: "json", - ...params, - }), - - /** - * No description - * - * @name GistsCreate - * @request POST:/gists - * @response `201` `SwaggerTypeGistGeneratedDataContract` - * @response `403` `void` - */ - gistsCreate: (body: SwaggerTypePostGistGeneratedDataContract, params: RequestParams = {}) => - this.request({ - path: `/gists`, - method: "POST", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @name PublicList - * @request GET:/gists/public - * @response `200` `SwaggerTypeGistsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeGistsGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - gistsDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}`, - method: "DELETE", - ...params, - }), - - /** - * No description - * - * @name GistsDetail - * @request GET:/gists/{id} - * @response `200` `SwaggerTypeGistGeneratedDataContract` - * @response `403` `void` - */ - gistsDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name GistsPartialUpdate - * @request PATCH:/gists/{id} - * @response `200` `SwaggerTypeGistGeneratedDataContract` - * @response `403` `void` - */ - gistsPartialUpdate: (id: number, body: SwaggerTypePatchGistGeneratedDataContract, 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 - * @response `200` `SwaggerTypeCommentsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeCommentGeneratedDataContract` - * @response `403` `void` - */ - commentsCreate: (id: number, body: SwaggerTypeCommentBodyGeneratedDataContract, 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeCommentGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeCommentGeneratedDataContract` - * @response `403` `void` - */ - commentsPartialUpdate: ( - id: number, - commentId: number, - body: SwaggerTypeCommentGeneratedDataContract, - 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 - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - forksCreate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/forks`, - method: "POST", - ...params, - }), - - /** - * No description - * - * @name StarDelete - * @request DELETE:/gists/{id}/star - * @response `204` `void` - * @response `403` `void` - */ - starDelete: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "DELETE", - ...params, - }), - - /** - * No description - * - * @name StarDetail - * @request GET:/gists/{id}/star - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - starDetail: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "GET", - ...params, - }), - - /** - * No description - * - * @name StarUpdate - * @request PUT:/gists/{id}/star - * @response `204` `void` - * @response `403` `void` - */ - starUpdate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/gists/${id}/star`, - method: "PUT", - ...params, - }), - }; - gitignore = { - /** - * No description - * - * @name TemplatesList - * @request GET:/gitignore/templates - * @response `200` `SwaggerTypeGitignoreGeneratedDataContract` - * @response `403` `void` - */ - templatesList: (params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name TemplatesDetail - * @request GET:/gitignore/templates/{language} - * @response `200` `SwaggerTypeGitignoreLangGeneratedDataContract` - * @response `403` `void` - */ - templatesDetail: (language: string, params: RequestParams = {}) => - this.request({ - path: `/gitignore/templates/${language}`, - method: "GET", - format: "json", - ...params, - }), - }; - issues = { - /** - * No description - * - * @name IssuesList - * @request GET:/issues - * @response `200` `SwaggerTypeIssuesGeneratedDataContract` - * @response `403` `void` - */ - issuesList: ( - query: { - /** @default "all" */ - filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - 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} - * @deprecated - * @response `200` `SwaggerTypeSearchIssuesByKeywordGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @deprecated - * @response `200` `SwaggerTypeSearchRepositoriesByKeywordGeneratedDataContract` - * @response `403` `void` - */ - reposSearchDetail: ( - keyword: string, - query?: { - /** @default "desc" */ - 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} - * @deprecated - * @response `200` `SwaggerTypeSearchUserByEmailGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @deprecated - * @response `200` `SwaggerTypeSearchUsersByKeywordGeneratedDataContract` - * @response `403` `void` - */ - userSearchDetail: ( - keyword: string, - query?: { - /** @default "desc" */ - 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 - * @response `200` `void` - * @response `403` `void` - */ - markdownCreate: (body: SwaggerTypeMarkdownGeneratedDataContract, params: RequestParams = {}) => - this.request({ - path: `/markdown`, - method: "POST", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @name PostMarkdown - * @request POST:/markdown/raw - * @response `200` `void` - * @response `403` `void` - */ - postMarkdown: (params: RequestParams = {}) => - this.request({ - path: `/markdown/raw`, - method: "POST", - type: ContentType.Text, - ...params, - }), - }; - meta = { - /** - * No description - * - * @name MetaList - * @request GET:/meta - * @response `200` `SwaggerTypeMetaGeneratedDataContract` - * @response `403` `void` - */ - metaList: (params: RequestParams = {}) => - this.request({ - path: `/meta`, - method: "GET", - format: "json", - ...params, - }), - }; - networks = { - /** - * No description - * - * @name EventsDetail - * @request GET:/networks/{owner}/{repo}/events - * @response `200` `SwaggerTypeEventsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeNotificationsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `205` `void` - * @response `403` `void` - */ - notificationsUpdate: (body: SwaggerTypeNotificationMarkReadGeneratedDataContract, params: RequestParams = {}) => - this.request({ - path: `/notifications`, - method: "PUT", - body: body, - ...params, - }), - - /** - * No description - * - * @name ThreadsDetail - * @request GET:/notifications/threads/{id} - * @response `200` `SwaggerTypeNotificationsGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `205` `void` - * @response `403` `void` - */ - threadsPartialUpdate: (id: number, params: RequestParams = {}) => - this.request({ - path: `/notifications/threads/${id}`, - method: "PATCH", - ...params, - }), - - /** - * No description - * - * @name ThreadsSubscriptionDelete - * @request DELETE:/notifications/threads/{id}/subscription - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeSubscriptionGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeSubscriptionGeneratedDataContract` - * @response `403` `void` - */ - threadsSubscriptionUpdate: ( - id: number, - body: SwaggerTypePutSubscriptionGeneratedDataContract, - 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} - * @response `200` `SwaggerTypeOrganizationGeneratedDataContract` - * @response `403` `void` - */ - orgsDetail: (org: string, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name OrgsPartialUpdate - * @request PATCH:/orgs/{org} - * @response `200` `SwaggerTypeOrganizationGeneratedDataContract` - * @response `403` `void` - */ - orgsPartialUpdate: (org: string, body: SwaggerTypePatchOrgGeneratedDataContract, 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 - * @response `200` `SwaggerTypeEventsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeIssuesGeneratedDataContract` - * @response `403` `void` - */ - issuesDetail: ( - org: string, - query: { - /** @default "all" */ - filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - 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 - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `302` `void` - * @response `403` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `204` `void` - * @response `302` `void` - * @response `403` `void` - * @response `404` `void` - */ - 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 - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeReposGeneratedDataContract` - * @response `403` `void` - */ - reposDetail: ( - org: string, - query?: { - /** @default "all" */ - 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 - * @response `201` `SwaggerTypeReposGeneratedDataContract` - * @response `403` `void` - */ - reposCreate: (org: string, body: SwaggerTypePostRepoGeneratedDataContract, params: RequestParams = {}) => - this.request({ - path: `/orgs/${org}/repos`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * No description - * - * @name TeamsDetail - * @request GET:/orgs/{org}/teams - * @response `200` `SwaggerTypeTeamsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeTeamGeneratedDataContract` - * @response `403` `void` - */ - teamsCreate: (org: string, body: SwaggerTypeOrgTeamsPostGeneratedDataContract, 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 - * @response `200` `SwaggerTypeRateLimitGeneratedDataContract` - * @response `403` `void` - */ - rateLimitList: (params: RequestParams = {}) => - this.request({ - path: `/rate_limit`, - method: "GET", - format: "json", - ...params, - }), - }; - repos = { - /** - * No description - * - * @name ReposDelete - * @request DELETE:/repos/{owner}/{repo} - * @response `204` `void` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeRepoGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeRepoGeneratedDataContract` - * @response `403` `void` - */ - reposPartialUpdate: ( - owner: string, - repo: string, - body: SwaggerTypeRepoEditGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeAssigneesGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - 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 - * @response `200` `SwaggerTypeBranchesGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeBranchGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeRepoCommentsGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeCommitCommentGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeCommitCommentGeneratedDataContract` - * @response `403` `void` - */ - commentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: SwaggerTypeCommentBodyGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeCommitsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeRefStatusGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeCommitGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeRepoCommentsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeCommitCommentGeneratedDataContract` - * @response `403` `void` - */ - commitsCommentsCreate: ( - owner: string, - repo: string, - shaCode: string, - body: SwaggerTypeCommitCommentBodyGeneratedDataContract, - 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} - * @response `200` `SwaggerTypeCompareCommitsGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeDeleteFileGeneratedDataContract` - * @response `403` `void` - */ - contentsDelete: ( - owner: string, - repo: string, - path: string, - body: SwaggerTypeDeleteFileBodyGeneratedDataContract, - 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} - * @response `200` `SwaggerTypeContentsPathGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeCreateFileGeneratedDataContract` - * @response `403` `void` - */ - contentsUpdate: ( - owner: string, - repo: string, - path: string, - body: SwaggerTypeCreateFileBodyGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeRepoDeploymentsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeDeploymentRespGeneratedDataContract` - * @response `403` `void` - */ - deploymentsCreate: ( - owner: string, - repo: string, - body: SwaggerTypeDeploymentGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeDeploymentStatusesGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `void` - * @response `403` `void` - */ - deploymentsStatusesCreate: ( - owner: string, - repo: string, - id: number, - body: SwaggerTypeDeploymentStatusesCreateGeneratedDataContract, - 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 - * @deprecated - * @response `200` `SwaggerTypeDownloadsGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @deprecated - * @response `204` `void` - * @response `403` `void` - */ - 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} - * @deprecated - * @originalName downloadsDetail - * @duplicate - * @response `200` `SwaggerTypeDownloadGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeEventsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeForksGeneratedDataContract` - * @response `403` `void` - */ - forksDetail: ( - owner: string, - repo: string, - query?: { - /** @default "newes" */ - 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 - * @response `201` `SwaggerTypeRepoGeneratedDataContract` - * @response `403` `void` - */ - forksCreate: ( - owner: string, - repo: string, - body: SwaggerTypeForkBodyGeneratedDataContract, - 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 - * @response `201` `SwaggerTypeBlobsGeneratedDataContract` - * @response `403` `void` - */ - gitBlobsCreate: ( - owner: string, - repo: string, - body: SwaggerTypeBlobGeneratedDataContract, - 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} - * @response `200` `SwaggerTypeBlobGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeGitCommitGeneratedDataContract` - * @response `403` `void` - */ - gitCommitsCreate: ( - owner: string, - repo: string, - body: SwaggerTypeRepoCommitBodyGeneratedDataContract, - 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} - * @response `200` `SwaggerTypeRepoCommitGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeRefsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeHeadBranchGeneratedDataContract` - * @response `403` `void` - */ - gitRefsCreate: ( - owner: string, - repo: string, - body: SwaggerTypeRefsBodyGeneratedDataContract, - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeHeadBranchGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeHeadBranchGeneratedDataContract` - * @response `403` `void` - */ - gitRefsPartialUpdate: ( - owner: string, - repo: string, - ref: string, - body: SwaggerTypeGitRefPatchGeneratedDataContract, - 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 - * @response `201` `SwaggerTypeTagGeneratedDataContract` - * @response `403` `void` - */ - gitTagsCreate: ( - owner: string, - repo: string, - body: SwaggerTypeTagBodyGeneratedDataContract, - 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} - * @response `200` `SwaggerTypeTagGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeTreesGeneratedDataContract` - * @response `403` `void` - */ - gitTreesCreate: ( - owner: string, - repo: string, - body: SwaggerTypeTreeGeneratedDataContract, - 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} - * @response `200` `SwaggerTypeTreeGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeHookGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeHookGeneratedDataContract` - * @response `403` `void` - */ - hooksCreate: ( - owner: string, - repo: string, - body: SwaggerTypeHookBodyGeneratedDataContract, - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeHookGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeHookGeneratedDataContract` - * @response `403` `void` - */ - hooksPartialUpdate: ( - owner: string, - repo: string, - hookId: number, - body: SwaggerTypeHookBodyGeneratedDataContract, - 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 - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeIssuesGeneratedDataContract` - * @response `403` `void` - */ - issuesDetail: ( - owner: string, - repo: string, - query: { - /** @default "all" */ - filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - 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 - * @response `201` `SwaggerTypeIssueGeneratedDataContract` - * @response `403` `void` - */ - issuesCreate: ( - owner: string, - repo: string, - body: SwaggerTypeIssueGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeIssuesCommentsGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeIssuesCommentGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeIssuesCommentGeneratedDataContract` - * @response `403` `void` - */ - issuesCommentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: SwaggerTypeCommentBodyGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeIssueEventsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeIssueEventGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeIssueGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeIssueGeneratedDataContract` - * @response `403` `void` - */ - issuesPartialUpdate: ( - owner: string, - repo: string, - number: number, - body: SwaggerTypeIssueGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeIssuesCommentsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeIssuesCommentGeneratedDataContract` - * @response `403` `void` - */ - issuesCommentsCreate: ( - owner: string, - repo: string, - number: number, - body: SwaggerTypeCommentBodyGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeIssueEventsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeLabelsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeLabelGeneratedDataContract` - * @response `403` `void` - */ - issuesLabelsCreate: ( - owner: string, - repo: string, - number: number, - body: SwaggerTypeEmailsPostGeneratedDataContract, - 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 - * @response `201` `SwaggerTypeLabelGeneratedDataContract` - * @response `403` `void` - */ - issuesLabelsUpdate: ( - owner: string, - repo: string, - number: number, - body: SwaggerTypeEmailsPostGeneratedDataContract, - 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 - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeKeysGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeUserKeysKeyIdGeneratedDataContract` - * @response `403` `void` - */ - keysCreate: ( - owner: string, - repo: string, - body: SwaggerTypeUserKeysPostGeneratedDataContract, - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeUserKeysKeyIdGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeLabelsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeLabelGeneratedDataContract` - * @response `403` `void` - */ - labelsCreate: ( - owner: string, - repo: string, - body: SwaggerTypeEmailsPostGeneratedDataContract, - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeLabelGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeLabelGeneratedDataContract` - * @response `403` `void` - */ - labelsPartialUpdate: ( - owner: string, - repo: string, - name: string, - body: SwaggerTypeEmailsPostGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeLanguagesGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeMergesSuccessfulGeneratedDataContract` - * @response `204` `void` - * @response `403` `void` - * @response `404` `SwaggerTypeMergesConflictGeneratedDataContract` - * @response `409` `SwaggerTypeMergesConflictGeneratedDataContract` - */ - mergesCreate: ( - owner: string, - repo: string, - body: SwaggerTypeMergesBodyGeneratedDataContract, - params: RequestParams = {}, - ) => - this.request< - SwaggerTypeMergesSuccessfulGeneratedDataContract, - void | SwaggerTypeMergesConflictGeneratedDataContract - >({ - 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 - * @response `200` `SwaggerTypeMilestoneGeneratedDataContract` - * @response `403` `void` - */ - milestonesDetail: ( - owner: string, - repo: string, - query?: { - /** @default "open" */ - state?: "open" | "closed"; - direction?: string; - /** @default "due_date" */ - 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 - * @response `201` `SwaggerTypeMilestoneGeneratedDataContract` - * @response `403` `void` - */ - milestonesCreate: ( - owner: string, - repo: string, - body: SwaggerTypeMilestoneUpdateGeneratedDataContract, - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeMilestoneGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeMilestoneGeneratedDataContract` - * @response `403` `void` - */ - milestonesPartialUpdate: ( - owner: string, - repo: string, - number: number, - body: SwaggerTypeMilestoneUpdateGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeLabelsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeNotificationsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `205` `void` - * @response `403` `void` - */ - notificationsUpdate: ( - owner: string, - repo: string, - body: SwaggerTypeNotificationMarkReadGeneratedDataContract, - params: RequestParams = {}, - ) => - this.request({ - path: `/repos/${owner}/${repo}/notifications`, - method: "PUT", - body: body, - ...params, - }), - - /** - * No description - * - * @name PullsDetail - * @request GET:/repos/{owner}/{repo}/pulls - * @response `200` `SwaggerTypePullsGeneratedDataContract` - * @response `403` `void` - */ - pullsDetail: ( - owner: string, - repo: string, - query?: { - /** @default "open" */ - 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 - * @response `201` `SwaggerTypePullsGeneratedDataContract` - * @response `403` `void` - */ - pullsCreate: ( - owner: string, - repo: string, - body: SwaggerTypePullsPostGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeIssuesCommentsGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypePullsCommentGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypePullsCommentGeneratedDataContract` - * @response `403` `void` - */ - pullsCommentsPartialUpdate: ( - owner: string, - repo: string, - commentId: number, - body: SwaggerTypeCommentBodyGeneratedDataContract, - 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 - * @response `200` `SwaggerTypePullRequestGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeRepoGeneratedDataContract` - * @response `403` `void` - */ - pullsPartialUpdate: ( - owner: string, - repo: string, - number: number, - body: SwaggerTypePullUpdateGeneratedDataContract, - 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 - * @response `200` `SwaggerTypePullsCommentGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypePullsCommentGeneratedDataContract` - * @response `403` `void` - */ - pullsCommentsCreate: ( - owner: string, - repo: string, - number: number, - body: SwaggerTypePullsCommentPostGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeCommitsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypePullsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - 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 - * @response `200` `SwaggerTypeMergeGeneratedDataContract` - * @response `403` `void` - * @response `405` `SwaggerTypeMergeGeneratedDataContract` - */ - pullsMergeUpdate: ( - owner: string, - repo: string, - number: number, - body: SwaggerTypeMergePullBodyGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeContentsPathGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeReleasesGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `201` `SwaggerTypeReleaseGeneratedDataContract` - * @response `403` `void` - */ - releasesCreate: ( - owner: string, - repo: string, - body: SwaggerTypeReleaseCreateGeneratedDataContract, - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeAssetGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeAssetGeneratedDataContract` - * @response `403` `void` - */ - releasesAssetsPartialUpdate: ( - owner: string, - repo: string, - id: string, - body: SwaggerTypeAssetPatchGeneratedDataContract, - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeReleaseGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeReleaseGeneratedDataContract` - * @response `403` `void` - */ - releasesPartialUpdate: ( - owner: string, - repo: string, - id: string, - body: SwaggerTypeReleaseCreateGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeAssetsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeCodeFrequencyStatsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeCommitActivityStatsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeContributorsStatsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeParticipationStatsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeCodeFrequencyStatsGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeRefGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `201` `SwaggerTypeRefGeneratedDataContract` - * @response `403` `void` - */ - statusesCreate: ( - owner: string, - repo: string, - ref: string, - body: SwaggerTypeHeadBranchGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeSubscriptionGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeSubscriptionGeneratedDataContract` - * @response `403` `void` - */ - subscriptionUpdate: ( - owner: string, - repo: string, - body: SwaggerTypeSubscriptionBodyGeneratedDataContract, - 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 - * @response `200` `SwaggerTypeTagsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeTeamsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `302` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeReposGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeSearchCodeGeneratedDataContract` - * @response `403` `void` - */ - codeList: ( - query: { - /** @default "desc" */ - 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 - * @response `200` `SwaggerTypeSearchIssuesGeneratedDataContract` - * @response `403` `void` - */ - issuesList: ( - query: { - /** @default "desc" */ - 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 - * @response `200` `SwaggerTypeSearchRepositoriesGeneratedDataContract` - * @response `403` `void` - */ - repositoriesList: ( - query: { - /** @default "desc" */ - 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 - * @response `200` `SwaggerTypeSearchUsersGeneratedDataContract` - * @response `403` `void` - */ - usersList: ( - query: { - /** @default "desc" */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - teamsDelete: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "DELETE", - ...params, - }), - - /** - * No description - * - * @name TeamsDetail - * @request GET:/teams/{teamId} - * @response `200` `SwaggerTypeTeamGeneratedDataContract` - * @response `403` `void` - */ - teamsDetail: (teamId: number, params: RequestParams = {}) => - this.request({ - path: `/teams/${teamId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name TeamsPartialUpdate - * @request PATCH:/teams/{teamId} - * @response `200` `SwaggerTypeTeamGeneratedDataContract` - * @response `403` `void` - */ - teamsPartialUpdate: (teamId: number, body: SwaggerTypeEditTeamGeneratedDataContract, 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 - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @deprecated - * @response `204` `void` - * @response `403` `void` - */ - 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} - * @deprecated - * @originalName membersDetail - * @duplicate - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - 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} - * @deprecated - * @response `204` `void` - * @response `403` `void` - * @response `422` `SwaggerTypeOrganizationAsTeamMemberGeneratedDataContract` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeTeamMembershipGeneratedDataContract` - * @response `403` `void` - * @response `404` `void` - */ - 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} - * @response `200` `SwaggerTypeTeamMembershipGeneratedDataContract` - * @response `403` `void` - * @response `422` `SwaggerTypeOrganizationAsTeamMemberGeneratedDataContract` - */ - membershipsUpdate: (teamId: number, username: string, params: RequestParams = {}) => - this.request< - SwaggerTypeTeamMembershipGeneratedDataContract, - void | SwaggerTypeOrganizationAsTeamMemberGeneratedDataContract - >({ - path: `/teams/${teamId}/memberships/${username}`, - method: "PUT", - format: "json", - ...params, - }), - - /** - * No description - * - * @name ReposDetail - * @request GET:/teams/{teamId}/repos - * @response `200` `SwaggerTypeTeamReposGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `403` `void` - */ - 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} - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeUserGeneratedDataContract` - * @response `403` `void` - */ - userList: (params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name UserPartialUpdate - * @request PATCH:/user - * @response `200` `SwaggerTypeUserGeneratedDataContract` - * @response `403` `void` - */ - userPartialUpdate: (body: SwaggerTypeUserUpdateGeneratedDataContract, params: RequestParams = {}) => - this.request({ - path: `/user`, - method: "PATCH", - body: body, - type: ContentType.Json, - format: "json", - ...params, - }), - - /** - * No description - * - * @name EmailsDelete - * @request DELETE:/user/emails - * @response `204` `void` - * @response `403` `void` - */ - emailsDelete: (body: SwaggerTypeUserEmailsGeneratedDataContract, params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "DELETE", - body: body, - type: ContentType.Json, - ...params, - }), - - /** - * No description - * - * @name EmailsList - * @request GET:/user/emails - * @response `200` `SwaggerTypeUserEmailsGeneratedDataContract` - * @response `403` `void` - */ - emailsList: (params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "GET", - ...params, - }), - - /** - * No description - * - * @name EmailsCreate - * @request POST:/user/emails - * @response `403` `void` - */ - emailsCreate: (body: SwaggerTypeEmailsPostGeneratedDataContract, params: RequestParams = {}) => - this.request({ - path: `/user/emails`, - method: "POST", - body: body, - ...params, - }), - - /** - * No description - * - * @name FollowersList - * @request GET:/user/followers - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - followersList: (params: RequestParams = {}) => - this.request({ - path: `/user/followers`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name FollowingList - * @request GET:/user/following - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - followingList: (params: RequestParams = {}) => - this.request({ - path: `/user/following`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name FollowingDelete - * @request DELETE:/user/following/{username} - * @response `204` `void` - * @response `403` `void` - */ - followingDelete: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "DELETE", - ...params, - }), - - /** - * No description - * - * @name FollowingDetail - * @request GET:/user/following/{username} - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - followingDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "GET", - ...params, - }), - - /** - * No description - * - * @name FollowingUpdate - * @request PUT:/user/following/{username} - * @response `204` `void` - * @response `403` `void` - */ - followingUpdate: (username: string, params: RequestParams = {}) => - this.request({ - path: `/user/following/${username}`, - method: "PUT", - ...params, - }), - - /** - * No description - * - * @name IssuesList - * @request GET:/user/issues - * @response `200` `SwaggerTypeIssuesGeneratedDataContract` - * @response `403` `void` - */ - issuesList: ( - query: { - /** @default "all" */ - filter: "assigned" | "created" | "mentioned" | "subscribed" | "all"; - /** @default "open" */ - state: "open" | "closed"; - labels: string; - /** @default "created" */ - sort: "created" | "updated" | "comments"; - /** @default "desc" */ - 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 - * @response `200` `SwaggerTypeGitignoreGeneratedDataContract` - * @response `403` `void` - */ - keysList: (params: RequestParams = {}) => - this.request({ - path: `/user/keys`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name KeysCreate - * @request POST:/user/keys - * @response `201` `SwaggerTypeUserKeysKeyIdGeneratedDataContract` - * @response `403` `void` - */ - keysCreate: (body: SwaggerTypeUserKeysPostGeneratedDataContract, params: RequestParams = {}) => - this.request({ - path: `/user/keys`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * No description - * - * @name KeysDelete - * @request DELETE:/user/keys/{keyId} - * @response `204` `void` - * @response `403` `void` - */ - keysDelete: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "DELETE", - ...params, - }), - - /** - * No description - * - * @name KeysDetail - * @request GET:/user/keys/{keyId} - * @response `200` `SwaggerTypeUserKeysKeyIdGeneratedDataContract` - * @response `403` `void` - */ - keysDetail: (keyId: number, params: RequestParams = {}) => - this.request({ - path: `/user/keys/${keyId}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name OrgsList - * @request GET:/user/orgs - * @response `200` `SwaggerTypeGitignoreGeneratedDataContract` - * @response `403` `void` - */ - orgsList: (params: RequestParams = {}) => - this.request({ - path: `/user/orgs`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name ReposList - * @request GET:/user/repos - * @response `200` `SwaggerTypeReposGeneratedDataContract` - * @response `403` `void` - */ - reposList: ( - query?: { - /** @default "all" */ - 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 - * @response `201` `SwaggerTypeReposGeneratedDataContract` - * @response `403` `void` - */ - reposCreate: (body: SwaggerTypePostRepoGeneratedDataContract, params: RequestParams = {}) => - this.request({ - path: `/user/repos`, - method: "POST", - body: body, - format: "json", - ...params, - }), - - /** - * No description - * - * @name StarredList - * @request GET:/user/starred - * @response `200` `SwaggerTypeGitignoreGeneratedDataContract` - * @response `403` `void` - */ - starredList: ( - query?: { - direction?: string; - /** @default "created" */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeReposGeneratedDataContract` - * @response `403` `void` - */ - subscriptionsList: (params: RequestParams = {}) => - this.request({ - path: `/user/subscriptions`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name SubscriptionsDelete - * @request DELETE:/user/subscriptions/{owner}/{repo} - * @deprecated - * @response `204` `void` - * @response `403` `void` - */ - 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} - * @deprecated - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - 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} - * @deprecated - * @response `204` `void` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeTeamsListGeneratedDataContract` - * @response `403` `void` - */ - teamsList: (params: RequestParams = {}) => - this.request({ - path: `/user/teams`, - method: "GET", - format: "json", - ...params, - }), - }; - users = { - /** - * No description - * - * @name UsersList - * @request GET:/users - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `200` `SwaggerTypeUserGeneratedDataContract` - * @response `403` `void` - */ - usersDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}`, - method: "GET", - format: "json", - ...params, - }), - - /** - * No description - * - * @name EventsDetail - * @request GET:/users/{username}/events - * @response `403` `void` - */ - 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} - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeUsersGeneratedDataContract` - * @response `403` `void` - */ - 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} - * @response `204` `void` - * @response `403` `void` - * @response `404` `void` - */ - 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 - * @response `200` `SwaggerTypeGistsGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeGitignoreGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeGitignoreGeneratedDataContract` - * @response `403` `void` - */ - 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 - * @response `403` `void` - */ - 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 - * @response `403` `void` - */ - 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 - * @response `200` `SwaggerTypeReposGeneratedDataContract` - * @response `403` `void` - */ - reposDetail: ( - username: string, - query?: { - /** @default "all" */ - 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 - * @response `403` `void` - */ - starredDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/starred`, - method: "GET", - ...params, - }), - - /** - * No description - * - * @name SubscriptionsDetail - * @request GET:/users/{username}/subscriptions - * @response `403` `void` - */ - subscriptionsDetail: (username: string, params: RequestParams = {}) => - this.request({ - path: `/users/${username}/subscriptions`, - method: "GET", - ...params, - }), - }; -} diff --git a/tests/spec/typeSuffixPrefix/test.js b/tests/spec/typeSuffixPrefix/test.js deleted file mode 100644 index 9b016725..00000000 --- a/tests/spec/typeSuffixPrefix/test.js +++ /dev/null @@ -1,31 +0,0 @@ -const _ = require("lodash"); -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node:path"); -const validateGeneratedModule = require("../../helpers/validateGeneratedModule"); -const createSchemaInfos = require("../../helpers/createSchemaInfos"); -const assertGeneratedModule = require("../../helpers/assertGeneratedModule"); - -const schemas = createSchemaInfos({ - absolutePathToSchemas: resolve(__dirname, "./"), - absoluteOutputPath: resolve(__dirname, "./"), -}); - -schemas.forEach(({ absolutePath, apiFileName, Exception }) => { - generateApiForTest({ - testName: "--type-suffix --type-prefix options test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - typePrefix: "SwaggerType", - typeSuffix: "GeneratedDataContract", - generateClient: true, - generateResponses: true, - }).then((output) => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/spec/unionEnums/expected.ts b/tests/spec/unionEnums/__snapshots__/basic.test.ts.snap similarity index 93% rename from tests/spec/unionEnums/expected.ts rename to tests/spec/unionEnums/__snapshots__/basic.test.ts.snap index d0b750f5..3a5d468e 100644 --- a/tests/spec/unionEnums/expected.ts +++ b/tests/spec/unionEnums/__snapshots__/basic.test.ts.snap @@ -1,4 +1,7 @@ -/* eslint-disable */ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`basic > --union-enums 1`] = ` +"/* eslint-disable */ /* tslint:disable */ /* * --------------------------------------------------------------- @@ -25,7 +28,7 @@ export type QueryParamsType = Record; export type ResponseFormat = keyof Omit; export interface FullRequestParams extends Omit { - /** set parameter to `true` for call `securityWorker` for this request */ + /** set parameter to \`true\` for call \`securityWorker\` for this request */ secure?: boolean; /** request path */ path: string; @@ -90,7 +93,7 @@ export class HttpClient { protected encodeQueryParam(key: string, value: any) { const encodedKey = encodeURIComponent(key); - return `${encodedKey}=${encodeURIComponent(typeof value === "number" ? value : `${value}`)}`; + return \`\${encodedKey}=\${encodeURIComponent(typeof value === "number" ? value : \`\${value}\`)}\`; } protected addQueryParam(query: QueryParamsType, key: string) { @@ -112,7 +115,7 @@ export class HttpClient { protected addQueryParams(rawQuery?: QueryParamsType): string { const queryString = this.toQueryString(rawQuery); - return queryString ? `?${queryString}` : ""; + return queryString ? \`?\${queryString}\` : ""; } private contentFormatters: Record any> = { @@ -128,7 +131,7 @@ export class HttpClient { ? property : typeof property === "object" && property !== null ? JSON.stringify(property) - : `${property}`, + : \`\${property}\`, ); return formData; }, new FormData()), @@ -192,7 +195,7 @@ export class HttpClient { const payloadFormatter = this.contentFormatters[type || ContentType.Json]; const responseFormat = format || requestParams.format; - return this.customFetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, { + return this.customFetch(\`\${baseUrl || this.baseUrl || ""}\${path}\${queryString ? \`?\${queryString}\` : ""}\`, { ...requestParams, headers: { ...(requestParams.headers || {}), @@ -236,3 +239,5 @@ export class HttpClient { * @baseUrl http://localhost:8080/api/v1 */ export class Api extends HttpClient {} +" +`; diff --git a/tests/spec/unionEnums/basic.test.ts b/tests/spec/unionEnums/basic.test.ts new file mode 100644 index 00000000..4e3d40dd --- /dev/null +++ b/tests/spec/unionEnums/basic.test.ts @@ -0,0 +1,36 @@ +import * as fs from "node:fs/promises"; +import * as os from "node:os"; +import * as path from "node:path"; + +import { afterAll, beforeAll, describe, expect, test } from "vitest"; + +import { generateApi } from "../../../src/index.js"; + +describe("basic", async () => { + let tmpdir = ""; + + beforeAll(async () => { + tmpdir = await fs.mkdtemp(path.join(os.tmpdir(), "swagger-typescript-api")); + }); + + afterAll(async () => { + await fs.rm(tmpdir, { recursive: true }); + }); + + test("--union-enums", async () => { + // @ts-expect-error + await generateApi({ + name: "schema", + input: path.resolve(__dirname, "schema.json"), + output: tmpdir, + silent: true, + generateUnionEnums: true, + }); + + const content = await fs.readFile(path.join(tmpdir, "schema.ts"), { + encoding: "utf8", + }); + + expect(content).toMatchSnapshot(); + }); +}); diff --git a/tests/spec/unionEnums/schema.ts b/tests/spec/unionEnums/schema.ts deleted file mode 100644 index d0b750f5..00000000 --- a/tests/spec/unionEnums/schema.ts +++ /dev/null @@ -1,238 +0,0 @@ -/* eslint-disable */ -/* tslint:disable */ -/* - * --------------------------------------------------------------- - * ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ## - * ## ## - * ## AUTHOR: acacode ## - * ## SOURCE: https://github.com/acacode/swagger-typescript-api ## - * --------------------------------------------------------------- - */ - -export type StringEnum = "String1" | "String2" | "String3" | "String4"; - -export type NumberEnum = 1 | 2 | 3 | 4; - -export type BooleanEnum = true | false; - -/** - * FooBar - * @format int32 - */ -export type IntEnumWithNames = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; - -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 = "http://localhost:8080/api/v1"; - 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.clone() 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 http://localhost:8080/api/v1 - */ -export class Api extends HttpClient {} diff --git a/tests/spec/unionEnums/test.js b/tests/spec/unionEnums/test.js deleted file mode 100644 index 504a5814..00000000 --- a/tests/spec/unionEnums/test.js +++ /dev/null @@ -1,26 +0,0 @@ -const { generateApiForTest } = require("../../helpers/generateApiForTest"); -const { resolve } = require("node: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: "--union-enums option test", - silent: true, - name: apiFileName, - input: absolutePath, - output: resolve(__dirname, "./"), - generateUnionEnums: true, - }).then(() => { - validateGeneratedModule(resolve(__dirname, `./${apiFileName}`)); - assertGeneratedModule( - resolve(__dirname, `./${apiFileName}`), - resolve(__dirname, "./expected.ts"), - ); - }); -}); diff --git a/tests/utils.ts b/tests/utils.ts new file mode 100644 index 00000000..b17957fb --- /dev/null +++ b/tests/utils.ts @@ -0,0 +1,20 @@ +import * as fs from "node:fs/promises"; +import * as path from "node:path"; + +export async function collectAllSchemas() { + const schemas = []; + const schemaPath = path.join(__dirname, "fixtures", "schemas"); + const schemaFiles = await fs.readdir(schemaPath, { recursive: true }); + for (const schemaFile of schemaFiles) { + if ( + schemaFile.endsWith(".json") || + schemaFile.endsWith(".yaml") || + schemaFile.endsWith(".yml") + ) { + const name = path.basename(schemaFile).replace(/\.(json|yaml|yml)$/, ""); + const filePath = path.join(schemaPath, schemaFile); + schemas.push({ name, filePath }); + } + } + return schemas; +} diff --git a/tests/validate.js b/tests/validate.js deleted file mode 100644 index 53f188b2..00000000 --- a/tests/validate.js +++ /dev/null @@ -1,9 +0,0 @@ -const { resolve } = require("node:path"); -const allSchemas = require("./allSchemas"); -const validateGeneratedModule = require("./helpers/validateGeneratedModule"); - -allSchemas.forEach((schema) => { - validateGeneratedModule(resolve(schema.outputPath, schema.apiFileName)); -}); - -console.log("everything is good:)"); diff --git a/vitest.config.mts b/vitest.config.mts new file mode 100644 index 00000000..f12111d9 --- /dev/null +++ b/vitest.config.mts @@ -0,0 +1,7 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + testTimeout: 10000, + }, +}); diff --git a/yarn.lock b/yarn.lock index e8c3881e..682f49df 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6,31 +6,31 @@ __metadata: cacheKey: 10c0 "@babel/code-frame@npm:^7.0.0": - version: 7.24.6 - resolution: "@babel/code-frame@npm:7.24.6" + version: 7.24.7 + resolution: "@babel/code-frame@npm:7.24.7" dependencies: - "@babel/highlight": "npm:^7.24.6" + "@babel/highlight": "npm:^7.24.7" picocolors: "npm:^1.0.0" - checksum: 10c0/c93c6d1763530f415218c31d07359364397f19b70026abdff766164c21ed352a931cf07f3102c5fb9e04792de319e332d68bcb1f7debef601a02197f90f9ba24 + checksum: 10c0/ab0af539473a9f5aeaac7047e377cb4f4edd255a81d84a76058595f8540784cc3fbe8acf73f1e073981104562490aabfb23008cd66dc677a456a4ed5390fdde6 languageName: node linkType: hard -"@babel/helper-validator-identifier@npm:^7.24.6": - version: 7.24.6 - resolution: "@babel/helper-validator-identifier@npm:7.24.6" - checksum: 10c0/d29d2e3fca66c31867a009014169b93f7bc21c8fc1dd7d0b9d85d7a4000670526ff2222d966febb75a6e12f9859a31d1e75b558984e28ecb69651314dd0a6fd1 +"@babel/helper-validator-identifier@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/helper-validator-identifier@npm:7.24.7" + checksum: 10c0/87ad608694c9477814093ed5b5c080c2e06d44cb1924ae8320474a74415241223cc2a725eea2640dd783ff1e3390e5f95eede978bc540e870053152e58f1d651 languageName: node linkType: hard -"@babel/highlight@npm:^7.24.6": - version: 7.24.6 - resolution: "@babel/highlight@npm:7.24.6" +"@babel/highlight@npm:^7.24.7": + version: 7.24.7 + resolution: "@babel/highlight@npm:7.24.7" dependencies: - "@babel/helper-validator-identifier": "npm:^7.24.6" + "@babel/helper-validator-identifier": "npm:^7.24.7" chalk: "npm:^2.4.2" js-tokens: "npm:^4.0.0" picocolors: "npm:^1.0.0" - checksum: 10c0/5bbc31695e5d44e97feb267f7aaf4c52908560d184ffeb2e2e57aae058d40125592931883889413e19def3326895ddb41ff45e090fa90b459d8c294b4ffc238c + checksum: 10c0/674334c571d2bb9d1c89bdd87566383f59231e16bcdcf5bb7835babdf03c9ae585ca0887a7b25bdf78f303984af028df52831c7989fecebb5101cc132da9393a languageName: node linkType: hard @@ -125,6 +125,167 @@ __metadata: languageName: node linkType: hard +"@esbuild/aix-ppc64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/aix-ppc64@npm:0.21.5" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/android-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/android-arm64@npm:0.21.5" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/android-arm@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/android-arm@npm:0.21.5" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@esbuild/android-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/android-x64@npm:0.21.5" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/darwin-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/darwin-arm64@npm:0.21.5" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/darwin-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/darwin-x64@npm:0.21.5" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/freebsd-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/freebsd-arm64@npm:0.21.5" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/freebsd-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/freebsd-x64@npm:0.21.5" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/linux-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-arm64@npm:0.21.5" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/linux-arm@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-arm@npm:0.21.5" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@esbuild/linux-ia32@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-ia32@npm:0.21.5" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/linux-loong64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-loong64@npm:0.21.5" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + +"@esbuild/linux-mips64el@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-mips64el@npm:0.21.5" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + +"@esbuild/linux-ppc64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-ppc64@npm:0.21.5" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/linux-riscv64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-riscv64@npm:0.21.5" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + +"@esbuild/linux-s390x@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-s390x@npm:0.21.5" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + +"@esbuild/linux-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/linux-x64@npm:0.21.5" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/netbsd-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/netbsd-x64@npm:0.21.5" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openbsd-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/openbsd-x64@npm:0.21.5" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/sunos-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/sunos-x64@npm:0.21.5" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/win32-arm64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/win32-arm64@npm:0.21.5" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/win32-ia32@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/win32-ia32@npm:0.21.5" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/win32-x64@npm:0.21.5": + version: 0.21.5 + resolution: "@esbuild/win32-x64@npm:0.21.5" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@exodus/schemasafe@npm:^1.0.0-rc.2": version: 1.3.0 resolution: "@exodus/schemasafe@npm:1.3.0" @@ -132,6 +293,184 @@ __metadata: languageName: node linkType: hard +"@isaacs/cliui@npm:^8.0.2": + version: 8.0.2 + resolution: "@isaacs/cliui@npm:8.0.2" + dependencies: + string-width: "npm:^5.1.2" + string-width-cjs: "npm:string-width@^4.2.0" + strip-ansi: "npm:^7.0.1" + strip-ansi-cjs: "npm:strip-ansi@^6.0.1" + wrap-ansi: "npm:^8.1.0" + wrap-ansi-cjs: "npm:wrap-ansi@^7.0.0" + checksum: 10c0/b1bf42535d49f11dc137f18d5e4e63a28c5569de438a221c369483731e9dac9fb797af554e8bf02b6192d1e5eba6e6402cf93900c3d0ac86391d00d04876789e + languageName: node + linkType: hard + +"@jest/schemas@npm:^29.6.3": + version: 29.6.3 + resolution: "@jest/schemas@npm:29.6.3" + dependencies: + "@sinclair/typebox": "npm:^0.27.8" + checksum: 10c0/b329e89cd5f20b9278ae1233df74016ebf7b385e0d14b9f4c1ad18d096c4c19d1e687aa113a9c976b16ec07f021ae53dea811fb8c1248a50ac34fbe009fdf6be + languageName: node + linkType: hard + +"@jridgewell/sourcemap-codec@npm:^1.4.15": + version: 1.4.15 + resolution: "@jridgewell/sourcemap-codec@npm:1.4.15" + checksum: 10c0/0c6b5ae663087558039052a626d2d7ed5208da36cfd707dcc5cea4a07cfc918248403dcb5989a8f7afaf245ce0573b7cc6fd94c4a30453bd10e44d9363940ba5 + languageName: node + linkType: hard + +"@npmcli/agent@npm:^2.0.0": + version: 2.2.2 + resolution: "@npmcli/agent@npm:2.2.2" + dependencies: + agent-base: "npm:^7.1.0" + http-proxy-agent: "npm:^7.0.0" + https-proxy-agent: "npm:^7.0.1" + lru-cache: "npm:^10.0.1" + socks-proxy-agent: "npm:^8.0.3" + checksum: 10c0/325e0db7b287d4154ecd164c0815c08007abfb07653cc57bceded17bb7fd240998a3cbdbe87d700e30bef494885eccc725ab73b668020811d56623d145b524ae + languageName: node + linkType: hard + +"@npmcli/fs@npm:^3.1.0": + version: 3.1.1 + resolution: "@npmcli/fs@npm:3.1.1" + dependencies: + semver: "npm:^7.3.5" + checksum: 10c0/c37a5b4842bfdece3d14dfdb054f73fe15ed2d3da61b34ff76629fb5b1731647c49166fd2a8bf8b56fcfa51200382385ea8909a3cbecdad612310c114d3f6c99 + languageName: node + linkType: hard + +"@pkgjs/parseargs@npm:^0.11.0": + version: 0.11.0 + resolution: "@pkgjs/parseargs@npm:0.11.0" + checksum: 10c0/5bd7576bb1b38a47a7fc7b51ac9f38748e772beebc56200450c4a817d712232b8f1d3ef70532c80840243c657d491cf6a6be1e3a214cff907645819fdc34aadd + languageName: node + linkType: hard + +"@rollup/rollup-android-arm-eabi@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.18.0" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@rollup/rollup-android-arm64@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-android-arm64@npm:4.18.0" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-arm64@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-darwin-arm64@npm:4.18.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-x64@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-darwin-x64@npm:4.18.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm-gnueabihf@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.18.0" + conditions: os=linux & cpu=arm & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm-musleabihf@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-arm-musleabihf@npm:4.18.0" + conditions: os=linux & cpu=arm & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-gnu@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.18.0" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-musl@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.18.0" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-linux-powerpc64le-gnu@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-powerpc64le-gnu@npm:4.18.0" + conditions: os=linux & cpu=ppc64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-riscv64-gnu@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.18.0" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-s390x-gnu@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-s390x-gnu@npm:4.18.0" + conditions: os=linux & cpu=s390x & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-gnu@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.18.0" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-musl@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.18.0" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-win32-arm64-msvc@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.18.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-win32-ia32-msvc@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.18.0" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@rollup/rollup-win32-x64-msvc@npm:4.18.0": + version: 4.18.0 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.18.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@sinclair/typebox@npm:^0.27.8": + version: 0.27.8 + resolution: "@sinclair/typebox@npm:0.27.8" + checksum: 10c0/ef6351ae073c45c2ac89494dbb3e1f87cc60a93ce4cde797b782812b6f97da0d620ae81973f104b43c9b7eaa789ad20ba4f6a1359f1cc62f63729a55a7d22d4e + languageName: node + linkType: hard + "@sindresorhus/is@npm:^4.6.0": version: 4.6.0 resolution: "@sindresorhus/is@npm:4.6.0" @@ -139,6 +478,13 @@ __metadata: languageName: node linkType: hard +"@types/estree@npm:1.0.5, @types/estree@npm:^1.0.0": + version: 1.0.5 + resolution: "@types/estree@npm:1.0.5" + checksum: 10c0/b3b0e334288ddb407c7b3357ca67dbee75ee22db242ca7c56fe27db4e1a31989cb8af48a84dd401deb787fe10cc6b2ab1ee82dc4783be87ededbe3d53c79c70d + languageName: node + linkType: hard + "@types/lodash@npm:4.17.5": version: 4.17.5 resolution: "@types/lodash@npm:4.17.5" @@ -162,6 +508,104 @@ __metadata: languageName: node linkType: hard +"@vitest/expect@npm:1.6.0": + version: 1.6.0 + resolution: "@vitest/expect@npm:1.6.0" + dependencies: + "@vitest/spy": "npm:1.6.0" + "@vitest/utils": "npm:1.6.0" + chai: "npm:^4.3.10" + checksum: 10c0/a4351f912a70543e04960f5694f1f1ac95f71a856a46e87bba27d3eb72a08c5d11d35021cbdc6077452a152e7d93723fc804bba76c2cc53c8896b7789caadae3 + languageName: node + linkType: hard + +"@vitest/runner@npm:1.6.0": + version: 1.6.0 + resolution: "@vitest/runner@npm:1.6.0" + dependencies: + "@vitest/utils": "npm:1.6.0" + p-limit: "npm:^5.0.0" + pathe: "npm:^1.1.1" + checksum: 10c0/27d67fa51f40effe0e41ee5f26563c12c0ef9a96161f806036f02ea5eb9980c5cdf305a70673942e7a1e3d472d4d7feb40093ae93024ef1ccc40637fc65b1d2f + languageName: node + linkType: hard + +"@vitest/snapshot@npm:1.6.0": + version: 1.6.0 + resolution: "@vitest/snapshot@npm:1.6.0" + dependencies: + magic-string: "npm:^0.30.5" + pathe: "npm:^1.1.1" + pretty-format: "npm:^29.7.0" + checksum: 10c0/be027fd268d524589ff50c5fad7b4faa1ac5742b59ac6c1dc6f5a3930aad553560e6d8775e90ac4dfae4be746fc732a6f134ba95606a1519707ce70db3a772a5 + languageName: node + linkType: hard + +"@vitest/spy@npm:1.6.0": + version: 1.6.0 + resolution: "@vitest/spy@npm:1.6.0" + dependencies: + tinyspy: "npm:^2.2.0" + checksum: 10c0/df66ea6632b44fb76ef6a65c1abbace13d883703aff37cd6d062add6dcd1b883f19ce733af8e0f7feb185b61600c6eb4042a518e4fb66323d0690ec357f9401c + languageName: node + linkType: hard + +"@vitest/utils@npm:1.6.0": + version: 1.6.0 + resolution: "@vitest/utils@npm:1.6.0" + dependencies: + diff-sequences: "npm:^29.6.3" + estree-walker: "npm:^3.0.3" + loupe: "npm:^2.3.7" + pretty-format: "npm:^29.7.0" + checksum: 10c0/8b0d19835866455eb0b02b31c5ca3d8ad45f41a24e4c7e1f064b480f6b2804dc895a70af332f14c11ed89581011b92b179718523f55f5b14787285a0321b1301 + languageName: node + linkType: hard + +"abbrev@npm:^2.0.0": + version: 2.0.0 + resolution: "abbrev@npm:2.0.0" + checksum: 10c0/f742a5a107473946f426c691c08daba61a1d15942616f300b5d32fd735be88fef5cba24201757b6c407fd564555fb48c751cfa33519b2605c8a7aadd22baf372 + languageName: node + linkType: hard + +"acorn-walk@npm:^8.3.2": + version: 8.3.3 + resolution: "acorn-walk@npm:8.3.3" + dependencies: + acorn: "npm:^8.11.0" + checksum: 10c0/4a9e24313e6a0a7b389e712ba69b66b455b4cb25988903506a8d247e7b126f02060b05a8a5b738a9284214e4ca95f383dd93443a4ba84f1af9b528305c7f243b + languageName: node + linkType: hard + +"acorn@npm:^8.11.0, acorn@npm:^8.11.3": + version: 8.12.0 + resolution: "acorn@npm:8.12.0" + bin: + acorn: bin/acorn + checksum: 10c0/a19f9dead009d3b430fa3c253710b47778cdaace15b316de6de93a68c355507bc1072a9956372b6c990cbeeb167d4a929249d0faeb8ae4bb6911d68d53299549 + languageName: node + linkType: hard + +"agent-base@npm:^7.0.2, agent-base@npm:^7.1.0, agent-base@npm:^7.1.1": + version: 7.1.1 + resolution: "agent-base@npm:7.1.1" + dependencies: + debug: "npm:^4.3.4" + checksum: 10c0/e59ce7bed9c63bf071a30cc471f2933862044c97fd9958967bfe22521d7a0f601ce4ed5a8c011799d0c726ca70312142ae193bbebb60f576b52be19d4a363b50 + languageName: node + linkType: hard + +"aggregate-error@npm:^3.0.0": + version: 3.1.0 + resolution: "aggregate-error@npm:3.1.0" + dependencies: + clean-stack: "npm:^2.0.0" + indent-string: "npm:^4.0.0" + checksum: 10c0/a42f67faa79e3e6687a4923050e7c9807db3848a037076f791d10e092677d65c1d2d863b7848560699f40fc0502c19f40963fb1cd1fb3d338a7423df8e45e039 + languageName: node + linkType: hard + "ansi-regex@npm:^5.0.1": version: 5.0.1 resolution: "ansi-regex@npm:5.0.1" @@ -169,6 +613,13 @@ __metadata: languageName: node linkType: hard +"ansi-regex@npm:^6.0.1": + version: 6.0.1 + resolution: "ansi-regex@npm:6.0.1" + checksum: 10c0/cbe16dbd2c6b2735d1df7976a7070dd277326434f0212f43abf6d87674095d247968209babdaad31bb00882fa68807256ba9be340eec2f1004de14ca75f52a08 + languageName: node + linkType: hard + "ansi-styles@npm:^3.2.1": version: 3.2.1 resolution: "ansi-styles@npm:3.2.1" @@ -187,6 +638,20 @@ __metadata: languageName: node linkType: hard +"ansi-styles@npm:^5.0.0": + version: 5.2.0 + resolution: "ansi-styles@npm:5.2.0" + checksum: 10c0/9c4ca80eb3c2fb7b33841c210d2f20807f40865d27008d7c3f707b7f95cab7d67462a565e2388ac3285b71cb3d9bb2173de8da37c57692a362885ec34d6e27df + languageName: node + linkType: hard + +"ansi-styles@npm:^6.1.0": + version: 6.2.1 + resolution: "ansi-styles@npm:6.2.1" + checksum: 10c0/5d1ec38c123984bcedd996eac680d548f31828bd679a66db2bdf11844634dde55fec3efa9c6bb1d89056a5e79c1ac540c4c784d592ea1d25028a92227d2f2d5c + languageName: node + linkType: hard + "argparse@npm:^2.0.1": version: 2.0.1 resolution: "argparse@npm:2.0.1" @@ -194,6 +659,13 @@ __metadata: languageName: node linkType: hard +"assertion-error@npm:^1.1.0": + version: 1.1.0 + resolution: "assertion-error@npm:1.1.0" + checksum: 10c0/25456b2aa333250f01143968e02e4884a34588a8538fbbf65c91a637f1dbfb8069249133cd2f4e530f10f624d206a664e7df30207830b659e9f5298b00a4099b + languageName: node + linkType: hard + "asynckit@npm:^0.4.0": version: 0.4.0 resolution: "asynckit@npm:0.4.0" @@ -229,6 +701,42 @@ __metadata: languageName: node linkType: hard +"brace-expansion@npm:^2.0.1": + version: 2.0.1 + resolution: "brace-expansion@npm:2.0.1" + dependencies: + balanced-match: "npm:^1.0.0" + checksum: 10c0/b358f2fe060e2d7a87aa015979ecea07f3c37d4018f8d6deb5bd4c229ad3a0384fe6029bb76cd8be63c81e516ee52d1a0673edbe2023d53a5191732ae3c3e49f + languageName: node + linkType: hard + +"cac@npm:^6.7.14": + version: 6.7.14 + resolution: "cac@npm:6.7.14" + checksum: 10c0/4ee06aaa7bab8981f0d54e5f5f9d4adcd64058e9697563ce336d8a3878ed018ee18ebe5359b2430eceae87e0758e62ea2019c3f52ae6e211b1bd2e133856cd10 + languageName: node + linkType: hard + +"cacache@npm:^18.0.0": + version: 18.0.3 + resolution: "cacache@npm:18.0.3" + dependencies: + "@npmcli/fs": "npm:^3.1.0" + fs-minipass: "npm:^3.0.0" + glob: "npm:^10.2.2" + lru-cache: "npm:^10.0.1" + minipass: "npm:^7.0.3" + minipass-collect: "npm:^2.0.1" + minipass-flush: "npm:^1.0.5" + minipass-pipeline: "npm:^1.2.4" + p-map: "npm:^4.0.0" + ssri: "npm:^10.0.0" + tar: "npm:^6.1.11" + unique-filename: "npm:^3.0.0" + checksum: 10c0/dfda92840bb371fb66b88c087c61a74544363b37a265023223a99965b16a16bbb87661fe4948718d79df6e0cc04e85e62784fbcf1832b2a5e54ff4c46fbb45b7 + languageName: node + linkType: hard + "call-me-maybe@npm:^1.0.1": version: 1.0.2 resolution: "call-me-maybe@npm:1.0.2" @@ -243,6 +751,21 @@ __metadata: languageName: node linkType: hard +"chai@npm:^4.3.10": + version: 4.4.1 + resolution: "chai@npm:4.4.1" + dependencies: + assertion-error: "npm:^1.1.0" + check-error: "npm:^1.0.3" + deep-eql: "npm:^4.1.3" + get-func-name: "npm:^2.0.2" + loupe: "npm:^2.3.6" + pathval: "npm:^1.1.1" + type-detect: "npm:^4.0.8" + checksum: 10c0/91590a8fe18bd6235dece04ccb2d5b4ecec49984b50924499bdcd7a95c02cb1fd2a689407c19bb854497bde534ef57525cfad6c7fdd2507100fd802fbc2aefbd + languageName: node + linkType: hard + "chalk@npm:^2.3.2, chalk@npm:^2.4.2": version: 2.4.2 resolution: "chalk@npm:2.4.2" @@ -261,6 +784,29 @@ __metadata: languageName: node linkType: hard +"check-error@npm:^1.0.3": + version: 1.0.3 + resolution: "check-error@npm:1.0.3" + dependencies: + get-func-name: "npm:^2.0.2" + checksum: 10c0/94aa37a7315c0e8a83d0112b5bfb5a8624f7f0f81057c73e4707729cdd8077166c6aefb3d8e2b92c63ee130d4a2ff94bad46d547e12f3238cc1d78342a973841 + languageName: node + linkType: hard + +"chownr@npm:^2.0.0": + version: 2.0.0 + resolution: "chownr@npm:2.0.0" + checksum: 10c0/594754e1303672171cc04e50f6c398ae16128eb134a88f801bf5354fd96f205320f23536a045d9abd8b51024a149696e51231565891d4efdab8846021ecf88e6 + languageName: node + linkType: hard + +"clean-stack@npm:^2.0.0": + version: 2.2.0 + resolution: "clean-stack@npm:2.2.0" + checksum: 10c0/1f90262d5f6230a17e27d0c190b09d47ebe7efdd76a03b5a1127863f7b3c9aec4c3e6c8bb3a7bbf81d553d56a1fd35728f5a8ef4c63f867ac8d690109742a8c1 + languageName: node + linkType: hard + "cliui@npm:^8.0.1": version: 8.0.1 resolution: "cliui@npm:8.0.1" @@ -320,6 +866,13 @@ __metadata: languageName: node linkType: hard +"confbox@npm:^0.1.7": + version: 0.1.7 + resolution: "confbox@npm:0.1.7" + checksum: 10c0/18b40c2f652196a833f3f1a5db2326a8a579cd14eacabfe637e4fc8cb9b68d7cf296139a38c5e7c688ce5041bf46f9adce05932d43fde44cf7e012840b5da111 + languageName: node + linkType: hard + "cosmiconfig@npm:^9.0.0": version: 9.0.0 resolution: "cosmiconfig@npm:9.0.0" @@ -349,7 +902,7 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^7.0.1": +"cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.1, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" dependencies: @@ -360,6 +913,27 @@ __metadata: languageName: node linkType: hard +"debug@npm:4, debug@npm:^4.3.4": + version: 4.3.5 + resolution: "debug@npm:4.3.5" + dependencies: + ms: "npm:2.1.2" + peerDependenciesMeta: + supports-color: + optional: true + checksum: 10c0/082c375a2bdc4f4469c99f325ff458adad62a3fc2c482d59923c260cb08152f34e2659f72b3767db8bb2f21ca81a60a42d1019605a412132d7b9f59363a005cc + languageName: node + linkType: hard + +"deep-eql@npm:^4.1.3": + version: 4.1.4 + resolution: "deep-eql@npm:4.1.4" + dependencies: + type-detect: "npm:^4.0.0" + checksum: 10c0/264e0613493b43552fc908f4ff87b8b445c0e6e075656649600e1b8a17a57ee03e960156fce7177646e4d2ddaf8e5ee616d76bd79929ff593e5c79e4e5e6c517 + languageName: node + linkType: hard + "delayed-stream@npm:~1.0.0": version: 1.0.0 resolution: "delayed-stream@npm:1.0.0" @@ -374,6 +948,13 @@ __metadata: languageName: node linkType: hard +"diff-sequences@npm:^29.6.3": + version: 29.6.3 + resolution: "diff-sequences@npm:29.6.3" + checksum: 10c0/32e27ac7dbffdf2fb0eb5a84efd98a9ad084fbabd5ac9abb8757c6770d5320d2acd172830b28c4add29bb873d59420601dfc805ac4064330ce59b1adfd0593b2 + languageName: node + linkType: hard + "diff@npm:^3.5.0": version: 3.5.0 resolution: "diff@npm:3.5.0" @@ -388,6 +969,13 @@ __metadata: languageName: node linkType: hard +"eastasianwidth@npm:^0.2.0": + version: 0.2.0 + resolution: "eastasianwidth@npm:0.2.0" + checksum: 10c0/26f364ebcdb6395f95124fda411f63137a4bfb5d3a06453f7f23dfe52502905bd84e0488172e0f9ec295fdc45f05c23d5d91baf16bd26f0fe9acd777a188dc39 + languageName: node + linkType: hard + "emoji-regex@npm:^8.0.0": version: 8.0.0 resolution: "emoji-regex@npm:8.0.0" @@ -395,6 +983,13 @@ __metadata: languageName: node linkType: hard +"emoji-regex@npm:^9.2.2": + version: 9.2.2 + resolution: "emoji-regex@npm:9.2.2" + checksum: 10c0/af014e759a72064cf66e6e694a7fc6b0ed3d8db680427b021a89727689671cefe9d04151b2cad51dbaf85d5ba790d061cd167f1cf32eb7b281f6368b3c181639 + languageName: node + linkType: hard + "emojilib@npm:^2.4.0": version: 2.4.0 resolution: "emojilib@npm:2.4.0" @@ -402,13 +997,29 @@ __metadata: languageName: node linkType: hard -"env-paths@npm:^2.2.1": +"encoding@npm:^0.1.13": + version: 0.1.13 + resolution: "encoding@npm:0.1.13" + dependencies: + iconv-lite: "npm:^0.6.2" + checksum: 10c0/36d938712ff00fe1f4bac88b43bcffb5930c1efa57bbcdca9d67e1d9d6c57cfb1200fb01efe0f3109b2ce99b231f90779532814a81370a1bd3274a0f58585039 + languageName: node + linkType: hard + +"env-paths@npm:^2.2.0, env-paths@npm:^2.2.1": version: 2.2.1 resolution: "env-paths@npm:2.2.1" checksum: 10c0/285325677bf00e30845e330eec32894f5105529db97496ee3f598478e50f008c5352a41a30e5e72ec9de8a542b5a570b85699cd63bd2bc646dbcb9f311d83bc4 languageName: node linkType: hard +"err-code@npm:^2.0.2": + version: 2.0.3 + resolution: "err-code@npm:2.0.3" + checksum: 10c0/b642f7b4dd4a376e954947550a3065a9ece6733ab8e51ad80db727aaae0817c2e99b02a97a3d6cecc648a97848305e728289cf312d09af395403a90c9d4d8a66 + languageName: node + linkType: hard + "error-ex@npm:^1.3.1": version: 1.3.2 resolution: "error-ex@npm:1.3.2" @@ -425,6 +1036,86 @@ __metadata: languageName: node linkType: hard +"esbuild@npm:^0.21.3": + version: 0.21.5 + resolution: "esbuild@npm:0.21.5" + dependencies: + "@esbuild/aix-ppc64": "npm:0.21.5" + "@esbuild/android-arm": "npm:0.21.5" + "@esbuild/android-arm64": "npm:0.21.5" + "@esbuild/android-x64": "npm:0.21.5" + "@esbuild/darwin-arm64": "npm:0.21.5" + "@esbuild/darwin-x64": "npm:0.21.5" + "@esbuild/freebsd-arm64": "npm:0.21.5" + "@esbuild/freebsd-x64": "npm:0.21.5" + "@esbuild/linux-arm": "npm:0.21.5" + "@esbuild/linux-arm64": "npm:0.21.5" + "@esbuild/linux-ia32": "npm:0.21.5" + "@esbuild/linux-loong64": "npm:0.21.5" + "@esbuild/linux-mips64el": "npm:0.21.5" + "@esbuild/linux-ppc64": "npm:0.21.5" + "@esbuild/linux-riscv64": "npm:0.21.5" + "@esbuild/linux-s390x": "npm:0.21.5" + "@esbuild/linux-x64": "npm:0.21.5" + "@esbuild/netbsd-x64": "npm:0.21.5" + "@esbuild/openbsd-x64": "npm:0.21.5" + "@esbuild/sunos-x64": "npm:0.21.5" + "@esbuild/win32-arm64": "npm:0.21.5" + "@esbuild/win32-ia32": "npm:0.21.5" + "@esbuild/win32-x64": "npm:0.21.5" + dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 10c0/fa08508adf683c3f399e8a014a6382a6b65542213431e26206c0720e536b31c09b50798747c2a105a4bbba1d9767b8d3615a74c2f7bf1ddf6d836cd11eb672de + languageName: node + linkType: hard + "escalade@npm:^3.1.1": version: 3.1.2 resolution: "escalade@npm:3.1.2" @@ -439,6 +1130,15 @@ __metadata: languageName: node linkType: hard +"estree-walker@npm:^3.0.3": + version: 3.0.3 + resolution: "estree-walker@npm:3.0.3" + dependencies: + "@types/estree": "npm:^1.0.0" + checksum: 10c0/c12e3c2b2642d2bcae7d5aa495c60fa2f299160946535763969a1c83fc74518ffa9c2cd3a8b69ac56aea547df6a8aac25f729a342992ef0bbac5f1c73e78995d + languageName: node + linkType: hard + "eta@npm:^2.2.0": version: 2.2.0 resolution: "eta@npm:2.2.0" @@ -446,6 +1146,30 @@ __metadata: languageName: node linkType: hard +"execa@npm:^8.0.1": + version: 8.0.1 + resolution: "execa@npm:8.0.1" + dependencies: + cross-spawn: "npm:^7.0.3" + get-stream: "npm:^8.0.1" + human-signals: "npm:^5.0.0" + is-stream: "npm:^3.0.0" + merge-stream: "npm:^2.0.0" + npm-run-path: "npm:^5.1.0" + onetime: "npm:^6.0.0" + signal-exit: "npm:^4.1.0" + strip-final-newline: "npm:^3.0.0" + checksum: 10c0/2c52d8775f5bf103ce8eec9c7ab3059909ba350a5164744e9947ed14a53f51687c040a250bda833f906d1283aa8803975b84e6c8f7a7c42f99dc8ef80250d1af + languageName: node + linkType: hard + +"exponential-backoff@npm:^3.1.1": + version: 3.1.1 + resolution: "exponential-backoff@npm:3.1.1" + checksum: 10c0/160456d2d647e6019640bd07111634d8c353038d9fa40176afb7cd49b0548bdae83b56d05e907c2cce2300b81cae35d800ef92fefb9d0208e190fa3b7d6bb579 + languageName: node + linkType: hard + "fast-safe-stringify@npm:^2.0.7": version: 2.1.1 resolution: "fast-safe-stringify@npm:2.1.1" @@ -463,6 +1187,16 @@ __metadata: languageName: node linkType: hard +"foreground-child@npm:^3.1.0": + version: 3.2.1 + resolution: "foreground-child@npm:3.2.1" + dependencies: + cross-spawn: "npm:^7.0.0" + signal-exit: "npm:^4.0.1" + checksum: 10c0/9a53a33dbd87090e9576bef65fb4a71de60f6863a8062a7b11bc1cbe3cc86d428677d7c0b9ef61cdac11007ac580006f78bd5638618d564cfd5e6fd713d6878f + languageName: node + linkType: hard + "form-data@npm:^4.0.0": version: 4.0.0 resolution: "form-data@npm:4.0.0" @@ -474,6 +1208,24 @@ __metadata: languageName: node linkType: hard +"fs-minipass@npm:^2.0.0": + version: 2.1.0 + resolution: "fs-minipass@npm:2.1.0" + dependencies: + minipass: "npm:^3.0.0" + checksum: 10c0/703d16522b8282d7299337539c3ed6edddd1afe82435e4f5b76e34a79cd74e488a8a0e26a636afc2440e1a23b03878e2122e3a2cfe375a5cf63c37d92b86a004 + languageName: node + linkType: hard + +"fs-minipass@npm:^3.0.0": + version: 3.0.3 + resolution: "fs-minipass@npm:3.0.3" + dependencies: + minipass: "npm:^7.0.3" + checksum: 10c0/63e80da2ff9b621e2cb1596abcb9207f1cf82b968b116ccd7b959e3323144cce7fb141462200971c38bbf2ecca51695069db45265705bed09a7cd93ae5b89f94 + languageName: node + linkType: hard + "fs.realpath@npm:^1.0.0": version: 1.0.0 resolution: "fs.realpath@npm:1.0.0" @@ -481,6 +1233,25 @@ __metadata: languageName: node linkType: hard +"fsevents@npm:~2.3.2, fsevents@npm:~2.3.3": + version: 2.3.3 + resolution: "fsevents@npm:2.3.3" + dependencies: + node-gyp: "npm:latest" + checksum: 10c0/a1f0c44595123ed717febbc478aa952e47adfc28e2092be66b8ab1635147254ca6cfe1df792a8997f22716d4cbafc73309899ff7bfac2ac3ad8cf2e4ecc3ec60 + conditions: os=darwin + languageName: node + linkType: hard + +"fsevents@patch:fsevents@npm%3A~2.3.2#optional!builtin, fsevents@patch:fsevents@npm%3A~2.3.3#optional!builtin": + version: 2.3.3 + resolution: "fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin::version=2.3.3&hash=df0bf1" + dependencies: + node-gyp: "npm:latest" + conditions: os=darwin + languageName: node + linkType: hard + "function-bind@npm:^1.1.2": version: 1.1.2 resolution: "function-bind@npm:1.1.2" @@ -495,6 +1266,20 @@ __metadata: languageName: node linkType: hard +"get-func-name@npm:^2.0.1, get-func-name@npm:^2.0.2": + version: 2.0.2 + resolution: "get-func-name@npm:2.0.2" + checksum: 10c0/89830fd07623fa73429a711b9daecdb304386d237c71268007f788f113505ef1d4cc2d0b9680e072c5082490aec9df5d7758bf5ac6f1c37062855e8e3dc0b9df + languageName: node + linkType: hard + +"get-stream@npm:^8.0.1": + version: 8.0.1 + resolution: "get-stream@npm:8.0.1" + checksum: 10c0/5c2181e98202b9dae0bb4a849979291043e5892eb40312b47f0c22b9414fc9b28a3b6063d2375705eb24abc41ecf97894d9a51f64ff021511b504477b27b4290 + languageName: node + linkType: hard + "git-diff@npm:2.0.6": version: 2.0.6 resolution: "git-diff@npm:2.0.6" @@ -508,6 +1293,21 @@ __metadata: languageName: node linkType: hard +"glob@npm:^10.2.2, glob@npm:^10.3.10": + version: 10.4.1 + resolution: "glob@npm:10.4.1" + dependencies: + foreground-child: "npm:^3.1.0" + jackspeak: "npm:^3.1.2" + minimatch: "npm:^9.0.4" + minipass: "npm:^7.1.2" + path-scurry: "npm:^1.11.1" + bin: + glob: dist/esm/bin.mjs + checksum: 10c0/77f2900ed98b9cc2a0e1901ee5e476d664dae3cd0f1b662b8bfd4ccf00d0edc31a11595807706a274ca10e1e251411bbf2e8e976c82bed0d879a9b89343ed379 + languageName: node + linkType: hard + "glob@npm:^7.0.0": version: 7.2.3 resolution: "glob@npm:7.2.3" @@ -522,6 +1322,13 @@ __metadata: languageName: node linkType: hard +"graceful-fs@npm:^4.2.6": + version: 4.2.11 + resolution: "graceful-fs@npm:4.2.11" + checksum: 10c0/386d011a553e02bc594ac2ca0bd6d9e4c22d7fa8cfbfc448a6d148c59ea881b092db9dbe3547ae4b88e55f1b01f7c4a2ecc53b310c042793e63aa44cf6c257f2 + languageName: node + linkType: hard + "has-flag@npm:^3.0.0": version: 3.0.0 resolution: "has-flag@npm:3.0.0" @@ -538,6 +1345,23 @@ __metadata: languageName: node linkType: hard +"http-cache-semantics@npm:^4.1.1": + version: 4.1.1 + resolution: "http-cache-semantics@npm:4.1.1" + checksum: 10c0/ce1319b8a382eb3cbb4a37c19f6bfe14e5bb5be3d09079e885e8c513ab2d3cd9214902f8a31c9dc4e37022633ceabfc2d697405deeaf1b8f3552bb4ed996fdfc + languageName: node + linkType: hard + +"http-proxy-agent@npm:^7.0.0": + version: 7.0.2 + resolution: "http-proxy-agent@npm:7.0.2" + dependencies: + agent-base: "npm:^7.1.0" + debug: "npm:^4.3.4" + checksum: 10c0/4207b06a4580fb85dd6dff521f0abf6db517489e70863dca1a0291daa7f2d3d2d6015a57bd702af068ea5cf9f1f6ff72314f5f5b4228d299c0904135d2aef921 + languageName: node + linkType: hard + "http2-client@npm:^1.2.5": version: 1.3.5 resolution: "http2-client@npm:1.3.5" @@ -545,6 +1369,32 @@ __metadata: languageName: node linkType: hard +"https-proxy-agent@npm:^7.0.1": + version: 7.0.4 + resolution: "https-proxy-agent@npm:7.0.4" + dependencies: + agent-base: "npm:^7.0.2" + debug: "npm:4" + checksum: 10c0/bc4f7c38da32a5fc622450b6cb49a24ff596f9bd48dcedb52d2da3fa1c1a80e100fb506bd59b326c012f21c863c69b275c23de1a01d0b84db396822fdf25e52b + languageName: node + linkType: hard + +"human-signals@npm:^5.0.0": + version: 5.0.0 + resolution: "human-signals@npm:5.0.0" + checksum: 10c0/5a9359073fe17a8b58e5a085e9a39a950366d9f00217c4ff5878bd312e09d80f460536ea6a3f260b5943a01fe55c158d1cea3fc7bee3d0520aeef04f6d915c82 + languageName: node + linkType: hard + +"iconv-lite@npm:^0.6.2": + version: 0.6.3 + resolution: "iconv-lite@npm:0.6.3" + dependencies: + safer-buffer: "npm:>= 2.1.2 < 3.0.0" + checksum: 10c0/98102bc66b33fcf5ac044099d1257ba0b7ad5e3ccd3221f34dd508ab4070edff183276221684e1e0555b145fce0850c9f7d2b60a9fcac50fbb4ea0d6e845a3b1 + languageName: node + linkType: hard + "import-fresh@npm:^3.3.0": version: 3.3.0 resolution: "import-fresh@npm:3.3.0" @@ -555,6 +1405,20 @@ __metadata: languageName: node linkType: hard +"imurmurhash@npm:^0.1.4": + version: 0.1.4 + resolution: "imurmurhash@npm:0.1.4" + checksum: 10c0/8b51313850dd33605c6c9d3fd9638b714f4c4c40250cff658209f30d40da60f78992fb2df5dabee4acf589a6a82bbc79ad5486550754bd9ec4e3fc0d4a57d6a6 + languageName: node + linkType: hard + +"indent-string@npm:^4.0.0": + version: 4.0.0 + resolution: "indent-string@npm:4.0.0" + checksum: 10c0/1e1904ddb0cb3d6cce7cd09e27a90184908b7a5d5c21b92e232c93579d314f0b83c246ffb035493d0504b1e9147ba2c9b21df0030f48673fba0496ecd698161f + languageName: node + linkType: hard + "inflight@npm:^1.0.4": version: 1.0.6 resolution: "inflight@npm:1.0.6" @@ -579,6 +1443,16 @@ __metadata: languageName: node linkType: hard +"ip-address@npm:^9.0.5": + version: 9.0.5 + resolution: "ip-address@npm:9.0.5" + dependencies: + jsbn: "npm:1.1.0" + sprintf-js: "npm:^1.1.3" + checksum: 10c0/331cd07fafcb3b24100613e4b53e1a2b4feab11e671e655d46dc09ee233da5011284d09ca40c4ecbdfe1d0004f462958675c224a804259f2f78d2465a87824bc + languageName: node + linkType: hard + "is-arrayish@npm:^0.2.1": version: 0.2.1 resolution: "is-arrayish@npm:0.2.1" @@ -602,6 +1476,20 @@ __metadata: languageName: node linkType: hard +"is-lambda@npm:^1.0.1": + version: 1.0.1 + resolution: "is-lambda@npm:1.0.1" + checksum: 10c0/85fee098ae62ba6f1e24cf22678805473c7afd0fb3978a3aa260e354cb7bcb3a5806cf0a98403188465efedec41ab4348e8e4e79305d409601323855b3839d4d + languageName: node + linkType: hard + +"is-stream@npm:^3.0.0": + version: 3.0.0 + resolution: "is-stream@npm:3.0.0" + checksum: 10c0/eb2f7127af02ee9aa2a0237b730e47ac2de0d4e76a4a905a50a11557f2339df5765eaea4ceb8029f1efa978586abe776908720bfcb1900c20c6ec5145f6f29d8 + languageName: node + linkType: hard + "isexe@npm:^2.0.0": version: 2.0.0 resolution: "isexe@npm:2.0.0" @@ -609,6 +1497,26 @@ __metadata: languageName: node linkType: hard +"isexe@npm:^3.1.1": + version: 3.1.1 + resolution: "isexe@npm:3.1.1" + checksum: 10c0/9ec257654093443eb0a528a9c8cbba9c0ca7616ccb40abd6dde7202734d96bb86e4ac0d764f0f8cd965856aacbff2f4ce23e730dc19dfb41e3b0d865ca6fdcc7 + languageName: node + linkType: hard + +"jackspeak@npm:^3.1.2": + version: 3.4.0 + resolution: "jackspeak@npm:3.4.0" + dependencies: + "@isaacs/cliui": "npm:^8.0.2" + "@pkgjs/parseargs": "npm:^0.11.0" + dependenciesMeta: + "@pkgjs/parseargs": + optional: true + checksum: 10c0/7e42d1ea411b4d57d43ea8a6afbca9224382804359cb72626d0fc45bb8db1de5ad0248283c3db45fe73e77210750d4fcc7c2b4fe5d24fda94aaa24d658295c5f + languageName: node + linkType: hard + "js-tokens@npm:^4.0.0": version: 4.0.0 resolution: "js-tokens@npm:4.0.0" @@ -616,6 +1524,13 @@ __metadata: languageName: node linkType: hard +"js-tokens@npm:^9.0.0": + version: 9.0.0 + resolution: "js-tokens@npm:9.0.0" + checksum: 10c0/4ad1c12f47b8c8b2a3a99e29ef338c1385c7b7442198a425f3463f3537384dab6032012791bfc2f056ea5ecdb06b1ed4f70e11a3ab3f388d3dcebfe16a52b27d + languageName: node + linkType: hard + "js-yaml@npm:^4.1.0": version: 4.1.0 resolution: "js-yaml@npm:4.1.0" @@ -627,6 +1542,13 @@ __metadata: languageName: node linkType: hard +"jsbn@npm:1.1.0": + version: 1.1.0 + resolution: "jsbn@npm:1.1.0" + checksum: 10c0/4f907fb78d7b712e11dea8c165fe0921f81a657d3443dde75359ed52eb2b5d33ce6773d97985a089f09a65edd80b11cb75c767b57ba47391fee4c969f7215c96 + languageName: node + linkType: hard + "json-parse-even-better-errors@npm:^2.3.0": version: 2.3.1 resolution: "json-parse-even-better-errors@npm:2.3.1" @@ -641,6 +1563,16 @@ __metadata: languageName: node linkType: hard +"local-pkg@npm:^0.5.0": + version: 0.5.0 + resolution: "local-pkg@npm:0.5.0" + dependencies: + mlly: "npm:^1.4.2" + pkg-types: "npm:^1.0.3" + checksum: 10c0/f61cbd00d7689f275558b1a45c7ff2a3ddf8472654123ed880215677b9adfa729f1081e50c27ffb415cdb9fa706fb755fec5e23cdd965be375c8059e87ff1cc9 + languageName: node + linkType: hard + "lodash@npm:^4.17.21": version: 4.17.21 resolution: "lodash@npm:4.17.21" @@ -655,6 +1587,58 @@ __metadata: languageName: node linkType: hard +"loupe@npm:^2.3.6, loupe@npm:^2.3.7": + version: 2.3.7 + resolution: "loupe@npm:2.3.7" + dependencies: + get-func-name: "npm:^2.0.1" + checksum: 10c0/71a781c8fc21527b99ed1062043f1f2bb30bdaf54fa4cf92463427e1718bc6567af2988300bc243c1f276e4f0876f29e3cbf7b58106fdc186915687456ce5bf4 + languageName: node + linkType: hard + +"lru-cache@npm:^10.0.1, lru-cache@npm:^10.2.0": + version: 10.2.2 + resolution: "lru-cache@npm:10.2.2" + checksum: 10c0/402d31094335851220d0b00985084288136136992979d0e015f0f1697e15d1c86052d7d53ae86b614e5b058425606efffc6969a31a091085d7a2b80a8a1e26d6 + languageName: node + linkType: hard + +"magic-string@npm:^0.30.5": + version: 0.30.10 + resolution: "magic-string@npm:0.30.10" + dependencies: + "@jridgewell/sourcemap-codec": "npm:^1.4.15" + checksum: 10c0/aa9ca17eae571a19bce92c8221193b6f93ee8511abb10f085e55ffd398db8e4c089a208d9eac559deee96a08b7b24d636ea4ab92f09c6cf42a7d1af51f7fd62b + languageName: node + linkType: hard + +"make-fetch-happen@npm:^13.0.0": + version: 13.0.1 + resolution: "make-fetch-happen@npm:13.0.1" + dependencies: + "@npmcli/agent": "npm:^2.0.0" + cacache: "npm:^18.0.0" + http-cache-semantics: "npm:^4.1.1" + is-lambda: "npm:^1.0.1" + minipass: "npm:^7.0.2" + minipass-fetch: "npm:^3.0.0" + minipass-flush: "npm:^1.0.5" + minipass-pipeline: "npm:^1.2.4" + negotiator: "npm:^0.6.3" + proc-log: "npm:^4.2.0" + promise-retry: "npm:^2.0.1" + ssri: "npm:^10.0.0" + checksum: 10c0/df5f4dbb6d98153b751bccf4dc4cc500de85a96a9331db9805596c46aa9f99d9555983954e6c1266d9f981ae37a9e4647f42b9a4bb5466f867f4012e582c9e7e + languageName: node + linkType: hard + +"merge-stream@npm:^2.0.0": + version: 2.0.0 + resolution: "merge-stream@npm:2.0.0" + checksum: 10c0/867fdbb30a6d58b011449b8885601ec1690c3e41c759ecd5a9d609094f7aed0096c37823ff4a7190ef0b8f22cc86beb7049196ff68c016e3b3c671d0dac91ce5 + languageName: node + linkType: hard + "mime-db@npm:1.52.0": version: 1.52.0 resolution: "mime-db@npm:1.52.0" @@ -671,19 +1655,147 @@ __metadata: languageName: node linkType: hard +"mimic-fn@npm:^4.0.0": + version: 4.0.0 + resolution: "mimic-fn@npm:4.0.0" + checksum: 10c0/de9cc32be9996fd941e512248338e43407f63f6d497abe8441fa33447d922e927de54d4cc3c1a3c6d652857acd770389d5a3823f311a744132760ce2be15ccbf + languageName: node + linkType: hard + "minimatch@npm:^3.1.1": version: 3.1.2 resolution: "minimatch@npm:3.1.2" dependencies: - brace-expansion: "npm:^1.1.7" - checksum: 10c0/0262810a8fc2e72cca45d6fd86bd349eee435eb95ac6aa45c9ea2180e7ee875ef44c32b55b5973ceabe95ea12682f6e3725cbb63d7a2d1da3ae1163c8b210311 + brace-expansion: "npm:^1.1.7" + checksum: 10c0/0262810a8fc2e72cca45d6fd86bd349eee435eb95ac6aa45c9ea2180e7ee875ef44c32b55b5973ceabe95ea12682f6e3725cbb63d7a2d1da3ae1163c8b210311 + languageName: node + linkType: hard + +"minimatch@npm:^9.0.4": + version: 9.0.4 + resolution: "minimatch@npm:9.0.4" + dependencies: + brace-expansion: "npm:^2.0.1" + checksum: 10c0/2c16f21f50e64922864e560ff97c587d15fd491f65d92a677a344e970fe62aafdbeafe648965fa96d33c061b4d0eabfe0213466203dd793367e7f28658cf6414 + languageName: node + linkType: hard + +"minimist@npm:^1.2.3": + version: 1.2.8 + resolution: "minimist@npm:1.2.8" + checksum: 10c0/19d3fcdca050087b84c2029841a093691a91259a47def2f18222f41e7645a0b7c44ef4b40e88a1e58a40c84d2ef0ee6047c55594d298146d0eb3f6b737c20ce6 + languageName: node + linkType: hard + +"minipass-collect@npm:^2.0.1": + version: 2.0.1 + resolution: "minipass-collect@npm:2.0.1" + dependencies: + minipass: "npm:^7.0.3" + checksum: 10c0/5167e73f62bb74cc5019594709c77e6a742051a647fe9499abf03c71dca75515b7959d67a764bdc4f8b361cf897fbf25e2d9869ee039203ed45240f48b9aa06e + languageName: node + linkType: hard + +"minipass-fetch@npm:^3.0.0": + version: 3.0.5 + resolution: "minipass-fetch@npm:3.0.5" + dependencies: + encoding: "npm:^0.1.13" + minipass: "npm:^7.0.3" + minipass-sized: "npm:^1.0.3" + minizlib: "npm:^2.1.2" + dependenciesMeta: + encoding: + optional: true + checksum: 10c0/9d702d57f556274286fdd97e406fc38a2f5c8d15e158b498d7393b1105974b21249289ec571fa2b51e038a4872bfc82710111cf75fae98c662f3d6f95e72152b + languageName: node + linkType: hard + +"minipass-flush@npm:^1.0.5": + version: 1.0.5 + resolution: "minipass-flush@npm:1.0.5" + dependencies: + minipass: "npm:^3.0.0" + checksum: 10c0/2a51b63feb799d2bb34669205eee7c0eaf9dce01883261a5b77410c9408aa447e478efd191b4de6fc1101e796ff5892f8443ef20d9544385819093dbb32d36bd + languageName: node + linkType: hard + +"minipass-pipeline@npm:^1.2.4": + version: 1.2.4 + resolution: "minipass-pipeline@npm:1.2.4" + dependencies: + minipass: "npm:^3.0.0" + checksum: 10c0/cbda57cea20b140b797505dc2cac71581a70b3247b84480c1fed5ca5ba46c25ecc25f68bfc9e6dcb1a6e9017dab5c7ada5eab73ad4f0a49d84e35093e0c643f2 + languageName: node + linkType: hard + +"minipass-sized@npm:^1.0.3": + version: 1.0.3 + resolution: "minipass-sized@npm:1.0.3" + dependencies: + minipass: "npm:^3.0.0" + checksum: 10c0/298f124753efdc745cfe0f2bdfdd81ba25b9f4e753ca4a2066eb17c821f25d48acea607dfc997633ee5bf7b6dfffb4eee4f2051eb168663f0b99fad2fa4829cb + languageName: node + linkType: hard + +"minipass@npm:^3.0.0": + version: 3.3.6 + resolution: "minipass@npm:3.3.6" + dependencies: + yallist: "npm:^4.0.0" + checksum: 10c0/a114746943afa1dbbca8249e706d1d38b85ed1298b530f5808ce51f8e9e941962e2a5ad2e00eae7dd21d8a4aae6586a66d4216d1a259385e9d0358f0c1eba16c + languageName: node + linkType: hard + +"minipass@npm:^5.0.0": + version: 5.0.0 + resolution: "minipass@npm:5.0.0" + checksum: 10c0/a91d8043f691796a8ac88df039da19933ef0f633e3d7f0d35dcd5373af49131cf2399bfc355f41515dc495e3990369c3858cd319e5c2722b4753c90bf3152462 + languageName: node + linkType: hard + +"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.1.2": + version: 7.1.2 + resolution: "minipass@npm:7.1.2" + checksum: 10c0/b0fd20bb9fb56e5fa9a8bfac539e8915ae07430a619e4b86ff71f5fc757ef3924b23b2c4230393af1eda647ed3d75739e4e0acb250a6b1eb277cf7f8fe449557 + languageName: node + linkType: hard + +"minizlib@npm:^2.1.1, minizlib@npm:^2.1.2": + version: 2.1.2 + resolution: "minizlib@npm:2.1.2" + dependencies: + minipass: "npm:^3.0.0" + yallist: "npm:^4.0.0" + checksum: 10c0/64fae024e1a7d0346a1102bb670085b17b7f95bf6cfdf5b128772ec8faf9ea211464ea4add406a3a6384a7d87a0cd1a96263692134323477b4fb43659a6cab78 + languageName: node + linkType: hard + +"mkdirp@npm:^1.0.3": + version: 1.0.4 + resolution: "mkdirp@npm:1.0.4" + bin: + mkdirp: bin/cmd.js + checksum: 10c0/46ea0f3ffa8bc6a5bc0c7081ffc3907777f0ed6516888d40a518c5111f8366d97d2678911ad1a6882bf592fa9de6c784fea32e1687bb94e1f4944170af48a5cf + languageName: node + linkType: hard + +"mlly@npm:^1.4.2, mlly@npm:^1.7.0": + version: 1.7.1 + resolution: "mlly@npm:1.7.1" + dependencies: + acorn: "npm:^8.11.3" + pathe: "npm:^1.1.2" + pkg-types: "npm:^1.1.1" + ufo: "npm:^1.5.3" + checksum: 10c0/d836a7b0adff4d118af41fb93ad4d9e57f80e694a681185280ba220a4607603c19e86c80f9a6c57512b04280567f2599e3386081705c5b5fd74c9ddfd571d0fa languageName: node linkType: hard -"minimist@npm:^1.2.3": - version: 1.2.8 - resolution: "minimist@npm:1.2.8" - checksum: 10c0/19d3fcdca050087b84c2029841a093691a91259a47def2f18222f41e7645a0b7c44ef4b40e88a1e58a40c84d2ef0ee6047c55594d298146d0eb3f6b737c20ce6 +"ms@npm:2.1.2": + version: 2.1.2 + resolution: "ms@npm:2.1.2" + checksum: 10c0/a437714e2f90dbf881b5191d35a6db792efbca5badf112f87b9e1c712aace4b4b9b742dd6537f3edf90fd6f684de897cec230abde57e87883766712ddda297cc languageName: node linkType: hard @@ -696,6 +1808,13 @@ __metadata: languageName: node linkType: hard +"negotiator@npm:^0.6.3": + version: 0.6.3 + resolution: "negotiator@npm:0.6.3" + checksum: 10c0/3ec9fd413e7bf071c937ae60d572bc67155262068ed522cf4b3be5edbe6ddf67d095ec03a3a14ebf8fc8e95f8e1d61be4869db0dbb0de696f6b837358bd43fc2 + languageName: node + linkType: hard + "node-emoji@npm:^2.1.3": version: 2.1.3 resolution: "node-emoji@npm:2.1.3" @@ -731,6 +1850,26 @@ __metadata: languageName: node linkType: hard +"node-gyp@npm:latest": + version: 10.1.0 + resolution: "node-gyp@npm:10.1.0" + dependencies: + env-paths: "npm:^2.2.0" + exponential-backoff: "npm:^3.1.1" + glob: "npm:^10.3.10" + graceful-fs: "npm:^4.2.6" + make-fetch-happen: "npm:^13.0.0" + nopt: "npm:^7.0.0" + proc-log: "npm:^3.0.0" + semver: "npm:^7.3.5" + tar: "npm:^6.1.2" + which: "npm:^4.0.0" + bin: + node-gyp: bin/node-gyp.js + checksum: 10c0/9cc821111ca244a01fb7f054db7523ab0a0cd837f665267eb962eb87695d71fb1e681f9e21464cc2fd7c05530dc4c81b810bca1a88f7d7186909b74477491a3c + languageName: node + linkType: hard + "node-readfiles@npm:^0.2.0": version: 0.2.0 resolution: "node-readfiles@npm:0.2.0" @@ -740,6 +1879,26 @@ __metadata: languageName: node linkType: hard +"nopt@npm:^7.0.0": + version: 7.2.1 + resolution: "nopt@npm:7.2.1" + dependencies: + abbrev: "npm:^2.0.0" + bin: + nopt: bin/nopt.js + checksum: 10c0/a069c7c736767121242037a22a788863accfa932ab285a1eb569eb8cd534b09d17206f68c37f096ae785647435e0c5a5a0a67b42ec743e481a455e5ae6a6df81 + languageName: node + linkType: hard + +"npm-run-path@npm:^5.1.0": + version: 5.3.0 + resolution: "npm-run-path@npm:5.3.0" + dependencies: + path-key: "npm:^4.0.0" + checksum: 10c0/124df74820c40c2eb9a8612a254ea1d557ddfab1581c3e751f825e3e366d9f00b0d76a3c94ecd8398e7f3eee193018622677e95816e8491f0797b21e30b2deba + languageName: node + linkType: hard + "oas-kit-common@npm:^1.0.8": version: 1.0.8 resolution: "oas-kit-common@npm:1.0.8" @@ -807,6 +1966,33 @@ __metadata: languageName: node linkType: hard +"onetime@npm:^6.0.0": + version: 6.0.0 + resolution: "onetime@npm:6.0.0" + dependencies: + mimic-fn: "npm:^4.0.0" + checksum: 10c0/4eef7c6abfef697dd4479345a4100c382d73c149d2d56170a54a07418c50816937ad09500e1ed1e79d235989d073a9bade8557122aee24f0576ecde0f392bb6c + languageName: node + linkType: hard + +"p-limit@npm:^5.0.0": + version: 5.0.0 + resolution: "p-limit@npm:5.0.0" + dependencies: + yocto-queue: "npm:^1.0.0" + checksum: 10c0/574e93b8895a26e8485eb1df7c4b58a1a6e8d8ae41b1750cc2cc440922b3d306044fc6e9a7f74578a883d46802d9db72b30f2e612690fcef838c173261b1ed83 + languageName: node + linkType: hard + +"p-map@npm:^4.0.0": + version: 4.0.0 + resolution: "p-map@npm:4.0.0" + dependencies: + aggregate-error: "npm:^3.0.0" + checksum: 10c0/592c05bd6262c466ce269ff172bb8de7c6975afca9b50c975135b974e9bdaafbfe80e61aaaf5be6d1200ba08b30ead04b88cfa7e25ff1e3b93ab28c9f62a2c75 + languageName: node + linkType: hard + "parent-module@npm:^1.0.0": version: 1.0.1 resolution: "parent-module@npm:1.0.1" @@ -842,6 +2028,13 @@ __metadata: languageName: node linkType: hard +"path-key@npm:^4.0.0": + version: 4.0.0 + resolution: "path-key@npm:4.0.0" + checksum: 10c0/794efeef32863a65ac312f3c0b0a99f921f3e827ff63afa5cb09a377e202c262b671f7b3832a4e64731003fa94af0263713962d317b9887bd1e0c48a342efba3 + languageName: node + linkType: hard + "path-parse@npm:^1.0.7": version: 1.0.7 resolution: "path-parse@npm:1.0.7" @@ -849,6 +2042,30 @@ __metadata: languageName: node linkType: hard +"path-scurry@npm:^1.11.1": + version: 1.11.1 + resolution: "path-scurry@npm:1.11.1" + dependencies: + lru-cache: "npm:^10.2.0" + minipass: "npm:^5.0.0 || ^6.0.2 || ^7.0.0" + checksum: 10c0/32a13711a2a505616ae1cc1b5076801e453e7aae6ac40ab55b388bb91b9d0547a52f5aaceff710ea400205f18691120d4431e520afbe4266b836fadede15872d + languageName: node + linkType: hard + +"pathe@npm:^1.1.1, pathe@npm:^1.1.2": + version: 1.1.2 + resolution: "pathe@npm:1.1.2" + checksum: 10c0/64ee0a4e587fb0f208d9777a6c56e4f9050039268faaaaecd50e959ef01bf847b7872785c36483fa5cdcdbdfdb31fef2ff222684d4fc21c330ab60395c681897 + languageName: node + linkType: hard + +"pathval@npm:^1.1.1": + version: 1.1.1 + resolution: "pathval@npm:1.1.1" + checksum: 10c0/f63e1bc1b33593cdf094ed6ff5c49c1c0dc5dc20a646ca9725cc7fe7cd9995002d51d5685b9b2ec6814342935748b711bafa840f84c0bb04e38ff40a335c94dc + languageName: node + linkType: hard + "picocolors@npm:^1.0.0": version: 1.0.1 resolution: "picocolors@npm:1.0.1" @@ -856,6 +2073,28 @@ __metadata: languageName: node linkType: hard +"pkg-types@npm:^1.0.3, pkg-types@npm:^1.1.1": + version: 1.1.1 + resolution: "pkg-types@npm:1.1.1" + dependencies: + confbox: "npm:^0.1.7" + mlly: "npm:^1.7.0" + pathe: "npm:^1.1.2" + checksum: 10c0/c7d167935de7207479e5829086040d70bea289f31fc1331f17c83e996a4440115c9deba2aa96de839ea66e1676d083c9ca44b33886f87bffa6b49740b67b6fcb + languageName: node + linkType: hard + +"postcss@npm:^8.4.38": + version: 8.4.38 + resolution: "postcss@npm:8.4.38" + dependencies: + nanoid: "npm:^3.3.7" + picocolors: "npm:^1.0.0" + source-map-js: "npm:^1.2.0" + checksum: 10c0/955407b8f70cf0c14acf35dab3615899a2a60a26718a63c848cf3c29f2467b0533991b985a2b994430d890bd7ec2b1963e36352b0774a19143b5f591540f7c06 + languageName: node + linkType: hard + "prettier@npm:3.3.2": version: 3.3.2 resolution: "prettier@npm:3.3.2" @@ -865,6 +2104,41 @@ __metadata: languageName: node linkType: hard +"pretty-format@npm:^29.7.0": + version: 29.7.0 + resolution: "pretty-format@npm:29.7.0" + dependencies: + "@jest/schemas": "npm:^29.6.3" + ansi-styles: "npm:^5.0.0" + react-is: "npm:^18.0.0" + checksum: 10c0/edc5ff89f51916f036c62ed433506b55446ff739358de77207e63e88a28ca2894caac6e73dcb68166a606e51c8087d32d400473e6a9fdd2dbe743f46c9c0276f + languageName: node + linkType: hard + +"proc-log@npm:^3.0.0": + version: 3.0.0 + resolution: "proc-log@npm:3.0.0" + checksum: 10c0/f66430e4ff947dbb996058f6fd22de2c66612ae1a89b097744e17fb18a4e8e7a86db99eda52ccf15e53f00b63f4ec0b0911581ff2aac0355b625c8eac509b0dc + languageName: node + linkType: hard + +"proc-log@npm:^4.2.0": + version: 4.2.0 + resolution: "proc-log@npm:4.2.0" + checksum: 10c0/17db4757c2a5c44c1e545170e6c70a26f7de58feb985091fb1763f5081cab3d01b181fb2dd240c9f4a4255a1d9227d163d5771b7e69c9e49a561692db865efb9 + languageName: node + linkType: hard + +"promise-retry@npm:^2.0.1": + version: 2.0.1 + resolution: "promise-retry@npm:2.0.1" + dependencies: + err-code: "npm:^2.0.2" + retry: "npm:^0.12.0" + checksum: 10c0/9c7045a1a2928094b5b9b15336dcd2a7b1c052f674550df63cc3f36cd44028e5080448175b6f6ca32b642de81150f5e7b1a98b728f15cb069f2dd60ac2616b96 + languageName: node + linkType: hard + "proxy-from-env@npm:^1.1.0": version: 1.1.0 resolution: "proxy-from-env@npm:1.1.0" @@ -872,6 +2146,13 @@ __metadata: languageName: node linkType: hard +"react-is@npm:^18.0.0": + version: 18.3.1 + resolution: "react-is@npm:18.3.1" + checksum: 10c0/f2f1e60010c683479e74c63f96b09fb41603527cd131a9959e2aee1e5a8b0caf270b365e5ca77d4a6b18aae659b60a86150bb3979073528877029b35aecd2072 + languageName: node + linkType: hard + "rechoir@npm:^0.6.2": version: 0.6.2 resolution: "rechoir@npm:0.6.2" @@ -928,6 +2209,92 @@ __metadata: languageName: node linkType: hard +"retry@npm:^0.12.0": + version: 0.12.0 + resolution: "retry@npm:0.12.0" + checksum: 10c0/59933e8501727ba13ad73ef4a04d5280b3717fd650408460c987392efe9d7be2040778ed8ebe933c5cbd63da3dcc37919c141ef8af0a54a6e4fca5a2af177bfe + languageName: node + linkType: hard + +"rollup@npm:^4.13.0": + version: 4.18.0 + resolution: "rollup@npm:4.18.0" + dependencies: + "@rollup/rollup-android-arm-eabi": "npm:4.18.0" + "@rollup/rollup-android-arm64": "npm:4.18.0" + "@rollup/rollup-darwin-arm64": "npm:4.18.0" + "@rollup/rollup-darwin-x64": "npm:4.18.0" + "@rollup/rollup-linux-arm-gnueabihf": "npm:4.18.0" + "@rollup/rollup-linux-arm-musleabihf": "npm:4.18.0" + "@rollup/rollup-linux-arm64-gnu": "npm:4.18.0" + "@rollup/rollup-linux-arm64-musl": "npm:4.18.0" + "@rollup/rollup-linux-powerpc64le-gnu": "npm:4.18.0" + "@rollup/rollup-linux-riscv64-gnu": "npm:4.18.0" + "@rollup/rollup-linux-s390x-gnu": "npm:4.18.0" + "@rollup/rollup-linux-x64-gnu": "npm:4.18.0" + "@rollup/rollup-linux-x64-musl": "npm:4.18.0" + "@rollup/rollup-win32-arm64-msvc": "npm:4.18.0" + "@rollup/rollup-win32-ia32-msvc": "npm:4.18.0" + "@rollup/rollup-win32-x64-msvc": "npm:4.18.0" + "@types/estree": "npm:1.0.5" + fsevents: "npm:~2.3.2" + dependenciesMeta: + "@rollup/rollup-android-arm-eabi": + optional: true + "@rollup/rollup-android-arm64": + optional: true + "@rollup/rollup-darwin-arm64": + optional: true + "@rollup/rollup-darwin-x64": + optional: true + "@rollup/rollup-linux-arm-gnueabihf": + optional: true + "@rollup/rollup-linux-arm-musleabihf": + optional: true + "@rollup/rollup-linux-arm64-gnu": + optional: true + "@rollup/rollup-linux-arm64-musl": + optional: true + "@rollup/rollup-linux-powerpc64le-gnu": + optional: true + "@rollup/rollup-linux-riscv64-gnu": + optional: true + "@rollup/rollup-linux-s390x-gnu": + optional: true + "@rollup/rollup-linux-x64-gnu": + optional: true + "@rollup/rollup-linux-x64-musl": + optional: true + "@rollup/rollup-win32-arm64-msvc": + optional: true + "@rollup/rollup-win32-ia32-msvc": + optional: true + "@rollup/rollup-win32-x64-msvc": + optional: true + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: 10c0/7d0239f029c48d977e0d0b942433bed9ca187d2328b962fc815fc775d0fdf1966ffcd701fef265477e999a1fb01bddcc984fc675d1b9d9864bf8e1f1f487e23e + languageName: node + linkType: hard + +"safer-buffer@npm:>= 2.1.2 < 3.0.0": + version: 2.1.2 + resolution: "safer-buffer@npm:2.1.2" + checksum: 10c0/7e3c8b2e88a1841c9671094bbaeebd94448111dd90a81a1f606f3f67708a6ec57763b3b47f06da09fc6054193e0e6709e77325415dc8422b04497a8070fa02d4 + languageName: node + linkType: hard + +"semver@npm:^7.3.5": + version: 7.6.2 + resolution: "semver@npm:7.6.2" + bin: + semver: bin/semver.js + checksum: 10c0/97d3441e97ace8be4b1976433d1c32658f6afaff09f143e52c593bae7eef33de19e3e369c88bd985ce1042c6f441c80c6803078d1de2a9988080b66684cbb30c + languageName: node + linkType: hard + "shebang-command@npm:^2.0.0": version: 2.0.0 resolution: "shebang-command@npm:2.0.0" @@ -1032,6 +2399,20 @@ __metadata: languageName: node linkType: hard +"siginfo@npm:^2.0.0": + version: 2.0.0 + resolution: "siginfo@npm:2.0.0" + checksum: 10c0/3def8f8e516fbb34cb6ae415b07ccc5d9c018d85b4b8611e3dc6f8be6d1899f693a4382913c9ed51a06babb5201639d76453ab297d1c54a456544acf5c892e34 + languageName: node + linkType: hard + +"signal-exit@npm:^4.0.1, signal-exit@npm:^4.1.0": + version: 4.1.0 + resolution: "signal-exit@npm:4.1.0" + checksum: 10c0/41602dce540e46d599edba9d9860193398d135f7ff72cab629db5171516cfae628d21e7bfccde1bbfdf11c48726bc2a6d1a8fb8701125852fbfda7cf19c6aa83 + languageName: node + linkType: hard + "skin-tone@npm:^2.0.0": version: 2.0.0 resolution: "skin-tone@npm:2.0.0" @@ -1041,7 +2422,72 @@ __metadata: languageName: node linkType: hard -"string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": +"smart-buffer@npm:^4.2.0": + version: 4.2.0 + resolution: "smart-buffer@npm:4.2.0" + checksum: 10c0/a16775323e1404dd43fabafe7460be13a471e021637bc7889468eb45ce6a6b207261f454e4e530a19500cc962c4cc5348583520843b363f4193cee5c00e1e539 + languageName: node + linkType: hard + +"socks-proxy-agent@npm:^8.0.3": + version: 8.0.3 + resolution: "socks-proxy-agent@npm:8.0.3" + dependencies: + agent-base: "npm:^7.1.1" + debug: "npm:^4.3.4" + socks: "npm:^2.7.1" + checksum: 10c0/4950529affd8ccd6951575e21c1b7be8531b24d924aa4df3ee32df506af34b618c4e50d261f4cc603f1bfd8d426915b7d629966c8ce45b05fb5ad8c8b9a6459d + languageName: node + linkType: hard + +"socks@npm:^2.7.1": + version: 2.8.3 + resolution: "socks@npm:2.8.3" + dependencies: + ip-address: "npm:^9.0.5" + smart-buffer: "npm:^4.2.0" + checksum: 10c0/d54a52bf9325165770b674a67241143a3d8b4e4c8884560c4e0e078aace2a728dffc7f70150660f51b85797c4e1a3b82f9b7aa25e0a0ceae1a243365da5c51a7 + languageName: node + linkType: hard + +"source-map-js@npm:^1.2.0": + version: 1.2.0 + resolution: "source-map-js@npm:1.2.0" + checksum: 10c0/7e5f896ac10a3a50fe2898e5009c58ff0dc102dcb056ed27a354623a0ece8954d4b2649e1a1b2b52ef2e161d26f8859c7710350930751640e71e374fe2d321a4 + languageName: node + linkType: hard + +"sprintf-js@npm:^1.1.3": + version: 1.1.3 + resolution: "sprintf-js@npm:1.1.3" + checksum: 10c0/09270dc4f30d479e666aee820eacd9e464215cdff53848b443964202bf4051490538e5dd1b42e1a65cf7296916ca17640aebf63dae9812749c7542ee5f288dec + languageName: node + linkType: hard + +"ssri@npm:^10.0.0": + version: 10.0.6 + resolution: "ssri@npm:10.0.6" + dependencies: + minipass: "npm:^7.0.3" + checksum: 10c0/e5a1e23a4057a86a97971465418f22ea89bd439ac36ade88812dd920e4e61873e8abd6a9b72a03a67ef50faa00a2daf1ab745c5a15b46d03e0544a0296354227 + languageName: node + linkType: hard + +"stackback@npm:0.0.2": + version: 0.0.2 + resolution: "stackback@npm:0.0.2" + checksum: 10c0/89a1416668f950236dd5ac9f9a6b2588e1b9b62b1b6ad8dff1bfc5d1a15dbf0aafc9b52d2226d00c28dffff212da464eaeebfc6b7578b9d180cef3e3782c5983 + languageName: node + linkType: hard + +"std-env@npm:^3.5.0": + version: 3.7.0 + resolution: "std-env@npm:3.7.0" + checksum: 10c0/60edf2d130a4feb7002974af3d5a5f3343558d1ccf8d9b9934d225c638606884db4a20d2fe6440a09605bca282af6b042ae8070a10490c0800d69e82e478f41e + languageName: node + linkType: hard + +"string-width-cjs@npm:string-width@^4.2.0, string-width@npm:^4.1.0, string-width@npm:^4.2.0, string-width@npm:^4.2.3": version: 4.2.3 resolution: "string-width@npm:4.2.3" dependencies: @@ -1052,7 +2498,18 @@ __metadata: languageName: node linkType: hard -"strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1": +"string-width@npm:^5.0.1, string-width@npm:^5.1.2": + version: 5.1.2 + resolution: "string-width@npm:5.1.2" + dependencies: + eastasianwidth: "npm:^0.2.0" + emoji-regex: "npm:^9.2.2" + strip-ansi: "npm:^7.0.1" + checksum: 10c0/ab9c4264443d35b8b923cbdd513a089a60de339216d3b0ed3be3ba57d6880e1a192b70ae17225f764d7adbf5994e9bb8df253a944736c15a0240eff553c678ca + languageName: node + linkType: hard + +"strip-ansi-cjs@npm:strip-ansi@^6.0.1, strip-ansi@npm:^6.0.0, strip-ansi@npm:^6.0.1": version: 6.0.1 resolution: "strip-ansi@npm:6.0.1" dependencies: @@ -1061,6 +2518,31 @@ __metadata: languageName: node linkType: hard +"strip-ansi@npm:^7.0.1": + version: 7.1.0 + resolution: "strip-ansi@npm:7.1.0" + dependencies: + ansi-regex: "npm:^6.0.1" + checksum: 10c0/a198c3762e8832505328cbf9e8c8381de14a4fa50a4f9b2160138158ea88c0f5549fb50cb13c651c3088f47e63a108b34622ec18c0499b6c8c3a5ddf6b305ac4 + languageName: node + linkType: hard + +"strip-final-newline@npm:^3.0.0": + version: 3.0.0 + resolution: "strip-final-newline@npm:3.0.0" + checksum: 10c0/a771a17901427bac6293fd416db7577e2bc1c34a19d38351e9d5478c3c415f523f391003b42ed475f27e33a78233035df183525395f731d3bfb8cdcbd4da08ce + languageName: node + linkType: hard + +"strip-literal@npm:^2.0.0": + version: 2.1.0 + resolution: "strip-literal@npm:2.1.0" + dependencies: + js-tokens: "npm:^9.0.0" + checksum: 10c0/bc8b8c8346125ae3c20fcdaf12e10a498ff85baf6f69597b4ab2b5fbf2e58cfd2827f1a44f83606b852da99a5f6c8279770046ddea974c510c17c98934c9cc24 + languageName: node + linkType: hard + "supports-color@npm:^5.3.0": version: 5.5.0 resolution: "supports-color@npm:5.5.0" @@ -1106,15 +2588,16 @@ __metadata: prettier: "npm:3.3.2" shx: "npm:0.3.4" swagger-schema-official: "npm:2.0.0-bab6bed" - swagger2openapi: "npm:^7.0.8" + swagger2openapi: "npm:7.0.8" typescript: "npm:5.4.5" + vitest: "npm:1.6.0" bin: sta: ./index.js swagger-typescript-api: ./index.js languageName: unknown linkType: soft -"swagger2openapi@npm:^7.0.8": +"swagger2openapi@npm:7.0.8": version: 7.0.8 resolution: "swagger2openapi@npm:7.0.8" dependencies: @@ -1137,6 +2620,41 @@ __metadata: languageName: node linkType: hard +"tar@npm:^6.1.11, tar@npm:^6.1.2": + version: 6.2.1 + resolution: "tar@npm:6.2.1" + dependencies: + chownr: "npm:^2.0.0" + fs-minipass: "npm:^2.0.0" + minipass: "npm:^5.0.0" + minizlib: "npm:^2.1.1" + mkdirp: "npm:^1.0.3" + yallist: "npm:^4.0.0" + checksum: 10c0/a5eca3eb50bc11552d453488344e6507156b9193efd7635e98e867fab275d527af53d8866e2370cd09dfe74378a18111622ace35af6a608e5223a7d27fe99537 + languageName: node + linkType: hard + +"tinybench@npm:^2.5.1": + version: 2.8.0 + resolution: "tinybench@npm:2.8.0" + checksum: 10c0/5a9a642351fa3e4955e0cbf38f5674be5f3ba6730fd872fd23a5c953ad6c914234d5aba6ea41ef88820180a81829ceece5bd8d3967c490c5171bca1141c2f24d + languageName: node + linkType: hard + +"tinypool@npm:^0.8.3": + version: 0.8.4 + resolution: "tinypool@npm:0.8.4" + checksum: 10c0/779c790adcb0316a45359652f4b025958c1dff5a82460fe49f553c864309b12ad732c8288be52f852973bc76317f5e7b3598878aee0beb8a33322c0e72c4a66c + languageName: node + linkType: hard + +"tinyspy@npm:^2.2.0": + version: 2.2.1 + resolution: "tinyspy@npm:2.2.1" + checksum: 10c0/0b4cfd07c09871e12c592dfa7b91528124dc49a4766a0b23350638c62e6a483d5a2a667de7e6282246c0d4f09996482ddaacbd01f0c05b7ed7e0f79d32409bdc + languageName: node + linkType: hard + "tr46@npm:~0.0.3": version: 0.0.3 resolution: "tr46@npm:0.0.3" @@ -1144,6 +2662,13 @@ __metadata: languageName: node linkType: hard +"type-detect@npm:^4.0.0, type-detect@npm:^4.0.8": + version: 4.0.8 + resolution: "type-detect@npm:4.0.8" + checksum: 10c0/8fb9a51d3f365a7de84ab7f73b653534b61b622aa6800aecdb0f1095a4a646d3f5eb295322127b6573db7982afcd40ab492d038cf825a42093a58b1e1353e0bd + languageName: node + linkType: hard + "typescript@npm:5.4.5": version: 5.4.5 resolution: "typescript@npm:5.4.5" @@ -1164,6 +2689,13 @@ __metadata: languageName: node linkType: hard +"ufo@npm:^1.5.3": + version: 1.5.3 + resolution: "ufo@npm:1.5.3" + checksum: 10c0/1df10702582aa74f4deac4486ecdfd660e74be057355f1afb6adfa14243476cf3d3acff734ccc3d0b74e9bfdefe91d578f3edbbb0a5b2430fe93cd672370e024 + languageName: node + linkType: hard + "undici-types@npm:~5.26.4": version: 5.26.5 resolution: "undici-types@npm:5.26.5" @@ -1178,6 +2710,129 @@ __metadata: languageName: node linkType: hard +"unique-filename@npm:^3.0.0": + version: 3.0.0 + resolution: "unique-filename@npm:3.0.0" + dependencies: + unique-slug: "npm:^4.0.0" + checksum: 10c0/6363e40b2fa758eb5ec5e21b3c7fb83e5da8dcfbd866cc0c199d5534c42f03b9ea9ab069769cc388e1d7ab93b4eeef28ef506ab5f18d910ef29617715101884f + languageName: node + linkType: hard + +"unique-slug@npm:^4.0.0": + version: 4.0.0 + resolution: "unique-slug@npm:4.0.0" + dependencies: + imurmurhash: "npm:^0.1.4" + checksum: 10c0/cb811d9d54eb5821b81b18205750be84cb015c20a4a44280794e915f5a0a70223ce39066781a354e872df3572e8155c228f43ff0cce94c7cbf4da2cc7cbdd635 + languageName: node + linkType: hard + +"vite-node@npm:1.6.0": + version: 1.6.0 + resolution: "vite-node@npm:1.6.0" + dependencies: + cac: "npm:^6.7.14" + debug: "npm:^4.3.4" + pathe: "npm:^1.1.1" + picocolors: "npm:^1.0.0" + vite: "npm:^5.0.0" + bin: + vite-node: vite-node.mjs + checksum: 10c0/0807e6501ac7763e0efa2b4bd484ce99fb207e92c98624c9f8999d1f6727ac026e457994260fa7fdb7060d87546d197081e46a705d05b0136a38b6f03715cbc2 + languageName: node + linkType: hard + +"vite@npm:^5.0.0": + version: 5.3.1 + resolution: "vite@npm:5.3.1" + dependencies: + esbuild: "npm:^0.21.3" + fsevents: "npm:~2.3.3" + postcss: "npm:^8.4.38" + rollup: "npm:^4.13.0" + peerDependencies: + "@types/node": ^18.0.0 || >=20.0.0 + less: "*" + lightningcss: ^1.21.0 + sass: "*" + stylus: "*" + sugarss: "*" + terser: ^5.4.0 + dependenciesMeta: + fsevents: + optional: true + peerDependenciesMeta: + "@types/node": + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + bin: + vite: bin/vite.js + checksum: 10c0/9317262c02ea2dc324dfdbc20c3c450cd89cc9a16399a41a4bf820a3a1f31cf400878c015135e355ee034853cc2399b5499899d5b1bc462d57642d71083e74b6 + languageName: node + linkType: hard + +"vitest@npm:1.6.0": + version: 1.6.0 + resolution: "vitest@npm:1.6.0" + dependencies: + "@vitest/expect": "npm:1.6.0" + "@vitest/runner": "npm:1.6.0" + "@vitest/snapshot": "npm:1.6.0" + "@vitest/spy": "npm:1.6.0" + "@vitest/utils": "npm:1.6.0" + acorn-walk: "npm:^8.3.2" + chai: "npm:^4.3.10" + debug: "npm:^4.3.4" + execa: "npm:^8.0.1" + local-pkg: "npm:^0.5.0" + magic-string: "npm:^0.30.5" + pathe: "npm:^1.1.1" + picocolors: "npm:^1.0.0" + std-env: "npm:^3.5.0" + strip-literal: "npm:^2.0.0" + tinybench: "npm:^2.5.1" + tinypool: "npm:^0.8.3" + vite: "npm:^5.0.0" + vite-node: "npm:1.6.0" + why-is-node-running: "npm:^2.2.2" + peerDependencies: + "@edge-runtime/vm": "*" + "@types/node": ^18.0.0 || >=20.0.0 + "@vitest/browser": 1.6.0 + "@vitest/ui": 1.6.0 + happy-dom: "*" + jsdom: "*" + peerDependenciesMeta: + "@edge-runtime/vm": + optional: true + "@types/node": + optional: true + "@vitest/browser": + optional: true + "@vitest/ui": + optional: true + happy-dom: + optional: true + jsdom: + optional: true + bin: + vitest: vitest.mjs + checksum: 10c0/065da5b8ead51eb174d93dac0cd50042ca9539856dc25e340ea905d668c41961f7e00df3e388e6c76125b2c22091db2e8465f993d0f6944daf9598d549e562e7 + languageName: node + linkType: hard + "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" @@ -1206,7 +2861,30 @@ __metadata: languageName: node linkType: hard -"wrap-ansi@npm:^7.0.0": +"which@npm:^4.0.0": + version: 4.0.0 + resolution: "which@npm:4.0.0" + dependencies: + isexe: "npm:^3.1.1" + bin: + node-which: bin/which.js + checksum: 10c0/449fa5c44ed120ccecfe18c433296a4978a7583bf2391c50abce13f76878d2476defde04d0f79db8165bdf432853c1f8389d0485ca6e8ebce3bbcded513d5e6a + languageName: node + linkType: hard + +"why-is-node-running@npm:^2.2.2": + version: 2.2.2 + resolution: "why-is-node-running@npm:2.2.2" + dependencies: + siginfo: "npm:^2.0.0" + stackback: "npm:0.0.2" + bin: + why-is-node-running: cli.js + checksum: 10c0/805d57eb5d33f0fb4e36bae5dceda7fd8c6932c2aeb705e30003970488f1a2bc70029ee64be1a0e1531e2268b11e65606e88e5b71d667ea745e6dc48fc9014bd + languageName: node + linkType: hard + +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0, wrap-ansi@npm:^7.0.0": version: 7.0.0 resolution: "wrap-ansi@npm:7.0.0" dependencies: @@ -1217,6 +2895,17 @@ __metadata: languageName: node linkType: hard +"wrap-ansi@npm:^8.1.0": + version: 8.1.0 + resolution: "wrap-ansi@npm:8.1.0" + dependencies: + ansi-styles: "npm:^6.1.0" + string-width: "npm:^5.0.1" + strip-ansi: "npm:^7.0.1" + checksum: 10c0/138ff58a41d2f877eae87e3282c0630fc2789012fc1af4d6bd626eeb9a2f9a65ca92005e6e69a75c7b85a68479fe7443c7dbe1eb8fbaa681a4491364b7c55c60 + languageName: node + linkType: hard + "wrappy@npm:1": version: 1.0.2 resolution: "wrappy@npm:1.0.2" @@ -1231,6 +2920,13 @@ __metadata: languageName: node linkType: hard +"yallist@npm:^4.0.0": + version: 4.0.0 + resolution: "yallist@npm:4.0.0" + checksum: 10c0/2286b5e8dbfe22204ab66e2ef5cc9bbb1e55dfc873bbe0d568aa943eb255d131890dfd5bf243637273d31119b870f49c18fcde2c6ffbb7a7a092b870dc90625a + languageName: node + linkType: hard + "yaml@npm:^1.10.0": version: 1.10.2 resolution: "yaml@npm:1.10.2" @@ -1259,3 +2955,10 @@ __metadata: checksum: 10c0/ccd7e723e61ad5965fffbb791366db689572b80cca80e0f96aad968dfff4156cd7cd1ad18607afe1046d8241e6fb2d6c08bf7fa7bfb5eaec818735d8feac8f05 languageName: node linkType: hard + +"yocto-queue@npm:^1.0.0": + version: 1.0.0 + resolution: "yocto-queue@npm:1.0.0" + checksum: 10c0/856117aa15cf5103d2a2fb173f0ab4acb12b4b4d0ed3ab249fdbbf612e55d1cadfd27a6110940e24746fb0a78cf640b522cc8bca76f30a3b00b66e90cf82abe0 + languageName: node + linkType: hard