diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index f319224cf0..7f35d2cb13 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -2,17 +2,11 @@ "version": 1, "isRoot": true, "tools": { - "sourcelink": { - "version": "3.1.1", - "commands": [ - "sourcelink" - ] - }, "dotnet-format": { - "version": "3.3.111304", + "version": "5.1.250801", "commands": [ "dotnet-format" ] } } -} \ No newline at end of file +} diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..61566da6f0 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,14 @@ +# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/dotnet/.devcontainer/base.Dockerfile + +# [Choice] .NET version: 6.0, 6.0-bullseye, 6.0-focal +ARG VARIANT="6.0-bullseye" +FROM mcr.microsoft.com/vscode/devcontainers/dotnet + +# "install" the dotnet 6.0 runtime for tests +COPY --from=mcr.microsoft.com/dotnet/sdk:6.0 /usr/share/dotnet/shared /usr/share/dotnet/shared + +# # Add mkdocs for doc generation +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && apt-get -y install --no-install-recommends python3-pip +# RUN pip3 install mkdocs + +RUN apt-get install -y mono-complete diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..a52dcaa8a2 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,39 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.234.0/containers/dotnet +{ + "name": "Octokit.net", + "build": { + "dockerfile": "Dockerfile", + "args": { + // Update 'VARIANT' to pick a .NET Core version: 6.0 + // Append -bullseye or -focal to pin to an OS version. + "VARIANT": "latest" + } + }, + // Set *default* container specific settings.json values on container create. + "settings": { + "omnisharp.path": "latest", + "omnisharp.defaultLaunchSolution": "Octokit.sln", + "omnisharp.disableMSBuildDiagnosticWarning": false, + "omnisharp.useModernNet": true, + "omnisharp.enableAsyncCompletion": true, + "omnisharp.enableEditorConfigSupport": true, + "omnisharp.enableImportCompletion": true, + "omnisharp.enableRoslynAnalyzers": true, + "omnisharp.organizeImportsOnFormat": true + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-dotnettools.csharp", + "eamodio.gitlens", + "fernandoescolar.vscode-solution-explorer", + "redhat.vscode-yaml" + ], + // This is needed so that the C# extension can resolve to the correct SDK version + "remoteEnv": { + "PATH": "${containerWorkspaceFolder}/.dotnet:${containerEnv:PATH}", + "DOTNET_MULTILEVEL_LOOKUP": "0", + "TARGET": "net7.0", + "DOTNET_WATCH_SUPPRESS_LAUNCH_BROWSER": "true" + } +} diff --git a/.github/ISSUE_TEMPLATE/bug.yml b/.github/ISSUE_TEMPLATE/bug.yml new file mode 100644 index 0000000000..ccb5214668 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug.yml @@ -0,0 +1,41 @@ +name: Bug +description: File a bug report +title: "[BUG]: " +labels: ["Type: Bug", "Status: Triage"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + id: what-happened + attributes: + label: What happened? + description: What did you do? What happened? What did you expect to happen? + placeholder: Put your description of the bug here. + validations: + required: true + - type: textarea + id: versions + attributes: + label: Versions + description: What versions of the relevant software are you running? + placeholder: Octokit.js v2.0.10, Node v16.18.0 + validations: + required: true + - type: textarea + id: logs + attributes: + label: Relevant log output + description: | + Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + Please check your logs before submission to ensure sensitive information is redacted. + render: shell + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md) + options: + - label: I agree to follow this project's Code of Conduct + required: true diff --git a/.github/ISSUE_TEMPLATE/documentation.yml b/.github/ISSUE_TEMPLATE/documentation.yml new file mode 100644 index 0000000000..64c1fc0754 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation.yml @@ -0,0 +1,49 @@ +name: Documentation +description: Update or add documentation +title: "[DOCS]: " +labels: ["Type: Documentation", "Status: Triage"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill this out! + - type: textarea + id: describe-need + attributes: + label: Describe the need + description: What do you wish was different about our docs? + placeholder: Describe the need for documentation updates here. + validations: + required: true + - type: input + id: sdk_version + attributes: + label: SDK Version + description: Do these docs apply to a specific SDK version? + placeholder: Octokit.NET v4.0.1 + validations: + required: false + - type: input + id: api_version + attributes: + label: API Version + description: Do these docs apply to a specific version of the GitHub REST API or GraphQL API? + placeholder: ex. v1.1.1 + validations: + required: false + - type: textarea + id: logs + attributes: + label: Relevant log output + description: | + Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + Please check your logs before submission to ensure sensitive information is redacted. + render: shell + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md) + options: + - label: I agree to follow this project's Code of Conduct + required: true diff --git a/.github/ISSUE_TEMPLATE/feature.yml b/.github/ISSUE_TEMPLATE/feature.yml new file mode 100644 index 0000000000..453cdfda4e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature.yml @@ -0,0 +1,49 @@ +name: Feature +description: Suggest an idea for a new feature or enhancement +title: "[FEAT]: " +labels: ["Type: Feature", "Status: Triage"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill this out! + - type: textarea + id: describe-need + attributes: + label: Describe the need + description: What do you want to happen? What problem are you trying to solve? + placeholder: Describe the need for the feature. + validations: + required: true + - type: input + id: sdk_version + attributes: + label: SDK Version + description: Does this feature suggestion apply to a specific SDK version? + placeholder: Octokit.rb v6.0.0 + validations: + required: false + - type: input + id: api_version + attributes: + label: API Version + description: Does this feature suggestion apply to a specific version of the GitHub REST API or GraphQL API? + placeholder: ex. v1.1.1 + validations: + required: false + - type: textarea + id: logs + attributes: + label: Relevant log output + description: | + Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + Please check your logs before submission to ensure sensitive information is redacted. + render: shell + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md) + options: + - label: I agree to follow this project's Code of Conduct + required: true diff --git a/.github/ISSUE_TEMPLATE/maintenance.yml b/.github/ISSUE_TEMPLATE/maintenance.yml new file mode 100644 index 0000000000..0c5221e2c1 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/maintenance.yml @@ -0,0 +1,49 @@ +name: Maintenance +description: Dependencies, cleanup, refactoring, reworking of code +title: "[MAINT]: " +labels: ["Type: Maintenance", "Status: Triage"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill this out! + - type: textarea + id: describe-need + attributes: + label: Describe the need + description: What do you want to happen? + placeholder: Describe the maintenance need here. + validations: + required: true + - type: input + id: sdk_version + attributes: + label: SDK Version + description: Does this maintenance apply to a specific SDK version? + placeholder: terraform-provider-github v5.7.0 + validations: + required: false + - type: input + id: api_version + attributes: + label: API Version + description: Does this maintenance apply to a specific version of the GitHub REST API or GraphQL API? + placeholder: ex. v1.1.1 + validations: + required: false + - type: textarea + id: logs + attributes: + label: Relevant log output + description: | + Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. + Please check your logs before submission to ensure sensitive information is redacted. + render: shell + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md) + options: + - label: I agree to follow this project's Code of Conduct + required: true diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 94a8e17a79..ccd0ec66a0 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,10 +5,6 @@ updates: schedule: interval: weekly open-pull-requests-limit: 10 - ignore: - - dependency-name: Microsoft.NET.Test.Sdk - versions: - - ">= 16.3.a, < 16.4" - package-ecosystem: nuget directory: "/build" schedule: diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000000..edcdd511a7 --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,29 @@ + + +Resolves #ISSUE_NUMBER + +---- + +### Before the change? + + +* + +### After the change? + + +* + +### Pull request checklist +- [ ] Tests for the changes have been added (for bug fixes / features) +- [ ] Docs have been reviewed and added / updated if needed (for bug fixes / features) + +### Does this introduce a breaking change? + + +Please see our docs on [breaking changes](https://github.com/octokit/.github/blob/main/community/breaking_changes.md) to help! + +- [ ] Yes +- [ ] No + +---- diff --git a/.github/workflows/add_to_octokit_project.yml b/.github/workflows/add_to_octokit_project.yml new file mode 100644 index 0000000000..936e1f4f80 --- /dev/null +++ b/.github/workflows/add_to_octokit_project.yml @@ -0,0 +1,20 @@ +name: Add PRs and issues to Octokit org project + +on: + issues: + types: [reopened, opened] + pull_request_target: + types: [reopened, opened] + +jobs: + add-to-project: + name: Add issue to project + runs-on: ubuntu-latest + continue-on-error: true + steps: + - uses: actions/add-to-project@v1.0.1 + with: + project-url: https://github.com/orgs/octokit/projects/10 + github-token: ${{ secrets.OCTOKITBOT_PROJECT_ACTION_TOKEN }} + labeled: "Status: Stale" + label-operator: NOT diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000000..8bc1f9ff72 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ main ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ main ] + schedule: + - cron: '29 4 * * 4' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'csharp' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/immediate-response.yml b/.github/workflows/immediate-response.yml new file mode 100644 index 0000000000..8a29b200fc --- /dev/null +++ b/.github/workflows/immediate-response.yml @@ -0,0 +1,29 @@ +name: Issue/PR response +permissions: + issues: write + pull-requests: write +on: + issues: + types: + - opened + pull_request_target: + types: + - opened +jobs: + respond-to-issue: + if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' && github.actor != 'githubactions[bot]' && github.actor != 'octokitbot' }} + runs-on: ubuntu-latest + steps: + - name: Determine issue or PR number + id: extract + run: echo "NUMBER=${{ github.event.issue.number || github.event.pull_request.number }}" >> "$GITHUB_OUTPUT" + + - name: Respond to issue or PR + uses: peter-evans/create-or-update-comment@v4 + with: + issue-number: ${{ steps.extract.outputs.NUMBER }} + body: > + 👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! + We have a [process in place](https://github.com/octokit/.github/blob/main/community/prioritization_response.md#overview) for prioritizing and responding to your input. + Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with `Status: Up for grabs`. + You & others like you are the reason all of this works! So thank you & happy coding! 🚀 diff --git a/.github/workflows/netcore.yml b/.github/workflows/netcore.yml index d5632a9ad8..dafba365a7 100644 --- a/.github/workflows/netcore.yml +++ b/.github/workflows/netcore.yml @@ -13,16 +13,16 @@ jobs: strategy: matrix: - platform: [ubuntu-latest, macos-latest] + platform: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.platform }} steps: - uses: actions/checkout@v1 - - name: Setup .NET Core - uses: actions/setup-dotnet@v1.4.0 + - name: Setup .NET 6 + uses: actions/setup-dotnet@v1 with: - dotnet-version: 3.1.201 + dotnet-version: 6.0.* - name: Build with dotnet - run: ./build.sh --linksources=true --verbosity=verbose + run: ./build.sh --verbosity=verbose shell: bash diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c23f50bc72..78e83aa188 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,13 +12,13 @@ jobs: steps: - uses: actions/checkout@v1 - - name: Setup .NET Core - uses: actions/setup-dotnet@v1.4.0 - with: - dotnet-version: 3.1.201 + - name: Setup .NET 6 + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.* - name: Build with dotnet - run: ./build.sh --linksources=true --verbosity=verbose + run: ./build.sh --verbosity=verbose shell: bash - name: Publish to NuGet diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 0000000000..bef0f316e2 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,30 @@ + +name: 'Close stale issues and PRs' +on: + workflow_dispatch: + schedule: + - cron: '30 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v4 + with: + stale-issue-message: > + 👋 Hey Friends, this issue has been automatically marked as `stale` because it has no recent activity. + It will be closed if no further activity occurs. + Please add the `Status: Pinned` label if you feel that this issue needs to remain open/active. + Thank you for your contributions and help in keeping things tidy! + stale-pr-message: > + 👋 Hey Friends, this pull request has been automatically marked as `stale` because it has no recent activity. + It will be closed if no further activity occurs. + Please add the `Status: Pinned` label if you feel that this issue needs to remain open/active. + Thank you for your contributions and help in keeping things tidy! + days-before-stale: 270 + days-before-close: 7 + exempt-issue-labels: 'Status: Pinned' + exempt-pr-labels: 'Status: Pinned' + operations-per-run: 100 + stale-issue-label: 'Status: Stale' + stale-pr-label: 'Status: Stale' diff --git a/.vscode/launch.json b/.vscode/launch.json index dd7b108d27..b1d5033cf1 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,12 +1,22 @@ { "version": "0.2.0", "configurations": [ + { + "name": "Run Generator", + "type": "coreclr", + "request": "launch", + "program": "${workspaceFolder}/Octokit.Generators/bin/Debug/net6.0/Octokit.Generators", + "args": [], + "cwd": "${workspaceFolder}/Octokit.Generators", + "console": "internalConsole", + "stopAtEntry": false + }, { "name": "Run unit tests", "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/Octokit.Tests/bin/Debug/netcoreapp3.1/Octokit.Tests.dll", + "program": "${workspaceFolder}/Octokit.Tests/bin/Debug/net6.0/Octokit.Tests.dll", "args": [], "cwd": "${workspaceFolder}/Octokit.Tests", "console": "internalConsole", @@ -17,7 +27,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/Octokit.Tests.Conventions/bin/Debug/netcoreapp3.1/Octokit.Tests.Conventions.dll", + "program": "${workspaceFolder}/Octokit.Tests.Conventions/bin/Debug/net6.0/Octokit.Tests.Conventions.dll", "args": [], "cwd": "${workspaceFolder}/Octokit.Tests.Conventions", "console": "internalConsole", @@ -28,7 +38,7 @@ "type": "coreclr", "request": "launch", "preLaunchTask": "build", - "program": "${workspaceFolder}/Octokit.Tests.Integration/bin/Debug/netcoreapp3.1/Octokit.Tests.Integration.dll", + "program": "${workspaceFolder}/Octokit.Tests.Integration/bin/Debug/net6.0/Octokit.Tests.Integration.dll", "args": [], "cwd": "${workspaceFolder}/Octokit.Tests.Integration", "console": "internalConsole", diff --git a/.vscode/settings.json b/.vscode/settings.json index 91f78ee477..0c1ea17bae 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,11 +1,15 @@ { - "files.exclude": { - "**/bin": true, - "**/obj": true, - "**/packaging": true, - "**/coverage-results": true - }, - "files.trimTrailingWhitespace": true, - "files.trimFinalNewlines": true, - "files.insertFinalNewline": true + "editor.formatOnSave": false, + "files.exclude": { + "**/bin": true, + "**/obj": true, + "**/packaging": true, + "**/coverage-results": true + }, + "files.trimTrailingWhitespace": true, + "files.trimFinalNewlines": true, + "files.insertFinalNewline": true, + "editor.detectIndentation": false, + "editor.tabSize": 2, + "editor.insertSpaces": true } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 609f11f165..eb8edc4f29 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -2,7 +2,7 @@ "version": "2.0.0", "tasks": [ { - "label": "build", + "label": "Build", "command": "dotnet", "type": "shell", "args": [ @@ -19,6 +19,36 @@ }, "problemMatcher": "$msCompile" }, + { + "label": "Unit Tests", + "command": "./build.sh", + "type": "shell", + "args": [ + "--target=UnitTests" + ], + "group": { + "kind": "test" + }, + "presentation": { + "reveal": "always" + }, + "problemMatcher": "$msCompile" + }, + { + "label": "Convention Tests", + "command": "./build.sh", + "type": "shell", + "args": [ + "--target=ConventionTests" + ], + "group": { + "kind": "test" + }, + "presentation": { + "reveal": "always" + }, + "problemMatcher": "$msCompile" + }, { "label": "Format", "command": "dotnet", @@ -28,6 +58,16 @@ "reveal": "silent" }, "problemMatcher": "$msCompile" + }, + { + "label": "Docs", + "command": "mkdocs", + "type": "shell", + "args": ["serve"], + "presentation": { + "reveal": "silent", + "revealProblems": "onProblem" + } } ] } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5c4ede774e..b52483bac2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,7 +29,7 @@ to ensure everything builds and the tests pass. ## How can I get involved? -We have an [`up-for-grabs`](https://github.com/octokit/octokit.net/issues/labels/up-for-grabs) +We have an [`Status: Up for grabs`](https://github.com/octokit/octokit.net/labels/Status%3A%20Up%20for%20grabs) tag on our issue tracker to indicate tasks which contributors can pick up. If you've found something you'd like to contribute to, leave a comment in the issue @@ -72,11 +72,11 @@ To install dependencies and run the CAKE build script use the following wrapper - Windows (Powershell) -`.\build.ps1 -Target -Configuration Release -LinkSources [Additional Parameters]` +`.\build.ps1 -Target -Configuration Release [Additional Parameters]` - Linux/OSX (bash) -`./build.sh --target= --configuration==Release --linksources=true [Additional Parameters]` +`./build.sh --target= --configuration==Release [Additional Parameters]` ### Running Tests @@ -183,5 +183,5 @@ Some things that will increase the chance that your pull request is accepted: # Additional Resources -* [Octokit Codebase Overview](https://github.com/octokit/octokit.net/blob/master/OVERVIEW.md) +* [Octokit Codebase Overview](https://github.com/octokit/octokit.net/blob/main/OVERVIEW.md) * [General GitHub documentation](http://help.github.com/) diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index bc84029763..1d8de296ad 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -1,19 +1,17 @@ ## Deploying a new release -When we're ready to deploy a new release, we need to do the following steps: +### Requirements -1. Create a branch named `release`. -2. Update [`ReleaseNotes.md`](ReleaseNotes.md). Note that the format is -important as we parse the version out and use that for the NuGet packages. -3. Push the branch to GitHub and create a pull request. This will kick off the -MyGet build of the NuGet package with this new version. - If you're impatient, you can run `.\build CreatePackages` and get the packages locally. -4. Test! -5. When you're satisfied with this release, push the package -[from MyGet](https://www.myget.org/feed/Packages/octokit) to NuGet. -6. Create a tag `git tag v#.#.#`. For example, to create a tag for 1.0.0 -`git tag v1.0.0` -7. Push the tag to the server. `git push --tags` -8. Accept the pull request. -9. Create a [new release](https://github.com/octokit/octokit.net/releases/new) -using the tag you just created and pasting in the release notes you just wrote up +Creating a new release and deploying the package to nuget are administrative tasks and require that you have/do the following: +1. Admin access to the [GitHub](https://www.nuget.org/profiles/GitHub) NuGet organization +2. Admin rights to the [octokit.net](https://github.com/octokit/octokit.net) repository + +### Publish to nuget.org + +1. Run test and perform manual tests from `main` +2. When you're satisfied with this release, create a tag `git tag v#.#.#`. For example, to create a tag for 3.0.1 +`git tag v3.0.1` +3. Push the tag to the server. `git push --tags` +4. When the tag is successfully pushed, the [publish workflow](https://github.com/octokit/octokit.net/blob/main/.github/workflows/publish.yml) will run and build and push the package to nuget +5. Verify that the package has been uploaded to [nuget.org](https://www.nuget.org/packages/Octokit/) +6. Create a [new release](https://github.com/octokit/octokit.net/releases/new) using the tag you just created and pasting in the release notes you just generated diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000000..c7568165b2 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,7 @@ + + + true + $(MSBuildThisFileDirectory)\key.snk + , PublicKey=0024000004800000940000000602000000240000525341310004000001000100f1e6b635f0c0b44c03d712e4f2cf789ddb54d7f74a9b34e2ece3aafb6afbfd46ec2b033f4104ef88f6afec226c5c647f453852ba3847fd9e37727c7dcb54e24731a288a107457a2c3e8b26ab04c25b206797be48cfe7a2b2c427422d0b0dd18c82111f21798f997e5d33ecc25c677744709c3785e0e650d6e0456a034a31acc4 + + diff --git a/Octokit.AsyncPaginationExtension/Extensions.cs b/Octokit.AsyncPaginationExtension/Extensions.cs new file mode 100644 index 0000000000..7e2f6221a5 --- /dev/null +++ b/Octokit.AsyncPaginationExtension/Extensions.cs @@ -0,0 +1,927 @@ +using System; +using System.Collections.Generic; +using Octokit.Models.Request.Enterprise; + +namespace Octokit.AsyncPaginationExtension +{ + /// + /// Provides all extensions for pagination. + /// + /// + /// The pageSize parameter at the end of all methods allows for specifying the amount of elements to be fetched per page. + /// Only useful to optimize the amount of API calls made. + /// + public static class Extensions + { + private const int DEFAULT_PAGE_SIZE = 30; + + /// + public static IPaginatedList GetAllAsync(this IApiConnection t, Uri uri, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(uri, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IApiConnection t, Uri uri, IDictionary parameters, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(uri, parameters, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IApiConnection t, Uri uri, IDictionary parameters, string accepts, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(uri, parameters, accepts, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IIssueCommentsClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IIssueCommentsClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IIssueCommentsClient t, string owner, string name, IssueCommentRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(owner, name, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IIssueCommentsClient t, long repositoryId, IssueCommentRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(repositoryId, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForIssueAsync(this IIssueCommentsClient t, string owner, string name, int issueNumber, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForIssue(owner, name, issueNumber, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForIssueAsync(this IIssueCommentsClient t, long repositoryId, int issueNumber, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForIssue(repositoryId, issueNumber, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForIssueAsync(this IIssueCommentsClient t, string owner, string name, int issueNumber, IssueCommentRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForIssue(owner, name, issueNumber, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForIssueAsync(this IIssueCommentsClient t, long repositoryId, int issueNumber, IssueCommentRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForIssue(repositoryId, issueNumber, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IRepositoryPagesClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IRepositoryPagesClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllWatchersAsync(this IWatchedClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllWatchers(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllWatchersAsync(this IWatchedClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllWatchers(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForCurrentAsync(this IWatchedClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllForCurrent, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForUserAsync(this IWatchedClient t, string user, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForUser(user, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForCurrentAsync(this INotificationsClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllForCurrent, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForCurrentAsync(this INotificationsClient t, NotificationsRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForCurrent(request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this INotificationsClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this INotificationsClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this INotificationsClient t, string owner, string name, NotificationsRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(owner, name, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this INotificationsClient t, long repositoryId, NotificationsRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(repositoryId, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForIssueAsync(this IIssueTimelineClient t, string owner, string repo, int issueNumber, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForIssue(owner, repo, issueNumber, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForIssueAsync(this IIssueTimelineClient t, long repositoryId, int issueNumber, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForIssue(repositoryId, issueNumber, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllLicensesAsync(this IMiscellaneousClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllLicenses, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IIssueReactionsClient t, string owner, string name, int issueNumber, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(owner, name, issueNumber, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IIssueReactionsClient t, long repositoryId, int issueNumber, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(repositoryId, issueNumber, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IRepositoryDeployKeysClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IRepositoryDeployKeysClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IEventsClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAll, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IEventsClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IEventsClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllIssuesForRepositoryAsync(this IEventsClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllIssuesForRepository(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllIssuesForRepositoryAsync(this IEventsClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllIssuesForRepository(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryNetworkAsync(this IEventsClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepositoryNetwork(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForOrganizationAsync(this IEventsClient t, string organization, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForOrganization(organization, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllUserReceivedAsync(this IEventsClient t, string user, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllUserReceived(user, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllUserReceivedPublicAsync(this IEventsClient t, string user, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllUserReceivedPublic(user, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllUserPerformedAsync(this IEventsClient t, string user, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllUserPerformed(user, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllUserPerformedPublicAsync(this IEventsClient t, string user, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllUserPerformedPublic(user, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForAnOrganizationAsync(this IEventsClient t, string user, string organization, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForAnOrganization(user, organization, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList ListAllRunnerApplicationsForEnterpriseAsync(this IActionsSelfHostedRunnersClient t, string enterprise, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.ListAllRunnerApplicationsForEnterprise(enterprise, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList ListAllRunnerApplicationsForOrganizationAsync(this IActionsSelfHostedRunnersClient t, string organization, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.ListAllRunnerApplicationsForOrganization(organization, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList ListAllRunnerApplicationsForRepositoryAsync(this IActionsSelfHostedRunnersClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.ListAllRunnerApplicationsForRepository(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IMilestonesClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IMilestonesClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IMilestonesClient t, string owner, string name, MilestoneRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(owner, name, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IMilestonesClient t, long repositoryId, MilestoneRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(repositoryId, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForCurrentAsync(this IUserGpgKeysClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllForCurrent, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IUserEmailsClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAll, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IRepoCollaboratorsClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IRepoCollaboratorsClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IRepoCollaboratorsClient t, string owner, string name, RepositoryCollaboratorListRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(owner, name, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IRepoCollaboratorsClient t, long repositoryId, RepositoryCollaboratorListRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(repositoryId, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IProjectColumnsClient t, int projectId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(projectId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IAuthorizationsClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAll, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IAssigneesClient t, string owner, string name, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(owner, name, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForRepositoryAsync(this IAssigneesClient t, long repositoryId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForRepository(repositoryId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IOrganizationCustomPropertyValuesClient t, string org, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(org, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IDeploymentStatusClient t, string owner, string name, long deploymentId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(owner, name, deploymentId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IDeploymentStatusClient t, long repositoryId, long deploymentId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(repositoryId, deploymentId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForCurrentAsync(this IFollowersClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllForCurrent, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IFollowersClient t, string login, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(login, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllFollowingForCurrentAsync(this IFollowersClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllFollowingForCurrent, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllFollowingAsync(this IFollowersClient t, string login, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllFollowing(login, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this ITeamsClient t, string org, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(org, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForCurrentAsync(this ITeamsClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllForCurrent, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllChildTeamsAsync(this ITeamsClient t, long id, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllChildTeams(id, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllMembersAsync(this ITeamsClient t, long id, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllMembers(id, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllMembersAsync(this ITeamsClient t, long id, TeamMembersRequest request, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllMembers(id, request, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllRepositoriesAsync(this ITeamsClient t, long id, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllRepositories(id, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllPendingInvitationsAsync(this ITeamsClient t, long id, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllPendingInvitations(id, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllInstallationsForCurrentAsync(this IGitHubAppsClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllInstallationsForCurrent, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForOrgAsync(this IPackagesClient t, string org, PackageType packageType, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForOrg(org, packageType, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForOrgAsync(this IPackagesClient t, string org, PackageType packageType, PackageVisibility? packageVisibility, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForOrg(org, packageType, packageVisibility, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForActiveUserAsync(this IPackagesClient t, PackageType packageType, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForActiveUser(packageType, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForActiveUserAsync(this IPackagesClient t, PackageType packageType, PackageVisibility? packageVisibility, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForActiveUser(packageType, packageVisibility, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForUserAsync(this IPackagesClient t, string username, PackageType packageType, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForUser(username, packageType, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForUserAsync(this IPackagesClient t, string username, PackageType packageType, PackageVisibility? packageVisibility, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForUser(username, packageType, packageVisibility, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllLicensesAsync(this ILicensesClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllLicenses, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IOrganizationMembersClient t, string org, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(org, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IOrganizationMembersClient t, string org, OrganizationMembersFilter filter, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(org, filter, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IOrganizationMembersClient t, string org, OrganizationMembersRole role, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(org, role, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAsync(this IOrganizationMembersClient t, string org, OrganizationMembersFilter filter, OrganizationMembersRole role, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAll(org, filter, role, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllPublicAsync(this IOrganizationMembersClient t, string org, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllPublic(org, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllPendingInvitationsAsync(this IOrganizationMembersClient t, string org, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllPendingInvitations(org, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllFailedInvitationsAsync(this IOrganizationMembersClient t, string org, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllFailedInvitations(org, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllOrganizationMembershipsForCurrentAsync(this IOrganizationMembersClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllOrganizationMembershipsForCurrent, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForCurrentAsync(this IOrganizationsClient t, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(t.GetAllForCurrent, pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllForUserAsync(this IOrganizationsClient t, string user, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllForUser(user, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAuthorizationsAsync(this IOrganizationsClient t, string org, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllAuthorizations(org, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAuthorizationsAsync(this IOrganizationsClient t, string org, string login, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllAuthorizations(org, login, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAnnotationsAsync(this ICheckRunsClient t, string owner, string name, long checkRunId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllAnnotations(owner, name, checkRunId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList GetAllAnnotationsAsync(this ICheckRunsClient t, long repositoryId, long checkRunId, int pageSize = DEFAULT_PAGE_SIZE) + => pageSize > 0 ? new PaginatedList(options => t.GetAllAnnotations(repositoryId, checkRunId, options), pageSize) : throw new ArgumentOutOfRangeException(nameof(pageSize), pageSize, "The page size must be positive."); + + /// + public static IPaginatedList