[
  {
    "path": ".devcontainers/Dockerfile",
    "content": "# [Choice] .NET version: 7.0, 7.0-bullseye-slim, 7.0-jammy, 6.0, 6.0-bullseye-slim, 6.0-jammy, 6.0-focal\nARG VARIANT=\"7.0-jammy\"\nFROM mcr.microsoft.com/dotnet/sdk:${VARIANT}\n\n# [Optional] Uncomment this section to install additional OS packages.\n# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \\\n#     && apt-get -y install --no-install-recommends <your-package-list-here>"
  },
  {
    "path": ".devcontainers/devcontainer.json",
    "content": "{\n  \"name\": \"DevContainer for .NET\",\n\n  \"build\": {\n    \"dockerfile\": \"./Dockerfile\",\n    \"context\": \".\",\n    \"args\": {\n      // version: 7.0, 7.0-bullseye-slim, 7.0-jammy, 6.0, 6.0-bullseye-slim, 6.0-jammy, 6.0-focal\n      \"VARIANT\": \"7.0\"\n    }\n  },\n\n  \"features\": {\n    // GitHub CLI\n    \"ghcr.io/devcontainers/features/github-cli:1\": {\n      \"version\": \"latest\"\n    },\n\n    // Install common utilities\n    \"ghcr.io/devcontainers/features/common-utils:1\": {\n      \"installZsh\": true,\n      \"installOhMyZsh\": true,\n      \"upgradePackages\": true,\n      \"username\": \"vscode\",\n      \"uid\": \"1000\",\n      \"gid\": \"1000\"\n    }\n  },\n\n  \"overrideFeatureInstallOrder\": [\n    \"ghcr.io/devcontainers/features/common-utils\"\n  ],\n\n  // Configure tool-specific properties.\n  \"customizations\": {\n    // Configure properties specific to VS Code.\n    \"vscode\": {\n      // Add the IDs of extensions you want installed when the container is created.\n      \"extensions\": [\n        \"ms-dotnettools.csharp\",\n        \"ms-vscode.PowerShell\",\n        \"VisualStudioExptTeam.vscodeintellicode\"\n      ],\n      \"settings\": {\n      }\n    }\n  },\n\n  // Uncomment if you want to use bash in 'postCreateCommand' after the container is created\n  \"postCreateCommand\": \"/bin/bash ./.devcontainer/post-create.sh > ~/post-create.log\",\n\n  // Uncomment if you want to connect other than 'root'. More info: https://aka.ms/vscode-remote/containers/non-root.\n  \"remoteUser\": \"vscode\"\n}\n"
  },
  {
    "path": ".devcontainers/post-create.sh",
    "content": "## Restore .NET packages and build the default solution\ndotnet restore\n"
  },
  {
    "path": ".editorconfig",
    "content": "# EditorConfig is awesome:http://EditorConfig.org\n# From https://raw.githubusercontent.com/dotnet/roslyn/master/.editorconfig\n\n# top-most EditorConfig file\nroot = true\n\n# Don't use tabs for indentation.\n[*]\nindent_style = space\ntrim_trailing_whitespace = true\n# (Please don't specify an indent_size here; that has too many unintended consequences.)\n\n# Code files\n[*.{cs,csx,vb,vbx}]\nindent_size = 4\ninsert_final_newline = true\ncharset = utf-8-bom\n\n# Xml project files\n[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]\nindent_size = 2\n\n# Xml config files\n[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]\nindent_size = 2\n\n# Yml/Yaml files\n[*.{yaml,yml}]\nindent_size = 2\n\n# Powershell files\n[*.ps1]\nindent_size = 2\n\n# JSON files\n[*.json]\nindent_size = 2\n\n# Shell scripts\n[*.sh]\nend_of_line = lf\n\n[*.{cmd,bat}]\nend_of_line = crlf\n\n# Dotnet code style settings:\n[*.{cs,vb}]\n# Sort using and Import directives with System.* appearing first\ndotnet_sort_system_directives_first = true\n# Put a blank line between System.* and Microsoft.*\ndotnet_separate_import_directive_groups = true\n\n# Avoid \"this.\" and \"Me.\" if not necessary\ndotnet_style_qualification_for_field = false:suggestion\ndotnet_style_qualification_for_property = false:suggestion\ndotnet_style_qualification_for_method = false:suggestion\ndotnet_style_qualification_for_event = false:suggestion\n\n# Use language keywords instead of framework type names for type references\ndotnet_style_predefined_type_for_locals_parameters_members = true:suggestion\ndotnet_style_predefined_type_for_member_access = true:suggestion\n\n# Prefer read-only on fields\ndotnet_style_readonly_field = true:warning\n\n# Suggest more modern language features when available\ndotnet_style_object_initializer = true:suggestion\ndotnet_style_collection_initializer = true:suggestion\ndotnet_style_coalesce_expression = true:suggestion\ndotnet_style_null_propagation = true:suggestion\ndotnet_style_explicit_tuple_names = true:suggestion\ndotnet_style_prefer_inferred_tuple_names = true:suggestion\ndotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion\ndotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion\ndotnet_style_prefer_conditional_expression_over_return = false\ndotnet_style_prefer_conditional_expression_over_assignment = false\ndotnet_style_prefer_auto_properties = true:suggestion\n\n# Parentheses\ndotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:silent\ndotnet_style_parentheses_in_other_binary_operators = always_for_clarity:silent\ndotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent\ndotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:silent\n\n# Accessibility modifiers\ndotnet_style_require_accessibility_modifiers = omit_if_default:suggestion\n\n\n# Naming Rules\n\n# Interfaces start with an I and are PascalCased\ndotnet_naming_rule.interfaces_must_be_pascal_cased_and_prefixed_with_I.symbols                        = interface_symbols\ndotnet_naming_rule.interfaces_must_be_pascal_cased_and_prefixed_with_I.style                          = pascal_case_and_prefix_with_I_style\ndotnet_naming_rule.interfaces_must_be_pascal_cased_and_prefixed_with_I.severity                       = warning\n\n# External members are PascalCased\ndotnet_naming_rule.externally_visible_members_must_be_pascal_cased.symbols                            = externally_visible_symbols\ndotnet_naming_rule.externally_visible_members_must_be_pascal_cased.style                              = pascal_case_style\ndotnet_naming_rule.externally_visible_members_must_be_pascal_cased.severity                           = warning\n\n# Parameters are camelCased\ndotnet_naming_rule.parameters_must_be_camel_cased.symbols                                             = parameter_symbols\ndotnet_naming_rule.parameters_must_be_camel_cased.style                                               = camel_case_style\ndotnet_naming_rule.parameters_must_be_camel_cased.severity                                            = warning\n\n# Constants are PascalCased\ndotnet_naming_rule.constants_must_be_pascal_cased.symbols                                             = constant_symbols\ndotnet_naming_rule.constants_must_be_pascal_cased.style                                               = pascal_case_style\ndotnet_naming_rule.constants_must_be_pascal_cased.severity                                            = warning\n\n# Uncomment this group and comment out the next group if you prefer s_ prefixes for static fields\n\n# Private static fields are prefixed with s_ and are camelCased like s_myStatic\n#dotnet_naming_rule.private_static_fields_must_be_camel_cased_and_prefixed_with_s_underscore.symbols   = private_static_field_symbols\n#dotnet_naming_rule.private_static_fields_must_be_camel_cased_and_prefixed_with_s_underscore.style     = camel_case_and_prefix_with_s_underscore_style\n#dotnet_naming_rule.private_static_fields_must_be_camel_cased_and_prefixed_with_s_underscore.severity  = warning\n\n# Static readonly fields are PascalCased\ndotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols                               = private_static_readonly_field_symbols\ndotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style                                 = pascal_case_style\ndotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity                              = warning\n\n# Comment this group and uncomment out the next group if you don't want _ prefixed fields.\n\n# Private instance fields are camelCased with an _ like _myField\n#dotnet_naming_rule.private_instance_fields_must_be_camel_cased_and_prefixed_with_underscore.symbols   = private_field_symbols\n#dotnet_naming_rule.private_instance_fields_must_be_camel_cased_and_prefixed_with_underscore.style     = camel_case_and_prefix_with_underscore_style\n#dotnet_naming_rule.private_instance_fields_must_be_camel_cased_and_prefixed_with_underscore.severity  = warning\n\n# Private instance fields are camelCased\ndotnet_naming_rule.private_instance_fields_must_be_camel_cased.symbols                                = private_field_symbols\ndotnet_naming_rule.private_instance_fields_must_be_camel_cased.style                                  = camel_case_style\ndotnet_naming_rule.private_instance_fields_must_be_camel_cased.severity                               = warning\n\n# Symbols\ndotnet_naming_symbols.externally_visible_symbols.applicable_kinds                                     = class,struct,interface,enum,property,method,field,event,delegate\ndotnet_naming_symbols.externally_visible_symbols.applicable_accessibilities                           = public,internal,friend,protected,protected_internal,protected_friend,private_protected\n\ndotnet_naming_symbols.interface_symbols.applicable_kinds                                              = interface\ndotnet_naming_symbols.interface_symbols.applicable_accessibilities                                    = *\n\ndotnet_naming_symbols.parameter_symbols.applicable_kinds                                              = parameter\ndotnet_naming_symbols.parameter_symbols.applicable_accessibilities                                    = *\n\ndotnet_naming_symbols.constant_symbols.applicable_kinds                                               = field\ndotnet_naming_symbols.constant_symbols.required_modifiers                                             = const\ndotnet_naming_symbols.constant_symbols.applicable_accessibilities                                     = *\n\ndotnet_naming_symbols.private_static_field_symbols.applicable_kinds                                   = field\ndotnet_naming_symbols.private_static_field_symbols.required_modifiers                                 = static,shared\ndotnet_naming_symbols.private_static_field_symbols.applicable_accessibilities                         = private\n\ndotnet_naming_symbols.private_static_readonly_field_symbols.applicable_kinds                          = field\ndotnet_naming_symbols.private_static_readonly_field_symbols.required_modifiers                        = static,shared,readonly\ndotnet_naming_symbols.private_static_readonly_field_symbols.applicable_accessibilities                = private\n\ndotnet_naming_symbols.private_field_symbols.applicable_kinds                                          = field\ndotnet_naming_symbols.private_field_symbols.applicable_accessibilities                                = private\n\n# Styles\ndotnet_naming_style.camel_case_style.capitalization                                                   = camel_case\n\ndotnet_naming_style.pascal_case_style.capitalization                                                  = pascal_case\n\ndotnet_naming_style.camel_case_and_prefix_with_s_underscore_style.required_prefix                     = s_\ndotnet_naming_style.camel_case_and_prefix_with_s_underscore_style.capitalization                      = camel_case\n\ndotnet_naming_style.camel_case_and_prefix_with_underscore_style.required_prefix                       = _\ndotnet_naming_style.camel_case_and_prefix_with_underscore_style.capitalization                        = camel_case\n\ndotnet_naming_style.pascal_case_and_prefix_with_I_style.required_prefix                               = I\ndotnet_naming_style.pascal_case_and_prefix_with_I_style.capitalization                                = pascal_case\n\n\n# CSharp code style settings:\n[*.cs]\n# Modifier order\ncsharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion\n\n# Code block\ncsharp_prefer_braces = false:none\n\n# Indentation preferences\ncsharp_indent_block_contents = true\ncsharp_indent_braces = false\ncsharp_indent_case_contents = true\ncsharp_indent_switch_labels = true\ncsharp_indent_labels = flush_left\n\n# Prefer \"var\" everywhere\ncsharp_style_var_for_built_in_types = true:suggestion\ncsharp_style_var_when_type_is_apparent = true:suggestion\ncsharp_style_var_elsewhere = true:suggestion\n\n# Code style defaults\ncsharp_preserve_single_line_blocks = true\ncsharp_preserve_single_line_statements = true\n\n# Prefer method-like constructs to have a block body\ncsharp_style_expression_bodied_methods = false:none\ncsharp_style_expression_bodied_constructors = false:none\ncsharp_style_expression_bodied_operators = false:none\n\n# Prefer property-like constructs to have an expression-body\ncsharp_style_expression_bodied_properties = true:none\ncsharp_style_expression_bodied_indexers = true:none\ncsharp_style_expression_bodied_accessors = true:none\n\n# Expression \ncsharp_prefer_simple_default_expression = true:suggestion\ncsharp_style_deconstructed_variable_declaration = true:suggestion\ncsharp_style_pattern_local_over_anonymous_function = true:suggestion\n\n# Pattern matching\ncsharp_style_pattern_matching_over_is_with_cast_check = true:suggestion\ncsharp_style_pattern_matching_over_as_with_null_check = true:suggestion\ncsharp_style_inlined_variable_declaration = true:suggestion\n\n# Null checking preferences\ncsharp_style_throw_expression = true:suggestion\ncsharp_style_conditional_delegate_call = true:suggestion\n\n# Newline settings\ncsharp_new_line_before_open_brace = all\ncsharp_new_line_before_else = true\ncsharp_new_line_before_catch = true\ncsharp_new_line_before_finally = true\ncsharp_new_line_before_members_in_object_initializers = true\ncsharp_new_line_before_members_in_anonymous_types = true\ncsharp_new_line_between_query_expression_clauses = true\n\n# Space preferences\ncsharp_space_after_cast = false\ncsharp_space_after_colon_in_inheritance_clause = true\ncsharp_space_after_comma = true\ncsharp_space_after_dot = false\ncsharp_space_after_keywords_in_control_flow_statements = true\ncsharp_space_after_semicolon_in_for_statement = true\ncsharp_space_around_binary_operators = before_and_after\ncsharp_space_around_declaration_statements = do_not_ignore\ncsharp_space_before_colon_in_inheritance_clause = true\ncsharp_space_before_comma = false\ncsharp_space_before_dot = false\ncsharp_space_before_open_square_brackets = false\ncsharp_space_before_semicolon_in_for_statement = false\ncsharp_space_between_empty_square_brackets = false\ncsharp_space_between_method_call_empty_parameter_list_parentheses = false\ncsharp_space_between_method_call_name_and_opening_parenthesis = false\ncsharp_space_between_method_call_parameter_list_parentheses = false\ncsharp_space_between_method_declaration_empty_parameter_list_parentheses = false\ncsharp_space_between_method_declaration_name_and_open_parenthesis = false\ncsharp_space_between_method_declaration_parameter_list_parentheses = false\ncsharp_space_between_parentheses = false\ncsharp_space_between_square_brackets = false\n"
  },
  {
    "path": ".gitattributes",
    "content": "# Auto detect text files and perform LF normalization\n* text=auto\n\n# Custom for Visual Studio\n*.cs     diff=csharp\n\n# Standard to msysgit\n*.doc\t diff=astextplain\n*.DOC\t diff=astextplain\n*.docx diff=astextplain\n*.DOCX diff=astextplain\n*.dot  diff=astextplain\n*.DOT  diff=astextplain\n*.pdf  diff=astextplain\n*.PDF\t diff=astextplain\n*.rtf\t diff=astextplain\n*.RTF\t diff=astextplain\n\n.idea/\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug-report.yml",
    "content": "name: Bug Report\ndescription: Create a report to help us improve\ntitle: \"[Bug]: \"\nlabels: [\"bug\"]\nbody:\n  - type: markdown\n    attributes:\n      value: |\n        ## Please note although we can't commit to any timeline, priority will be given to those who are [Contributors](https://github.com/reactiveui/ReactiveUI#contribute ) to the project.\n  - type: textarea\n    id: description\n    attributes:\n      label: Describe the bug 🐞\n      description: A clear and concise description of what the bug is.\n      value: \"A bug happened!\"\n    validations:\n      required: true\n  - type: textarea\n    id: reproduce-steps\n    attributes:\n      label: Step to reproduce\n      description: \"Steps to reproduce the behavior:\"\n      value: |\n        1. Go to '...'\n        2. Click on '....'\n        3. Scroll down to '....'\n        4. See error\n    validations:\n      required: true\n  - type: input\n    id: reproduce-repository\n    attributes:\n      label: Reproduction repository\n      description: \"Simple repository representing the bug\"\n      placeholder: https://github.com/reactiveui/refit\n      value: |\n        https://github.com/reactiveui/refit\n    validations:\n      required: false\n  - type: textarea\n    id: expected-behavior\n    attributes:\n      label: Expected behavior\n      description: A clear and concise description of what you expected to happen.\n      value: This should happen...\n    validations:\n      required: true\n  - type: textarea\n    id: screenshots\n    attributes:\n      label: Screenshots 🖼️\n      description: If applicable, add screenshots to help explain your problem.\n    validations:\n      required: false\n  - type: dropdown\n    id: ide\n    attributes:\n      label: IDE\n      multiple: true\n      options:\n        - Visual Studio 2022\n        - Visual Studio 2019\n        - Visual Studio 2017\n        - Visual Studio for Mac\n        - Rider Windows\n        - Rider macOS\n        - Visual Studio Code\n  - type: input\n    id: operating-system\n    attributes:\n      label: Operating system\n      description: Windows, Linux, Mac OS...\n    validations:\n      required: false\n  - type: input\n    id: system-version\n    attributes:\n      label: Version\n      description: Version and distribution (if applicable)\n    validations:\n      required: false\n  - type: input\n    id: device\n    attributes:\n      label: Device\n      description: Device e.g. iPhone 6\n    validations:\n      required: false\n  - type: input\n    id: refit-version\n    attributes:\n      label: Refit Version\n      description: e.g. 15.1.1\n    validations:\n      required: false\n  - type: textarea\n    id: additional-information\n    attributes:\n      label: Additional information ℹ️\n      description: Add any other information about the problem here.\n    validations:\n      required: false\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: false\ncontact_links:\n  - name: Questions\n    url: https://github.com/reactiveui/refit/discussions\n    about: 'For general questions about Refit, ask in the GitHub discussions'\n  - name: Chat\n    url: https://www.reactiveui.net/slack\n    about: 'Our slack chat community invite'\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: feature request\nassignees: ''\n\n---\n\n<!--\nPlease note although we can't commit to any timeline, priority will be given to those who are [Contributors](https://github.com/reactiveui/ReactiveUI#contribute ) to the project.\n\nIf this is a question please ask on [StackOverflow](https://stackoverflow.com/questions/tagged/reactiveui).\n-->\n\n**Is your feature request related to a problem? Please describe.**\n<!-- A clear and concise description of what the problem is. -->\n\n\n\n**Describe the solution you'd like**\n<!-- A clear and concise description of what you want to happen. -->\n\n\n\n**Describe alternatives you've considered**\n<!-- A clear and concise description of any alternative solutions or features you've considered. -->\n\n\n\n**Describe suggestions on how to achieve the feature**\n<!-- A clear description to how to achieve the feature. -->\n\n\n\n**Additional context**\n<!-- Add any other context or screenshots about the feature request here. -->\n"
  },
  {
    "path": ".github/renovate.json",
    "content": "{\n    \"$schema\": \"https://docs.renovatebot.com/renovate-schema.json\",\n    \"extends\": [\"local>reactiveui/.github:renovate\"]\n}"
  },
  {
    "path": ".github/workflows/ci-build.yml",
    "content": "name: Build\n\non:\n  push:\n    branches: [ main ]\n  pull_request:\n    branches: [ main ]\n\n# Needed so the reusable workflow can optionally delete the temp per-OS artifacts it creates.\npermissions:\n  contents: read\n  actions: write\n\nenv:\n  productNamespacePrefix: \"Refit\"\n\njobs:\n  build:\n    uses: reactiveui/actions-common/.github/workflows/workflow-common-setup-and-build.yml@main\n    with:\n      productNamespacePrefix: \"Refit\"\n      srcFolder: \"./\"\n    secrets:\n      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/lock.yml",
    "content": "name: 'Lock Threads'\n\non:\n  schedule:\n    - cron: '0 0 * * *'\n  workflow_dispatch:\n\npermissions:\n  issues: write\n  pull-requests: write\n\nconcurrency:\n  group: lock\n\njobs:\n  action:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: dessant/lock-threads@v6\n        with:\n          github-token: ${{ github.token }}\n          issue-inactive-days: '14'\n          pr-inactive-days: '14'\n          issue-comment: >\n            This issue has been automatically locked since there\n            has not been any recent activity after it was closed.\n            Please open a new issue for related bugs.\n          pr-comment: >\n            This pull request has been automatically locked since there\n            has not been any recent activity after it was closed.\n            Please open a new issue for related bugs.\n"
  },
  {
    "path": ".github/workflows/release.yml",
    "content": "name: Release\n\non:\n  workflow_dispatch:\n\npermissions:\n  contents: write\n  id-token: write\n\njobs:\n  release:\n    uses: reactiveui/actions-common/.github/workflows/workflow-common-release.yml@main\n    with:\n      srcFolder: \"./\"\n    secrets:\n      ES_USERNAME: ${{ secrets.ES_USERNAME }}\n      ES_PASSWORD: ${{ secrets.ES_PASSWORD }}\n      CREDENTIAL_ID: ${{ secrets.CREDENTIAL_ID }}\n      ES_TOTP_SECRET: ${{ secrets.ES_TOTP_SECRET }}\n\n  publish-nuget:\n    needs: release\n    runs-on: ubuntu-latest\n    environment:\n      name: release\n    permissions:\n      id-token: write\n    steps:\n      - name: Download signed packages\n        uses: actions/download-artifact@v8\n        with:\n          name: signed-nuget\n\n      - name: Setup .NET\n        uses: actions/setup-dotnet@v5\n\n      - name: NuGet login (OIDC trusted publishing)\n        id: nuget-login\n        uses: NuGet/login@v1\n        with:\n          user: ${{ secrets.NUGET_USER }}\n\n      - name: Push to NuGet\n        shell: bash\n        run: |\n          for pkg in *.nupkg; do\n            dotnet nuget push \"$pkg\" --source https://api.nuget.org/v3/index.json --api-key \"${{ steps.nuget-login.outputs.NUGET_API_KEY }}\"\n          done\n  create-release:\n    needs: [release, publish-nuget]\n    uses: reactiveui/actions-common/.github/workflows/workflow-common-create-release.yml@main\n    with:\n      version: ${{ needs.release.outputs.semver2 }}\n"
  },
  {
    "path": ".gitignore",
    "content": "# Windows image file caches\nThumbs.db \n\n# Folder config file\nDesktop.ini\n\n## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User-specific files\n*.suo\n*.user\n*.userprefs\n\n.vs/\n\n# Build results\nbin/[Dd]ebug/\nbin/[Rr]elease/\n*_i.c\n*_p.c\n*.ilk\n*.meta\n*.obj\n*.pch\nbin/**/*.pdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.vspscc\n.builds\n\n# Idea cache files\n\n.idea/\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opensdf\n*.sdf\n\n*.ide/\n\n\n*.lock.json\n*.nuget.props\n*.nuget.targets\n\n# Visual Studio profiler\n*.psess\n*.vsp\n\n# ReSharper is a .NET coding add-in\n_ReSharper*\n\n# Click-Once directory\npublish\n\n# Visual Studio Code\n\n.vscode/\n\n# Others\n[Bb]in\n[Oo]bj\nsql\nTestResults\n*.Cache\nClientBin\nstylecop.*\n~$*\n*.dbmdl\n.DS_Store\nGenerated_Code #added for RIA/Silverlight projects\n\n# Custom\n\n# packages\nRelease/\npackages/\n\n*.userprefs\nRefit-Tests/test-results\n/InterfaceStubGenerator.App/Properties/launchSettings.json\n*.binlog\n/InterfaceStubGenerator.Core/Properties/launchSettings.json\n*.svclog\n**/BenchmarkDotNet.Artifacts\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Code of Conduct\n\nAs contributors and maintainers of this project, and in the interest of\nfostering an open and welcoming community, we pledge to respect all people who\ncontribute through reporting issues, posting feature requests, updating\ndocumentation, submitting pull requests or patches, and other activities.\n\nWe are committed to making participation in this project a harassment-free\nexperience for everyone, regardless of level of experience, gender, gender\nidentity and expression, sexual orientation, disability, personal appearance,\nbody size, race, ethnicity, age, religion, or nationality.\n\nExamples of unacceptable behavior by participants include:\n\n* The use of sexualized language or imagery\n* Personal attacks\n* Trolling or insulting/derogatory comments\n* Public or private harassment\n* Publishing other's private information, such as physical or electronic\n  addresses, without explicit permission\n* Other unethical or unprofessional conduct\n\nProject maintainers have the right and responsibility to remove, edit, or\nreject comments, commits, code, wiki edits, issues, and other contributions\nthat are not aligned to this Code of Conduct, or to ban temporarily or\npermanently any contributor for other behaviors that they deem inappropriate,\nthreatening, offensive, or harmful.\n\nBy adopting this Code of Conduct, project maintainers commit themselves to\nfairly and consistently applying these principles to every aspect of managing\nthis project. Project maintainers who do not follow or enforce the Code of\nConduct may be permanently removed from the project team.\n\nThis Code of Conduct applies both within project spaces and in public spaces\nwhen an individual is representing the project or its community.\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported by contacting a project maintainer at anais@anaisbetts.org. All\ncomplaints will be reviewed and investigated and will result in a response that\nis deemed necessary and appropriate to the circumstances. Maintainers are\nobligated to maintain confidentiality with regard to the reporter of an\nincident.\n\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage],\nversion 1.3.0, available at\n[http://contributor-covenant.org/version/1/3/0/][version]\n\n[homepage]: http://contributor-covenant.org\n[version]: http://contributor-covenant.org/version/1/3/0/\n"
  },
  {
    "path": "COPYING",
    "content": "Copyright (c) 2012 GitHub\n\nPermission is hereby granted,  free of charge,  to any person obtaining a\ncopy of this software and associated documentation files (the \"Software\"),\nto deal in the Software without restriction, including without limitation\nthe rights to  use, copy, modify, merge, publish, distribute, sublicense,\nand/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\n"
  },
  {
    "path": "CodeCoverage.runsettings",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- File name extension must be .runsettings -->\n<RunSettings>\n  <DataCollectionRunSettings>\n    <DataCollectors>\n       <DataCollector friendlyName=\"XPlat code coverage\">\n        <Configuration>\n          <Format>cobertura</Format>\n          <Exclude>[xunit.*]*,[*Tests]*,[System.*]*,[InterfaceStubGenerator.App]*</Exclude> <!-- [Assembly-Filter]Type-Filter -->\n          <ExcludeByAttribute>Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute</ExcludeByAttribute>\n        </Configuration>\n      </DataCollector>      \n    </DataCollectors>\n  </DataCollectionRunSettings>\n</RunSettings>\n"
  },
  {
    "path": "Directory.Build.props",
    "content": "<Project>\n  <PropertyGroup>\n    <MinClientVersion>2.12</MinClientVersion>\n    <GenerateDocumentationFile>true</GenerateDocumentationFile>\n    <IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>\n    <DebugType>embedded</DebugType>\n    <Authors>.NET Foundation and Contributors</Authors>\n    <Copyright>Copyright (c) .NET Foundation and Contributors</Copyright>\n    <PackageLicenseExpression>MIT</PackageLicenseExpression>\n    <PackageProjectUrl>https://github.com/reactiveui/refit</PackageProjectUrl>\n    <PackageIcon>refit_logo.png</PackageIcon>\n    <PackageReadmeFile>README.md</PackageReadmeFile>\n    <DefaultLanguage>en-US</DefaultLanguage>\n    <Description>The automatic type-safe REST library for Xamarin and .NET</Description>\n    <NoPackageAnalysis>true</NoPackageAnalysis>\n    <LangVersion>preview</LangVersion>\n    <EmbedUntrackedSources>true</EmbedUntrackedSources>\n    <!-- Net Analyzers config taken from : https://docs.microsoft.com/en-gb/visualstudio/code-quality/migrate-from-fxcop-analyzers-to-net-analyzers?view=vs-2019 -->\n    <EnableNETAnalyzers>True</EnableNETAnalyzers>\n    <AnalysisLevel>latest</AnalysisLevel>\n    <AnalysisMode>AllEnabledByDefault</AnalysisMode>\n    <ImplicitUsings>true</ImplicitUsings>\n    <PublishRepositoryUrl>true</PublishRepositoryUrl>\n    <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)buildtask.snk</AssemblyOriginatorKeyFile>\n    <!--<SignAssembly>true</SignAssembly>-->\n    <RefitTargets Condition=\"$([MSBuild]::IsOsPlatform('Windows'))\">net462</RefitTargets>\n    <RefitTestTargets>net8.0;net9.0;net10.0</RefitTestTargets>\n    <RefitTargets>$(RefitTargets);netstandard2.0;$(RefitTestTargets)</RefitTargets>\n    <NoWarn>IDE0040;CA1054;CA1510</NoWarn>\n  </PropertyGroup>\n\n  <PropertyGroup Condition=\"'$(GITHUB_ACTIONS)' == 'true'\">\n    <ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <None Include=\"$(MSBuildThisFileDirectory)refit_logo.png\" Pack=\"true\" PackagePath=\"\\\" Visible=\"false\"  />\n    <None Include=\"$(MSBuildThisFileDirectory)LICENSE\" Pack=\"true\" PackagePath=\"LICENSE\" />\n    <None Include=\"$(MSBuildThisFileDirectory)README.md\" Pack=\"true\" PackagePath=\"\\\" />\n  </ItemGroup>\n\n  <ItemGroup Condition=\"'$(IsTestProject)' != 'true'\">\n    <PackageReference Include=\"Microsoft.VisualStudio.Threading.Analyzers\" Version=\"17.14.15\" PrivateAssets=\"All\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Microsoft.SourceLink.GitHub\" Version=\"8.0.0\" PrivateAssets=\"All\"/>\n    <PackageReference Include=\"Nerdbank.GitVersioning\" Version=\"3.9.50\" PrivateAssets=\"all\" />\n  </ItemGroup>\n\n  <Target Name=\"AddCommitHashToAssemblyAttributes\" BeforeTargets=\"GetAssemblyAttributes\">\n    <ItemGroup>\n      <AssemblyAttribute Include=\"System.Reflection.AssemblyMetadataAttribute\" Condition=\" '$(SourceRevisionId)' != '' \">\n        <_Parameter1>CommitHash</_Parameter1>\n        <_Parameter2>$(SourceRevisionId)</_Parameter2>\n      </AssemblyAttribute>\n    </ItemGroup>\n  </Target>\n</Project>\n"
  },
  {
    "path": "InterfaceStubGenerator.Roslyn38/InterfaceStubGenerator.Roslyn38.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netstandard2.0</TargetFrameworks>\n    <AssemblyName>InterfaceStubGeneratorV1</AssemblyName>\n    <RootNamespace>Refit.Generator</RootNamespace>\n    <IsPackable>false</IsPackable>\n    <AssemblyOriginatorKeyFile>..\\buildtask.snk</AssemblyOriginatorKeyFile>\n    <SignAssembly>true</SignAssembly>\n    <IsRoslynComponent>true</IsRoslynComponent>\n    <Nullable>enable</Nullable>\n    <MsCACSharpVersion>3.8.0</MsCACSharpVersion>\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Microsoft.CodeAnalysis.CSharp\" Version=\"$(MsCACSharpVersion)\" />\n  </ItemGroup>\n\n  <Target Name=\"SetBuildVer\" AfterTargets=\"GetBuildVersion\" BeforeTargets=\"SetCloudBuildVersionVars;SetCloudBuildNumberWithVersion\">\n    <PropertyGroup>\n      <Version>$(BuildVersion)</Version>\n      <AssemblyVersion>$(BuildVersionSimple)</AssemblyVersion>\n    </PropertyGroup>\n  </Target>\n\n  <Import Project=\"..\\InterfaceStubGenerator.Shared\\InterfaceStubGenerator.Shared.projitems\" Label=\"Shared\" />\n\n</Project>\n"
  },
  {
    "path": "InterfaceStubGenerator.Roslyn41/InterfaceStubGenerator.Roslyn41.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netstandard2.0</TargetFrameworks>\n    <AssemblyName>InterfaceStubGeneratorV2</AssemblyName>\n    <RootNamespace>Refit.Generator</RootNamespace>\n    <IsPackable>false</IsPackable>\n    <AssemblyOriginatorKeyFile>..\\buildtask.snk</AssemblyOriginatorKeyFile>\n    <SignAssembly>true</SignAssembly>\n    <IsRoslynComponent>true</IsRoslynComponent>\n    <Nullable>enable</Nullable>\n    <DefineConstants>$(DefineConstants);ROSLYN_4</DefineConstants>\n    <MsCACSharpVersion>4.1.0</MsCACSharpVersion>\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Microsoft.CodeAnalysis.CSharp\" Version=\"$(MsCACSharpVersion)\" PrivateAssets=\"all\" />\n  </ItemGroup>\n\n  <Target Name=\"SetBuildVer\" AfterTargets=\"GetBuildVersion\" BeforeTargets=\"SetCloudBuildVersionVars;SetCloudBuildNumberWithVersion\">\n    <PropertyGroup>\n      <Version>$(BuildVersion)</Version>\n      <AssemblyVersion>$(BuildVersionSimple)</AssemblyVersion>\n    </PropertyGroup>\n  </Target>\n\n  <Import Project=\"..\\InterfaceStubGenerator.Shared\\InterfaceStubGenerator.Shared.projitems\" Label=\"Shared\" />\n\n</Project>\n"
  },
  {
    "path": "InterfaceStubGenerator.Roslyn50/InterfaceStubGenerator.Roslyn50.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFrameworks>netstandard2.0</TargetFrameworks>\n    <AssemblyName>InterfaceStubGeneratorV3</AssemblyName>\n    <RootNamespace>Refit.Generator</RootNamespace>\n    <IsPackable>false</IsPackable>\n    <AssemblyOriginatorKeyFile>..\\buildtask.snk</AssemblyOriginatorKeyFile>\n    <SignAssembly>true</SignAssembly>\n    <IsRoslynComponent>true</IsRoslynComponent>\n    <Nullable>enable</Nullable>\n    <DefineConstants>$(DefineConstants);ROSLYN_4;ROSLYN_5</DefineConstants>\n    <MsCACSharpVersion>5.0.0</MsCACSharpVersion>\n    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>\n    <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Microsoft.CodeAnalysis.CSharp\" Version=\"$(MsCACSharpVersion)\" PrivateAssets=\"all\" />\n  </ItemGroup>\n\n  <Target Name=\"SetBuildVer\" AfterTargets=\"GetBuildVersion\" BeforeTargets=\"SetCloudBuildVersionVars;SetCloudBuildNumberWithVersion\">\n    <PropertyGroup>\n      <Version>$(BuildVersion)</Version>\n      <AssemblyVersion>$(BuildVersionSimple)</AssemblyVersion>\n    </PropertyGroup>\n  </Target>\n\n  <Import Project=\"..\\InterfaceStubGenerator.Shared\\InterfaceStubGenerator.Shared.projitems\" Label=\"Shared\" />\n\n</Project>\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/DiagnosticDescriptors.cs",
    "content": "﻿using Microsoft.CodeAnalysis;\n\nnamespace Refit.Generator;\n\ninternal static class DiagnosticDescriptors\n{\n#pragma warning disable RS2008 // Enable analyzer release tracking\n    public static readonly DiagnosticDescriptor InvalidRefitMember =\n        new(\n            \"RF001\",\n            \"Refit types must have Refit HTTP method attributes\",\n            \"Method {0}.{1} either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument\",\n            \"Refit\",\n            DiagnosticSeverity.Warning,\n            true\n        );\n\n    public static readonly DiagnosticDescriptor RefitNotReferenced =\n        new(\n            \"RF002\",\n            \"Refit must be referenced\",\n            \"Refit is not referenced. Add a reference to Refit.\",\n            \"Refit\",\n            DiagnosticSeverity.Error,\n            true\n        );\n#pragma warning restore RS2008 // Enable analyzer release tracking\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/Emitter.cs",
    "content": "﻿using System.Linq;\nusing System.Text;\nusing Microsoft.CodeAnalysis.Text;\n\nnamespace Refit.Generator;\n\ninternal static class Emitter\n{\n    private const string TypeParameterVariableName = \"______typeParameters\";\n\n    public static void EmitSharedCode(\n        ContextGenerationModel model,\n        Action<string, SourceText> addSource\n    )\n    {\n        if (model.Interfaces.Count == 0)\n            return;\n\n        var attributeText = $$\"\"\"\n\n            #pragma warning disable\n            namespace {{model.RefitInternalNamespace}}\n            {\n                [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n                [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n                [global::System.AttributeUsage (global::System.AttributeTargets.Class | global::System.AttributeTargets.Struct | global::System.AttributeTargets.Enum | global::System.AttributeTargets.Constructor | global::System.AttributeTargets.Method | global::System.AttributeTargets.Property | global::System.AttributeTargets.Field | global::System.AttributeTargets.Event | global::System.AttributeTargets.Interface | global::System.AttributeTargets.Delegate)]\n                sealed class PreserveAttribute : global::System.Attribute\n                {\n                    //\n                    // Fields\n                    //\n                    public bool AllMembers;\n\n                    public bool Conditional;\n                }\n            }\n            #pragma warning restore\n\n            \"\"\";\n        // add the attribute text\n        addSource(\"PreserveAttribute.g.cs\", SourceText.From(attributeText, Encoding.UTF8));\n\n        var generatedClassText = $$\"\"\"\n\n            #pragma warning disable\n            namespace Refit.Implementation\n            {\n\n                /// <inheritdoc />\n                [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n                [global::System.Diagnostics.DebuggerNonUserCode]\n                [{{model.PreserveAttributeDisplayName}}]\n                [global::System.Reflection.Obfuscation(Exclude=true)]\n                [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n                internal static partial class Generated\n                {\n            #if NET5_0_OR_GREATER\n                    [System.Runtime.CompilerServices.ModuleInitializer]\n                    [System.Diagnostics.CodeAnalysis.DynamicDependency(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All, typeof(global::Refit.Implementation.Generated))]\n                    public static void Initialize()\n                    {\n                    }\n            #endif\n                }\n            }\n            #pragma warning restore\n\n            \"\"\";\n        addSource(\"Generated.g.cs\", SourceText.From(generatedClassText, Encoding.UTF8));\n    }\n\n    public static SourceText EmitInterface(InterfaceModel model)\n    {\n        var source = new SourceWriter();\n\n        // if nullability is supported emit the nullable directive\n        if (model.Nullability != Nullability.None)\n        {\n            source.WriteLine(\n                \"#nullable \" + (model.Nullability == Nullability.Enabled ? \"enable\" : \"disable\")\n            );\n        }\n\n        source.WriteLine(\n            $$\"\"\"\n            #pragma warning disable\n            namespace Refit.Implementation\n            {\n\n                partial class Generated\n                {\n\n                /// <inheritdoc />\n                [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n                [global::System.Diagnostics.DebuggerNonUserCode]\n                [{{model.PreserveAttributeDisplayName}}]\n                [global::System.Reflection.Obfuscation(Exclude=true)]\n                [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n                partial class {{model.Ns}}{{model.ClassDeclaration}}\n                    : {{model.InterfaceDisplayName}}\n            \"\"\"\n        );\n\n        source.Indentation += 2;\n        GenerateConstraints(source, model.Constraints, false);\n        source.Indentation--;\n\n        source.WriteLine(\n            $$\"\"\"\n            {\n                /// <inheritdoc />\n                public global::System.Net.Http.HttpClient Client { get; }\n                readonly global::Refit.IRequestBuilder requestBuilder;\n\n                /// <inheritdoc />\n                public {{model.Ns}}{{model.ClassSuffix}}(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n                {\n                    Client = client;\n                    this.requestBuilder = requestBuilder;\n                }\n\n            \"\"\"\n        );\n\n        source.Indentation++;\n        var uniqueNames = new UniqueNameBuilder();\n        uniqueNames.Reserve(model.MemberNames);\n\n        // Handle Refit Methods\n        foreach (var method in model.RefitMethods)\n        {\n            WriteRefitMethod(source, method, true, uniqueNames);\n        }\n\n        foreach (var method in model.DerivedRefitMethods)\n        {\n            WriteRefitMethod(source, method, false, uniqueNames);\n        }\n\n        // Handle non-refit Methods that aren't static or properties or have a method body\n        foreach (var method in model.NonRefitMethods)\n        {\n            WriteNonRefitMethod(source, method);\n        }\n\n        // Handle Dispose\n        if (model.DisposeMethod)\n        {\n            WriteDisposableMethod(source);\n        }\n\n        source.Indentation -= 2;\n        source.WriteLine(\n            \"\"\"\n                }\n                }\n            }\n\n            #pragma warning restore\n            \"\"\"\n        );\n        return source.ToSourceText();\n    }\n\n    /// <summary>\n    /// Generates the body of the Refit method\n    /// </summary>\n    /// <param name=\"source\"></param>\n    /// <param name=\"methodModel\"></param>\n    /// <param name=\"isTopLevel\">True if directly from the type we're generating for, false for methods found on base interfaces</param>\n    /// <param name=\"uniqueNames\">Contains the unique member names in the interface scope.</param>\n    private static void WriteRefitMethod(\n        SourceWriter source,\n        MethodModel methodModel,\n        bool isTopLevel,\n        UniqueNameBuilder uniqueNames\n    )\n    {\n        var parameterTypesExpression = GenerateTypeParameterExpression(\n            source,\n            methodModel,\n            uniqueNames\n        );\n\n        var returnType = methodModel.ReturnType;\n        var (isAsync, @return, configureAwait) = methodModel.ReturnTypeMetadata switch\n        {\n            ReturnTypeInfo.AsyncVoid => (true, \"await (\", \").ConfigureAwait(false)\"),\n            ReturnTypeInfo.AsyncResult => (true, \"return await (\", \").ConfigureAwait(false)\"),\n            ReturnTypeInfo.Return => (false, \"return \", \"\"),\n            _ => throw new ArgumentOutOfRangeException(\n                nameof(methodModel.ReturnTypeMetadata),\n                methodModel.ReturnTypeMetadata,\n                \"Unsupported value.\"\n            ),\n        };\n\n        var isExplicit = methodModel.IsExplicitInterface || !isTopLevel;\n        WriteMethodOpening(source, methodModel, isExplicit, isExplicit, isAsync);\n\n        // Build the list of args for the array\n        var argArray = methodModel\n            .Parameters.AsArray()\n            .Select(static param => $\"@{param.MetadataName}\")\n            .ToArray();\n\n        // List of generic arguments\n        var genericArray = methodModel\n            .Constraints.AsArray()\n            .Select(static typeParam => $\"typeof({typeParam.DeclaredName})\")\n            .ToArray();\n\n        var argumentsArrayString =\n            argArray.Length == 0\n                ? \"global::System.Array.Empty<object>()\"\n                : $\"new object[] {{ {string.Join(\", \", argArray)} }}\";\n\n        var genericString =\n            genericArray.Length > 0\n                ? $\", new global::System.Type[] {{ {string.Join(\", \", genericArray)} }}\"\n                : string.Empty;\n\n        // Normalize method lookup key: strip explicit interface prefix if present (e.g. IFoo.Bar -> Bar)\n        var lookupName = methodModel.Name;\n        var lastDotIndex = lookupName.LastIndexOf('.');\n        if (lastDotIndex >= 0 && lastDotIndex < lookupName.Length - 1)\n        {\n            lookupName = lookupName.Substring(lastDotIndex + 1);\n        }\n\n        source.WriteLine(\n            $\"\"\"\n            var ______arguments = {argumentsArrayString};\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"{lookupName}\", {parameterTypesExpression}{genericString} );\n\n            {@return}({returnType})______func(this.Client, ______arguments){configureAwait};\n            \"\"\"\n        );\n\n        WriteMethodClosing(source);\n    }\n\n    private static void WriteNonRefitMethod(SourceWriter source, MethodModel methodModel)\n    {\n        var isExplicit = methodModel.IsExplicitInterface;\n        WriteMethodOpening(source, methodModel, isExplicit, isExplicit);\n\n        source.WriteLine(\n            @\"throw new global::System.NotImplementedException(\"\"Either this method has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument.\"\");\"\n        );\n\n        WriteMethodClosing(source);\n    }\n\n    private static void WriteDisposableMethod(SourceWriter source)\n    {\n        source.WriteLine(\n            \"\"\"\n\n            /// <inheritdoc />\n            void global::System.IDisposable.Dispose()\n            {\n                    Client?.Dispose();\n            }\n            \"\"\"\n        );\n    }\n\n    private static string GenerateTypeParameterExpression(\n        SourceWriter source,\n        MethodModel methodModel,\n        UniqueNameBuilder uniqueNames\n    )\n    {\n        // use Array.Empty if method has no parameters.\n        if (methodModel.Parameters.Count == 0)\n            return \"global::System.Array.Empty<global::System.Type>()\";\n\n        // if one of the parameters is/contains a type parameter then it cannot be cached as it will change type between calls.\n        if (methodModel.Parameters.Any(x => x.IsGeneric))\n        {\n            var typeEnumerable = methodModel.Parameters.Select(param => $\"typeof({param.Type})\");\n            return $\"new global::System.Type[] {{ {string.Join(\", \", typeEnumerable)} }}\";\n        }\n\n        // find a name and generate field declaration.\n        var typeParameterFieldName = uniqueNames.New(TypeParameterVariableName);\n        var types = string.Join(\", \", methodModel.Parameters.Select(x => $\"typeof({x.Type})\"));\n\n        source.WriteLine(\n            $$\"\"\"\n\n            private static readonly global::System.Type[] {{typeParameterFieldName}} = new global::System.Type[] {{{types}} };\n            \"\"\"\n        );\n\n        return typeParameterFieldName;\n    }\n\n    private static void WriteMethodOpening(\n        SourceWriter source,\n        MethodModel methodModel,\n        bool isDerivedExplicitImpl,\n        bool isExplicitInterface,\n        bool isAsync = false\n    )\n    {\n        var visibility = !isExplicitInterface ? \"public \" : string.Empty;\n        var async = isAsync ? \"async \" : \"\";\n\n        var builder = new StringBuilder();\n        builder.Append(\n            @$\"/// <inheritdoc />\n{visibility}{async}{methodModel.ReturnType} \"\n        );\n\n        if (isExplicitInterface)\n        {\n            var ct = methodModel.ContainingType;\n            if (!ct.StartsWith(\"global::\"))\n            {\n                ct = \"global::\" + ct;\n            }\n            builder.Append(@$\"{ct}.\");\n        }\n        builder.Append(@$\"{methodModel.DeclaredMethod}(\");\n\n        if (methodModel.Parameters.Count > 0)\n        {\n            var list = new List<string>();\n            foreach (var param in methodModel.Parameters)\n            {\n                var annotation = param.Annotation;\n                list.Add($@\"{param.Type}{(annotation ? '?' : string.Empty)} @{param.MetadataName}\");\n            }\n\n            builder.Append(string.Join(\", \", list));\n        }\n\n        builder.Append(\")\");\n\n        source.WriteLine();\n        source.WriteLine(builder.ToString());\n        source.Indentation++;\n        GenerateConstraints(source, methodModel.Constraints, isDerivedExplicitImpl || isExplicitInterface);\n        source.Indentation--;\n        source.WriteLine(\"{\");\n        source.Indentation++;\n    }\n\n    private static void WriteMethodClosing(SourceWriter source)\n    {\n        source.Indentation--;\n        source.WriteLine(\"}\");\n    }\n\n    private static void GenerateConstraints(\n        SourceWriter writer,\n        ImmutableEquatableArray<TypeConstraint> typeParameters,\n        bool isOverrideOrExplicitImplementation\n    )\n    {\n        // Need to loop over the constraints and create them\n        foreach (var typeParameter in typeParameters)\n        {\n            WriteConstraintsForTypeParameter(\n                writer,\n                typeParameter,\n                isOverrideOrExplicitImplementation\n            );\n        }\n    }\n\n    private static void WriteConstraintsForTypeParameter(\n        SourceWriter source,\n        TypeConstraint typeParameter,\n        bool isOverrideOrExplicitImplementation\n    )\n    {\n        // Explicit interface implementations and overrides can only have class or struct constraints\n\n        var parameters = new List<string>();\n        var knownConstraints = typeParameter.KnownTypeConstraint;\n        if (knownConstraints.HasFlag(KnownTypeConstraint.Class))\n        {\n            parameters.Add(\"class\");\n        }\n        if (\n            knownConstraints.HasFlag(KnownTypeConstraint.Unmanaged)\n            && !isOverrideOrExplicitImplementation\n        )\n        {\n            parameters.Add(\"unmanaged\");\n        }\n        if (knownConstraints.HasFlag(KnownTypeConstraint.Struct))\n        {\n            parameters.Add(\"struct\");\n        }\n        if (\n            knownConstraints.HasFlag(KnownTypeConstraint.NotNull)\n            && !isOverrideOrExplicitImplementation\n        )\n        {\n            parameters.Add(\"notnull\");\n        }\n        if (!isOverrideOrExplicitImplementation)\n        {\n            parameters.AddRange(typeParameter.Constraints);\n        }\n\n        // new constraint has to be last\n        if (\n            knownConstraints.HasFlag(KnownTypeConstraint.New) && !isOverrideOrExplicitImplementation\n        )\n        {\n            parameters.Add(\"new()\");\n        }\n\n        if (parameters.Count > 0)\n        {\n            source.WriteLine($\"where {typeParameter.TypeName} : {string.Join(\", \", parameters)}\");\n        }\n    }\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/ITypeSymbolExtensions.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Microsoft.CodeAnalysis;\n\nnamespace Refit.Generator\n{\n    static class ITypeSymbolExtensions\n    {\n        public static IEnumerable<ITypeSymbol> GetBaseTypesAndThis(this ITypeSymbol? type)\n        {\n            var current = type;\n            while (current != null)\n            {\n                yield return current;\n                current = current.BaseType;\n            }\n        }\n\n        // Determine if \"type\" inherits from \"baseType\", ignoring constructed types, optionally including interfaces,\n        // dealing only with original types.\n        public static bool InheritsFromOrEquals(\n            this ITypeSymbol type,\n            ITypeSymbol baseType,\n            bool includeInterfaces\n        )\n        {\n            if (!includeInterfaces)\n            {\n                return InheritsFromOrEquals(type, baseType);\n            }\n\n            return type.GetBaseTypesAndThis()\n                .Concat(type.AllInterfaces)\n                .Any(t => t.Equals(baseType, SymbolEqualityComparer.Default));\n        }\n\n        // Determine if \"type\" inherits from \"baseType\", ignoring constructed types and interfaces, dealing\n        // only with original types.\n        public static bool InheritsFromOrEquals(this ITypeSymbol type, ITypeSymbol baseType)\n        {\n            return type.GetBaseTypesAndThis()\n                .Any(t => t.Equals(baseType, SymbolEqualityComparer.Default));\n        }\n    }\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/ImmutableEquatableArray.cs",
    "content": "﻿using System.Collections;\n\nnamespace Refit.Generator;\n\ninternal static class ImmutableEquatableArray\n{\n    public static ImmutableEquatableArray<T> Empty<T>()\n        where T : IEquatable<T> => ImmutableEquatableArray<T>.Empty;\n\n    public static ImmutableEquatableArray<T> ToImmutableEquatableArray<T>(\n        this IEnumerable<T>? values\n    )\n        where T : IEquatable<T> => values == null ? Empty<T>() : new(values);\n}\n\n/// <summary>\n/// Provides an immutable list implementation which implements sequence equality.\n/// </summary>\ninternal sealed class ImmutableEquatableArray<T>\n    : IEquatable<ImmutableEquatableArray<T>>,\n        IReadOnlyList<T>\n    where T : IEquatable<T>\n{\n    public static ImmutableEquatableArray<T> Empty { get; } = new(Array.Empty<T>());\n\n    private readonly T[] _values;\n    public T this[int index] => _values[index];\n    public int Count => _values.Length;\n\n    public ImmutableEquatableArray(T[] values) => _values = values;\n\n    public ImmutableEquatableArray(IEnumerable<T> values) => _values = values.ToArray();\n\n    public T[] AsArray() => _values;\n\n    public bool Equals(ImmutableEquatableArray<T>? other) =>\n        other != null && ((ReadOnlySpan<T>)_values).SequenceEqual(other._values);\n\n    public override bool Equals(object? obj) =>\n        obj is ImmutableEquatableArray<T> other && Equals(other);\n\n    public override int GetHashCode()\n    {\n        var hash = 0;\n        foreach (T value in _values)\n        {\n            hash = Combine(hash, value.GetHashCode());\n        }\n\n        static int Combine(int h1, int h2)\n        {\n            // RyuJIT optimizes this to use the ROL instruction\n            // Related GitHub pull request: https://github.com/dotnet/coreclr/pull/1830\n            uint rol5 = ((uint)h1 << 5) | ((uint)h1 >> 27);\n            return ((int)rol5 + h1) ^ h2;\n        }\n\n        return hash;\n    }\n\n    public Enumerator GetEnumerator() => new(_values);\n\n    IEnumerator<T> IEnumerable<T>.GetEnumerator() => ((IEnumerable<T>)_values).GetEnumerator();\n\n    IEnumerator IEnumerable.GetEnumerator() => _values.GetEnumerator();\n\n    public record struct Enumerator\n    {\n        private readonly T[] _values;\n        private int _index;\n\n        internal Enumerator(T[] values)\n        {\n            _values = values;\n            _index = -1;\n        }\n\n        public bool MoveNext()\n        {\n            var newIndex = _index + 1;\n\n            if ((uint)newIndex < (uint)_values.Length)\n            {\n                _index = newIndex;\n                return true;\n            }\n\n            return false;\n        }\n\n        public readonly T Current => _values[_index];\n    }\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/IncrementalValuesProviderExtensions.cs",
    "content": "﻿#if ROSLYN_4\nusing System.Text;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.Text;\n\nnamespace Refit.Generator;\n\ninternal static class IncrementalValuesProviderExtensions\n{\n    /// <summary>\n    /// Registers an output node into an <see cref=\"IncrementalGeneratorInitializationContext\"/> to output a diagnostic.\n    /// </summary>\n    /// <param name=\"context\">The input <see cref=\"IncrementalGeneratorInitializationContext\"/> instance.</param>\n    /// <param name=\"diagnostic\">The input <see cref=\"IncrementalValuesProvider{TValues}\"/> sequence of diagnostics.</param>\n    public static void ReportDiagnostics(\n        this IncrementalGeneratorInitializationContext context,\n        IncrementalValuesProvider<Diagnostic> diagnostic\n    )\n    {\n        context.RegisterSourceOutput(\n            diagnostic,\n            static (context, diagnostic) => context.ReportDiagnostic(diagnostic)\n        );\n    }\n\n    /// <summary>\n    /// Registers an output node into an <see cref=\"IncrementalGeneratorInitializationContext\"/> to output diagnostics.\n    /// </summary>\n    /// <param name=\"context\">The input <see cref=\"IncrementalGeneratorInitializationContext\"/> instance.</param>\n    /// <param name=\"diagnostics\">The input <see cref=\"IncrementalValuesProvider{TValues}\"/> sequence of diagnostics.</param>\n    public static void ReportDiagnostics(\n        this IncrementalGeneratorInitializationContext context,\n        IncrementalValueProvider<ImmutableEquatableArray<Diagnostic>> diagnostics\n    )\n    {\n        context.RegisterSourceOutput(\n            diagnostics,\n            static (context, diagnostics) =>\n            {\n                foreach (var diagnostic in diagnostics)\n                {\n                    context.ReportDiagnostic(diagnostic);\n                }\n            }\n        );\n    }\n\n    /// <summary>\n    /// Registers an implementation source output for the provided mappers.\n    /// </summary>\n    /// <param name=\"context\">The context, on which the output is registered.</param>\n    /// <param name=\"model\">The interfaces stubs.</param>\n    public static void EmitSource(\n        this IncrementalGeneratorInitializationContext context,\n        IncrementalValuesProvider<InterfaceModel> model\n    )\n    {\n        context.RegisterImplementationSourceOutput(\n            model,\n            static (spc, model) =>\n            {\n                var mapperText = Emitter.EmitInterface(model);\n                spc.AddSource(model.FileName, mapperText);\n            }\n        );\n    }\n}\n#endif\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/InterfaceStubGenerator.Shared.projitems",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <MSBuildAllProjects Condition=\"'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'\">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>\n    <HasSharedItems>true</HasSharedItems>\n    <SharedGUID>b591423d-f92d-4e00-b0eb-615c9853506c</SharedGUID>\n  </PropertyGroup>\n  <PropertyGroup Label=\"Configuration\">\n    <Import_RootNamespace>InterfaceStubGenerator.Shared</Import_RootNamespace>\n  </PropertyGroup>\n  <ItemGroup>\n    <Compile Include=\"$(MSBuildThisFileDirectory)DiagnosticDescriptors.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)Emitter.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)ImmutableEquatableArray.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)IncrementalValuesProviderExtensions.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)InterfaceStubGenerator.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)IsExternalInit.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)ITypeSymbolExtensions.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)Models\\ContextGenerationModel.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)Models\\InterfaceModel.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)Models\\MethodModel.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)Models\\ParameterModel.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)Models\\TypeConstraint.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)Models\\WellKnownTypes.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)Parser.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)Polyfills\\IndexRange.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)SourceWriter.cs\" />\n    <Compile Include=\"$(MSBuildThisFileDirectory)UniqueNameBuilder.cs\" />\n  </ItemGroup>\n</Project>"
  },
  {
    "path": "InterfaceStubGenerator.Shared/InterfaceStubGenerator.Shared.shproj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup Label=\"Globals\">\n    <ProjectGuid>b591423d-f92d-4e00-b0eb-615c9853506c</ProjectGuid>\n    <MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>\n  </PropertyGroup>\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <Import Project=\"$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.Common.Default.props\" />\n  <Import Project=\"$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.Common.props\" />\n  <PropertyGroup />\n  <Import Project=\"InterfaceStubGenerator.Shared.projitems\" Label=\"Shared\" />\n  <Import Project=\"$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\CodeSharing\\Microsoft.CodeSharing.CSharp.targets\" />\n</Project>\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/InterfaceStubGenerator.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Collections.Immutable;\nusing System.Linq;\nusing System.Text;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Text;\n\nnamespace Refit.Generator\n{\n    /// <summary>\n    /// InterfaceStubGenerator.\n    /// </summary>\n    [Generator]\n#if ROSLYN_4\n    public class InterfaceStubGeneratorV2 : IIncrementalGenerator\n#else\n    public class InterfaceStubGenerator : ISourceGenerator\n#endif\n    {\n        private const string TypeParameterVariableName = \"______typeParameters\";\n\n#if !ROSLYN_4\n        /// <summary>\n        /// Executes the specified context.\n        /// </summary>\n        /// <param name=\"context\">The context.</param>\n        public void Execute(GeneratorExecutionContext context)\n        {\n            if (context.SyntaxReceiver is not SyntaxReceiver receiver)\n                return;\n\n            context.AnalyzerConfigOptions.GlobalOptions.TryGetValue(\n                \"build_property.RefitInternalNamespace\",\n                out var refitInternalNamespace\n            );\n\n            var parseStep = Parser.GenerateInterfaceStubs(\n                (CSharpCompilation)context.Compilation,\n                refitInternalNamespace,\n                receiver.CandidateMethods.ToImmutableArray(),\n                receiver.CandidateInterfaces.ToImmutableArray(),\n                context.CancellationToken\n            );\n\n            foreach (var diagnostic in parseStep.diagnostics)\n            {\n                context.ReportDiagnostic(diagnostic);\n            }\n\n            foreach (var interfaceModel in parseStep.contextGenerationSpec.Interfaces)\n            {\n                var interfaceText = Emitter.EmitInterface(interfaceModel);\n                context.AddSource(\n                    interfaceModel.FileName,\n                    interfaceText\n                );\n            }\n\n            Emitter.EmitSharedCode(\n                parseStep.contextGenerationSpec,\n                (name, code) => context.AddSource(name, code)\n            );\n        }\n#endif\n\n#if ROSLYN_4\n        /// <inheritdoc/>\n        public void Initialize(IncrementalGeneratorInitializationContext context)\n        {\n            var candidateMethodsProvider = context.SyntaxProvider.CreateSyntaxProvider(\n                (syntax, cancellationToken) =>\n                    syntax\n                        is MethodDeclarationSyntax\n                        {\n                            Parent: InterfaceDeclarationSyntax,\n                            AttributeLists.Count: > 0\n                        },\n                (context, cancellationToken) => (MethodDeclarationSyntax)context.Node\n            );\n\n            var candidateInterfacesProvider = context.SyntaxProvider.CreateSyntaxProvider(\n                (syntax, cancellationToken) =>\n                    syntax is InterfaceDeclarationSyntax { BaseList: not null },\n                (context, cancellationToken) => (InterfaceDeclarationSyntax)context.Node\n            );\n\n            var refitInternalNamespace = context.AnalyzerConfigOptionsProvider.Select(\n                (analyzerConfigOptionsProvider, cancellationToken) =>\n                    analyzerConfigOptionsProvider.GlobalOptions.TryGetValue(\n                        \"build_property.RefitInternalNamespace\",\n                        out var refitInternalNamespace\n                    )\n                        ? refitInternalNamespace\n                        : null\n            );\n\n            var inputs = candidateMethodsProvider\n                .Collect()\n                .Combine(candidateInterfacesProvider.Collect())\n                .Select(\n                    (combined, cancellationToken) =>\n                        (candidateMethods: combined.Left, candidateInterfaces: combined.Right)\n                )\n                .Combine(refitInternalNamespace)\n                .Combine(context.CompilationProvider)\n                .Select(\n                    (combined, cancellationToken) =>\n                        (\n                            combined.Left.Left.candidateMethods,\n                            combined.Left.Left.candidateInterfaces,\n                            refitInternalNamespace: combined.Left.Right,\n                            compilation: combined.Right\n                        )\n                );\n\n            var parseStep = inputs.Select(\n                (collectedValues, cancellationToken) =>\n                {\n                    return Parser.GenerateInterfaceStubs(\n                        (CSharpCompilation)collectedValues.compilation,\n                        collectedValues.refitInternalNamespace,\n                        collectedValues.candidateMethods,\n                        collectedValues.candidateInterfaces,\n                        cancellationToken\n                    );\n                }\n            );\n\n            var diagnostics = parseStep\n                .Select(static (x, _) => x.diagnostics.ToImmutableEquatableArray())\n                .WithTrackingName(RefitGeneratorStepName.ReportDiagnostics);\n            context.ReportDiagnostics(diagnostics);\n\n            var contextModel = parseStep.Select(static (x, _) => x.Item2);\n            var interfaceModels = contextModel\n                .SelectMany(static (x, _) => x.Interfaces)\n                .WithTrackingName(RefitGeneratorStepName.BuildRefit);\n            context.EmitSource(interfaceModels);\n\n            context.RegisterImplementationSourceOutput(\n                contextModel,\n                static (spc, model) =>\n                {\n                    Emitter.EmitSharedCode(model, (name, code) => spc.AddSource(name, code));\n                }\n            );\n        }\n#else\n        /// <summary>\n        /// Initializes the specified context.\n        /// </summary>\n        /// <param name=\"context\">The context.</param>\n        public void Initialize(GeneratorInitializationContext context)\n        {\n            context.RegisterForSyntaxNotifications(() => new SyntaxReceiver());\n        }\n\n        class SyntaxReceiver : ISyntaxReceiver\n        {\n            public List<MethodDeclarationSyntax> CandidateMethods { get; } = [];\n\n            public List<InterfaceDeclarationSyntax> CandidateInterfaces { get; } = [];\n\n            public void OnVisitSyntaxNode(SyntaxNode syntaxNode)\n            {\n                if (\n                    syntaxNode is MethodDeclarationSyntax methodDeclarationSyntax\n                    && methodDeclarationSyntax.Parent is InterfaceDeclarationSyntax\n                    && methodDeclarationSyntax.AttributeLists.Count > 0\n                )\n                {\n                    CandidateMethods.Add(methodDeclarationSyntax);\n                }\n\n                if (syntaxNode is InterfaceDeclarationSyntax iface && iface.BaseList is not null)\n                {\n                    CandidateInterfaces.Add(iface);\n                }\n            }\n        }\n#endif\n    }\n\n    internal static class RefitGeneratorStepName\n    {\n        public const string ReportDiagnostics = \"ReportDiagnostics\";\n        public const string BuildRefit = \"BuildRefit\";\n    }\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/IsExternalInit.cs",
    "content": "﻿// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\n#if NETSTANDARD2_0 || NETSTANDARD2_1 || NETCOREAPP2_0 || NETCOREAPP2_1 || NETCOREAPP2_2 || NETCOREAPP3_0 || NETCOREAPP3_1 || NET45 || NET451 || NET452 || NET6 || NET461 || NET462 || NET47 || NET471 || NET472 || NET48\n\nusing System.ComponentModel;\n\n// ReSharper disable once CheckNamespace\nnamespace System.Runtime.CompilerServices\n{\n    /// <summary>\n    /// Reserved to be used by the compiler for tracking metadata.\n    /// This class should not be used by developers in source code.\n    /// </summary>\n    [EditorBrowsable(EditorBrowsableState.Never)]\n    internal static class IsExternalInit { }\n}\n\n#endif\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/Models/ContextGenerationModel.cs",
    "content": "﻿namespace Refit.Generator;\n\ninternal sealed record ContextGenerationModel(\n    string RefitInternalNamespace,\n    string PreserveAttributeDisplayName,\n    ImmutableEquatableArray<InterfaceModel> Interfaces\n);\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/Models/InterfaceModel.cs",
    "content": "﻿namespace Refit.Generator;\n\ninternal sealed record InterfaceModel(\n    string PreserveAttributeDisplayName,\n    string FileName,\n    string ClassName,\n    string Ns,\n    string ClassDeclaration,\n    string InterfaceDisplayName,\n    string ClassSuffix,\n    ImmutableEquatableArray<TypeConstraint> Constraints,\n    ImmutableEquatableArray<string> MemberNames,\n    ImmutableEquatableArray<MethodModel> NonRefitMethods,\n    ImmutableEquatableArray<MethodModel> RefitMethods,\n    ImmutableEquatableArray<MethodModel> DerivedRefitMethods,\n    Nullability Nullability,\n    bool DisposeMethod\n);\n\ninternal enum Nullability : byte\n{\n    Enabled,\n    Disabled,\n    None\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/Models/MethodModel.cs",
    "content": "﻿using System.Collections.Immutable;\n\nnamespace Refit.Generator;\n\ninternal sealed record MethodModel(\n    string Name,\n    string ReturnType,\n    string ContainingType,\n    string DeclaredMethod,\n    ReturnTypeInfo ReturnTypeMetadata,\n    ImmutableEquatableArray<ParameterModel> Parameters,\n    ImmutableEquatableArray<TypeConstraint> Constraints,\n    bool IsExplicitInterface\n);\n\ninternal enum ReturnTypeInfo : byte\n{\n    Return,\n    AsyncVoid,\n    AsyncResult\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/Models/ParameterModel.cs",
    "content": "﻿namespace Refit.Generator;\n\ninternal sealed record ParameterModel(\n    string MetadataName,\n    string Type,\n    bool Annotation,\n    bool IsGeneric\n);\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/Models/TypeConstraint.cs",
    "content": "﻿namespace Refit.Generator;\n\ninternal readonly record struct TypeConstraint(\n    string TypeName,\n    string DeclaredName,\n    KnownTypeConstraint KnownTypeConstraint,\n    ImmutableEquatableArray<string> Constraints\n);\n\n[Flags]\ninternal enum KnownTypeConstraint : byte\n{\n    None = 0,\n    Class = 1 << 0,\n    Unmanaged = 1 << 1,\n    Struct = 1 << 2,\n    NotNull = 1 << 3,\n    New = 1 << 4\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/Models/WellKnownTypes.cs",
    "content": "﻿using Microsoft.CodeAnalysis;\n\nnamespace Refit.Generator;\n\n/// <summary>\n/// WellKnownTypes.\n/// </summary>\npublic class WellKnownTypes(Compilation compilation)\n{\n    readonly Dictionary<string, INamedTypeSymbol?> cachedTypes = [];\n\n    /// <summary>\n    /// Gets this instance.\n    /// </summary>\n    /// <typeparam name=\"T\"></typeparam>\n    /// <returns></returns>\n    public INamedTypeSymbol Get<T>() => Get(typeof(T));\n\n    /// <summary>\n    /// Gets the specified type.\n    /// </summary>\n    /// <param name=\"type\">The type.</param>\n    /// <returns></returns>\n    /// <exception cref=\"InvalidOperationException\">Could not get name of type \" + type</exception>\n    public INamedTypeSymbol Get(Type type)\n    {\n        if (type is null)\n        {\n            throw new ArgumentNullException(nameof(type));\n        }\n\n        return Get(type.FullName ?? throw new InvalidOperationException(\"Could not get name of type \" + type));\n    }\n\n    /// <summary>\n    /// Tries the get.\n    /// </summary>\n    /// <param name=\"typeFullName\">Full name of the type.</param>\n    /// <returns></returns>\n    public INamedTypeSymbol? TryGet(string typeFullName)\n    {\n        if (cachedTypes.TryGetValue(typeFullName, out var typeSymbol))\n        {\n            return typeSymbol;\n        }\n\n        typeSymbol = compilation.GetTypeByMetadataName(typeFullName);\n        cachedTypes.Add(typeFullName, typeSymbol);\n\n        return typeSymbol;\n    }\n\n    INamedTypeSymbol Get(string typeFullName) =>\n        TryGet(typeFullName) ?? throw new InvalidOperationException(\"Could not get type \" + typeFullName);\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/Parser.cs",
    "content": "﻿using System.Collections.Immutable;\nusing System.Text;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\nusing Microsoft.CodeAnalysis.Text;\n\nnamespace Refit.Generator;\n\ninternal static class Parser\n{\n    /// <summary>\n    /// Generates the interface stubs.\n    /// </summary>\n    /// <param name=\"compilation\">The compilation.</param>\n    /// <param name=\"refitInternalNamespace\">The refit internal namespace.</param>\n    /// <param name=\"candidateMethods\">The candidate methods.</param>\n    /// <param name=\"candidateInterfaces\">The candidate interfaces.</param>\n    /// <param name=\"cancellationToken\">The cancellation token.</param>\n    /// <returns></returns>\n    public static (\n        List<Diagnostic> diagnostics,\n        ContextGenerationModel contextGenerationSpec\n    ) GenerateInterfaceStubs(\n        CSharpCompilation compilation,\n        string? refitInternalNamespace,\n        ImmutableArray<MethodDeclarationSyntax> candidateMethods,\n        ImmutableArray<InterfaceDeclarationSyntax> candidateInterfaces,\n        CancellationToken cancellationToken\n    )\n    {\n        if (compilation == null)\n            throw new ArgumentNullException(nameof(compilation));\n\n        var wellKnownTypes = new WellKnownTypes(compilation);\n\n        refitInternalNamespace = $\"{refitInternalNamespace ?? string.Empty}RefitInternalGenerated\";\n\n        // Remove - as they are valid in csproj, but invalid in a namespace\n        refitInternalNamespace = refitInternalNamespace.Replace('-', '_').Replace('@', '_');\n\n        // we're going to create a new compilation that contains the attribute.\n        // TODO: we should allow source generators to provide source during initialize, so that this step isn't required.\n        var options = (CSharpParseOptions)compilation.SyntaxTrees[0].Options;\n\n        var disposableInterfaceSymbol = wellKnownTypes.Get(typeof(IDisposable));\n        var httpMethodBaseAttributeSymbol = wellKnownTypes.TryGet(\n            \"Refit.HttpMethodAttribute\"\n        );\n\n        var diagnostics = new List<Diagnostic>();\n        if (httpMethodBaseAttributeSymbol == null)\n        {\n            diagnostics.Add(Diagnostic.Create(DiagnosticDescriptors.RefitNotReferenced, null));\n            return (\n                diagnostics,\n                new ContextGenerationModel(\n                    refitInternalNamespace,\n                    string.Empty,\n                    ImmutableEquatableArray.Empty<InterfaceModel>()\n                )\n            );\n        }\n\n        // Check the candidates and keep the ones we're actually interested in\n\n#pragma warning disable RS1024 // Compare symbols correctly\n        var interfaceToNullableEnabledMap = new Dictionary<INamedTypeSymbol, bool>(\n            SymbolEqualityComparer.Default\n        );\n#pragma warning restore RS1024 // Compare symbols correctly\n        var methodSymbols = new List<IMethodSymbol>();\n        foreach (var group in candidateMethods.GroupBy(m => m.SyntaxTree))\n        {\n            var model = compilation.GetSemanticModel(group.Key);\n            foreach (var method in group)\n            {\n                // Get the symbol being declared by the method\n                var methodSymbol = model.GetDeclaredSymbol(\n                    method,\n                    cancellationToken: cancellationToken\n                );\n                if (!IsRefitMethod(methodSymbol, httpMethodBaseAttributeSymbol))\n                    continue;\n\n                var isAnnotated =\n                    compilation.Options.NullableContextOptions == NullableContextOptions.Enable\n                    || model.GetNullableContext(method.SpanStart) == NullableContext.Enabled;\n                interfaceToNullableEnabledMap[methodSymbol!.ContainingType] = isAnnotated;\n\n                methodSymbols.Add(methodSymbol!);\n            }\n        }\n\n        var interfaces = methodSymbols\n            .GroupBy<IMethodSymbol, INamedTypeSymbol>(\n                m => m.ContainingType,\n                SymbolEqualityComparer.Default\n            )\n            .ToDictionary<\n                IGrouping<INamedTypeSymbol, IMethodSymbol>,\n                INamedTypeSymbol,\n                List<IMethodSymbol>\n            >(g => g.Key, v => [.. v], SymbolEqualityComparer.Default);\n\n        // Look through the candidate interfaces\n        var interfaceSymbols = new List<INamedTypeSymbol>();\n        foreach (var group in candidateInterfaces.GroupBy(i => i.SyntaxTree))\n        {\n            var model = compilation.GetSemanticModel(group.Key);\n            foreach (var iface in group)\n            {\n                // get the symbol belonging to the interface\n                var ifaceSymbol = model.GetDeclaredSymbol(\n                    iface,\n                    cancellationToken: cancellationToken\n                );\n\n                // See if we already know about it, might be a dup\n                if (ifaceSymbol is null || interfaces.ContainsKey(ifaceSymbol))\n                    continue;\n\n                // The interface has no refit methods, but its base interfaces might\n                var hasDerivedRefit = ifaceSymbol\n                    .AllInterfaces.SelectMany(i => i.GetMembers().OfType<IMethodSymbol>())\n                    .Any(m => IsRefitMethod(m, httpMethodBaseAttributeSymbol));\n\n                if (hasDerivedRefit)\n                {\n                    // Add the interface to the generation list with an empty set of methods\n                    // The logic already looks for base refit methods\n                    interfaces.Add(ifaceSymbol, []);\n                    var isAnnotated =\n                        model.GetNullableContext(iface.SpanStart) == NullableContext.Enabled;\n\n                    interfaceToNullableEnabledMap[ifaceSymbol] = isAnnotated;\n                }\n            }\n        }\n\n        cancellationToken.ThrowIfCancellationRequested();\n\n        // Bail out if there aren't any interfaces to generate code for. This may be the case with transitives\n        if (interfaces.Count == 0)\n            return (\n                diagnostics,\n                new ContextGenerationModel(\n                    refitInternalNamespace,\n                    string.Empty,\n                    ImmutableEquatableArray.Empty<InterfaceModel>()\n                )\n            );\n\n        var supportsNullable = options.LanguageVersion >= LanguageVersion.CSharp8;\n\n        var keyCount = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase);\n\n        var attributeText =\n            @$\"\n#pragma warning disable\nnamespace {refitInternalNamespace}\n{{\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    [global::System.AttributeUsage (global::System.AttributeTargets.Class | global::System.AttributeTargets.Struct | global::System.AttributeTargets.Enum | global::System.AttributeTargets.Constructor | global::System.AttributeTargets.Method | global::System.AttributeTargets.Property | global::System.AttributeTargets.Field | global::System.AttributeTargets.Event | global::System.AttributeTargets.Interface | global::System.AttributeTargets.Delegate)]\n    sealed class PreserveAttribute : global::System.Attribute\n    {{\n        //\n        // Fields\n        //\n        public bool AllMembers;\n\n        public bool Conditional;\n    }}\n}}\n#pragma warning restore\n\";\n\n        // TODO: Delete?\n        // Is it necessary to add the attributes to the compilation now, does it affect the users ide experience?\n        // Is it needed in order to get the preserve attribute display name.\n        // Will the compilation ever change this.\n        compilation = compilation.AddSyntaxTrees(\n            CSharpSyntaxTree.ParseText(\n                SourceText.From(attributeText, Encoding.UTF8),\n                options,\n                cancellationToken: cancellationToken\n            )\n        );\n\n        // get the newly bound attribute\n        var preserveAttributeSymbol = compilation.GetTypeByMetadataName(\n            $\"{refitInternalNamespace}.PreserveAttribute\"\n        )!;\n\n        var preserveAttributeDisplayName = preserveAttributeSymbol.ToDisplayString(\n            SymbolDisplayFormat.FullyQualifiedFormat\n        );\n\n        var interfaceModels = new List<InterfaceModel>();\n        // group the fields by interface and generate the source\n        foreach (var group in interfaces)\n        {\n            cancellationToken.ThrowIfCancellationRequested();\n\n            // each group is keyed by the Interface INamedTypeSymbol and contains the members\n            // with a refit attribute on them. Types may contain other members, without the attribute, which we'll\n            // need to check for and error out on\n            var keyName = group.Key.Name;\n            int value;\n            while (keyCount.TryGetValue(keyName, out value))\n            {\n                keyName = $\"{keyName}{++value}\";\n            }\n            keyCount[keyName] = value;\n            var fileName = $\"{keyName}.g.cs\";\n\n            var interfaceModel = ProcessInterface(\n                fileName,\n                diagnostics,\n                group.Key,\n                group.Value,\n                preserveAttributeDisplayName,\n                disposableInterfaceSymbol,\n                httpMethodBaseAttributeSymbol,\n                supportsNullable,\n                interfaceToNullableEnabledMap[group.Key]\n            );\n\n            interfaceModels.Add(interfaceModel);\n        }\n\n        var contextGenerationSpec = new ContextGenerationModel(\n            refitInternalNamespace,\n            preserveAttributeDisplayName,\n            interfaceModels.ToImmutableEquatableArray()\n        );\n        return (diagnostics, contextGenerationSpec);\n    }\n\n    static InterfaceModel ProcessInterface(\n        string fileName,\n        List<Diagnostic> diagnostics,\n        INamedTypeSymbol interfaceSymbol,\n        List<IMethodSymbol> refitMethods,\n        string preserveAttributeDisplayName,\n        ISymbol disposableInterfaceSymbol,\n        INamedTypeSymbol httpMethodBaseAttributeSymbol,\n        bool supportsNullable,\n        bool nullableEnabled\n    )\n    {\n        // Get the class name with the type parameters, then remove the namespace\n        var className = interfaceSymbol.ToDisplayString();\n        var lastDot = className.LastIndexOf('.');\n        if (lastDot > 0)\n        {\n            className = className.Substring(lastDot + 1);\n        }\n        var classDeclaration = $\"{interfaceSymbol.ContainingType?.Name}{className}\";\n\n        // Get the class name itself\n        var classSuffix = $\"{interfaceSymbol.ContainingType?.Name}{interfaceSymbol.Name}\";\n        var ns = interfaceSymbol.ContainingNamespace?.ToDisplayString();\n\n        // if it's the global namespace, our lookup rules say it should be the same as the class name\n        if (interfaceSymbol.ContainingNamespace is { IsGlobalNamespace: true })\n        {\n            ns = string.Empty;\n        }\n\n        // Remove dots\n        ns = ns!.Replace(\".\", \"\");\n        var interfaceDisplayName = interfaceSymbol.ToDisplayString(\n            SymbolDisplayFormat.FullyQualifiedFormat\n        );\n\n        // Get any other methods on the refit interfaces. We'll need to generate something for them and warn\n        var nonRefitMethods = interfaceSymbol\n            .GetMembers()\n            .OfType<IMethodSymbol>()\n            .Except(refitMethods, SymbolEqualityComparer.Default)\n            .Cast<IMethodSymbol>()\n            .ToArray();\n\n        // get methods for all inherited\n        var derivedMethods = interfaceSymbol\n            .AllInterfaces.SelectMany(i => i.GetMembers().OfType<IMethodSymbol>())\n            .ToList();\n\n        // Look for disposable\n        var disposeMethod = derivedMethods.Find(\n            m =>\n                m.ContainingType?.Equals(disposableInterfaceSymbol, SymbolEqualityComparer.Default)\n                == true\n        );\n        if (disposeMethod != null)\n        {\n            //remove it from the derived methods list so we don't process it with the rest\n            derivedMethods.Remove(disposeMethod);\n        }\n\n        // Pull out the refit methods from the derived types\n        var derivedRefitMethods = derivedMethods\n            .Where(m => IsRefitMethod(m, httpMethodBaseAttributeSymbol))\n            .ToArray();\n        var derivedNonRefitMethods = derivedMethods\n            .Except(derivedRefitMethods, SymbolEqualityComparer.Default)\n            .Cast<IMethodSymbol>()\n            .ToArray();\n\n        // Exclude base interface methods that the current interface explicitly implements.\n        // This avoids false positive RF001 diagnostics for cases like:\n        // interface IFoo { int Bar(); } and interface IRemoteFoo : IFoo { [Get] abstract int IFoo.Bar(); }\n        if (derivedNonRefitMethods.Length > 0)\n        {\n            var explicitlyImplementedBaseMethods = new HashSet<IMethodSymbol>(\n                SymbolEqualityComparer.Default\n            );\n\n            foreach (var member in interfaceSymbol.GetMembers().OfType<IMethodSymbol>())\n            {\n                foreach (var baseMethod in member.ExplicitInterfaceImplementations)\n                {\n                    // Use OriginalDefinition for robustness when comparing generic methods\n                    explicitlyImplementedBaseMethods.Add(\n                        baseMethod.OriginalDefinition ?? baseMethod\n                    );\n                }\n            }\n\n            if (explicitlyImplementedBaseMethods.Count > 0)\n            {\n                derivedNonRefitMethods = derivedNonRefitMethods\n                    .Where(m => !explicitlyImplementedBaseMethods.Contains(m.OriginalDefinition ?? m))\n                    .ToArray();\n            }\n        }\n\n        var memberNames = interfaceSymbol\n            .GetMembers()\n            .Select(x => x.Name)\n            .Distinct()\n            .ToImmutableEquatableArray();\n\n        // Handle Refit Methods\n        var refitMethodsArray = refitMethods\n            .Select(m => ParseMethod(m, true))\n            .ToImmutableEquatableArray();\n\n        // Only include refit methods discovered on base interfaces here.\n        // Do NOT duplicate the current interface's refit methods.\n        var derivedRefitMethodsArray = derivedRefitMethods\n            .Select(m => ParseMethod(m, false))\n            .ToImmutableEquatableArray();\n\n        // Handle non-refit Methods that aren't static or properties or have a method body\n        var nonRefitMethodModelList = new List<MethodModel>();\n        foreach (var method in nonRefitMethods)\n        {\n            if (\n                method.IsStatic\n                || method.MethodKind == MethodKind.PropertyGet\n                || method.MethodKind == MethodKind.PropertySet\n                || !method.IsAbstract\n            )\n                continue;\n\n            nonRefitMethodModelList.Add(ParseNonRefitMethod(method, diagnostics, isDerived: false));\n        }\n        foreach (var method in derivedNonRefitMethods)\n        {\n            if (\n                method.IsStatic\n                || method.MethodKind == MethodKind.PropertyGet\n                || method.MethodKind == MethodKind.PropertySet\n                || !method.IsAbstract\n            )\n                continue;\n\n            // Derived non-refit methods should be emitted as explicit interface implementations\n            nonRefitMethodModelList.Add(ParseNonRefitMethod(method, diagnostics, isDerived: true));\n        }\n\n        var nonRefitMethodModels = nonRefitMethodModelList.ToImmutableEquatableArray();\n\n        var constraints = GenerateConstraints(interfaceSymbol.TypeParameters, false);\n        var hasDispose = disposeMethod != null;\n        var nullability = (supportsNullable, nullableEnabled) switch\n        {\n            (false, _) => Nullability.None,\n            (true, true) => Nullability.Enabled,\n            (true, false) => Nullability.Disabled,\n        };\n        return new InterfaceModel(\n            preserveAttributeDisplayName,\n            fileName,\n            className,\n            ns,\n            classDeclaration,\n            interfaceDisplayName,\n            classSuffix,\n            constraints,\n            memberNames,\n            nonRefitMethodModels,\n            refitMethodsArray,\n            derivedRefitMethodsArray,\n            nullability,\n            hasDispose\n        );\n    }\n\n    private static MethodModel ParseNonRefitMethod(\n        IMethodSymbol methodSymbol,\n        List<Diagnostic> diagnostics,\n        bool isDerived\n    )\n    {\n        // report invalid error diagnostic\n        foreach (var location in methodSymbol.Locations)\n        {\n            var diagnostic = Diagnostic.Create(\n                DiagnosticDescriptors.InvalidRefitMember,\n                location,\n                methodSymbol.ContainingType.Name,\n                methodSymbol.Name\n            );\n            diagnostics.Add(diagnostic);\n        }\n\n        // Parse like a regular method, but force explicit implementation for derived base-interface methods\n        var explicitImpl = methodSymbol.ExplicitInterfaceImplementations.FirstOrDefault();\n        var containingTypeSymbol = explicitImpl?.ContainingType ?? methodSymbol.ContainingType;\n        var containingType = containingTypeSymbol.ToDisplayString(\n            SymbolDisplayFormat.FullyQualifiedFormat\n        );\n\n        // Method name should be simple name only (never include interface qualifier)\n        var declaredBaseName = methodSymbol.Name;\n        var lastDot = declaredBaseName.LastIndexOf('.');\n        if (lastDot >= 0)\n        {\n            declaredBaseName = declaredBaseName.Substring(lastDot + 1);\n        }\n\n        if (methodSymbol.TypeParameters.Length > 0)\n        {\n            var typeParams = string.Join(\n                \", \",\n                methodSymbol.TypeParameters.Select(\n                    tp => tp.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)\n                )\n            );\n            declaredBaseName += $\"<{typeParams}>\";\n        }\n\n        var returnType = methodSymbol.ReturnType.ToDisplayString(\n            SymbolDisplayFormat.FullyQualifiedFormat\n        );\n\n        var returnTypeInfo = methodSymbol.ReturnType.MetadataName switch\n        {\n            \"Task\" => ReturnTypeInfo.AsyncVoid,\n            \"Task`1\" or \"ValueTask`1\" => ReturnTypeInfo.AsyncResult,\n            _ => ReturnTypeInfo.Return,\n        };\n\n        var parameters = methodSymbol.Parameters.Select(ParseParameter).ToImmutableEquatableArray();\n\n        var isExplicit = isDerived || explicitImpl is not null;\n        var constraints = GenerateConstraints(methodSymbol.TypeParameters, isExplicit);\n\n        return new MethodModel(\n            methodSymbol.Name,\n            returnType,\n            containingType,\n            declaredBaseName,\n            returnTypeInfo,\n            parameters,\n            constraints,\n            isExplicit\n        );\n    }\n\n    private static bool IsRefitMethod(\n        IMethodSymbol? methodSymbol,\n        INamedTypeSymbol httpMethodAttribute\n    )\n    {\n        return methodSymbol\n                ?.GetAttributes()\n                .Any(ad => ad.AttributeClass?.InheritsFromOrEquals(httpMethodAttribute) == true)\n            == true;\n    }\n\n    private static ImmutableEquatableArray<TypeConstraint> GenerateConstraints(\n        ImmutableArray<ITypeParameterSymbol> typeParameters,\n        bool isOverrideOrExplicitImplementation\n    )\n    {\n        // Need to loop over the constraints and create them\n        return typeParameters\n            .Select(\n                typeParameter =>\n                    ParseConstraintsForTypeParameter(\n                        typeParameter,\n                        isOverrideOrExplicitImplementation\n                    )\n            )\n            .ToImmutableEquatableArray();\n    }\n\n    private static TypeConstraint ParseConstraintsForTypeParameter(\n        ITypeParameterSymbol typeParameter,\n        bool isOverrideOrExplicitImplementation\n    )\n    {\n        // Explicit interface implementations and overrides can only have class or struct constraints\n        var known = KnownTypeConstraint.None;\n\n        if (typeParameter.HasReferenceTypeConstraint)\n        {\n            known |= KnownTypeConstraint.Class;\n        }\n        if (typeParameter.HasUnmanagedTypeConstraint && !isOverrideOrExplicitImplementation)\n        {\n            known |= KnownTypeConstraint.Unmanaged;\n        }\n\n        // unmanaged constraints are both structs and unmanaged so the struct constraint is redundant\n        if (typeParameter.HasValueTypeConstraint && !typeParameter.HasUnmanagedTypeConstraint)\n        {\n            known |= KnownTypeConstraint.Struct;\n        }\n        if (typeParameter.HasNotNullConstraint && !isOverrideOrExplicitImplementation)\n        {\n            known |= KnownTypeConstraint.NotNull;\n        }\n\n        var constraints = ImmutableEquatableArray<string>.Empty;\n        if (!isOverrideOrExplicitImplementation)\n        {\n            constraints = typeParameter\n                .ConstraintTypes.Select(\n                    typeConstraint =>\n                        typeConstraint.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)\n                )\n                .ToImmutableEquatableArray();\n        }\n\n        // new constraint has to be last\n        if (typeParameter.HasConstructorConstraint && !isOverrideOrExplicitImplementation)\n        {\n            known |= KnownTypeConstraint.New;\n        }\n\n        var declaredName = typeParameter.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n        return new TypeConstraint(typeParameter.Name, declaredName, known, constraints);\n    }\n\n    private static ParameterModel ParseParameter(IParameterSymbol param)\n    {\n        var annotation =\n            !param.Type.IsValueType && param.NullableAnnotation == NullableAnnotation.Annotated;\n\n        var paramType = param.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);\n        var isGeneric = ContainsTypeParameter(param.Type);\n\n        return new ParameterModel(param.MetadataName, paramType, annotation, isGeneric);\n    }\n\n    private static bool ContainsTypeParameter(ITypeSymbol symbol)\n    {\n        if (symbol is ITypeParameterSymbol)\n            return true;\n\n        if (symbol is not INamedTypeSymbol { TypeParameters.Length: > 0 } namedType)\n            return false;\n\n        foreach (var typeArg in namedType.TypeArguments)\n        {\n            if (ContainsTypeParameter(typeArg))\n                return true;\n        }\n\n        return false;\n    }\n\n    private static MethodModel ParseMethod(IMethodSymbol methodSymbol, bool isImplicitInterface)\n    {\n        var returnType = methodSymbol.ReturnType.ToDisplayString(\n            SymbolDisplayFormat.FullyQualifiedFormat\n        );\n\n        // For explicit interface implementations, the containing type for the explicit method signature\n        // must be the interface being implemented (e.g. IFoo), not the interface that declares it.\n        var explicitImpl = methodSymbol.ExplicitInterfaceImplementations.FirstOrDefault();\n        var containingTypeSymbol = explicitImpl?.ContainingType ?? methodSymbol.ContainingType;\n        var containingType = containingTypeSymbol.ToDisplayString(\n            SymbolDisplayFormat.FullyQualifiedFormat\n        );\n\n        // Simple method name (strip any explicit interface qualifier if present)\n        var declaredBaseName = methodSymbol.Name;\n        var lastDot = declaredBaseName.LastIndexOf('.');\n        if (lastDot >= 0)\n        {\n            declaredBaseName = declaredBaseName.Substring(lastDot + 1);\n        }\n\n        if (methodSymbol.TypeParameters.Length > 0)\n        {\n            var typeParams = string.Join(\n                \", \",\n                methodSymbol.TypeParameters.Select(\n                    tp => tp.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)\n                )\n            );\n            declaredBaseName += $\"<{typeParams}>\";\n        }\n\n        var returnTypeInfo = methodSymbol.ReturnType.MetadataName switch\n        {\n            \"Task\" => ReturnTypeInfo.AsyncVoid,\n            \"Task`1\" or \"ValueTask`1\" => ReturnTypeInfo.AsyncResult,\n            _ => ReturnTypeInfo.Return,\n        };\n\n        var parameters = methodSymbol.Parameters.Select(ParseParameter).ToImmutableEquatableArray();\n\n        var isExplicit = explicitImpl is not null;\n        var constraints = GenerateConstraints(methodSymbol.TypeParameters, isExplicit || !isImplicitInterface);\n\n        return new MethodModel(\n            methodSymbol.Name,\n            returnType,\n            containingType,\n            declaredBaseName,\n            returnTypeInfo,\n            parameters,\n            constraints,\n            isExplicit\n        );\n    }\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/Polyfills/IndexRange.cs",
    "content": "﻿#if NETSTANDARD2_0 || NET462\nnamespace System\n{\n    /// <summary>\n    /// Minimal polyfill for <c>System.Index</c> to support the C# index syntax when targeting\n    /// .NET Standard 2.0 or .NET Framework 4.6.2. This implementation only exposes the members\n    /// required by this codebase and is not a full replacement for the BCL type.\n    /// </summary>\n    /// <remarks>\n    /// This type exists solely to allow the source to compile on older targets where\n    /// <c>System.Index</c> is not available. It should not be used as a general-purpose\n    /// substitute outside of this project.\n    /// </remarks>\n    public readonly record struct Index\n    {\n        private readonly int _value;\n        private readonly bool _fromEnd;\n\n        /// <summary>\n        /// Creates a new <see cref=\"Index\"/> from the start of a sequence.\n        /// </summary>\n        /// <param name=\"value\">The zero-based index from the start.</param>\n        public Index(int value) { _value = value; _fromEnd = false; }\n\n        /// <summary>\n        /// Creates a new <see cref=\"Index\"/> with the specified origin.\n        /// </summary>\n        /// <param name=\"value\">The index position value.</param>\n        /// <param name=\"fromEnd\">\n        /// When <see langword=\"true\"/>, the index is calculated from the end of the sequence; otherwise from the start.\n        /// </param>\n        public Index(int value, bool fromEnd) { _value = value; _fromEnd = fromEnd; }\n\n        /// <summary>\n        /// Gets the index value.\n        /// </summary>\n        public int Value => _value;\n\n        /// <summary>\n        /// Gets a value indicating whether the index is from the end of the sequence.\n        /// </summary>\n        public bool IsFromEnd => _fromEnd;\n\n        /// <summary>\n        /// Gets an <see cref=\"Index\"/> that points to the start of a sequence.\n        /// </summary>\n        public static Index Start => new(0);\n\n        /// <summary>\n        /// Gets an <see cref=\"Index\"/> that points just past the end of a sequence.\n        /// </summary>\n        public static Index End => new(0, true);\n\n        /// <summary>\n        /// Implicitly converts an <see cref=\"int\"/> to an <see cref=\"Index\"/> from the start.\n        /// </summary>\n        /// <param name=\"value\">The zero-based index from the start.</param>\n        public static implicit operator Index(int value) => new(value);\n    }\n\n    /// <summary>\n    /// Minimal polyfill for <c>System.Range</c> to support the C# range syntax when targeting\n    /// .NET Standard 2.0 or .NET Framework 4.6.2. This implementation only exposes the members\n    /// required by this codebase and is not a full replacement for the BCL type.\n    /// </summary>\n    /// <remarks>\n    /// This type exists solely to allow the source to compile on older targets where\n    /// <c>System.Range</c> is not available. It should not be used as a general-purpose\n    /// substitute outside of this project.\n    /// </remarks>\n    public readonly record struct Range\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Range\"/> struct.\n        /// </summary>\n        /// <param name=\"start\">The inclusive start <see cref=\"Index\"/>.</param>\n        /// <param name=\"end\">The exclusive end <see cref=\"Index\"/>.</param>\n        public Range(Index start, Index end) { Start = start; End = end; }\n\n        /// <summary>\n        /// Gets the inclusive start <see cref=\"Index\"/> of the range.\n        /// </summary>\n        public Index Start { get; }\n\n        /// <summary>\n        /// Gets the exclusive end <see cref=\"Index\"/> of the range.\n        /// </summary>\n        public Index End { get; }\n\n        /// <summary>\n        /// Creates a <see cref=\"Range\"/> that starts at the specified index and ends at <see cref=\"Index.End\"/>.\n        /// </summary>\n        /// <param name=\"start\">The inclusive start <see cref=\"Index\"/>.</param>\n        /// <returns>A new <see cref=\"Range\"/>.</returns>\n        public static Range StartAt(Index start) => new(start, Index.End);\n\n        /// <summary>\n        /// Creates a <see cref=\"Range\"/> that starts at <see cref=\"Index.Start\"/> and ends at the specified index.\n        /// </summary>\n        /// <param name=\"end\">The exclusive end <see cref=\"Index\"/>.</param>\n        /// <returns>A new <see cref=\"Range\"/>.</returns>\n        public static Range EndAt(Index end) => new(Index.Start, end);\n\n        /// <summary>\n        /// Gets a <see cref=\"Range\"/> that represents the entire sequence.\n        /// </summary>\n        public static Range All => new(Index.Start, Index.End);\n    }\n}\n#endif\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/SourceWriter.cs",
    "content": "﻿using System.Diagnostics;\nusing System.Text;\nusing Microsoft.CodeAnalysis.Text;\n\nnamespace Refit.Generator;\n\n// From https://github.com/dotnet/runtime/blob/233826c88d2100263fb9e9535d96f75824ba0aea/src/libraries/Common/src/SourceGenerators/SourceWriter.cs#L11\ninternal sealed class SourceWriter\n{\n    const char IndentationChar = ' ';\n    const int CharsPerIndentation = 4;\n\n    readonly StringBuilder sb = new();\n    int indentation;\n\n    public int Indentation\n    {\n        get => indentation;\n        set\n        {\n            if (value < 0)\n            {\n                Throw();\n                static void Throw() => throw new ArgumentOutOfRangeException(nameof(value));\n            }\n\n            indentation = value;\n        }\n    }\n\n    public void Append(string text) => sb.Append(text);\n\n    public void WriteLine(char value)\n    {\n        AddIndentation();\n        sb.Append(value);\n        sb.AppendLine();\n    }\n\n    public void WriteLine(string text)\n    {\n        if (indentation == 0)\n        {\n            sb.AppendLine(text);\n            return;\n        }\n\n        bool isFinalLine;\n        ReadOnlySpan<char> remainingText = text.AsSpan();\n        do\n        {\n            ReadOnlySpan<char> nextLine = GetNextLine(ref remainingText, out isFinalLine);\n\n            if (!nextLine.IsEmpty)\n            {\n                AddIndentation();\n            }\n            AppendSpan(sb, nextLine);\n            sb.AppendLine();\n        }\n        while (!isFinalLine);\n    }\n\n    public void WriteLine() => sb.AppendLine();\n\n    public SourceText ToSourceText()\n    {\n        Debug.Assert(indentation == 0 && sb.Length > 0);\n        return SourceText.From(sb.ToString(), Encoding.UTF8);\n    }\n\n    public void Reset()\n    {\n        sb.Clear();\n        indentation = 0;\n    }\n\n    private void AddIndentation() =>\n        sb.Append(IndentationChar, CharsPerIndentation * indentation);\n\n    private static ReadOnlySpan<char> GetNextLine(\n        ref ReadOnlySpan<char> remainingText,\n        out bool isFinalLine\n    )\n    {\n        if (remainingText.IsEmpty)\n        {\n            isFinalLine = true;\n            return default;\n        }\n\n        ReadOnlySpan<char> next;\n        ReadOnlySpan<char> rest;\n\n        int lineLength = remainingText.IndexOf('\\n');\n        if (lineLength == -1)\n        {\n            lineLength = remainingText.Length;\n            isFinalLine = true;\n            rest = default;\n        }\n        else\n        {\n            rest = remainingText.Slice(lineLength + 1);\n            isFinalLine = false;\n        }\n\n        if ((uint)lineLength > 0 && remainingText[lineLength - 1] == '\\r')\n        {\n            lineLength--;\n        }\n\n        next = remainingText.Slice(0, lineLength);\n        remainingText = rest;\n        return next;\n    }\n\n    private static unsafe void AppendSpan(StringBuilder builder, ReadOnlySpan<char> span)\n    {\n        fixed (char* ptr = span)\n        {\n            builder.Append(ptr, span.Length);\n        }\n    }\n}\n"
  },
  {
    "path": "InterfaceStubGenerator.Shared/UniqueNameBuilder.cs",
    "content": "﻿namespace Refit.Generator;\n\n// <Summary>\n// UniqueNameBuilder.\n// </Summary>\npublic class UniqueNameBuilder()\n{\n    private readonly HashSet<string> _usedNames = new(StringComparer.Ordinal);\n    private readonly UniqueNameBuilder? _parentScope;\n\n    private UniqueNameBuilder(UniqueNameBuilder parentScope)\n        : this()\n    {\n        _parentScope = parentScope;\n    }\n\n    /// <summary>\n    /// Reserve a name.\n    /// </summary>\n    /// <param name=\"name\"></param>\n    public void Reserve(string name) => _usedNames.Add(name);\n\n    /// <summary>\n    /// Create a new scope.\n    /// </summary>\n    /// <returns>Unique Name Builder.</returns>\n    public UniqueNameBuilder NewScope() => new(this);\n\n    /// <summary>\n    /// Generate a unique name.\n    /// </summary>\n    /// <param name=\"name\">THe name.</param>\n    /// <returns></returns>\n    public string New(string name)\n    {\n        var i = 0;\n        var uniqueName = name;\n        while (Contains(uniqueName))\n        {\n            uniqueName = name + i;\n            i++;\n        }\n\n        _usedNames.Add(uniqueName);\n\n        return uniqueName;\n    }\n\n    /// <summary>\n    /// Reserve names.\n    /// </summary>\n    /// <param name=\"names\">The name.</param>\n    public void Reserve(IEnumerable<string> names)\n    {\n        if (names == null)\n        {\n            return;\n        }\n\n        foreach (var name in names)\n        {\n            _usedNames.Add(name);\n        }\n    }\n\n    private bool Contains(string name)\n    {\n        if (_usedNames.Contains(name))\n            return true;\n\n        if (_parentScope != null)\n            return _parentScope.Contains(name);\n\n        return false;\n    }\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright (c) ReactiveUI 2012 - 2025\n\nAll rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "NuGet.config",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <packageSources>\n    <add key=\"dotnet-tools\" value=\"https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json\" />\n    <add key=\"nuget\" value=\"https://api.nuget.org/v3/index.json\" /> \n  </packageSources>\n</configuration>"
  },
  {
    "path": "README.md",
    "content": "![Refit](refit_logo.png)\n\n## Refit: The automatic type-safe REST library for .NET Core, Xamarin and .NET\n\n[![Build](https://github.com/reactiveui/refit/actions/workflows/ci-build.yml/badge.svg)](https://github.com/reactiveui/refit/actions/workflows/ci-build.yml) [![codecov](https://codecov.io/github/reactiveui/refit/branch/main/graph/badge.svg?token=2guEgHsDU2)](https://codecov.io/github/reactiveui/refit)\n\n||Refit|Refit.HttpClientFactory|Refit.Newtonsoft.Json|\n|-|-|-|-|\n|*NuGet*|[![NuGet](https://img.shields.io/nuget/v/Refit.svg)](https://www.nuget.org/packages/Refit/)|[![NuGet](https://img.shields.io/nuget/v/Refit.HttpClientFactory.svg)](https://www.nuget.org/packages/Refit.HttpClientFactory/)|[![NuGet](https://img.shields.io/nuget/v/Refit.Newtonsoft.Json.svg)](https://www.nuget.org/packages/Refit.Newtonsoft.Json/)|\n\nRefit is a library heavily inspired by Square's\n[Retrofit](http://square.github.io/retrofit) library, and it turns your REST\nAPI into a live interface:\n\n```csharp\npublic interface IGitHubApi\n{\n    [Get(\"/users/{user}\")]\n    Task<User> GetUser(string user);\n}\n```\n\nThe `RestService` class generates an implementation of `IGitHubApi` that uses\n`HttpClient` to make its calls:\n\n```csharp\nvar gitHubApi = RestService.For<IGitHubApi>(\"https://api.github.com\");\nvar octocat = await gitHubApi.GetUser(\"octocat\");\n```\n.NET Core supports registering via HttpClientFactory\n```csharp\nservices\n    .AddRefitClient<IGitHubApi>()\n    .ConfigureHttpClient(c => c.BaseAddress = new Uri(\"https://api.github.com\"));\n```\n\n# Table of Contents\n\n* [Where does this work?](#where-does-this-work)\n  * [Breaking changes in 6.x](#breaking-changes-in-6x)\n* [API Attributes](#api-attributes)\n* [Querystrings](#querystrings)\n  * [Dynamic Querystring Parameters](#dynamic-querystring-parameters)\n  * [Collections as Querystring parameters](#collections-as-querystring-parameters)\n  * [Unescape Querystring parameters](#unescape-querystring-parameters)\n  * [Custom Querystring Parameter formatting](#custom-querystring-parameter-formatting)\n* [Body content](#body-content)\n  * [Buffering and the Content-Length header](#buffering-and-the-content-length-header)\n  * [JSON content](#json-content)\n  * [XML Content](#xml-content)\n  * [Form posts](#form-posts)\n* [Setting request headers](#setting-request-headers)\n  * [Static headers](#static-headers)\n  * [Dynamic headers](#dynamic-headers)\n  * [Bearer Authentication](#bearer-authentication)\n  * [Reducing header boilerplate with DelegatingHandlers (Authorization headers worked example)](#reducing-header-boilerplate-with-delegatinghandlers-authorization-headers-worked-example)\n  * [Redefining headers](#redefining-headers)\n  * [Removing headers](#removing-headers)\n* [Passing state into DelegatingHandlers](#passing-state-into-delegatinghandlers)\n  * [Support for Polly and Polly.Context](#support-for-polly-and-pollycontext)\n  * [Target Interface type](#target-interface-type)\n  * [MethodInfo of the method on the Refit client interface that was invoked](#methodinfo-of-the-method-on-the-refit-client-interface-that-was-invoked)\n* [Multipart uploads](#multipart-uploads)\n* [Retrieving the response](#retrieving-the-response)\n* [Using generic interfaces](#using-generic-interfaces)\n* [Interface inheritance](#interface-inheritance)\n  * [Headers inheritance](#headers-inheritance)\n* [Default Interface Methods](#default-interface-methods)\n* [Using HttpClientFactory](#using-httpclientfactory)\n* [Providing a custom HttpClient](#providing-a-custom-httpclient)\n* [Handling exceptions](#handling-exceptions)\n  * [When returning Task&lt;IApiResponse&gt;, Task&lt;IApiResponse&lt;T&gt;&gt;, or Task&lt;ApiResponse&lt;T&gt;&gt;](#when-returning-taskiapiresponse-taskiapiresponset-or-taskapiresponset)\n  * [When returning Task&lt;T&gt;](#when-returning-taskt)\n  * [Providing a custom ExceptionFactory](#providing-a-custom-exceptionfactory)\n  * [ApiException deconstruction with Serilog](#apiexception-deconstruction-with-serilog)\n\n### Where does this work?\n\nRefit currently supports the following platforms and any .NET Standard 2.0 target:\n\n* UWP\n* Xamarin.Android\n* Xamarin.Mac\n* Xamarin.iOS\n* Desktop .NET 4.6.1\n* .NET 6 / 8\n* Blazor\n* Uno Platform\n\n### SDK Requirements\n\n### Updates in 8.0.x\nFixes for some issues experienced, this lead to some breaking changes.\nSee [Releases](https://github.com/reactiveui/refit/releases) for full details.\n\n### V6.x.x\n\nRefit 6 requires Visual Studio 16.8 or higher, or the .NET SDK 5.0.100 or higher. It can target any .NET Standard 2.0 platform.\n\nRefit 6 does not support the old `packages.config` format for NuGet references (as they do not support analyzers/source generators). You must\n[migrate to PackageReference](https://devblogs.microsoft.com/nuget/migrate-packages-config-to-package-reference/) to use Refit v6 and later.\n\n#### Breaking changes in 6.x\n\nRefit 6 makes [System.Text.Json](https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-overview) the default JSON serializer. If you'd like to continue to use `Newtonsoft.Json`, add the `Refit.Newtonsoft.Json` NuGet package and set your `ContentSerializer` to `NewtonsoftJsonContentSerializer` on your `RefitSettings` instance. `System.Text.Json` is faster and uses less memory, though not all features are supported. The [migration guide](https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to?pivots=dotnet-5-0) contains more details.\n\n`IContentSerializer` was renamed to `IHttpContentSerializer` to better reflect its purpose. Additionally, two of its methods were renamed, `SerializeAsync<T>` -> `ToHttpContent<T>` and `DeserializeAsync<T>` -> `FromHttpContentAsync<T>`. Any existing implementations of these will need to be updated, though the changes should be minor.\n\n##### Updates in 6.3\n\nRefit 6.3 splits out the XML serialization via `XmlContentSerializer` into a separate package, `Refit.Xml`. This\nis to reduce the dependency size when using Refit with Web Assembly (WASM) applications. If you require XML, add a reference\nto `Refit.Xml`.\n\n### API Attributes\n\nEvery method must have an HTTP attribute that provides the request method and\nrelative URL. There are six built-in annotations: Get, Post, Put, Delete, Patch and\nHead. The relative URL of the resource is specified in the annotation.\n\n```csharp\n[Get(\"/users/list\")]\n```\n\nYou can also specify query parameters in the URL:\n\n```csharp\n[Get(\"/users/list?sort=desc\")]\n```\n\nA request URL can be updated dynamically using replacement blocks and\nparameters on the method. A replacement block is an alphanumeric string\nsurrounded by { and }.\n\nIf the name of your parameter doesn't match the name in the URL path, use the\n`AliasAs` attribute.\n\n```csharp\n[Get(\"/group/{id}/users\")]\nTask<List<User>> GroupList([AliasAs(\"id\")] int groupId);\n```\n\nA request url can also bind replacement blocks to a custom object\n\n```csharp\n[Get(\"/group/{request.groupId}/users/{request.userId}\")]\nTask<List<User>> GroupList(UserGroupRequest request);\n\nclass UserGroupRequest{\n    int groupId { get;set; }\n    int userId { get;set; }\n}\n\n```\n\nParameters that are not specified as a URL substitution will automatically be\nused as query parameters. This is different than Retrofit, where all\nparameters must be explicitly specified.\n\nThe comparison between parameter name and URL parameter is *not*\ncase-sensitive, so it will work correctly if you name your parameter `groupId`\nin the path `/group/{groupid}/show` for example.\n\n```csharp\n[Get(\"/group/{groupid}/users\")]\nTask<List<User>> GroupList(int groupId, [AliasAs(\"sort\")] string sortOrder);\n\nGroupList(4, \"desc\");\n>>> \"/group/4/users?sort=desc\"\n```\n\nRound-tripping route parameter syntax: Forward slashes aren't encoded when using a double-asterisk (\\*\\*) catch-all parameter syntax.\n\nDuring link generation, the routing system encodes the value captured in a double-asterisk (\\*\\*) catch-all parameter (for example, {**myparametername}) except the forward slashes.\n\nThe type of round-tripping route parameter must be string.\n\n```csharp\n[Get(\"/search/{**page}\")]\nTask<List<Page>> Search(string page);\n\nSearch(\"admin/products\");\n>>> \"/search/admin/products\"\n```\n\n### Querystrings\n\n#### Dynamic Querystring Parameters\n\nIf you specify an `object` as a query parameter, all public properties which are not null are used as query parameters.\nThis previously only applied to GET requests, but has now been expanded to all HTTP request methods, partly thanks to Twitter's hybrid API that insists on non-GET requests with querystring parameters.\nUse the `Query` attribute to change the behavior to 'flatten' your query parameter object. If using this Attribute you can specify values for the Delimiter and the Prefix which are used to 'flatten' the object.\n\n```csharp\npublic class MyQueryParams\n{\n    [AliasAs(\"order\")]\n    public string SortOrder { get; set; }\n\n    public int Limit { get; set; }\n\n    public KindOptions Kind { get; set; }\n}\n\npublic enum KindOptions\n{\n    Foo,\n\n    [EnumMember(Value = \"bar\")]\n    Bar\n}\n\n\n[Get(\"/group/{id}/users\")]\nTask<List<User>> GroupList([AliasAs(\"id\")] int groupId, MyQueryParams params);\n\n[Get(\"/group/{id}/users\")]\nTask<List<User>> GroupListWithAttribute([AliasAs(\"id\")] int groupId, [Query(\".\",\"search\")] MyQueryParams params);\n\n\nparams.SortOrder = \"desc\";\nparams.Limit = 10;\nparams.Kind = KindOptions.Bar;\n\nGroupList(4, params)\n>>> \"/group/4/users?order=desc&Limit=10&Kind=bar\"\n\nGroupListWithAttribute(4, params)\n>>> \"/group/4/users?search.order=desc&search.Limit=10&search.Kind=bar\"\n```\n\nA similar behavior exists if using a Dictionary, but without the advantages of the `AliasAs` attributes and of course no intellisense and/or type safety.\n\nYou can also specify querystring parameters with [Query] and have them flattened in non-GET requests, similar to:\n```csharp\n[Post(\"/statuses/update.json\")]\nTask<Tweet> PostTweet([Query]TweetParams params);\n```\n\nWhere `TweetParams` is a POCO, and properties will also support `[AliasAs]` attributes.\n\nIf you need to keep internal-only properties on your query DTO, mark them with one of the standard ignore attributes and Refit will skip them when building the query string:\n\n- `[IgnoreDataMember]`\n- `[System.Text.Json.Serialization.JsonIgnore]`\n- `[Newtonsoft.Json.JsonIgnore]`\n\n#### Collections as Querystring parameters\n\nUse the `Query` attribute to specify format in which collections should be formatted in query string\n\n```csharp\n[Get(\"/users/list\")]\nTask Search([Query(CollectionFormat.Multi)]int[] ages);\n\nSearch(new [] {10, 20, 30})\n>>> \"/users/list?ages=10&ages=20&ages=30\"\n\n[Get(\"/users/list\")]\nTask Search([Query(CollectionFormat.Csv)]int[] ages);\n\nSearch(new [] {10, 20, 30})\n>>> \"/users/list?ages=10%2C20%2C30\"\n```\n\nYou can also specify collection format in `RefitSettings`, that will be used by default, unless explicitly defined in `Query` attribute.\n\n```csharp\nvar gitHubApi = RestService.For<IGitHubApi>(\"https://api.github.com\",\n    new RefitSettings {\n        CollectionFormat = CollectionFormat.Multi\n    });\n```\n\n#### Unescape Querystring parameters\n\nUse the `QueryUriFormat` attribute to specify if the query parameters should be url escaped\n\n```csharp\n[Get(\"/query\")]\n[QueryUriFormat(UriFormat.Unescaped)]\nTask Query(string q);\n\nQuery(\"Select+Id,Name+From+Account\")\n>>> \"/query?q=Select+Id,Name+From+Account\"\n```\n\n#### Custom Querystring parameter formatting\n\n**Formatting Keys**\n\nTo customize the format of query keys, you have two main options:\n\n1. **Using the `AliasAs` Attribute**:\n\n   You can use the `AliasAs` attribute to specify a custom key name for a property. This attribute will always take precedence over any key formatter you specify.\n\n   ```csharp\n   public class MyQueryParams\n   {\n       [AliasAs(\"order\")]\n       public string SortOrder { get; set; }\n\n       public int Limit { get; set; }\n   }\n\n   [Get(\"/group/{id}/users\")]\n   Task<List<User>> GroupList([AliasAs(\"id\")] int groupId, [Query] MyQueryParams params);\n\n   params.SortOrder = \"desc\";\n   params.Limit = 10;\n\n   GroupList(1, params);\n   ```\n\n   This will generate the following request:\n\n   ```\n   /group/1/users?order=desc&Limit=10\n   ```\n\n2. **Using the `RefitSettings.UrlParameterKeyFormatter` Property**:\n\n   By default, Refit uses the property name as the query key without any additional formatting. If you want to apply a custom format across all your query keys, you can use the `UrlParameterKeyFormatter` property. Remember that if a property has an `AliasAs` attribute, it will be used regardless of the formatter.\n\n   The following example uses the built-in `CamelCaseUrlParameterKeyFormatter`:\n\n   ```csharp\n   public class MyQueryParams\n   {\n       public string SortOrder { get; set; }\n\n       [AliasAs(\"queryLimit\")]\n       public int Limit { get; set; }\n   }\n\n   [Get(\"/group/users\")]\n   Task<List<User>> GroupList([Query] MyQueryParams params);\n\n   params.SortOrder = \"desc\";\n   params.Limit = 10;\n   ```\n\n   The request will look like:\n\n   ```\n   /group/users?sortOrder=desc&queryLimit=10\n   ```\n\n**Note**: The `AliasAs` attribute always takes the top priority. If both the attribute and a custom key formatter are present, the `AliasAs` attribute's value will be used.\n\n#### Formatting URL Parameter Values with the `UrlParameterFormatter`\n\nIn Refit, the `UrlParameterFormatter` property within `RefitSettings` allows you to customize how parameter values are formatted in the URL. This can be particularly useful when you need to format dates, numbers, or other types in a specific manner that aligns with your API's expectations.\n\n**Using `UrlParameterFormatter`**:\n\nAssign a custom formatter that implements the `IUrlParameterFormatter` interface to the `UrlParameterFormatter` property.\n\n```csharp\npublic class CustomDateUrlParameterFormatter : IUrlParameterFormatter\n{\n    public string? Format(object? value, ICustomAttributeProvider attributeProvider, Type type)\n    {\n        if (value is DateTime dt)\n        {\n            return dt.ToString(\"yyyyMMdd\");\n        }\n\n        return value?.ToString();\n    }\n}\n\nvar settings = new RefitSettings\n{\n    UrlParameterFormatter = new CustomDateUrlParameterFormatter()\n};\n```\n\nIn this example, a custom formatter is created for date values. Whenever a `DateTime` parameter is encountered, it formats the date as `yyyyMMdd`.\n\n**Formatting Dictionary Keys**:\n\nWhen dealing with dictionaries, it's important to note that keys are treated as values. If you need custom formatting for dictionary keys, you should use the `UrlParameterFormatter` as well.\n\nFor instance, if you have a dictionary parameter and you want to format its keys in a specific way, you can handle that in the custom formatter:\n\n```csharp\npublic class CustomDictionaryKeyFormatter : IUrlParameterFormatter\n{\n    public string? Format(object? value, ICustomAttributeProvider attributeProvider, Type type)\n    {\n        // Handle dictionary keys\n        if (attributeProvider is PropertyInfo prop && prop.PropertyType.IsGenericType && prop.PropertyType.GetGenericTypeDefinition() == typeof(Dictionary<,>))\n        {\n            // Custom formatting logic for dictionary keys\n            return value?.ToString().ToUpperInvariant();\n        }\n\n        return value?.ToString();\n    }\n}\n\nvar settings = new RefitSettings\n{\n    UrlParameterFormatter = new CustomDictionaryKeyFormatter()\n};\n```\n\nIn the above example, the dictionary keys will be converted to uppercase.\n\n### Body content\n\nOne of the parameters in your method can be used as the body, by using the\nBody attribute:\n\n```csharp\n[Post(\"/users/new\")]\nTask CreateUser([Body] User user);\n```\n\nThere are four possibilities for supplying the body data, depending on the\ntype of the parameter:\n\n* If the type is `Stream`, the content will be streamed via `StreamContent`\n* If the type is `string`, the string will be used directly as the content unless `[Body(BodySerializationMethod.Json)]` is set which will send it as a `StringContent`\n* If the parameter has the attribute `[Body(BodySerializationMethod.UrlEncoded)]`,\n  the content will be URL-encoded (see [form posts](#form-posts) below)\n* For all other types, the object will be serialized using the content serializer specified in\nRefitSettings (JSON is the default).\n\n#### Buffering and the `Content-Length` header\n\nBy default, Refit streams the body content without buffering it. This means you can\nstream a file from disk, for example, without incurring the overhead of loading\nthe whole file into memory. The downside of this is that no `Content-Length` header\nis set _on the request_. If your API needs you to send a `Content-Length` header with\nthe request, you can disable this streaming behavior by setting the `buffered` argument\nof the `[Body]` attribute to `true`:\n\n```csharp\nTask CreateUser([Body(buffered: true)] User user);\n```\n\n#### JSON content\n\nJSON requests and responses are serialized/deserialized using an instance of the `IHttpContentSerializer` interface. Refit provides two implementations out of the box: `SystemTextJsonContentSerializer` (which is the default JSON serializer) and `NewtonsoftJsonContentSerializer`. The first uses `System.Text.Json` APIs and is focused on high performance and low memory usage, while the latter uses the known `Newtonsoft.Json` library and is more versatile and customizable. You can read more about the two serializers and the main differences between the two [at this link](https://docs.microsoft.com/dotnet/standard/serialization/system-text-json-migrate-from-newtonsoft-how-to).\n\nFor instance, here is how to create a new `RefitSettings` instance using the `Newtonsoft.Json`-based serializer (you'll also need to add a `PackageReference` to `Refit.Newtonsoft.Json`):\n\n```csharp\nvar settings = new RefitSettings(new NewtonsoftJsonContentSerializer());\n```\n\nIf you're using `Newtonsoft.Json` APIs, you can customize their behavior by setting the `Newtonsoft.Json.JsonConvert.DefaultSettings` property:\n\n```csharp\nJsonConvert.DefaultSettings =\n    () => new JsonSerializerSettings() {\n        ContractResolver = new CamelCasePropertyNamesContractResolver(),\n        Converters = {new StringEnumConverter()}\n    };\n\n// Serialized as: {\"day\":\"Saturday\"}\nawait PostSomeStuff(new { Day = DayOfWeek.Saturday });\n```\n\nAs these are global settings they will affect your entire application. It\nmight be beneficial to isolate the settings for calls to a particular API.\nWhen creating a Refit generated live interface, you may optionally pass a\n`RefitSettings` that will allow you to specify what serializer settings you\nwould like. This allows you to have different serializer settings for separate\nAPIs:\n\n```csharp\nvar gitHubApi = RestService.For<IGitHubApi>(\"https://api.github.com\",\n    new RefitSettings {\n        ContentSerializer = new NewtonsoftJsonContentSerializer(\n            new JsonSerializerSettings {\n                ContractResolver = new SnakeCasePropertyNamesContractResolver()\n        }\n    )});\n\nvar otherApi = RestService.For<IOtherApi>(\"https://api.example.com\",\n    new RefitSettings {\n        ContentSerializer = new NewtonsoftJsonContentSerializer(\n            new JsonSerializerSettings {\n                ContractResolver = new CamelCasePropertyNamesContractResolver()\n        }\n    )});\n```\n\nProperty serialization/deserialization can be customised using Json.NET's\nJsonProperty attribute:\n\n```csharp\npublic class Foo\n{\n    // Works like [AliasAs(\"b\")] would in form posts (see below)\n    [JsonProperty(PropertyName=\"b\")]\n    public string Bar { get; set; }\n}\n```\n\n##### JSON source generator\n\nTo apply the benefits of the new [JSON source generator](https://devblogs.microsoft.com/dotnet/try-the-new-system-text-json-source-generator/) for System.Text.Json added in .NET 6, you can use `SystemTextJsonContentSerializer` with a custom instance of `RefitSettings` and `JsonSerializerOptions`:\n\n```csharp\nvar gitHubApi = RestService.For<IGitHubApi>(\"https://api.github.com\",\n    new RefitSettings {\n        ContentSerializer = new SystemTextJsonContentSerializer(MyJsonSerializerContext.Default.Options)\n    });\n```\n\n#### XML Content\n\nXML requests and responses are serialized/deserialized using _System.Xml.Serialization.XmlSerializer_.\nBy default, Refit will use JSON content serialization, to use XML content configure the ContentSerializer to use the `XmlContentSerializer`:\n\n```csharp\nvar gitHubApi = RestService.For<IXmlApi>(\"https://www.w3.org/XML\",\n    new RefitSettings {\n        ContentSerializer = new XmlContentSerializer()\n    });\n```\n\nProperty serialization/deserialization can be customised using   attributes found in the _System.Xml.Serialization_ namespace:\n\n```csharp\n    public class Foo\n    {\n        [XmlElement(Namespace = \"https://www.w3.org/XML\")]\n        public string Bar { get; set; }\n    }\n```\n\nThe _System.Xml.Serialization.XmlSerializer_ provides many options for serializing, those options can be set by providing an `XmlContentSerializerSettings` to the `XmlContentSerializer` constructor:\n\n```csharp\nvar gitHubApi = RestService.For<IXmlApi>(\"https://www.w3.org/XML\",\n    new RefitSettings {\n        ContentSerializer = new XmlContentSerializer(\n            new XmlContentSerializerSettings\n            {\n                XmlReaderWriterSettings = new XmlReaderWriterSettings()\n                {\n                    ReaderSettings = new XmlReaderSettings\n                    {\n                        IgnoreWhitespace = true\n                    }\n                }\n            }\n        )\n    });\n```\n\n#### <a name=\"form-posts\"></a>Form posts\n\nFor APIs that take form posts (i.e. serialized as `application/x-www-form-urlencoded`),\ninitialize the Body attribute with `BodySerializationMethod.UrlEncoded`.\n\nThe parameter can be an `IDictionary`:\n\n```csharp\npublic interface IMeasurementProtocolApi\n{\n    [Post(\"/collect\")]\n    Task Collect([Body(BodySerializationMethod.UrlEncoded)] Dictionary<string, object> data);\n}\n\nvar data = new Dictionary<string, object> {\n    {\"v\", 1},\n    {\"tid\", \"UA-1234-5\"},\n    {\"cid\", new Guid(\"d1e9ea6b-2e8b-4699-93e0-0bcbd26c206c\")},\n    {\"t\", \"event\"},\n};\n\n// Serialized as: v=1&tid=UA-1234-5&cid=d1e9ea6b-2e8b-4699-93e0-0bcbd26c206c&t=event\nawait api.Collect(data);\n```\n\nOr you can just pass any object and all _public, readable_ properties will\nbe serialized as form fields in the request. This approach allows you to alias\nproperty names using `[AliasAs(\"whatever\")]` which can help if the API has\ncryptic field names:\n\n```csharp\npublic interface IMeasurementProtocolApi\n{\n    [Post(\"/collect\")]\n    Task Collect([Body(BodySerializationMethod.UrlEncoded)] Measurement measurement);\n}\n\npublic class Measurement\n{\n    // Properties can be read-only and [AliasAs] isn't required\n    public int v { get { return 1; } }\n\n    [AliasAs(\"tid\")]\n    public string WebPropertyId { get; set; }\n\n    [AliasAs(\"cid\")]\n    public Guid ClientId { get; set; }\n\n    [AliasAs(\"t\")]\n    public string Type { get; set; }\n\n    public object IgnoreMe { private get; set; }\n}\n\nvar measurement = new Measurement {\n    WebPropertyId = \"UA-1234-5\",\n    ClientId = new Guid(\"d1e9ea6b-2e8b-4699-93e0-0bcbd26c206c\"),\n    Type = \"event\"\n};\n\n// Serialized as: v=1&tid=UA-1234-5&cid=d1e9ea6b-2e8b-4699-93e0-0bcbd26c206c&t=event\nawait api.Collect(measurement);\n```\n\nIf you have a type that has `[JsonProperty(PropertyName)]` attributes setting property aliases, Refit will use those too (`[AliasAs]` will take precedence where you have both).\nThis means that the following type will serialize as `one=value1&two=value2`:\n\n```csharp\n\npublic class SomeObject\n{\n    [JsonProperty(PropertyName = \"one\")]\n    public string FirstProperty { get; set; }\n\n    [JsonProperty(PropertyName = \"notTwo\")]\n    [AliasAs(\"two\")]\n    public string SecondProperty { get; set; }\n}\n\n```\n\n**NOTE:** This use of `AliasAs` applies to querystring parameters and form body posts, but not to response objects; for aliasing fields on response objects, you'll still need to use `[JsonProperty(\"full-property-name\")]`.\n\n### Setting request headers\n\n#### Static headers\n\nYou can set one or more static request headers for a request applying a `Headers`\nattribute to the method:\n\n```csharp\n[Headers(\"User-Agent: Awesome Octocat App\")]\n[Get(\"/users/{user}\")]\nTask<User> GetUser(string user);\n```\n\nStatic headers can also be added to _every request in the API_ by applying the\n`Headers` attribute to the interface:\n\n```csharp\n[Headers(\"User-Agent: Awesome Octocat App\")]\npublic interface IGitHubApi\n{\n    [Get(\"/users/{user}\")]\n    Task<User> GetUser(string user);\n\n    [Post(\"/users/new\")]\n    Task CreateUser([Body] User user);\n}\n```\n\n#### Dynamic headers\n\nIf the content of the header needs to be set at runtime, you can add a header\nwith a dynamic value to a request by applying a `Header` attribute to a parameter:\n\n```csharp\n[Get(\"/users/{user}\")]\nTask<User> GetUser(string user, [Header(\"Authorization\")] string authorization);\n\n// Will add the header \"Authorization: token OAUTH-TOKEN\" to the request\nvar user = await GetUser(\"octocat\", \"token OAUTH-TOKEN\");\n```\n\nAdding an `Authorization` header is such a common use case that you can add an access token to a request by applying an `Authorize` attribute to a parameter and optionally specifying the scheme:\n\n```csharp\n[Get(\"/users/{user}\")]\nTask<User> GetUser(string user, [Authorize(\"Bearer\")] string token);\n\n// Will add the header \"Authorization: Bearer OAUTH-TOKEN}\" to the request\nvar user = await GetUser(\"octocat\", \"OAUTH-TOKEN\");\n\n//note: the scheme defaults to Bearer if none provided\n```\n\nIf you need to set multiple headers at runtime, you can add a `IDictionary<string, string>`\nand apply a `HeaderCollection` attribute to the parameter and it will inject the headers into the request:\n\n[//]: # ({% raw %})\n```csharp\n\n[Get(\"/users/{user}\")]\nTask<User> GetUser(string user, [HeaderCollection] IDictionary<string, string> headers);\n\nvar headers = new Dictionary<string, string> {{\"Authorization\",\"Bearer tokenGoesHere\"}, {\"X-Tenant-Id\",\"123\"}};\nvar user = await GetUser(\"octocat\", headers);\n```\n[//]: # ({% endraw %})\n\n#### Bearer Authentication\n\nMost APIs need some sort of Authentication. The most common is OAuth Bearer authentication. A header is added to each request of the form: `Authorization: Bearer <token>`. Refit makes it easy to insert your logic to get the token however your app needs, so you don't have to pass a token into each method.\n\n1. Add `[Headers(\"Authorization: Bearer\")]` to the interface or methods which need the token.\n2. Set `AuthorizationHeaderValueGetter` in the `RefitSettings` instance. Refit will call your delegate each time it needs to obtain the token, so it's a good idea for your mechanism to cache the token value for some period within the token lifetime.\n\n`AuthorizationHeaderValueGetter` works whether you create clients with `RestService.For<T>(\"https://...\")` or supply your own `HttpClient` via `RestService.For<T>(httpClient, settings)`. If your API methods accept a `CancellationToken`, that token is propagated to the getter delegate.\n\n#### Reducing header boilerplate with DelegatingHandlers (Authorization headers worked example)\nAlthough we make provisions for adding dynamic headers at runtime directly in Refit,\nmost use-cases would likely benefit from registering a custom `DelegatingHandler` in order to inject the headers as part of the `HttpClient` middleware pipeline\nthus removing the need to add lots of `[Header]` or `[HeaderCollection]` attributes.\n\nIn the example above we are leveraging a `[HeaderCollection]` parameter to inject an `Authorization` and `X-Tenant-Id` header.\nThis is quite a common scenario if you are integrating with a 3rd party that uses OAuth2. While it's ok for the occasional endpoint,\nit would be quite cumbersome if we had to add that boilerplate to every method in our interface.\n\nIn this example we will assume our application is a multi-tenant application that is able to pull information about a tenant through\nsome interface `ITenantProvider` and has a data store `IAuthTokenStore` that can be used to retrieve an auth token to attach to the outbound request.\n\n```csharp\n\n //Custom delegating handler for adding Auth headers to outbound requests\n class AuthHeaderHandler : DelegatingHandler\n {\n     private readonly ITenantProvider tenantProvider;\n     private readonly IAuthTokenStore authTokenStore;\n\n    public AuthHeaderHandler(ITenantProvider tenantProvider, IAuthTokenStore authTokenStore)\n    {\n         this.tenantProvider = tenantProvider ?? throw new ArgumentNullException(nameof(tenantProvider));\n         this.authTokenStore = authTokenStore ?? throw new ArgumentNullException(nameof(authTokenStore));\n         // InnerHandler must be left as null when using DI, but must be assigned a value when\n         // using RestService.For<IMyApi>\n         // InnerHandler = new HttpClientHandler();\n    }\n\n    protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n    {\n        var token = await authTokenStore.GetToken();\n\n        //potentially refresh token here if it has expired etc.\n\n        request.Headers.Authorization = new AuthenticationHeaderValue(\"Bearer\", token);\n        request.Headers.Add(\"X-Tenant-Id\", tenantProvider.GetTenantId());\n\n        return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);\n    }\n}\n\n//Startup.cs\npublic void ConfigureServices(IServiceCollection services)\n{\n    services.AddTransient<ITenantProvider, TenantProvider>();\n    services.AddTransient<IAuthTokenStore, AuthTokenStore>();\n    services.AddTransient<AuthHeaderHandler>();\n\n    //this will add our refit api implementation with an HttpClient\n    //that is configured to add auth headers to all requests\n\n    //note: AddRefitClient<T> requires a reference to Refit.HttpClientFactory\n    //note: the order of delegating handlers is important and they run in the order they are added!\n\n    services.AddRefitClient<ISomeThirdPartyApi>()\n        .ConfigureHttpClient(c => c.BaseAddress = new Uri(\"https://api.example.com\"))\n        .AddHttpMessageHandler<AuthHeaderHandler>();\n        //you could add Polly here to handle HTTP 429 / HTTP 503 etc\n}\n\n//Your application code\npublic class SomeImportantBusinessLogic\n{\n    private ISomeThirdPartyApi thirdPartyApi;\n\n    public SomeImportantBusinessLogic(ISomeThirdPartyApi thirdPartyApi)\n    {\n        this.thirdPartyApi = thirdPartyApi;\n    }\n\n    public async Task DoStuffWithUser(string username)\n    {\n        var user = await thirdPartyApi.GetUser(username);\n        //do your thing\n    }\n}\n```\n\nIf you aren't using dependency injection then you could achieve the same thing by doing something like this:\n\n```csharp\nvar api = RestService.For<ISomeThirdPartyApi>(new HttpClient(new AuthHeaderHandler(tenantProvider, authTokenStore))\n    {\n        BaseAddress = new Uri(\"https://api.example.com\")\n    }\n);\n\nvar user = await thirdPartyApi.GetUser(username);\n//do your thing\n```\n\n#### Redefining headers\n\nUnlike Retrofit, where headers do not overwrite each other and are all added to\nthe request regardless of how many times the same header is defined, Refit takes\na similar approach to the approach ASP.NET MVC takes with action filters &mdash;\n**redefining a header will replace it**, in the following order of precedence:\n\n* `Headers` attribute on the interface _(lowest priority)_\n* `Headers` attribute on the method\n* `Header` attribute or `HeaderCollection` attribute on a method parameter _(highest priority)_\n\n```csharp\n[Headers(\"X-Emoji: :rocket:\")]\npublic interface IGitHubApi\n{\n    [Get(\"/users/list\")]\n    Task<List> GetUsers();\n\n    [Get(\"/users/{user}\")]\n    [Headers(\"X-Emoji: :smile_cat:\")]\n    Task<User> GetUser(string user);\n\n    [Post(\"/users/new\")]\n    [Headers(\"X-Emoji: :metal:\")]\n    Task CreateUser([Body] User user, [Header(\"X-Emoji\")] string emoji);\n}\n\n// X-Emoji: :rocket:\nvar users = await GetUsers();\n\n// X-Emoji: :smile_cat:\nvar user = await GetUser(\"octocat\");\n\n// X-Emoji: :trollface:\nawait CreateUser(user, \":trollface:\");\n```\n\n**Note:** This redefining behavior only applies to headers _with the same name_. Headers with different names are not replaced. The following code will result in all headers being included:\n\n```csharp\n[Headers(\"Header-A: 1\")]\npublic interface ISomeApi\n{\n    [Headers(\"Header-B: 2\")]\n    [Post(\"/post\")]\n    Task PostTheThing([Header(\"Header-C\")] int c);\n}\n\n// Header-A: 1\n// Header-B: 2\n// Header-C: 3\nvar user = await api.PostTheThing(3);\n```\n\n#### Removing headers\n\nHeaders defined on an interface or method can be removed by redefining\na static header without a value (i.e. without `: <value>`) or passing `null` for\na dynamic header. _Empty strings will be included as empty headers._\n\n```csharp\n[Headers(\"X-Emoji: :rocket:\")]\npublic interface IGitHubApi\n{\n    [Get(\"/users/list\")]\n    [Headers(\"X-Emoji\")] // Remove the X-Emoji header\n    Task<List> GetUsers();\n\n    [Get(\"/users/{user}\")]\n    [Headers(\"X-Emoji:\")] // Redefine the X-Emoji header as empty\n    Task<User> GetUser(string user);\n\n    [Post(\"/users/new\")]\n    Task CreateUser([Body] User user, [Header(\"X-Emoji\")] string emoji);\n}\n\n// No X-Emoji header\nvar users = await GetUsers();\n\n// X-Emoji:\nvar user = await GetUser(\"octocat\");\n\n// No X-Emoji header\nawait CreateUser(user, null);\n\n// X-Emoji:\nawait CreateUser(user, \"\");\n```\n\n### Passing state into DelegatingHandlers\n\nIf there is runtime state that you need to pass to a `DelegatingHandler` you can add a property with a dynamic value to the underlying `HttpRequestMessage.Properties`\nby applying a `Property` attribute to a parameter:\n\n```csharp\npublic interface IGitHubApi\n{\n    [Post(\"/users/new\")]\n    Task CreateUser([Body] User user, [Property(\"SomeKey\")] string someValue);\n\n    [Post(\"/users/new\")]\n    Task CreateUser([Body] User user, [Property] string someOtherKey);\n}\n```\n\nThe attribute constructor optionally takes a string which becomes the key in the `HttpRequestMessage.Properties` dictionary.\nIf no key is explicitly defined then the name of the parameter becomes the key.\nIf a key is defined multiple times the value in `HttpRequestMessage.Properties` will be overwritten.\nThe parameter itself can be any `object`. Properties can be accessed inside a `DelegatingHandler` as follows:\n\n> ⚠️ **Important for `IHttpClientFactory` users:** `DelegatingHandler` instances are pooled and can live longer than a single request scope. Avoid reading per-request state from services that may be scoped/cached across handler lifetimes (for example a tenant/customer resolver stored on the handler). For per-request values like `CustomerId`, pass the value through `[Property]` so each request carries its own state.\n\n```csharp\nclass RequestPropertyHandler : DelegatingHandler\n{\n    public RequestPropertyHandler(HttpMessageHandler innerHandler = null) : base(innerHandler ?? new HttpClientHandler()) {}\n\n    protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n    {\n        // See if the request has a the property\n        if(request.Properties.ContainsKey(\"SomeKey\"))\n        {\n            var someProperty = request.Properties[\"SomeKey\"];\n            //do stuff\n        }\n\n        if(request.Properties.ContainsKey(\"someOtherKey\"))\n        {\n            var someOtherProperty = request.Properties[\"someOtherKey\"];\n            //do stuff\n        }\n\n        return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);\n    }\n}\n```\n\nNote: in .NET 5 `HttpRequestMessage.Properties` has been marked `Obsolete` and Refit will instead populate the value into the new `HttpRequestMessage.Options`.\n\n#### Support for Polly and Polly.Context\n\nBecause Refit supports `HttpClientFactory` it is possible to configure Polly policies on your HttpClient.\nIf your policy makes use of `Polly.Context` this can be passed via Refit by adding `[Property(\"PolicyExecutionContext\")] Polly.Context context`\nas behind the scenes `Polly.Context` is simply stored in `HttpRequestMessage.Properties` under the key `PolicyExecutionContext` and is of type `Polly.Context`. It's only recommended to pass the `Polly.Context` this way if your use case requires that the `Polly.Context` be initialized with dynamic content only known at runtime. If your `Polly.Context` only requires the same content every time (e.g an `ILogger` that you want to use to log from inside your policies) a cleaner approach is to inject the `Polly.Context` via a `DelegatingHandler` as described in [#801](https://github.com/reactiveui/refit/issues/801#issuecomment-1137318526)\n\n#### Target Interface Type and method info\n\nThere may be times when you want to know what the target interface type is of the Refit instance. An example is where you\nhave a derived interface that implements a common base like this:\n\n```csharp\npublic interface IGetAPI<TEntity>\n{\n    [Get(\"/{key}\")]\n    Task<TEntity> Get(long key);\n}\n\npublic interface IUsersAPI : IGetAPI<User>\n{\n}\n\npublic interface IOrdersAPI : IGetAPI<Order>\n{\n}\n```\n\nYou can access the concrete type of the interface for use in a handler, such as to alter the URL of the request:\n\n[//]: # ({% raw %})\n```csharp\nclass RequestPropertyHandler : DelegatingHandler\n{\n    public RequestPropertyHandler(HttpMessageHandler innerHandler = null) : base(innerHandler ?? new HttpClientHandler()) {}\n\n    protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n    {\n        // Get the type of the target interface\n        Type interfaceType = (Type)request.Properties[HttpMessageRequestOptions.InterfaceType];\n\n        var builder = new UriBuilder(request.RequestUri);\n        // Alter the Path in some way based on the interface or an attribute on it\n        builder.Path = $\"/{interfaceType.Name}{builder.Path}\";\n        // Set the new Uri on the outgoing message\n        request.RequestUri = builder.Uri;\n\n        return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);\n    }\n}\n```\n[//]: # ({% endraw %})\n\nThe full method information (`RestMethodInfo`) is also always available in the request options. The `RestMethodInfo` contains more information about the method being called such as the full `MethodInfo` when using reflection is needed:\n\n[//]: # ({% raw %})\n```csharp\nclass RequestPropertyHandler : DelegatingHandler\n{\n    public RequestPropertyHandler(HttpMessageHandler innerHandler = null) : base(innerHandler ?? new HttpClientHandler()) {}\n\n    protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n    {\n        // Get the method info\n        if (request.Options.TryGetValue(new HttpRequestOptionsKey<RestMethodInfo>(HttpRequestMessageOptions.RestMethodInfo), out RestMethodInfo restMethodInfo))\n        {\n            var builder = new UriBuilder(request.RequestUri);\n            // Alter the Path in some way based on the method info or an attribute on it\n            builder.Path = $\"/{restMethodInfo.MethodInfo.Name}{builder.Path}\";\n            // Set the new Uri on the outgoing message\n            request.RequestUri = builder.Uri;\n        }\n\n        return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);\n    }\n}\n```\n[//]: # ({% endraw %})\n\nNote: in .NET 5 `HttpRequestMessage.Properties` has been marked `Obsolete` and Refit will instead populate the value into the new `HttpRequestMessage.Options`. Refit provides `HttpRequestMessageOptions.InterfaceType` and `HttpRequestMessageOptions.RestMethodInfo` to respectively access the interface type and REST method info from the options.\n\n### Multipart uploads\n\nMethods decorated with `Multipart` attribute will be submitted with multipart content type.\nAt this time, multipart methods support the following parameter types:\n\n - `string` (parameter name will be used as name and string value as value)\n - byte array\n - `Stream`\n - `FileInfo`\n\nName of the field in the multipart data priority precedence:\n\n* `multipartItem.Name` if specified and not null (optional); dynamic, allows naming form data part at execution time.\n* `[AliasAs]` attribute  (optional) that decorate the streamPart parameter in the method signature (see below); static, defined in code.\n* `MultipartItem` parameter name (default) as defined in the method signature; static, defined in code.\n\nA custom boundary can be specified with an optional string parameter to the `Multipart` attribute. If left empty, this defaults to `----MyGreatBoundary`.\n\nTo specify the file name and content type for byte array (`byte[]`), `Stream` and `FileInfo` parameters, use of a wrapper class is required.\nThe wrapper classes for these types are `ByteArrayPart`, `StreamPart` and `FileInfoPart`.\n\n```csharp\npublic interface ISomeApi\n{\n    [Multipart]\n    [Post(\"/users/{id}/photo\")]\n    Task UploadPhoto(int id, [AliasAs(\"myPhoto\")] StreamPart stream);\n}\n```\n\nTo pass a `Stream` to this method, construct a StreamPart object like so:\n\n```csharp\nsomeApiInstance.UploadPhoto(id, new StreamPart(myPhotoStream, \"photo.jpg\", \"image/jpeg\"));\n```\n\nNote: The `AttachmentName` attribute that was previously described in this section has been deprecated and its use is not recommended.\n\n### Retrieving the response\n\nNote that in Refit unlike in Retrofit, there is no option for a synchronous\nnetwork request - all requests must be async, either via `Task` or via\n`IObservable`. There is also no option to create an async method via a Callback\nparameter unlike Retrofit, because we live in the async/await future.\n\nSimilarly to how body content changes via the parameter type, the return type\nwill determine the content returned.\n\nReturning Task without a type parameter will discard the content and solely\ntell you whether or not the call succeeded:\n\n```csharp\n[Post(\"/users/new\")]\nTask CreateUser([Body] User user);\n\n// This will throw if the network call fails\nawait CreateUser(someUser);\n```\n\nIf the type parameter is 'HttpResponseMessage' or 'string', the raw response\nmessage or the content as a string will be returned respectively.\n\n```csharp\n// Returns the content as a string (i.e. the JSON data)\n[Get(\"/users/{user}\")]\nTask<string> GetUser(string user);\n\n// Returns the raw response, as an IObservable that can be used with the\n// Reactive Extensions\n[Get(\"/users/{user}\")]\nIObservable<HttpResponseMessage> GetUser(string user);\n```\n\nThere is also a generic wrapper class called `ApiResponse<T>` that can be used as a return type. Using this class as a return type allows you to retrieve not just the content as an object, but also any metadata associated with the request/response. This includes information such as response headers, the http status code and reason phrase (e.g. 404 Not Found), the response version, the original request message that was sent and in the case of an error, an `ApiException` object containing details of the error. Following are some examples of how you can retrieve the response metadata.\n\n```csharp\n//Returns the content within a wrapper class containing metadata about the request/response\n[Get(\"/users/{user}\")]\nTask<ApiResponse<User>> GetUser(string user);\n\n//Calling the API\nvar response = await gitHubApi.GetUser(\"octocat\");\n\n//Getting the status code (returns a value from the System.Net.HttpStatusCode enumeration)\nvar httpStatus = response.StatusCode;\n\n//Determining if a success status code was received and there wasn't any other error\n//(for example, during content deserialization)\nif(response.IsSuccessful)\n{\n    //YAY! Do the thing...\n}\n\n//Retrieving a well-known header value (e.g. \"Server\" header)\nvar serverHeaderValue = response.Headers.Server != null ? response.Headers.Server.ToString() : string.Empty;\n\n//Retrieving a custom header value\nvar customHeaderValue = string.Join(',', response.Headers.GetValues(\"A-Custom-Header\"));\n\n//Looping through all the headers\nforeach(var header in response.Headers)\n{\n    var headerName = header.Key;\n    var headerValue = string.Join(',', header.Value);\n}\n\n//Finally, retrieving the content in the response body as a strongly-typed object\nvar user = response.Content;\n```\n\n### Using generic interfaces\n\nWhen using something like ASP.NET Web API, it's a fairly common pattern to have a whole stack of CRUD REST services. Refit now supports these, allowing you to define a single API interface with a generic type:\n\n```csharp\npublic interface IReallyExcitingCrudApi<T, in TKey> where T : class\n{\n    [Post(\"\")]\n    Task<T> Create([Body] T payload);\n\n    [Get(\"\")]\n    Task<List<T>> ReadAll();\n\n    [Get(\"/{key}\")]\n    Task<T> ReadOne(TKey key);\n\n    [Put(\"/{key}\")]\n    Task Update(TKey key, [Body]T payload);\n\n    [Delete(\"/{key}\")]\n    Task Delete(TKey key);\n}\n```\n\nWhich can be used like this:\n\n```csharp\n// The \"/users\" part here is kind of important if you want it to work for more\n// than one type (unless you have a different domain for each type)\nvar api = RestService.For<IReallyExcitingCrudApi<User, string>>(\"http://api.example.com/users\");\n```\n### Interface inheritance\n\nWhen multiple services that need to be kept separate share a number of APIs, it is possible to leverage interface inheritance to avoid having to define the same Refit methods multiple times in different services:\n\n```csharp\npublic interface IBaseService\n{\n    [Get(\"/resources\")]\n    Task<Resource> GetResource(string id);\n}\n\npublic interface IDerivedServiceA : IBaseService\n{\n    [Delete(\"/resources\")]\n    Task DeleteResource(string id);\n}\n\npublic interface IDerivedServiceB : IBaseService\n{\n    [Post(\"/resources\")]\n    Task<string> AddResource([Body] Resource resource);\n}\n```\n\nIn this example, the `IDerivedServiceA` interface will expose both the `GetResource` and `DeleteResource` APIs, while `IDerivedServiceB` will expose `GetResource` and `AddResource`.\n\n#### Headers inheritance\n\nWhen using inheritance, existing header attributes will be passed along as well, and the inner-most ones will have precedence:\n\n```csharp\n[Headers(\"User-Agent: AAA\")]\npublic interface IAmInterfaceA\n{\n    [Get(\"/get?result=Ping\")]\n    Task<string> Ping();\n}\n\n[Headers(\"User-Agent: BBB\")]\npublic interface IAmInterfaceB : IAmInterfaceA\n{\n    [Get(\"/get?result=Pang\")]\n    [Headers(\"User-Agent: PANG\")]\n    Task<string> Pang();\n\n    [Get(\"/get?result=Foo\")]\n    Task<string> Foo();\n}\n```\n\nHere, `IAmInterfaceB.Pang()` will use `PANG` as its user agent, while `IAmInterfaceB.Foo` and `IAmInterfaceB.Ping` will use `BBB`.\nNote that if `IAmInterfaceB` didn't have a header attribute, `Foo` would then use the `AAA` value inherited from `IAmInterfaceA`.\nIf an interface is inheriting more than one interface, the order of precedence is the same as the one in which the inherited interfaces are declared:\n\n```csharp\npublic interface IAmInterfaceC : IAmInterfaceA, IAmInterfaceB\n{\n    [Get(\"/get?result=Foo\")]\n    Task<string> Foo();\n}\n```\n\nHere `IAmInterfaceC.Foo` would use the header attribute inherited from `IAmInterfaceA`, if present, or the one inherited from `IAmInterfaceB`, and so on for all the declared interfaces.\n\n### Default Interface Methods\nStarting with C# 8.0, default interface methods (a.k.a. DIMs) can be defined on interfaces. Refit interfaces can provide additional logic using DIMs, optionally combined with private and/or static helper methods:\n```csharp\npublic interface IApiClient\n{\n    // implemented by Refit but not exposed publicly\n    [Get(\"/get\")]\n    internal Task<string> GetInternal();\n    // Publicly available with added logic applied to the result from the API call\n    public async Task<string> Get()\n        => FormatResponse(await GetInternal());\n    private static String FormatResponse(string response)\n        => $\"The response is: {response}\";\n}\n```\nThe type generated by Refit will implement the method `IApiClient.GetInternal`. If additional logic is required immediately before or after its invocation, it shouldn't be exposed directly and can thus be hidden from consumers by being marked as `internal`.\nThe default interface method `IApiClient.Get` will be inherited by all types implementing `IApiClient`, including - of course - the type generated by Refit.\nConsumers of the `IApiClient` will call the public `Get` method and profit from the additional logic provided in its implementation (optionally, in this case, with the help of the private static helper `FormatResponse`).\nTo support runtimes without DIM-support (.NET Core 2.x and below or .NET Standard 2.0 and below), two additional types would be required for the same solution.\n```csharp\ninternal interface IApiClientInternal\n{\n    [Get(\"/get\")]\n    Task<string> Get();\n}\npublic interface IApiClient\n{\n    public Task<string> Get();\n}\ninternal class ApiClient : IApiClient\n{\n    private readonly IApiClientInternal client;\n    public ApiClient(IApiClientInternal client) => this.client = client;\n    public async Task<string> Get()\n        => FormatResponse(await client.Get());\n    private static String FormatResponse(string response)\n        => $\"The response is: {response}\";\n}\n```\n\n### Using HttpClientFactory\n\nRefit has first class support for the ASP.Net Core 2.1 HttpClientFactory. Add a reference to `Refit.HttpClientFactory` and call\nthe provided extension method in your `ConfigureServices` method to configure your Refit interface:\n\n```csharp\nservices.AddRefitClient<IWebApi>()\n        .ConfigureHttpClient(c => c.BaseAddress = new Uri(\"https://api.example.com\"));\n        // Add additional IHttpClientBuilder chained methods as required here:\n        // .AddHttpMessageHandler<MyHandler>()\n        // .SetHandlerLifetime(TimeSpan.FromMinutes(2));\n```\n\nOptionally, a `RefitSettings` object can be included:\n```csharp\nvar settings = new RefitSettings();\n// Configure refit settings here\n\nservices.AddRefitClient<IWebApi>(settings)\n        .ConfigureHttpClient(c => c.BaseAddress = new Uri(\"https://api.example.com\"));\n        // Add additional IHttpClientBuilder chained methods as required here:\n        // .AddHttpMessageHandler<MyHandler>()\n        // .SetHandlerLifetime(TimeSpan.FromMinutes(2));\n\n// or injected from the container\nservices.AddRefitClient<IWebApi>(provider => new RefitSettings() { /* configure settings */ })\n        .ConfigureHttpClient(c => c.BaseAddress = new Uri(\"https://api.example.com\"));\n        // Add additional IHttpClientBuilder chained methods as required here:\n        // .AddHttpMessageHandler<MyHandler>()\n        // .SetHandlerLifetime(TimeSpan.FromMinutes(2));\n\n```\nNote that some of the properties of `RefitSettings` will be ignored because the `HttpClient` and `HttpClientHandlers` will be managed by the `HttpClientFactory` instead of Refit.\n\nYou can then get the api interface using constructor injection:\n\n```csharp\npublic class HomeController : Controller\n{\n    public HomeController(IWebApi webApi)\n    {\n        _webApi = webApi;\n    }\n\n    private readonly IWebApi _webApi;\n\n    public async Task<IActionResult> Index(CancellationToken cancellationToken)\n    {\n        var thing = await _webApi.GetSomethingWeNeed(cancellationToken);\n        return View(thing);\n    }\n}\n```\n\n### Providing a custom HttpClient\n\nYou can supply a custom `HttpClient` instance by simply passing it as a parameter to the `RestService.For<T>` method:\n\n```csharp\nRestService.For<ISomeApi>(new HttpClient()\n{\n    BaseAddress = new Uri(\"https://www.someapi.com/api/\")\n});\n```\n\nHowever, when supplying a custom `HttpClient` instance, `HttpMessageHandlerFactory` will not be used because you already control the handler pipeline.\n\n`AuthorizationHeaderValueGetter` does still work with `RestService.For<T>(httpClient, settings)` when the request includes an `Authorization` header placeholder (for example `[Headers(\"Authorization: Bearer\")]`).\n\nIf you still want to be able to configure the `HtttpClient` instance that `Refit` provides while still making use of the above settings, simply expose the `HttpClient` on the API interface:\n\n```csharp\ninterface ISomeApi\n{\n    // This will automagically be populated by Refit if the property exists\n    HttpClient Client { get; }\n\n    [Headers(\"Authorization: Bearer\")]\n    [Get(\"/endpoint\")]\n    Task<string> SomeApiEndpoint();\n}\n```\n\nThen, after creating the REST service, you can set any `HttpClient` property you want, e.g. `Timeout`:\n\n```csharp\nSomeApi = RestService.For<ISomeApi>(\"https://www.someapi.com/api/\", new RefitSettings()\n{\n    AuthorizationHeaderValueGetter = (rq, ct) => GetTokenAsync()\n});\n\nSomeApi.Client.Timeout = timeout;\n```\n\n### Native AoT / trimming guidance\n\nRefit's recommended **source-generator-first** setup for Native AoT and trimmed applications is:\n\n1. Use normal Refit interfaces so the Refit source generator produces the client implementation at build time.\n2. Prefer `RestService.For<T>(...)` over reflection-heavy manual patterns around `Type` where possible.\n3. Supply source-generated `System.Text.Json` metadata for your DTOs.\n\nFor the default `SystemTextJsonContentSerializer` on .NET 8+, Refit prefers `JsonTypeInfo` metadata from your configured `JsonSerializerOptions` when it is available. That means Native AoT apps can improve compatibility by supplying source-generated metadata through a `JsonSerializerContext` or `TypeInfoResolver` on the serializer options they pass into `SystemTextJsonContentSerializer`.\n\n```csharp\n[JsonSerializable(typeof(Todo))]\npublic partial class TodoJsonContext : JsonSerializerContext\n{\n}\n\nvar settings = new RefitSettings(\n    new SystemTextJsonContentSerializer(\n        new JsonSerializerOptions(JsonSerializerDefaults.Web)\n        {\n            TypeInfoResolver = TodoJsonContext.Default\n        }\n    )\n);\n\nvar api = RestService.For<ITodoApi>(\"https://api.example.com\", settings);\n```\n\nIf a generated Refit client cannot be found at runtime, Refit now explicitly points you back to the source generator/build output and recommends generated clients plus source-generated `System.Text.Json` metadata for Native AoT scenarios.\n\nRefit also ships analyzers for newer Roslyn toolchains, including a Roslyn 5.0 build for newer Visual Studio versions.\n\n### Handling exceptions\nRefit has different exception handling behavior depending on if your Refit interface methods return `Task<T>` or if they return `Task<IApiResponse>`, `Task<IApiResponse<T>>`, or `Task<ApiResponse<T>>`.\n\n#### <a id=\"when-returning-taskapiresponset\"></a>When returning `Task<IApiResponse>`, `Task<IApiResponse<T>>`, or `Task<ApiResponse<T>>`\nRefit traps any `ApiException` raised by the `ExceptionFactory` when processing the response, and any errors that occur when attempting to deserialize the response to `ApiResponse<T>`, and populates the exception into the `Error` property on `ApiResponse<T>` without throwing the exception.\n\nYou can then decide what to do like so:\n\n```csharp\nvar response = await _myRefitClient.GetSomeStuff();\nif(response.IsSuccessful)\n{\n   //do your thing\n}\nelse\n{\n   _logger.LogError(response.Error, response.Error.Content);\n}\n```\n\n> [!NOTE]\n> The `IsSuccessful` property checks whether the response status code is in the range 200-299 and there wasn't any other error (for example, during content deserialization). If you just want to check the HTTP response status code, you can use the `IsSuccessStatusCode` property.\n\n#### When returning `Task<T>`\nRefit throws any `ApiException` raised by the `ExceptionFactory` when processing the response and any errors that occur when attempting to deserialize the response to `Task<T>`.\n\n```csharp\n// ...\ntry\n{\n   var result = await awesomeApi.GetFooAsync(\"bar\");\n}\ncatch (ApiException exception)\n{\n   //exception handling\n}\n// ...\n```\n\nRefit can also throw `ValidationApiException` instead which in addition to the information present on `ApiException` also contains `ProblemDetails` when the service implements the [RFC 7807](https://tools.ietf.org/html/rfc7807) specification for problem details and the response content type is `application/problem+json`\n\nFor specific information on the problem details of the validation exception, simply catch `ValidationApiException`:\n\n```csharp\n// ...\ntry\n{\n   var result = await awesomeApi.GetFooAsync(\"bar\");\n}\ncatch (ValidationApiException validationException)\n{\n   // handle validation here by using validationException.Content,\n   // which is type of ProblemDetails according to RFC 7807\n\n   // If the response contains additional properties on the problem details,\n   // they will be added to the validationException.Content.Extensions collection.\n}\ncatch (ApiException exception)\n{\n   // other exception handling\n}\n// ...\n```\n\n#### Providing a custom `ExceptionFactory`\n\nYou can also override default exceptions behavior that are raised by the `ExceptionFactory` when processing the result by providing a custom exception factory in `RefitSettings`. For example, you can suppress all exceptions with the following:\n\n```csharp\nvar nullTask = Task.FromResult<Exception>(null);\n\nvar gitHubApi = RestService.For<IGitHubApi>(\"https://api.github.com\",\n    new RefitSettings {\n        ExceptionFactory = httpResponse => nullTask;\n    });\n```\n\nFor exceptions raised when attempting to deserialize the response use DeserializationExceptionFactory described bellow.\n\n#### Providing a custom `DeserializationExceptionFactory`\n\nYou can override default deserialization exceptions behavior that are raised by the `DeserializationExceptionFactory` when processing the result by providing a custom exception factory in `RefitSettings`. For example, you can suppress all deserialization exceptions with the following:\n\n```csharp\nvar nullTask = Task.FromResult<Exception>(null);\n\nvar gitHubApi = RestService.For<IGitHubApi>(\"https://api.github.com\",\n    new RefitSettings {\n        DeserializationExceptionFactory = (httpResponse, exception) => nullTask;\n    });\n```\n\n#### `ApiException` deconstruction with Serilog\n\nFor users of [Serilog](https://serilog.net), you can enrich the logging of `ApiException` using the\n[Serilog.Exceptions.Refit](https://www.nuget.org/packages/Serilog.Exceptions.Refit) NuGet package. Details of how to\nintegrate this package into your applications can be found [here](https://github.com/RehanSaeed/Serilog.Exceptions#serilogexceptionsrefit).\n"
  },
  {
    "path": "Refit/AnonymousDisposable.cs",
    "content": "﻿namespace Refit\n{\n    sealed class AnonymousDisposable(Action block) : IDisposable\n    {\n        public void Dispose()\n        {\n            block();\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/AotCompatibility.cs",
    "content": "﻿using System.Runtime.CompilerServices;\nusing System.Diagnostics.CodeAnalysis;\n#if NET7_0_OR_GREATER\nusing System.Runtime.InteropServices;\n#endif\n\nnamespace Refit\n{\n    internal static class AotCompatibility\n    {\n        // Intentionally left blank to avoid changing public API surface (e.g., assembly-level attributes)\n        // while keeping a central place for any future AOT-related initializers if needed.\n    }\n}\n"
  },
  {
    "path": "Refit/ApiException.cs",
    "content": "﻿using System.Diagnostics.CodeAnalysis;\nusing System.Net;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\n\nnamespace Refit\n{\n    /// <summary>\n    /// Represents an error that occured while sending an API request.\n    /// </summary>\n    [Serializable]\n#pragma warning disable CA1032 // Implement standard exception constructors\n    public class ApiException : Exception\n#pragma warning restore CA1032 // Implement standard exception constructors\n    {\n        /// <summary>\n        /// HTTP response status code.\n        /// </summary>\n        public HttpStatusCode StatusCode { get; }\n\n        /// <summary>\n        /// The reason phrase which typically is sent by the server together with the status code.\n        /// </summary>\n        public string? ReasonPhrase { get; }\n\n        /// <summary>\n        /// HTTP response headers.\n        /// </summary>\n        public HttpResponseHeaders Headers { get; }\n\n        /// <summary>\n        /// The HTTP method used to send the request.\n        /// </summary>\n        public HttpMethod HttpMethod { get; }\n\n        /// <summary>\n        /// The <see cref=\"System.Uri\"/> used to send the HTTP request.\n        /// </summary>\n        public Uri? Uri => RequestMessage.RequestUri;\n\n        /// <summary>\n        /// The HTTP Request message used to send the request.\n        /// </summary>\n        public HttpRequestMessage RequestMessage { get; }\n\n        /// <summary>\n        /// HTTP response content headers as defined in RFC 2616.\n        /// </summary>\n        public HttpContentHeaders? ContentHeaders { get; private set; }\n\n        /// <summary>\n        /// HTTP Response content as string.\n        /// </summary>\n        public string? Content { get; private set; }\n\n        /// <summary>\n        /// Does the response have content?\n        /// </summary>\n        #if NET6_0_OR_GREATER\n        [MemberNotNullWhen(true, nameof(Content))]\n        #endif\n        public bool HasContent => !string.IsNullOrWhiteSpace(Content);\n\n        /// <summary>\n        /// Refit settings used to send the request.\n        /// </summary>\n        public RefitSettings RefitSettings { get; }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ApiException\"/> class.\n        /// </summary>\n        /// <param name=\"message\">The message.</param>\n        /// <param name=\"httpMethod\">The HTTP method.</param>\n        /// <param name=\"content\">The content.</param>\n        /// <param name=\"statusCode\">The status code.</param>\n        /// <param name=\"reasonPhrase\">The reason phrase.</param>\n        /// <param name=\"headers\">The headers.</param>\n        /// <param name=\"refitSettings\">The refit settings.</param>\n        /// <param name=\"innerException\">The inner exception.</param>\n        protected ApiException(\n            HttpRequestMessage message,\n            HttpMethod httpMethod,\n            string? content,\n            HttpStatusCode statusCode,\n            string? reasonPhrase,\n            HttpResponseHeaders headers,\n            RefitSettings refitSettings,\n            Exception? innerException = null\n        )\n            : this(\n                CreateMessage(statusCode, reasonPhrase),\n                message,\n                httpMethod,\n                content,\n                statusCode,\n                reasonPhrase,\n                headers,\n                refitSettings,\n                innerException\n            ) { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ApiException\"/> class.\n        /// </summary>\n        /// <param name=\"exceptionMessage\">The exception message.</param>\n        /// <param name=\"message\">The message.</param>\n        /// <param name=\"httpMethod\">The HTTP method.</param>\n        /// <param name=\"content\">The content.</param>\n        /// <param name=\"statusCode\">The status code.</param>\n        /// <param name=\"reasonPhrase\">The reason phrase.</param>\n        /// <param name=\"headers\">The headers.</param>\n        /// <param name=\"refitSettings\">The refit settings.</param>\n        /// <param name=\"innerException\">The inner exception.</param>\n        protected ApiException(\n            string exceptionMessage,\n            HttpRequestMessage message,\n            HttpMethod httpMethod,\n            string? content,\n            HttpStatusCode statusCode,\n            string? reasonPhrase,\n            HttpResponseHeaders headers,\n            RefitSettings refitSettings,\n            Exception? innerException = null\n        )\n            : base(exceptionMessage, innerException)\n        {\n            RequestMessage = message;\n            HttpMethod = httpMethod;\n            StatusCode = statusCode;\n            ReasonPhrase = reasonPhrase;\n            Headers = headers;\n            RefitSettings = refitSettings;\n            Content = content;\n        }\n\n        /// <summary>\n        /// Get the deserialized response content as nullable <typeparamref name=\"T\"/>.\n        /// </summary>\n        /// <typeparam name=\"T\">Type to deserialize the content to</typeparam>\n        /// <returns>The response content deserialized as <typeparamref name=\"T\"/></returns>\n        public async Task<T?> GetContentAsAsync<T>() =>\n            HasContent\n                ? await RefitSettings\n                    .ContentSerializer.FromHttpContentAsync<T>(new StringContent(Content!))\n                    .ConfigureAwait(false)\n                : default;\n\n        /// <summary>\n        /// Create an instance of <see cref=\"ApiException\"/>.\n        /// </summary>\n        /// <param name=\"message\">The HTTP Request message used to send the request.</param>\n        /// <param name=\"httpMethod\">The HTTP method used to send the request.</param>\n        /// <param name=\"response\">The HTTP Response message.</param>\n        /// <param name=\"refitSettings\">Refit settings used to sent the request.</param>\n        /// <param name=\"innerException\">Add an inner exception to the <see cref=\"ApiException\"/>.</param>\n        /// <returns>A newly created <see cref=\"ApiException\"/>.</returns>\n#pragma warning disable VSTHRD200 // Use \"Async\" suffix for async methods\n        public static Task<ApiException> Create(\n            HttpRequestMessage message,\n            HttpMethod httpMethod,\n            HttpResponseMessage response,\n            RefitSettings refitSettings,\n            Exception? innerException = null\n        )\n#pragma warning restore VSTHRD200 // Use \"Async\" suffix for async methods\n        {\n            if (response?.IsSuccessStatusCode == true)\n            {\n                throw new ArgumentException(\"Response is successful, cannot create an ApiException.\", nameof(response));\n            }\n\n            var exceptionMessage = CreateMessage(response!.StatusCode, response.ReasonPhrase);\n            return Create(\n                exceptionMessage,\n                message,\n                httpMethod,\n                response,\n                refitSettings,\n                innerException\n            );\n        }\n\n        /// <summary>\n        /// Create an instance of <see cref=\"ApiException\"/> with a custom exception message.\n        /// </summary>\n        /// <param name=\"exceptionMessage\">A custom exception message.</param>\n        /// <param name=\"message\">The HTTP Request message used to send the request.</param>\n        /// <param name=\"httpMethod\">The HTTP method used to send the request.</param>\n        /// <param name=\"response\">The HTTP Response message.</param>\n        /// <param name=\"refitSettings\">Refit settings used to sent the request.</param>\n        /// <param name=\"innerException\">Add an inner exception to the <see cref=\"ApiException\"/>.</param>\n        /// <returns>A newly created <see cref=\"ApiException\"/>.</returns>\n#pragma warning disable VSTHRD200 // Use \"Async\" suffix for async methods\n        public static async Task<ApiException> Create(\n            string exceptionMessage,\n            HttpRequestMessage message,\n            HttpMethod httpMethod,\n            HttpResponseMessage response,\n            RefitSettings refitSettings,\n            Exception? innerException = null\n        )\n#pragma warning restore VSTHRD200 // Use \"Async\" suffix for async methods\n        {\n            if (response == null)\n            {\n                throw new ArgumentNullException(nameof(response));\n            }\n\n            var exception = new ApiException(\n                exceptionMessage,\n                message,\n                httpMethod,\n                null,\n                response.StatusCode,\n                response.ReasonPhrase,\n                response.Headers,\n                refitSettings,\n                innerException\n            );\n\n            if (response.Content == null)\n            {\n                return exception;\n            }\n\n#pragma warning disable CA1031 // Do not catch general exception types\n            try\n            {\n                exception.ContentHeaders = response.Content.Headers;\n                var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);\n                exception.Content = content;\n\n                if (\n                    response\n                        .Content.Headers?.ContentType\n                        ?.MediaType\n                        ?.Equals(\"application/problem+json\") ?? false\n                )\n                {\n                    exception = ValidationApiException.Create(exception);\n                }\n\n                response.Content.Dispose();\n            }\n            catch\n            {\n                // NB: We're already handling an exception at this point,\n                // so we want to make sure we don't throw another one\n                // that hides the real error.\n            }\n#pragma warning restore CA1031 // Do not catch general exception types\n\n            return exception;\n        }\n\n        static string CreateMessage(HttpStatusCode statusCode, string? reasonPhrase) =>\n            $\"Response status code does not indicate success: {(int)statusCode} ({reasonPhrase}).\";\n    }\n}\n"
  },
  {
    "path": "Refit/ApiResponse.cs",
    "content": "﻿using System.Diagnostics.CodeAnalysis;\nusing System.Net;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\n\nnamespace Refit\n{\n    static class ApiResponse\n    {\n        internal static T Create<T, TBody>(\n            HttpResponseMessage resp,\n            object? content,\n            RefitSettings settings,\n            ApiException? error = null\n        )\n        {\n            return (T)\n                Activator.CreateInstance(\n                    typeof(ApiResponse<TBody>),\n                    resp,\n                    content,\n                    settings,\n                    error\n                )!;\n        }\n    }\n\n    /// <summary>\n    /// Implementation of <see cref=\"IApiResponse{T}\"/> that provides additional functionalities.\n    /// </summary>\n    /// <typeparam name=\"T\"></typeparam>\n    /// <remarks>\n    /// Create an instance of <see cref=\"ApiResponse{T}\"/> with type <typeparamref name=\"T\"/>.\n    /// </remarks>\n    /// <param name=\"response\">Original HTTP Response message.</param>\n    /// <param name=\"content\">Response content.</param>\n    /// <param name=\"settings\">Refit settings used to send the request.</param>\n    /// <param name=\"error\">The ApiException, if the request failed.</param>\n    /// <exception cref=\"ArgumentNullException\"></exception>\n    public sealed class ApiResponse<T>(\n        HttpResponseMessage response,\n        T? content,\n        RefitSettings settings,\n        ApiException? error = null\n        ) : IApiResponse<T>\n    {\n        readonly HttpResponseMessage response = response ?? throw new ArgumentNullException(nameof(response));\n        bool disposed;\n\n        /// <summary>\n        /// Deserialized request content as <typeparamref name=\"T\"/>.\n        /// </summary>\n        public T? Content { get; } = content;\n\n        /// <summary>\n        /// Refit settings used to send the request.\n        /// </summary>\n        public RefitSettings Settings { get; } = settings;\n\n        /// <summary>\n        /// HTTP response headers.\n        /// </summary>\n        public HttpResponseHeaders Headers => response.Headers;\n\n        /// <summary>\n        /// HTTP response content headers as defined in RFC 2616.\n        /// </summary>\n        public HttpContentHeaders? ContentHeaders => response.Content?.Headers;\n\n        /// <summary>\n        /// Indicates whether the request was successful.\n        /// </summary>\n#if NET6_0_OR_GREATER\n        [MemberNotNullWhen(true, nameof(ContentHeaders))]\n        [MemberNotNullWhen(false, nameof(Error))]\n#endif\n        public bool IsSuccessStatusCode => response.IsSuccessStatusCode;\n\n        /// <summary>\n        /// Indicates whether the request was successful and there wasn't any other error (for example, during content deserialization).\n        /// </summary>\n#if NET6_0_OR_GREATER\n        [MemberNotNullWhen(true, nameof(Content))]\n        [MemberNotNullWhen(true, nameof(ContentHeaders))]\n        [MemberNotNullWhen(false, nameof(Error))]\n#endif\n        public bool IsSuccessful => IsSuccessStatusCode && Error is null;\n\n        /// <summary>\n        /// The reason phrase which typically is sent by the server together with the status code.\n        /// </summary>\n        public string? ReasonPhrase => response.ReasonPhrase;\n\n        /// <summary>\n        /// The HTTP Request message which led to this response.\n        /// </summary>\n        public HttpRequestMessage? RequestMessage => response.RequestMessage;\n\n        /// <summary>\n        /// HTTP response status code.\n        /// </summary>\n        public HttpStatusCode StatusCode => response.StatusCode;\n\n        /// <summary>\n        /// HTTP Message version.\n        /// </summary>\n        public Version Version => response.Version;\n\n        /// <summary>\n        /// The <see cref=\"ApiException\" /> object in case of unsuccessful response.\n        /// </summary>\n        public ApiException? Error { get; private set; } = error;\n\n        /// <summary>\n        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.\n        /// </summary>\n        public void Dispose()\n        {\n            Dispose(true);\n        }\n\n        /// <summary>\n        /// Ensures the request was successful by throwing an exception in case of failure\n        /// </summary>\n        /// <returns>The current <see cref=\"ApiResponse{T}\"/></returns>\n        /// <exception cref=\"ApiException\"></exception>\n        public async Task<ApiResponse<T>> EnsureSuccessStatusCodeAsync()\n        {\n            if (!IsSuccessStatusCode)\n            {\n                await ThrowsApiExceptionAsync().ConfigureAwait(false);\n            }\n\n            return this;\n        }\n\n        /// <summary>\n        /// Ensures the request was successful and without any other error by throwing an exception in case of failure\n        /// </summary>\n        /// <returns>The current <see cref=\"ApiResponse{T}\"/></returns>\n        /// <exception cref=\"ApiException\"></exception>\n        public async Task<ApiResponse<T>> EnsureSuccessfulAsync()\n        {\n            if (!IsSuccessful)\n            {\n                await ThrowsApiExceptionAsync().ConfigureAwait(false);\n            }\n\n            return this;\n        }\n\n        void Dispose(bool disposing)\n        {\n            if (!disposing || disposed)\n                return;\n\n            disposed = true;\n\n            response.Dispose();\n        }\n\n        private async Task<ApiException> ThrowsApiExceptionAsync()\n        {\n            var exception =\n                    Error\n                    ?? await ApiException\n                        .Create(\n                            response.RequestMessage!,\n                            response.RequestMessage!.Method,\n                            response,\n                            Settings\n                        )\n                        .ConfigureAwait(false);\n\n            Dispose();\n\n            throw exception;\n        }\n    }\n\n    /// <inheritdoc/>\n    public interface IApiResponse<out T> : IApiResponse\n    {\n#if NET6_0_OR_GREATER\n        /// <summary>\n        /// The <see cref=\"ApiException\"/> object in case of unsuccessful response.\n        /// </summary>\n        [SuppressMessage(\n            \"Naming\",\n            \"CA1716:Identifiers should not match keywords\",\n            Justification = \"By Design\"\n        )]\n        new ApiException? Error { get; }\n\n        /// <summary>\n        /// HTTP response content headers as defined in RFC 2616.\n        /// </summary>\n        new HttpContentHeaders? ContentHeaders { get; }\n\n        /// <summary>\n        /// Indicates whether the request was successful.\n        /// </summary>\n        [MemberNotNullWhen(true, nameof(ContentHeaders))]\n        [MemberNotNullWhen(false, nameof(Error))]\n        new bool IsSuccessStatusCode { get; }\n\n        /// <summary>\n        /// Indicates whether the request was successful and there wasn't any other error (for example, during content deserialization).\n        /// </summary>\n        [MemberNotNullWhen(true, nameof(Content))]\n        [MemberNotNullWhen(true, nameof(ContentHeaders))]\n        [MemberNotNullWhen(false, nameof(Error))]\n        new bool IsSuccessful { get; }\n#endif\n\n        /// <summary>\n        /// Deserialized request content as <typeparamref name=\"T\"/>.\n        /// </summary>\n        T? Content { get; }\n    }\n\n    /// <summary>\n    /// Base interface used to represent an API response.\n    /// </summary>\n    public interface IApiResponse : IDisposable\n    {\n        /// <summary>\n        /// HTTP response headers.\n        /// </summary>\n        HttpResponseHeaders Headers { get; }\n\n        /// <summary>\n        /// HTTP response content headers as defined in RFC 2616.\n        /// </summary>\n        HttpContentHeaders? ContentHeaders { get; }\n\n        /// <summary>\n        /// Indicates whether the request was successful.\n        /// </summary>\n#if NET6_0_OR_GREATER\n        [MemberNotNullWhen(true, nameof(ContentHeaders))]\n        [MemberNotNullWhen(false, nameof(Error))]\n#endif\n        bool IsSuccessStatusCode { get; }\n\n        /// <summary>\n        /// Indicates whether the request was successful and there wasn't any other error (for example, during content deserialization).\n        /// </summary>\n#if NET6_0_OR_GREATER        \n        [MemberNotNullWhen(true, nameof(ContentHeaders))]\n        [MemberNotNullWhen(false, nameof(Error))]\n#endif\n        bool IsSuccessful { get; }\n\n        /// <summary>\n        /// HTTP response status code.\n        /// </summary>\n        HttpStatusCode StatusCode { get; }\n\n        /// <summary>\n        /// The reason phrase which typically is sent by the server together with the status code.\n        /// </summary>\n        string? ReasonPhrase { get; }\n\n        /// <summary>\n        /// The HTTP Request message which led to this response.\n        /// </summary>\n        HttpRequestMessage? RequestMessage { get; }\n\n        /// <summary>\n        /// HTTP Message version.\n        /// </summary>\n        Version Version { get; }\n\n        /// <summary>\n        /// The <see cref=\"ApiException\"/> object in case of unsuccessful response.\n        /// </summary>\n        [SuppressMessage(\n           \"Naming\",\n           \"CA1716:Identifiers should not match keywords\",\n           Justification = \"By Design\"\n       )]\n        ApiException? Error { get; }\n    }\n}\n"
  },
  {
    "path": "Refit/Attributes.cs",
    "content": "﻿using System.Net.Http;\n\nnamespace Refit\n{\n    /// <summary>\n    /// HttpMethodAttribute.\n    /// </summary>\n    /// <seealso cref=\"System.Attribute\" />\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"HttpMethodAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"path\">The path.</param>\n    public abstract class HttpMethodAttribute(string path) : Attribute\n    {\n        /// <summary>\n        /// Gets the method.\n        /// </summary>\n        /// <value>\n        /// The method.\n        /// </value>\n        public abstract HttpMethod Method { get; }\n\n        /// <summary>\n        /// Gets or sets the path.\n        /// </summary>\n        /// <value>\n        /// The path.\n        /// </value>\n        public virtual string Path { get; protected set; } = path;\n    }\n\n    /// <summary>\n    /// Send the request with HTTP method 'GET'.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"GetAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"path\">The path.</param>\n    [AttributeUsage(AttributeTargets.Method)]\n#pragma warning disable CA1813 // Avoid unsealed attributes\n    public class GetAttribute(string path) : HttpMethodAttribute(path)\n    {\n        /// <summary>\n        /// Gets the method.\n        /// </summary>\n        /// <value>\n        /// The method.\n        /// </value>\n        public override HttpMethod Method => HttpMethod.Get;\n    }\n\n    /// <summary>\n    /// Send the request with HTTP method 'POST'.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"PostAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"path\">The path.</param>\n    [AttributeUsage(AttributeTargets.Method)]\n    public class PostAttribute(string path) : HttpMethodAttribute(path)\n    {\n        /// <summary>\n        /// Gets the method.\n        /// </summary>\n        /// <value>\n        /// The method.\n        /// </value>\n        public override HttpMethod Method => HttpMethod.Post;\n    }\n\n    /// <summary>\n    /// Send the request with HTTP method 'PUT'.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"PutAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"path\">The path.</param>\n    [AttributeUsage(AttributeTargets.Method)]\n    public class PutAttribute(string path) : HttpMethodAttribute(path)\n    {\n        /// <summary>\n        /// Gets the method.\n        /// </summary>\n        /// <value>\n        /// The method.\n        /// </value>\n        public override HttpMethod Method => HttpMethod.Put;\n    }\n\n    /// <summary>\n    /// Send the request with HTTP method 'DELETE'.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"DeleteAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"path\">The path.</param>\n    [AttributeUsage(AttributeTargets.Method)]\n    public class DeleteAttribute(string path) : HttpMethodAttribute(path)\n    {\n        /// <summary>\n        /// Gets the method.\n        /// </summary>\n        /// <value>\n        /// The method.\n        /// </value>\n        public override HttpMethod Method => HttpMethod.Delete;\n    }\n\n    /// <summary>\n    /// Send the request with HTTP method 'PATCH'.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"PatchAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"path\">The path.</param>\n    [AttributeUsage(AttributeTargets.Method)]\n    public class PatchAttribute(string path) : HttpMethodAttribute(path)\n    {\n        /// <summary>\n        /// Gets the method.\n        /// </summary>\n        /// <value>\n        /// The method.\n        /// </value>\n        public override HttpMethod Method => new(\"PATCH\");\n    }\n\n    /// <summary>\n    /// Send the request with HTTP method 'OPTION'.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"OptionsAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"path\">The path.</param>\n    [AttributeUsage(AttributeTargets.Method)]\n    public class OptionsAttribute(string path) : HttpMethodAttribute(path)\n    {\n        /// <summary>\n        /// Gets the method.\n        /// </summary>\n        /// <value>\n        /// The method.\n        /// </value>\n        public override HttpMethod Method => new(\"OPTIONS\");\n    }\n\n    /// <summary>\n    /// Send the request with HTTP method 'HEAD'.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"HeadAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"path\">The path.</param>\n    [AttributeUsage(AttributeTargets.Method)]\n    public class HeadAttribute(string path) : HttpMethodAttribute(path)\n    {\n        /// <summary>\n        /// Gets the method.\n        /// </summary>\n        /// <value>\n        /// The method.\n        /// </value>\n        public override HttpMethod Method => HttpMethod.Head;\n    }\n\n    /// <summary>\n    /// Send the request as multipart.\n    /// </summary>\n    /// <remarks>\n    /// Currently, multipart methods only support the following parameter types: <see cref=\"string\"/>, <see cref=\"byte\"/> array, <see cref=\"System.IO.Stream\"/>, <see cref=\"System.IO.FileInfo\"/>.\n    /// </remarks>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"MultipartAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"boundaryText\">The boundary text.</param>\n    [AttributeUsage(AttributeTargets.Method)]\n    public class MultipartAttribute(string boundaryText = \"----MyGreatBoundary\") : Attribute\n    {\n        /// <summary>\n        /// Gets the boundary text.\n        /// </summary>\n        /// <value>\n        /// The boundary text.\n        /// </value>\n        public string BoundaryText { get; private set; } = boundaryText;\n    }\n\n    /// <summary>\n    /// Defines methods to serialize HTTP requests' bodies.\n    /// </summary>\n    public enum BodySerializationMethod\n    {\n        /// <summary>\n        /// Encodes everything using the ContentSerializer in RefitSettings except for strings. Strings are set as-is\n        /// </summary>\n        Default,\n\n        /// <summary>\n        /// Json encodes everything, including strings\n        /// </summary>\n        [Obsolete(\"Use BodySerializationMethod.Serialized instead\", false)]\n        Json,\n\n        /// <summary>\n        /// Form-UrlEncode's the values\n        /// </summary>\n        UrlEncoded,\n\n        /// <summary>\n        /// Encodes everything using the ContentSerializer in RefitSettings\n        /// </summary>\n        Serialized\n    }\n\n    /// <summary>\n    /// Set a parameter to be sent as the HTTP request's body.\n    /// </summary>\n    /// <remarks>\n    /// There are four behaviors when sending a parameter as the request body:<br/>\n    /// - If the type is/implements <see cref=\"System.IO.Stream\"/>, the content will be streamed via <see cref=\"StreamContent\"/>.<br/>\n    /// - If the type is <see cref=\"string\"/>, it will be used directly as the content unless <c>[Body(BodySerializationMethod.Json)]</c> is set\n    /// which will send it as a <see cref=\"StringContent\"/>.<br/>\n    /// - If the parameter has the attribute <c>[Body(BodySerializationMethod.UrlEncoded)]</c>, the content will be URL-encoded.<br/>\n    /// - For all other types, the object will be serialized using the content serializer specified in the request's <see cref=\"RefitSettings\"/>.\n    /// </remarks>\n    [AttributeUsage(AttributeTargets.Parameter)]\n    public class BodyAttribute : Attribute\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"BodyAttribute\"/> class.\n        /// </summary>\n        public BodyAttribute() { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"BodyAttribute\"/> class.\n        /// </summary>\n        /// <param name=\"buffered\">if set to <c>true</c> [buffered].</param>\n        public BodyAttribute(bool buffered) => Buffered = buffered;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"BodyAttribute\"/> class.\n        /// </summary>\n        /// <param name=\"serializationMethod\">The serialization method.</param>\n        /// <param name=\"buffered\">if set to <c>true</c> [buffered].</param>\n        public BodyAttribute(BodySerializationMethod serializationMethod, bool buffered)\n        {\n            SerializationMethod = serializationMethod;\n            Buffered = buffered;\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"BodyAttribute\"/> class.\n        /// </summary>\n        /// <param name=\"serializationMethod\">The serialization method.</param>\n        public BodyAttribute(\n            BodySerializationMethod serializationMethod = BodySerializationMethod.Default\n        )\n        {\n            SerializationMethod = serializationMethod;\n        }\n\n        /// <summary>\n        /// Gets or sets the buffered.\n        /// </summary>\n        /// <value>\n        /// The buffered.\n        /// </value>\n        public bool? Buffered { get; }\n\n        /// <summary>\n        /// Gets or sets the serialization method.\n        /// </summary>\n        /// <value>\n        /// The serialization method.\n        /// </value>\n        public BodySerializationMethod SerializationMethod { get; } =\n            BodySerializationMethod.Default;\n    }\n\n    /// <summary>\n    /// Override the key that will be sent in the query string.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"AliasAsAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"name\">The name.</param>\n    [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]\n    public class AliasAsAttribute(string name) : Attribute\n    {\n        /// <summary>\n        /// Gets or sets the name.\n        /// </summary>\n        /// <value>\n        /// The name.\n        /// </value>\n        public string Name { get; protected set; } = name;\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"AttachmentNameAttribute\"/> class.\n    /// </summary>\n    /// <param name=\"name\">The name.</param>\n    [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)]\n    [Obsolete(\n        \"Use Refit.StreamPart, Refit.ByteArrayPart, Refit.FileInfoPart or if necessary, inherit from Refit.MultipartItem\",\n        false\n    )]\n    public class AttachmentNameAttribute(string name) : Attribute\n    {\n        /// <summary>\n        /// Gets or sets the name.\n        /// </summary>\n        /// <value>\n        /// The name.\n        /// </value>\n        public string Name { get; protected set; } = name;\n    }\n\n    /// <summary>\n    /// Allows you to provide a Dictionary of headers to be added to the request.\n    /// </summary>\n    [AttributeUsage(AttributeTargets.Parameter)]\n    public class HeaderCollectionAttribute : Attribute { }\n\n    /// <summary>\n    /// Add multiple headers to the request.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"HeadersAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"headers\">The headers.</param>\n    [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Method)]\n    public class HeadersAttribute(params string[] headers) : Attribute\n    {\n        /// <summary>\n        /// Gets the headers.\n        /// </summary>\n        /// <value>\n        /// The headers.\n        /// </value>\n        public string[] Headers { get; } = headers ?? [];\n    }\n\n    /// <summary>\n    /// Add a header to the request.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"HeaderAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"header\">The header.</param>\n    [AttributeUsage(AttributeTargets.Parameter)]\n    public class HeaderAttribute(string header) : Attribute\n    {\n        /// <summary>\n        /// Gets the header.\n        /// </summary>\n        /// <value>\n        /// The header.\n        /// </value>\n        public string Header { get; } = header;\n    }\n\n    /// <summary>\n    /// Used to store the value in HttpRequestMessage.Properties for further processing in a custom DelegatingHandler.\n    /// If a string is supplied to the constructor then it will be used as the key in the HttpRequestMessage.Properties dictionary.\n    /// If no key is specified then the key will be defaulted to the name of the parameter.\n    /// </summary>\n    [AttributeUsage(AttributeTargets.Parameter)]\n    public class PropertyAttribute : Attribute\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"PropertyAttribute\"/> class.\n        /// </summary>\n        public PropertyAttribute() { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"PropertyAttribute\"/> class.\n        /// </summary>\n        /// <param name=\"key\">The key.</param>\n        public PropertyAttribute(string key)\n        {\n            Key = key;\n        }\n\n        /// <summary>\n        /// Specifies the key under which to store the value on the HttpRequestMessage.Properties dictionary.\n        /// </summary>\n        public string? Key { get; }\n    }\n\n    /// <summary>\n    /// Add the Authorize header to the request with the value of the associated parameter.\n    /// </summary>\n    /// <remarks>\n    /// Default authorization scheme: Bearer\n    /// </remarks>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"AuthorizeAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"scheme\">The scheme.</param>\n    [AttributeUsage(AttributeTargets.Parameter)]\n    public class AuthorizeAttribute(string scheme = \"Bearer\") : Attribute\n    {\n        /// <summary>\n        /// Gets the scheme.\n        /// </summary>\n        /// <value>\n        /// The scheme.\n        /// </value>\n        public string Scheme { get; } = scheme;\n    }\n\n    /// <summary>\n    /// Associated value will be added to the request Uri as query-string, using a delimiter to split the values. (default: '.')\n    /// </summary>\n    [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] // Property is to allow for form url encoded data\n    public class QueryAttribute : Attribute\n    {\n        CollectionFormat? collectionFormat;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"QueryAttribute\"/> class.\n        /// </summary>\n        public QueryAttribute() { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"QueryAttribute\"/> class.\n        /// </summary>\n        /// <param name=\"delimiter\">The delimiter.</param>\n        public QueryAttribute(string delimiter)\n        {\n            Delimiter = delimiter;\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"QueryAttribute\"/> class.\n        /// </summary>\n        /// <param name=\"delimiter\">The delimiter.</param>\n        /// <param name=\"prefix\">The prefix.</param>\n        public QueryAttribute(string delimiter, string prefix)\n        {\n            Delimiter = delimiter;\n            Prefix = prefix;\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"QueryAttribute\"/> class.\n        /// </summary>\n        /// <param name=\"delimiter\">The delimiter.</param>\n        /// <param name=\"prefix\">The prefix.</param>\n        /// <param name=\"format\">The format.</param>\n        public QueryAttribute(string delimiter, string prefix, string format)\n        {\n            Delimiter = delimiter;\n            Prefix = prefix;\n            Format = format;\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"QueryAttribute\"/> class.\n        /// </summary>\n        /// <param name=\"collectionFormat\">The collection format.</param>\n        public QueryAttribute(CollectionFormat collectionFormat)\n        {\n            CollectionFormat = collectionFormat;\n        }\n\n        /// <summary>\n        /// Used to specify that the value should be treated as a string.\n        /// Set to true if you want to call ToString() on the object before adding it to the query string.\n        /// </summary>\n        public bool TreatAsString { get; set; }\n\n        /// <summary>\n        /// Used to customize the name of either the query parameter pair or of the form field when form encoding.\n        /// </summary>\n        /// <seealso cref=\"Prefix\"/>\n        public string Delimiter { get; protected set; } = \".\";\n\n        /// <summary>\n        /// Used to customize the name of the encoded value.\n        /// </summary>\n        /// <remarks>\n        /// Gets combined with <see cref=\"Delimiter\"/> in the format <code>var name = $\"{Prefix}{Delimiter}{originalFieldName}\"</code>\n        /// where <c>originalFieldName</c> is the name of the object property or method parameter.\n        /// </remarks>\n        /// <example>\n        /// <code>\n        /// class Form\n        /// {\n        ///   [Query(\"-\", \"dontlog\")]\n        ///   public string password { get; }\n        /// }\n        /// </code>\n        /// will result in the encoded form having a field named <c>dontlog-password</c>.\n        /// </example>\n        public string? Prefix { get; protected set; }\n\n#pragma warning disable CA1019 // Define accessors for attribute arguments\n\n        /// <summary>\n        /// Used to customize the formatting of the encoded value.\n        /// </summary>\n        /// <example>\n        /// <code>\n        /// interface IServerApi\n        /// {\n        ///   [Get(\"/expenses\")]\n        ///   Task addExpense([Query(Format=\"0.00\")] double expense);\n        /// }\n        /// </code>\n        /// Calling <c>serverApi.addExpense(5)</c> will result in a URI of <c>{baseUri}/expenses?expense=5.00</c>.\n        /// </example>\n        public string? Format { get; set; }\n\n        /// <summary>\n        /// Specifies how the collection should be encoded.\n        /// </summary>\n        public CollectionFormat CollectionFormat\n        {\n            // Cannot make property nullable due to Attribute restrictions\n            get => collectionFormat.GetValueOrDefault();\n            set => collectionFormat = value;\n        }\n\n#pragma warning restore CA1019 // Define accessors for attribute arguments\n\n        /// <summary>\n        /// Gets a value indicating whether this instance is collection format specified.\n        /// </summary>\n        /// <value>\n        ///   <c>true</c> if this instance is collection format specified; otherwise, <c>false</c>.\n        /// </value>\n        public bool IsCollectionFormatSpecified => collectionFormat.HasValue;\n    }\n\n    /// <summary>\n    /// QueryUriFormatAttribute.\n    /// </summary>\n    /// <seealso cref=\"System.Attribute\" />\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"QueryUriFormatAttribute\"/> class.\n    /// </remarks>\n    /// <param name=\"uriFormat\">The URI format.</param>\n    [AttributeUsage(AttributeTargets.Method)]\n    public class QueryUriFormatAttribute(UriFormat uriFormat) : Attribute\n    {\n        /// <summary>\n        /// Specifies how the Query Params should be encoded.\n        /// </summary>\n        public UriFormat UriFormat { get; } = uriFormat;\n    }\n#pragma warning restore CA1813 // Avoid unsealed attributes\n}\n"
  },
  {
    "path": "Refit/AuthenticatedHttpClientHandler.cs",
    "content": "﻿using System.Net.Http;\nusing System.Net.Http.Headers;\n\nnamespace Refit\n{\n    class AuthenticatedHttpClientHandler : DelegatingHandler\n    {\n        readonly Func<HttpRequestMessage, CancellationToken, Task<string>> getToken;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"AuthenticatedHttpClientHandler\"/> class.\n        /// </summary>\n        /// <param name=\"getToken\">The function to get the authentication token.</param>\n        /// <param name=\"innerHandler\">The optional inner handler.</param>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"getToken\"/> must not be null.</exception>\n        /// <remarks>\n        /// Warning: This constructor sets the <see cref=\"DelegatingHandler.InnerHandler\"/> to an instance\n        /// of <see cref=\"HttpClientHandler\"/>, when <paramref name=\"innerHandler\"/> is <c>null</c>. This is\n        /// a behavior which is incompatible with the <code>IHttpClientBuilder</code>.\n        /// </remarks>\n        public AuthenticatedHttpClientHandler(\n            Func<HttpRequestMessage, CancellationToken, Task<string>> getToken,\n            HttpMessageHandler? innerHandler = null\n        )\n            : base(innerHandler ?? new HttpClientHandler())\n        {\n            this.getToken = getToken ?? throw new ArgumentNullException(nameof(getToken));\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"AuthenticatedHttpClientHandler\"/> class.\n        /// </summary>\n        /// <param name=\"innerHandler\">The optional inner handler.</param>\n        /// <param name=\"getToken\">The function to get the authentication token.</param>\n        /// <exception cref=\"ArgumentNullException\"><paramref name=\"getToken\"/> must not be null.</exception>\n        /// <remarks>\n        /// This function doesn't set the <see cref=\"DelegatingHandler.InnerHandler\"/> automatically to an\n        /// instance of <see cref=\"HttpClientHandler\"/> when <paramref name=\"innerHandler\"/> is null,\n        /// which is different from the old (legacy) constructor, and compliant with the behavior expected\n        /// by the <code>IHttpClientBuilder</code>.\n        /// </remarks>\n        public AuthenticatedHttpClientHandler(\n            HttpMessageHandler? innerHandler,\n            Func<HttpRequestMessage, CancellationToken, Task<string>> getToken\n        )\n        {\n            this.getToken = getToken ?? throw new ArgumentNullException(nameof(getToken));\n            if (innerHandler != null)\n                InnerHandler = innerHandler;\n        }\n\n        protected override async Task<HttpResponseMessage> SendAsync(\n            HttpRequestMessage request,\n            CancellationToken cancellationToken\n        )\n        {\n            // See if the request has an authorize header\n            var auth = request.Headers.Authorization;\n            if (auth != null)\n            {\n                var token = await getToken(request, cancellationToken).ConfigureAwait(false);\n                request.Headers.Authorization = new AuthenticationHeaderValue(auth.Scheme, token);\n            }\n\n            return await base.SendAsync(request, cancellationToken).ConfigureAwait(false);\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/Buffers/PooledBufferWriter.Stream.NETStandard21.cs",
    "content": "﻿#if NET6_0_OR_GREATER\n\nusing System;\nusing System.IO;\nusing System.Threading;\nusing System.Threading.Tasks;\n\n#nullable enable\n\nnamespace Refit.Buffers\n{\n    internal sealed partial class PooledBufferWriter\n    {\n        private sealed partial class PooledMemoryStream : Stream\n        {\n            /// <inheritdoc/>\n            public Task CopyToInternalAsync(Stream destination, CancellationToken cancellationToken)\n            {\n                if (pooledBuffer is null)\n                    ThrowObjectDisposedException();\n\n                var bytesAvailable = length - position;\n\n                var source = pooledBuffer.AsMemory(position, bytesAvailable);\n\n                position += source.Length;\n\n                return destination.WriteAsync(source, cancellationToken).AsTask();\n            }\n\n            /// <inheritdoc/>\n            public override ValueTask<int> ReadAsync(\n                Memory<byte> buffer,\n                CancellationToken cancellationToken = default\n            )\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return new ValueTask<int>(Task.FromCanceled<int>(cancellationToken));\n                }\n\n                try\n                {\n                    var result = Read(buffer.Span);\n\n                    return new ValueTask<int>(result);\n                }\n                catch (OperationCanceledException e)\n                {\n                    return new ValueTask<int>(Task.FromCanceled<int>(e.CancellationToken));\n                }\n                catch (Exception e)\n                {\n                    return new ValueTask<int>(Task.FromException<int>(e));\n                }\n            }\n\n            /// <inheritdoc/>\n            public override int Read(Span<byte> buffer)\n            {\n                if (pooledBuffer is null)\n                    ThrowObjectDisposedException();\n\n                if (position >= length)\n                    return 0;\n\n                var bytesAvailable = length - position;\n\n                var source = pooledBuffer.AsSpan(position, bytesAvailable);\n\n                var bytesCopied = Math.Min(source.Length, buffer.Length);\n\n                var destination = buffer.Slice(0, bytesCopied);\n\n                source.CopyTo(destination);\n\n                position += bytesCopied;\n\n                return bytesCopied;\n            }\n        }\n    }\n}\n\n#endif\n"
  },
  {
    "path": "Refit/Buffers/PooledBufferWriter.Stream.cs",
    "content": "﻿using System.Buffers;\n\n#nullable enable\n\nnamespace Refit.Buffers\n{\n    internal sealed partial class PooledBufferWriter\n    {\n        /// <summary>\n        /// An in-memory <see cref=\"Stream\"/> that uses memory buffers rented from a shared pool\n        /// </summary>\n        private sealed partial class PooledMemoryStream : Stream\n        {\n            /// <summary>\n            /// The current used length for <see cref=\"pooledBuffer\"/>\n            /// </summary>\n            private readonly int length;\n\n            /// <summary>\n            /// The buffer rented from <see cref=\"ArrayPool{T}\"/> currently in use\n            /// </summary>\n            private byte[]? pooledBuffer;\n\n            /// <summary>\n            /// The current position within <see cref=\"pooledBuffer\"/>\n            /// </summary>\n            private int position;\n\n            /// <summary>\n            /// Creates a new <see cref=\"PooledMemoryStream\"/> instance\n            /// </summary>\n            public PooledMemoryStream(PooledBufferWriter writer)\n            {\n                length = writer.position;\n                pooledBuffer = writer.buffer;\n            }\n\n            /// <summary>\n            /// Releases the resources for the current <see cref=\"PooledMemoryStream\"/> instance\n            /// </summary>\n            ~PooledMemoryStream()\n            {\n                Dispose(true);\n            }\n\n            /// <inheritdoc/>\n            public override bool CanRead => true;\n\n            /// <inheritdoc/>\n            public override bool CanSeek => false;\n\n            /// <inheritdoc/>\n            public override bool CanWrite => false;\n\n            /// <inheritdoc/>\n            public override long Length => length;\n\n            /// <inheritdoc/>\n            public override long Position\n            {\n                get => position;\n                set => ThrowNotSupportedException();\n            }\n\n            /// <inheritdoc/>\n            public override void Flush() { }\n\n            /// <inheritdoc/>\n            public override Task FlushAsync(CancellationToken cancellationToken)\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return Task.FromCanceled(cancellationToken);\n                }\n\n                return Task.CompletedTask;\n            }\n\n            /// <inheritdoc/>\n            public override Task CopyToAsync(\n                Stream destination,\n                int bufferSize,\n                CancellationToken cancellationToken\n            )\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return Task.FromCanceled(cancellationToken);\n                }\n\n                try\n                {\n#if NET6_0_OR_GREATER\n                    return CopyToInternalAsync(destination, cancellationToken);\n#else\n                    CopyTo(destination, bufferSize);\n                    return Task.CompletedTask;\n#endif\n                }\n                catch (OperationCanceledException e)\n                {\n                    return Task.FromCanceled(e.CancellationToken);\n                }\n                catch (Exception e)\n                {\n                    return Task.FromException(e);\n                }\n            }\n\n            /// <inheritdoc/>\n            public override int Read(byte[] buffer, int offset, int count)\n            {\n                if (offset < 0)\n                    ThrowArgumentOutOfRangeExceptionForNegativeOffset();\n                if (count < 0)\n                    ThrowArgumentOutOfRangeExceptionForNegativeCount();\n                if (offset + count > buffer.Length)\n                    ThrowArgumentOutOfRangeExceptionForEndOfStreamReached();\n                if (pooledBuffer is null)\n                    ThrowObjectDisposedException();\n\n                var destination = buffer.AsSpan(offset, count);\n                var source = pooledBuffer.AsSpan(0, length).Slice(position);\n\n                // If the source is contained within the destination, copy the entire span\n                if (source.Length <= destination.Length)\n                {\n                    source.CopyTo(destination);\n\n                    position += source.Length;\n\n                    return source.Length;\n                }\n\n                // Resize the source slice and only copy the overlapping region\n                source.Slice(0, destination.Length).CopyTo(destination);\n\n                position += destination.Length;\n\n                return destination.Length;\n            }\n\n            /// <inheritdoc/>\n            public override Task<int> ReadAsync(\n                byte[] buffer,\n                int offset,\n                int count,\n                CancellationToken cancellationToken\n            )\n            {\n                if (cancellationToken.IsCancellationRequested)\n                {\n                    return Task.FromCanceled<int>(cancellationToken);\n                }\n\n                try\n                {\n                    var result = Read(buffer, offset, count);\n\n                    return Task.FromResult(result);\n                }\n                catch (OperationCanceledException e)\n                {\n                    return Task.FromCanceled<int>(e.CancellationToken);\n                }\n                catch (Exception e)\n                {\n                    return Task.FromException<int>(e);\n                }\n            }\n\n            /// <inheritdoc/>\n            public override int ReadByte()\n            {\n                if (pooledBuffer is null)\n                    ThrowObjectDisposedException();\n\n                if (position >= pooledBuffer!.Length)\n                {\n                    return -1;\n                }\n\n                return pooledBuffer[position++];\n            }\n\n            /// <inheritdoc/>\n            public override long Seek(long offset, SeekOrigin origin)\n            {\n                ThrowNotSupportedException();\n\n                return default;\n            }\n\n            /// <inheritdoc/>\n            public override void SetLength(long value)\n            {\n                ThrowNotSupportedException();\n            }\n\n            /// <inheritdoc/>\n            public override void Write(byte[] buffer, int offset, int count)\n            {\n                ThrowNotSupportedException();\n            }\n\n            /// <inheritdoc/>\n            protected override void Dispose(bool disposing)\n            {\n                if (pooledBuffer == null)\n                    return;\n\n                GC.SuppressFinalize(this);\n\n                ArrayPool<byte>.Shared.Return(pooledBuffer);\n\n                pooledBuffer = null;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/Buffers/PooledBufferWriter.ThrowExceptions.cs",
    "content": "﻿using System.Runtime.CompilerServices;\n\nnamespace Refit.Buffers\n{\n    internal sealed partial class PooledBufferWriter\n    {\n        /// <summary>\n        /// Throws an <see cref=\"ArgumentOutOfRangeException\"/> when a method receives a negative \"count\" parameter.\n        /// </summary>\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private static void ThrowArgumentOutOfRangeExceptionForNegativeCount()\n        {\n            throw new ArgumentOutOfRangeException(\"count\", \"The count can't be < 0\");\n        }\n\n        /// <summary>\n        /// Throws an <see cref=\"ArgumentOutOfRangeException\"/> when a method receives a negative \"offset\" parameter.\n        /// </summary>\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private static void ThrowArgumentOutOfRangeExceptionForNegativeOffset()\n        {\n            throw new ArgumentOutOfRangeException(\"offset\", \"The offset can't be < 0\");\n        }\n\n        /// <summary>\n        /// Throws an <see cref=\"ArgumentOutOfRangeException\"/> when <see cref=\"Advance\"/> advances too far.\n        /// </summary>\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private static void ThrowArgumentOutOfRangeExceptionForAdvancedTooFar()\n        {\n            throw new ArgumentOutOfRangeException(\"count\", \"Advanced too far\");\n        }\n\n        /// <summary>\n        /// Throws an <see cref=\"ArgumentException\"/> when the end of a <see cref=\"PooledMemoryStream\"/> has been exceeded.\n        /// </summary>\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private static void ThrowArgumentOutOfRangeExceptionForEndOfStreamReached()\n        {\n            throw new ArgumentException(\"The end of the stream has been exceeded\");\n        }\n\n        /// <summary>\n        /// Throws an <see cref=\"ObjectDisposedException\"/> when a <see cref=\"PooledMemoryStream\"/> method is called on a disposed instance.\n        /// </summary>\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private static void ThrowObjectDisposedException()\n        {\n            throw new ObjectDisposedException(\"The stream in use has alreadybeen disposed\");\n        }\n\n        /// <summary>\n        /// Throws an <see cref=\"NotSupportedException\"/> when an operation in <see cref=\"PooledMemoryStream\"/> is not supported.\n        /// </summary>\n        [MethodImpl(MethodImplOptions.NoInlining)]\n        private static void ThrowNotSupportedException()\n        {\n            throw new NotSupportedException(\"The stream doesn't support the requested operation\");\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/Buffers/PooledBufferWriter.cs",
    "content": "﻿using System.Buffers;\nusing System.Runtime.CompilerServices;\n\nnamespace Refit.Buffers\n{\n    /// <summary>\n    /// A <see langword=\"struct\"/> that provides a fast implementation of a binary writer, leveraging <see cref=\"ArrayPool{T}\"/> for memory pooling\n    /// </summary>\n    sealed partial class PooledBufferWriter : IBufferWriter<byte>, IDisposable\n    {\n        /// <summary>\n        /// The default size to use to create new <see cref=\"PooledBufferWriter\"/> instances\n        /// </summary>\n        public const int DefaultSize = 1024;\n\n        /// <summary>\n        /// The <see cref=\"byte\"/> array current in use\n        /// </summary>\n        byte[] buffer = Array.Empty<byte>();\n\n        /// <summary>\n        /// The current position into <see cref=\"buffer\"/>\n        /// </summary>\n        int position;\n\n        /// <summary>\n        /// Creates a new <see cref=\"PooledBufferWriter\"/> instance\n        /// </summary>\n        public PooledBufferWriter()\n        {\n            buffer = ArrayPool<byte>.Shared.Rent(DefaultSize);\n            position = 0;\n        }\n\n        /// <inheritdoc/>\n        public void Advance(int count)\n        {\n            if (count < 0)\n                ThrowArgumentOutOfRangeExceptionForNegativeCount();\n            if (position > buffer.Length - count)\n                ThrowArgumentOutOfRangeExceptionForAdvancedTooFar();\n\n            position += count;\n        }\n\n        /// <inheritdoc/>\n        public Memory<byte> GetMemory(int sizeHint = 0)\n        {\n            EnsureFreeCapacity(sizeHint);\n\n            return buffer.AsMemory(position);\n        }\n\n        /// <inheritdoc/>\n        public Span<byte> GetSpan(int sizeHint = 0)\n        {\n            EnsureFreeCapacity(sizeHint);\n\n            return buffer.AsSpan(position);\n        }\n\n        /// <summary>\n        /// Ensures the buffer in use has the free capacity to contain the specified amount of new data\n        /// </summary>\n        /// <param name=\"count\">The size in bytes of the new data to insert into the buffer</param>\n        [MethodImpl(MethodImplOptions.AggressiveInlining)]\n        void EnsureFreeCapacity(int count)\n        {\n            if (count < 0)\n                ThrowArgumentOutOfRangeExceptionForNegativeCount();\n\n            if (count == 0)\n                count = 1;\n\n            int currentLength = buffer.Length,\n                freeCapacity = currentLength - position;\n\n            if (count <= freeCapacity)\n                return;\n\n            int growBy = Math.Max(count, currentLength),\n                newSize = checked(currentLength + growBy);\n\n            var rent = ArrayPool<byte>.Shared.Rent(newSize);\n\n            Array.Copy(buffer, rent, position);\n\n            ArrayPool<byte>.Shared.Return(buffer);\n\n            buffer = rent;\n        }\n\n        /// <inheritdoc/>\n        public void Dispose()\n        {\n            if (buffer.Length == 0)\n                return;\n\n            ArrayPool<byte>.Shared.Return(buffer);\n        }\n\n        /// <summary>\n        /// Gets a readable <see cref=\"Stream\"/> for the current instance, by detaching the used buffer\n        /// </summary>\n        /// <returns>A readable <see cref=\"Stream\"/> with the contents of the current instance</returns>\n        public Stream DetachStream()\n        {\n            var stream = new PooledMemoryStream(this);\n\n            buffer = Array.Empty<byte>();\n\n            return stream;\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/CachedRequestBuilderImplementation.cs",
    "content": "﻿using System.Collections.Concurrent;\nusing System.Net.Http;\n#if NET8_0_OR_GREATER\nusing System.Diagnostics.CodeAnalysis;\n#endif\n\nnamespace Refit\n{\n    class CachedRequestBuilderImplementation<T>\n        : CachedRequestBuilderImplementation,\n            IRequestBuilder<T>\n    {\n        public CachedRequestBuilderImplementation(IRequestBuilder<T> innerBuilder)\n            : base(innerBuilder) { }\n    }\n\n    class CachedRequestBuilderImplementation : IRequestBuilder\n    {\n        public CachedRequestBuilderImplementation(IRequestBuilder innerBuilder)\n        {\n            this.innerBuilder =\n                innerBuilder ?? throw new ArgumentNullException(nameof(innerBuilder));\n        }\n\n        readonly IRequestBuilder innerBuilder;\n        internal readonly ConcurrentDictionary<\n            MethodTableKey,\n            Func<HttpClient, object[], object?>\n        > MethodDictionary = new();\n\n#if NET8_0_OR_GREATER\n        [RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces and DTOs are preserved when trimming.\")]\n#endif\n        public Func<HttpClient, object[], object?> BuildRestResultFuncForMethod(\n            string methodName,\n            Type[]? parameterTypes = null,\n            Type[]? genericArgumentTypes = null\n        )\n        {\n            var cacheKey = new MethodTableKey(\n                methodName,\n                parameterTypes ?? Array.Empty<Type>(),\n                genericArgumentTypes ?? Array.Empty<Type>()\n            );\n\n            if (MethodDictionary.TryGetValue(cacheKey, out var methodFunc))\n            {\n                return methodFunc;\n            }\n\n            // use GetOrAdd with cloned array method table key. This prevents the array from being modified, breaking the dictionary.\n            var func = MethodDictionary.GetOrAdd(\n                new MethodTableKey(methodName,\n                    parameterTypes?.ToArray() ?? Array.Empty<Type>(),\n                    genericArgumentTypes?.ToArray() ?? Array.Empty<Type>()),\n                _ =>\n                    innerBuilder.BuildRestResultFuncForMethod(\n                        methodName,\n                        parameterTypes,\n                        genericArgumentTypes\n                    )\n            );\n\n            return func;\n        }\n    }\n\n    /// <summary>\n    /// Represents a method composed of its name, generic arguments and parameters.\n    /// </summary>\n    internal readonly struct MethodTableKey : IEquatable<MethodTableKey>\n    {\n        /// <summary>\n        /// Constructs an instance of <see cref=\"MethodTableKey\"/>.\n        /// </summary>\n        /// <param name=\"methodName\">Represents the methods name.</param>\n        /// <param name=\"parameters\">Array containing the methods parameters.</param>\n        /// <param name=\"genericArguments\">Array containing the methods generic arguments.</param>\n        public MethodTableKey (string methodName, Type[] parameters, Type[] genericArguments)\n        {\n            MethodName = methodName;\n            Parameters = parameters;\n            GenericArguments = genericArguments;\n        }\n\n        /// <summary>\n        /// The methods name.\n        /// </summary>\n        string MethodName { get; }\n\n        /// <summary>\n        /// Array containing the methods parameters.\n        /// </summary>\n        Type[] Parameters { get; }\n\n        /// <summary>\n        /// Array containing the methods generic arguments.\n        /// </summary>\n        Type[] GenericArguments { get; }\n\n        public override int GetHashCode()\n        {\n            unchecked\n            {\n                var hashCode = MethodName.GetHashCode();\n\n                foreach (var argument in Parameters)\n                {\n                    hashCode = (hashCode * 397) ^ argument.GetHashCode();\n                }\n\n                foreach (var genericArgument in GenericArguments)\n                {\n                    hashCode = (hashCode * 397) ^ genericArgument.GetHashCode();\n                }\n                return hashCode;\n            }\n        }\n\n        public bool Equals(MethodTableKey other)\n        {\n            if (Parameters.Length != other.Parameters.Length\n                || GenericArguments.Length != other.GenericArguments.Length\n                || MethodName != other.MethodName)\n            {\n                return false;\n            }\n\n            for (var i = 0; i < Parameters.Length; i++)\n            {\n                if (Parameters[i] != other.Parameters[i])\n                {\n                    return false;\n                }\n            }\n\n            for (var i = 0; i < GenericArguments.Length; i++)\n            {\n                if (GenericArguments[i] != other.GenericArguments[i])\n                {\n                    return false;\n                }\n            }\n\n            return true;\n        }\n\n        public override bool Equals(object? obj) => obj is MethodTableKey other && Equals(other);\n    }\n}\n"
  },
  {
    "path": "Refit/CamelCaseUrlParameterKeyFormatter.cs",
    "content": "﻿namespace Refit\n{\n    /// <summary>\n    /// Provides an implementation of <see cref=\"IUrlParameterKeyFormatter\"/> that formats URL parameter keys in camelCase.\n    /// </summary>\n    public class CamelCaseUrlParameterKeyFormatter : IUrlParameterKeyFormatter\n    {\n        /// <summary>\n        /// Formats the specified key.\n        /// </summary>\n        /// <param name=\"key\">The key.</param>\n        /// <returns></returns>\n        public string Format(string key)\n        {\n            if (string.IsNullOrEmpty(key) || !char.IsUpper(key[0]))\n            {\n                return key;\n            }\n\n#if NETCOREAPP\n            return string.Create(\n                key.Length,\n                key,\n                (chars, name) =>\n                {\n                    name.CopyTo(chars);\n                    FixCasing(chars);\n                }\n            );\n#else\n            char[] chars = key.ToCharArray();\n            FixCasing(chars);\n            return new string(chars);\n#endif\n        }\n\n        private static void FixCasing(Span<char> chars)\n        {\n            for (var i = 0; i < chars.Length; i++)\n            {\n                if (i == 1 && !char.IsUpper(chars[i]))\n                {\n                    break;\n                }\n\n                var hasNext = (i + 1 < chars.Length);\n\n                // Stop when next char is already lowercase.\n                if (i > 0 && hasNext && !char.IsUpper(chars[i + 1]))\n                {\n                    break;\n                }\n\n                chars[i] = char.ToLowerInvariant(chars[i]);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/CloseGenericMethodKey.cs",
    "content": "﻿using System.Reflection;\n\nnamespace Refit\n{\n    readonly struct CloseGenericMethodKey : IEquatable<CloseGenericMethodKey>\n    {\n        internal CloseGenericMethodKey(MethodInfo openMethodInfo, Type[] types)\n        {\n            OpenMethodInfo = openMethodInfo;\n            Types = types;\n        }\n\n        public MethodInfo OpenMethodInfo { get; }\n        public Type[] Types { get; }\n\n        public bool Equals(CloseGenericMethodKey other) =>\n            OpenMethodInfo == other.OpenMethodInfo && Types.SequenceEqual(other.Types);\n\n        public override bool Equals(object? obj)\n        {\n            if (obj is CloseGenericMethodKey closeGenericMethodKey)\n            {\n                return Equals(closeGenericMethodKey);\n            }\n            return false;\n        }\n\n        public override int GetHashCode()\n        {\n            unchecked\n            {\n                var hash = 17;\n                hash = hash * 23 + OpenMethodInfo.GetHashCode();\n                foreach (var type in Types)\n                {\n                    hash = hash * 23 + type.GetHashCode();\n                }\n                return hash;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/CollectionFormat.cs",
    "content": "﻿namespace Refit\n{\n    /// <summary>\n    /// Collection format defined in https://swagger.io/docs/specification/2-0/describing-parameters/\n    /// </summary>\n    public enum CollectionFormat\n    {\n        /// <summary>\n        /// Values formatted with <see cref=\"RefitSettings.UrlParameterFormatter\"/> or\n        /// <see cref=\"RefitSettings.FormUrlEncodedParameterFormatter\"/>.\n        /// </summary>\n        RefitParameterFormatter,\n\n        /// <summary>\n        /// Comma-separated values\n        /// </summary>\n        Csv,\n\n        /// <summary>\n        /// Space-separated values\n        /// </summary>\n        Ssv,\n\n        /// <summary>\n        /// Tab-separated values\n        /// </summary>\n        Tsv,\n\n        /// <summary>\n        /// Pipe-separated values\n        /// </summary>\n        Pipes,\n\n        /// <summary>\n        /// Multiple parameter instances\n        /// </summary>\n        Multi\n    }\n}\n"
  },
  {
    "path": "Refit/DynamicallyAccessedMembersAttribute.cs",
    "content": "﻿#if NETSTANDARD2_0 || NET462\nnamespace System.Diagnostics.CodeAnalysis;\n\n/// <summary>\n/// Indicates that certain members on a specified <see cref=\"Type\"/> are accessed dynamically,\n/// for example through <see cref=\"Reflection\"/>.\n/// </summary>\n/// <remarks>\n/// This allows tools to understand which members are being accessed during the execution\n/// of a program.\n///\n/// This attribute is valid on members whose type is <see cref=\"Type\"/> or <see cref=\"string\"/>.\n///\n/// When this attribute is applied to a location of type <see cref=\"string\"/>, the assumption is\n/// that the string represents a fully qualified type name.\n///\n/// When this attribute is applied to a class, interface, or struct, the members specified\n/// can be accessed dynamically on <see cref=\"Type\"/> instances returned from calling\n/// <see cref=\"object.GetType\"/> on instances of that class, interface, or struct.\n///\n/// If the attribute is applied to a method it's treated as a special case and it implies\n/// the attribute should be applied to the \"this\" parameter of the method. As such the attribute\n/// should only be used on instance methods of types assignable to System.Type (or string, but no methods\n/// will use it there).\n/// </remarks>\ninternal sealed class DynamicallyAccessedMembersAttribute : Attribute\n{\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"DynamicallyAccessedMembersAttribute\"/> class\n    /// with the specified member types.\n    /// </summary>\n    /// <param name=\"memberTypes\">The types of members dynamically accessed.</param>\n    public DynamicallyAccessedMembersAttribute(DynamicallyAccessedMemberTypes memberTypes)\n    {\n        MemberTypes = memberTypes;\n    }\n\n    /// <summary>\n    /// Gets the <see cref=\"DynamicallyAccessedMemberTypes\"/> which specifies the type\n    /// of members dynamically accessed.\n    /// </summary>\n    public DynamicallyAccessedMemberTypes MemberTypes { get; }\n}\n\n[Flags]\ninternal enum DynamicallyAccessedMemberTypes\n{\n    None = 0,\n    PublicParameterlessConstructor = 1,\n    PublicConstructors = 3,\n    NonPublicConstructors = 4,\n    PublicMethods = 8,\n    NonPublicMethods = 16, // 0x00000010\n    PublicFields = 32, // 0x00000020\n    NonPublicFields = 64, // 0x00000040\n    PublicNestedTypes = 128, // 0x00000080\n    NonPublicNestedTypes = 256, // 0x00000100\n    PublicProperties = 512, // 0x00000200\n    NonPublicProperties = 1024, // 0x00000400\n    PublicEvents = 2048, // 0x00000800\n    NonPublicEvents = 4096, // 0x00001000\n    Interfaces = 8192, // 0x00002000\n    All = -1, // 0xFFFFFFFF\n}\n#endif\n"
  },
  {
    "path": "Refit/EnumerableExtensions.cs",
    "content": "﻿namespace Refit;\n\ninternal static class EnumerableExtensions\n{\n    internal static EnumerablePeek TryGetSingle<T>(this IEnumerable<T> enumerable, out T? value)\n    {\n        value = default;\n        using var enumerator = enumerable.GetEnumerator();\n        var hasFirst = enumerator.MoveNext();\n        if (!hasFirst)\n            return EnumerablePeek.Empty;\n\n        value = enumerator.Current;\n        if (!enumerator.MoveNext())\n            return EnumerablePeek.Single;\n\n        value = default;\n        return EnumerablePeek.Many;\n    }\n}\n\ninternal static class EmptyDictionary<TKey, TValue> where TKey : notnull\n{\n    private static readonly Dictionary<TKey, TValue> Value = [];\n\n    internal static Dictionary<TKey, TValue> Get() => Value;\n}\n\ninternal enum EnumerablePeek\n{\n    Empty,\n    Single,\n    Many\n}\n"
  },
  {
    "path": "Refit/FormValueMultimap.cs",
    "content": "﻿using System.Collections;\nusing System.Reflection;\n\nnamespace Refit\n{\n    /// <summary>\n    /// Transforms a form source from a .NET representation to the appropriate HTTP form encoded representation.\n    /// </summary>\n    /// <remarks>Performs field renaming and value formatting as specified in <see cref=\"QueryAttribute\"/>s and\n    /// <see cref=\"RefitSettings.FormUrlEncodedParameterFormatter\"/>. A given key may appear multiple times with the\n    /// same or different values.</remarks>\n    class FormValueMultimap : IEnumerable<KeyValuePair<string?, string?>>\n    {\n        static readonly Dictionary<Type, PropertyInfo[]> PropertyCache = [];\n\n        readonly IList<KeyValuePair<string?, string?>> formEntries = [];\n\n        readonly IHttpContentSerializer contentSerializer;\n\n        public FormValueMultimap(object source, RefitSettings settings)\n        {\n            if (settings is null)\n                throw new ArgumentNullException(nameof(settings));\n            contentSerializer = settings.ContentSerializer;\n\n            if (source == null)\n                return;\n\n            if (source is IDictionary dictionary)\n            {\n                foreach (var key in dictionary.Keys)\n                {\n                    var value = dictionary[key];\n                    if (value != null)\n                    {\n                        Add(\n                            key.ToString(),\n                            settings.FormUrlEncodedParameterFormatter.Format(value, null)\n                        );\n                    }\n                }\n\n                return;\n            }\n\n            var type = source.GetType();\n\n            lock (PropertyCache)\n            {\n                if (!PropertyCache.TryGetValue(type, out var properties))\n                {\n                    properties = GetProperties(type);\n                    PropertyCache[type] = properties;\n                }\n\n                foreach (var property in properties)\n                {\n                    var value = property.GetValue(source, null);\n                    if (value == null)\n                        continue;\n\n                    var fieldName = GetFieldNameForProperty(property);\n\n                    // see if there's a query attribute\n                    var attrib = property.GetCustomAttribute<QueryAttribute>(true);\n\n                    // add strings/non enumerable properties\n                    if (value is not IEnumerable enumerable || value is string)\n                    {\n                        Add(\n                            fieldName,\n                            settings.FormUrlEncodedParameterFormatter.Format(value, attrib?.Format)\n                        );\n                        continue;\n                    }\n\n                    var collectionFormat =\n                        attrib != null && attrib.IsCollectionFormatSpecified\n                            ? attrib.CollectionFormat\n                            : settings.CollectionFormat;\n\n                    switch (collectionFormat)\n                    {\n                        case CollectionFormat.Multi:\n                            foreach (var item in enumerable)\n                            {\n                                Add(\n                                    fieldName,\n                                    settings.FormUrlEncodedParameterFormatter.Format(\n                                        item,\n                                        attrib?.Format\n                                    )\n                                );\n                            }\n\n                            break;\n                        case CollectionFormat.Csv:\n                        case CollectionFormat.Ssv:\n                        case CollectionFormat.Tsv:\n                        case CollectionFormat.Pipes:\n                            var delimiter = collectionFormat switch\n                            {\n                                CollectionFormat.Csv => \",\",\n                                CollectionFormat.Ssv => \" \",\n                                CollectionFormat.Tsv => \"\\t\",\n                                _ => \"|\"\n                            };\n\n                            var formattedValues = enumerable\n                                .Cast<object>()\n                                .Select(\n                                    v =>\n                                        settings.FormUrlEncodedParameterFormatter.Format(\n                                            v,\n                                            attrib?.Format\n                                        )\n                                );\n                            Add(fieldName, string.Join(delimiter, formattedValues));\n                            break;\n                        default:\n                            Add(\n                                fieldName,\n                                settings.FormUrlEncodedParameterFormatter.Format(\n                                    value,\n                                    attrib?.Format\n                                )\n                            );\n                            break;\n                    }\n                }\n            }\n        }\n\n        /// <summary>\n        /// Returns a key for each entry. If multiple entries share the same key, the key is returned multiple times.\n        /// </summary>\n        public IEnumerable<string?> Keys => this.Select(it => it.Key);\n\n        void Add(string? key, string? value)\n        {\n            formEntries.Add(new KeyValuePair<string?, string?>(key, value));\n        }\n\n        string GetFieldNameForProperty(PropertyInfo propertyInfo)\n        {\n            var name =\n                propertyInfo\n                    .GetCustomAttributes<AliasAsAttribute>(true)\n                    .Select(a => a.Name)\n                    .FirstOrDefault()\n                ?? contentSerializer.GetFieldNameForProperty(propertyInfo)\n                ?? propertyInfo.Name;\n\n            var qattrib = propertyInfo\n                .GetCustomAttributes<QueryAttribute>(true)\n                .Select(\n                    attr =>\n                        !string.IsNullOrWhiteSpace(attr.Prefix)\n                            ? $\"{attr.Prefix}{attr.Delimiter}{name}\"\n                            : name\n                )\n                .FirstOrDefault();\n\n            return qattrib ?? name;\n        }\n\n        static PropertyInfo[] GetProperties(Type type)\n        {\n            return [.. type.GetProperties(BindingFlags.Instance | BindingFlags.Public).Where(p => p.CanRead && p.GetMethod?.IsPublic == true)];\n        }\n\n        public IEnumerator<KeyValuePair<string?, string?>> GetEnumerator()\n        {\n            return formEntries.GetEnumerator();\n        }\n\n        IEnumerator IEnumerable.GetEnumerator()\n        {\n            return GetEnumerator();\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/HttpContentExtensions.cs",
    "content": "﻿using System.Net.Http;\n\nnamespace Refit\n{\n#if !NET6_0_OR_GREATER\n    static class HttpContentExtensions\n    {\n#pragma warning disable IDE0079 // Remove unnecessary suppression\n#pragma warning disable IDE0060 // Remove unused parameter\n        public static Task<Stream> ReadAsStreamAsync(\n            this HttpContent httpContent,\n            CancellationToken cancellationToken\n        )\n        {\n            return httpContent.ReadAsStreamAsync();\n        }\n\n        public static Task<string> ReadAsStringAsync(\n            this HttpContent httpContent,\n            CancellationToken cancellationToken\n        )\n        {\n            return httpContent.ReadAsStringAsync();\n        }\n#pragma warning restore IDE0060 // Remove unused parameter\n#pragma warning restore IDE0079 // Remove unnecessary suppression\n    }\n#endif\n}\n"
  },
  {
    "path": "Refit/HttpRequestMessageProperties.cs",
    "content": "namespace Refit\n{\n    /// <summary>\n    /// Contains Refit-defined properties on the HttpRequestMessage.Properties/Options\n    /// </summary>\n    public static class HttpRequestMessageOptions\n    {\n        /// <summary>\n        /// Returns the <see cref=\"System.Type\"/> of the top-level interface where the method was called from\n        /// </summary>\n        public static string InterfaceType { get; } = \"Refit.InterfaceType\";\n\n        /// <summary>\n        /// Returns the <see cref=\"Refit.RestMethodInfo\"/> of the top-level interface\n        /// </summary>\n        public static string RestMethodInfo { get; } = \"Refit.RestMethodInfo\";\n    }\n}\n"
  },
  {
    "path": "Refit/JsonContentSerializer.cs",
    "content": "﻿using System.Net.Http;\nusing System.Reflection;\n\nnamespace Refit\n{\n    /// <summary>\n    /// JsonContentSerializer.\n    /// </summary>\n    /// <seealso cref=\"Refit.IHttpContentSerializer\" />\n    [Obsolete(\n        \"Use NewtonsoftJsonContentSerializer in the Refit.Newtonsoft.Json package instead\",\n        true\n    )]\n    public class JsonContentSerializer : IHttpContentSerializer\n    {\n        /// <summary>\n        /// Converts to httpcontent.\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the object to serialize from.</typeparam>\n        /// <param name=\"item\">Object to serialize.</param>\n        /// <returns>\n        ///   <see cref=\"HttpContent\" /> that contains the serialized <typeparamref name=\"T\" /> object.\n        /// </returns>\n        /// <exception cref=\"System.NotImplementedException\"></exception>\n        public HttpContent ToHttpContent<T>(T item) => throw new NotImplementedException();\n\n        /// <summary>\n        /// Deserializes an object of type <typeparamref name=\"T\" /> from an <see cref=\"HttpContent\" /> object.\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the object to serialize to.</typeparam>\n        /// <param name=\"content\">HttpContent object to deserialize.</param>\n        /// <param name=\"cancellationToken\">CancellationToken to abort the deserialization.</param>\n        /// <returns>\n        /// The deserialized object of type <typeparamref name=\"T\" />.\n        /// </returns>\n        /// <exception cref=\"System.NotImplementedException\"></exception>\n        public Task<T?> FromHttpContentAsync<T>(\n            HttpContent content,\n            CancellationToken cancellationToken = default\n        ) => throw new NotImplementedException();\n\n        /// <summary>\n        /// Calculates what the field name should be for the given property. This may be affected by custom attributes the serializer understands\n        /// </summary>\n        /// <param name=\"propertyInfo\">A PropertyInfo object.</param>\n        /// <returns>\n        /// The calculated field name.\n        /// </returns>\n        /// <exception cref=\"System.NotImplementedException\"></exception>\n        public string GetFieldNameForProperty(PropertyInfo propertyInfo) =>\n            throw new NotImplementedException();\n    }\n}\n"
  },
  {
    "path": "Refit/MultipartItem.cs",
    "content": "﻿using System.Net.Http;\nusing System.Net.Http.Headers;\n\nnamespace Refit\n{\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"MultipartItem\"/> class.\n    /// </summary>\n    /// <param name=\"fileName\">Name of the file.</param>\n    /// <param name=\"contentType\">Type of the content.</param>\n    /// <exception cref=\"System.ArgumentNullException\">fileName</exception>\n    public abstract class MultipartItem(string fileName, string? contentType)\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"MultipartItem\"/> class.\n        /// </summary>\n        /// <param name=\"fileName\">Name of the file.</param>\n        /// <param name=\"contentType\">Type of the content.</param>\n        /// <param name=\"name\">The name.</param>\n        public MultipartItem(string fileName, string? contentType, string? name)\n            : this(fileName, contentType)\n        {\n            Name = name;\n        }\n\n        /// <summary>\n        /// Gets the name.\n        /// </summary>\n        /// <value>\n        /// The name.\n        /// </value>\n        public string? Name { get; }\n\n        /// <summary>\n        /// Gets the type of the content.\n        /// </summary>\n        /// <value>\n        /// The type of the content.\n        /// </value>\n        public string? ContentType { get; } = contentType;\n\n        /// <summary>\n        /// Gets the name of the file.\n        /// </summary>\n        /// <value>\n        /// The name of the file.\n        /// </value>\n        public string FileName { get; } =\n            fileName ?? throw new ArgumentNullException(nameof(fileName));\n\n        /// <summary>\n        /// Converts to content.\n        /// </summary>\n        /// <returns></returns>\n        public HttpContent ToContent()\n        {\n            var content = CreateContent();\n            if (!string.IsNullOrEmpty(ContentType))\n            {\n                content.Headers.ContentType = new MediaTypeHeaderValue(ContentType);\n            }\n\n            return content;\n        }\n\n        /// <summary>\n        /// Creates the content.\n        /// </summary>\n        /// <returns></returns>\n        protected abstract HttpContent CreateContent();\n    }\n\n    /// <summary>\n    /// Allows the use of a generic <see cref=\"Stream\"/> in a multipart form body.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"StreamPart\"/> class.\n    /// </remarks>\n    /// <param name=\"value\">The value.</param>\n    /// <param name=\"fileName\">Name of the file.</param>\n    /// <param name=\"contentType\">Type of the content.</param>\n    /// <param name=\"name\">The name.</param>\n    /// <exception cref=\"System.ArgumentNullException\">value</exception>\n    public class StreamPart(\n        Stream value,\n        string fileName,\n        string? contentType = null,\n        string? name = null\n    ) : MultipartItem(fileName, contentType, name)\n    {\n        /// <summary>\n        /// Gets the value.\n        /// </summary>\n        /// <value>\n        /// The value.\n        /// </value>\n        public Stream Value { get; } = value ?? throw new ArgumentNullException(nameof(value));\n\n        /// <summary>\n        /// Creates the content.\n        /// </summary>\n        /// <returns></returns>\n        protected override HttpContent CreateContent()\n        {\n            return new StreamContent(Value);\n        }\n    }\n\n    /// <summary>\n    /// Allows the use of a <see cref=\"byte\"/> array in a multipart form body.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"ByteArrayPart\"/> class.\n    /// </remarks>\n    /// <param name=\"value\">The value.</param>\n    /// <param name=\"fileName\">Name of the file.</param>\n    /// <param name=\"contentType\">Type of the content.</param>\n    /// <param name=\"name\">The name.</param>\n    /// <exception cref=\"System.ArgumentNullException\">value</exception>\n    public class ByteArrayPart(\n        byte[] value,\n        string fileName,\n        string? contentType = null,\n        string? name = null\n    ) : MultipartItem(fileName, contentType, name)\n    {\n        /// <summary>\n        /// Gets the value.\n        /// </summary>\n        /// <value>\n        /// The value.\n        /// </value>\n        public byte[] Value { get; } = value ?? throw new ArgumentNullException(nameof(value));\n\n        /// <summary>\n        /// Creates the content.\n        /// </summary>\n        /// <returns></returns>\n        protected override HttpContent CreateContent()\n        {\n            return new ByteArrayContent(Value);\n        }\n    }\n\n    /// <summary>\n    /// Allows the use of a <see cref=\"FileInfo\"/> object in a multipart form body.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"FileInfoPart\"/> class.\n    /// </remarks>\n    /// <param name=\"value\">The value.</param>\n    /// <param name=\"fileName\">Name of the file.</param>\n    /// <param name=\"contentType\">Type of the content.</param>\n    /// <param name=\"name\">The name.</param>\n    /// <exception cref=\"System.ArgumentNullException\">value</exception>\n    public class FileInfoPart(\n        FileInfo value,\n        string fileName,\n        string? contentType = null,\n        string? name = null\n    ) : MultipartItem(fileName, contentType, name)\n    {\n        /// <summary>\n        /// Gets the value.\n        /// </summary>\n        /// <value>\n        /// The value.\n        /// </value>\n        public FileInfo Value { get; } = value ?? throw new ArgumentNullException(nameof(value));\n\n        /// <summary>\n        /// Creates the content.\n        /// </summary>\n        /// <returns></returns>\n        protected override HttpContent CreateContent()\n        {\n            return new StreamContent(Value.OpenRead());\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/NameValueCollection.cs",
    "content": "﻿namespace System.Collections.Specialized\n{\n    class NameValueCollection : Dictionary<string, string>\n    {\n        public string[] AllKeys => [.. Keys];\n    }\n}\n"
  },
  {
    "path": "Refit/Polyfills.Trimming.cs",
    "content": "﻿#if NETSTANDARD2_0 || NET462\nnamespace System.Diagnostics.CodeAnalysis\n{\n    [System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Event, Inherited = false)]\n    internal sealed class RequiresUnreferencedCodeAttribute : System.Attribute\n    {\n        public RequiresUnreferencedCodeAttribute(string message) => Message = message;\n        public string Message { get; }\n        public string? Url { get; set; }\n    }\n\n    [System.AttributeUsage(System.AttributeTargets.Constructor | System.AttributeTargets.Method, AllowMultiple = true)]\n    internal sealed class DynamicDependencyAttribute : System.Attribute\n    {\n        public DynamicDependencyAttribute(DynamicallyAccessedMemberTypes memberTypes, System.Type type) { }\n        public DynamicDependencyAttribute(string memberSignature, System.Type type) { }\n    }\n}\n#endif\n"
  },
  {
    "path": "Refit/ProblemDetails.cs",
    "content": "﻿using System.Text.Json.Serialization;\n\nnamespace Refit\n{\n    /// <summary>\n    /// The object representing the details about a ValidationException caught by a service implementing RFC 7807.\n    /// </summary>\n    public class ProblemDetails\n    {\n        /// <summary>\n        /// Collection of resulting errors for the request.\n        /// </summary>\n        public Dictionary<string, string[]> Errors { get; set; } = [];\n\n        /// <summary>\n        /// Collection of ProblemDetails extensions\n        /// </summary>\n        [JsonExtensionData]\n        public IDictionary<string, object> Extensions { get; set; } =\n            new Dictionary<string, object>(StringComparer.Ordinal);\n\n        /// <summary>\n        /// A URI reference that identifies the problem type.\n        /// </summary>\n        public string? Type { get; set; } = \"about:blank\";\n\n        /// <summary>\n        /// A short, human-readable summary of the problem type.\n        /// </summary>\n        public string? Title { get; set; }\n\n        /// <summary>\n        /// The HTTP status code generated by the origin server for this occurrence of the problem.\n        /// </summary>\n        public int Status { get; set; }\n\n        /// <summary>\n        /// A human-readable explanation specific to this occurrence of the problem.\n        /// </summary>\n        public string? Detail { get; set; }\n\n        /// <summary>\n        /// A URI reference that identifies the specific occurrence of the problem.\n        /// </summary>\n        public string? Instance { get; set; }\n    }\n}\n"
  },
  {
    "path": "Refit/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Runtime.CompilerServices;\n\n[assembly: InternalsVisibleTo(\"Refit.Tests\")]\n//    \"Refit.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001009dc017250415a0d51fddb74de84257c388028f04893673ca5c8f9e7145aea2b11443cb49dd79386d2255179a79ec516466b621f77e43386e711b775f77bb0e4b217f8c208c054e5f515ae33ee76bac1b56cdc20e1c151cf026a9b7f8362f1963825e546e16b360dfc63fe670403c9d6152c24491dd5dfb9ff68fe102ef3e1aed\"\n// )]\n[assembly: InternalsVisibleTo(\"Refit.HttpClientFactory\")]\n// \"Refit.HttpClientFactory, PublicKey=00240000048000009400000006020000002400005253413100040000010001009dc017250415a0d51fddb74de84257c388028f04893673ca5c8f9e7145aea2b11443cb49dd79386d2255179a79ec516466b621f77e43386e711b775f77bb0e4b217f8c208c054e5f515ae33ee76bac1b56cdc20e1c151cf026a9b7f8362f1963825e546e16b360dfc63fe670403c9d6152c24491dd5dfb9ff68fe102ef3e1aed\"\n// )]\n[assembly: InternalsVisibleTo(\"Refit.Newtonsoft.Json\")]\n// \"Refit.Newtonsoft.Json, PublicKey=00240000048000009400000006020000002400005253413100040000010001009dc017250415a0d51fddb74de84257c388028f04893673ca5c8f9e7145aea2b11443cb49dd79386d2255179a79ec516466b621f77e43386e711b775f77bb0e4b217f8c208c054e5f515ae33ee76bac1b56cdc20e1c151cf026a9b7f8362f1963825e546e16b360dfc63fe670403c9d6152c24491dd5dfb9ff68fe102ef3e1aed\"\n// )]\n[assembly: InternalsVisibleTo(\"Refit.Xml\")]\n// \"Refit.Xml, PublicKey=00240000048000009400000006020000002400005253413100040000010001009dc017250415a0d51fddb74de84257c388028f04893673ca5c8f9e7145aea2b11443cb49dd79386d2255179a79ec516466b621f77e43386e711b775f77bb0e4b217f8c208c054e5f515ae33ee76bac1b56cdc20e1c151cf026a9b7f8362f1963825e546e16b360dfc63fe670403c9d6152c24491dd5dfb9ff68fe102ef3e1aed\"\n// )]\n"
  },
  {
    "path": "Refit/PushStreamContent.cs",
    "content": "﻿// Copyright(c) Microsoft Open Technologies, Inc.All rights reserved.\n// Microsoft Open Technologies would like to thank its contributors, a list\n// of whom are at http://aspnetwebstack.codeplex.com/wikipage?title=Contributors.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you\n// may not use this file except in compliance with the License. You may\n// obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n// implied. See the License for the specific language governing permissions\n// and limitations under the License.\n\n// NOTICE\n// This has been converted from:\n// https://github.com/ASP-NET-MVC/aspnetwebstack/blob/d5188c8a75b5b26b09ab89bedfd7ee635ae2ff17/src/System.Net.Http.Formatting/PushStreamContent.cs\n// to work on NET Standard 1.4\n\nusing System.Diagnostics.CodeAnalysis;\nusing System.Diagnostics.Contracts;\nusing System.Net.Http.Headers;\n\nnamespace System.Net.Http\n{\n    /// <summary>\n    /// Provides an <see cref=\"HttpContent\"/> implementation that exposes an output <see cref=\"Stream\"/>\n    /// which can be written to directly. The ability to push data to the output stream differs from the\n    /// <see cref=\"StreamContent\"/> where data is pulled and not pushed.\n    /// </summary>\n    // https://github.com/ASP-NET-MVC/aspnetwebstack/blob/d5188c8a75b5b26b09ab89bedfd7ee635ae2ff17/src/System.Net.Http.Formatting/PushStreamContent.cs\n    [ExcludeFromCodeCoverage]\n    class PushStreamContent : HttpContent\n    {\n        readonly Func<Stream, HttpContent, TransportContext?, Task> onStreamAvailable;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"PushStreamContent\"/> class. The\n        /// <paramref name=\"onStreamAvailable\"/> action is called when an output stream\n        /// has become available allowing the action to write to it directly. When the\n        /// stream is closed, it will signal to the content that is has completed and the\n        /// HTTP request or response will be completed.\n        /// </summary>\n        /// <param name=\"onStreamAvailable\">The action to call when an output stream is available.</param>\n        public PushStreamContent(Action<Stream, HttpContent, TransportContext?> onStreamAvailable)\n            : this(Taskify(onStreamAvailable), (MediaTypeHeaderValue?)null) { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"PushStreamContent\"/> class.\n        /// </summary>\n        /// <param name=\"onStreamAvailable\">The action to call when an output stream is available. The stream is automatically\n        /// closed when the return task is completed.</param>\n        public PushStreamContent(\n            Func<Stream, HttpContent, TransportContext?, Task> onStreamAvailable\n        )\n            : this(onStreamAvailable, (MediaTypeHeaderValue?)null) { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"PushStreamContent\"/> class with the given media type.\n        /// </summary>\n        public PushStreamContent(\n            Action<Stream, HttpContent, TransportContext?> onStreamAvailable,\n            string mediaType\n        )\n            : this(Taskify(onStreamAvailable), new MediaTypeHeaderValue(mediaType)) { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"PushStreamContent\"/> class with the given media type.\n        /// </summary>\n        public PushStreamContent(\n            Func<Stream, HttpContent, TransportContext?, Task> onStreamAvailable,\n            string mediaType\n        )\n            : this(onStreamAvailable, new MediaTypeHeaderValue(mediaType)) { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"PushStreamContent\"/> class with the given <see cref=\"MediaTypeHeaderValue\"/>.\n        /// </summary>\n        public PushStreamContent(\n            Action<Stream, HttpContent, TransportContext?> onStreamAvailable,\n            MediaTypeHeaderValue? mediaType\n        )\n            : this(Taskify(onStreamAvailable), mediaType) { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"PushStreamContent\"/> class with the given <see cref=\"MediaTypeHeaderValue\"/>.\n        /// </summary>\n        public PushStreamContent(\n            Func<Stream, HttpContent, TransportContext?, Task> onStreamAvailable,\n            MediaTypeHeaderValue? mediaType\n        )\n        {\n            this.onStreamAvailable =\n                onStreamAvailable ?? throw new ArgumentNullException(nameof(onStreamAvailable));\n            Headers.ContentType = mediaType ?? new MediaTypeHeaderValue(\"application/octet-stream\");\n        }\n\n        static Func<Stream, HttpContent, TransportContext?, Task> Taskify(\n            Action<Stream, HttpContent, TransportContext?> onStreamAvailable\n        )\n        {\n            if (onStreamAvailable == null)\n            {\n                throw new ArgumentNullException(nameof(onStreamAvailable));\n            }\n\n            return (Stream stream, HttpContent content, TransportContext? transportContext) =>\n            {\n                onStreamAvailable(stream, content, transportContext);\n                // https://github.com/ASP-NET-MVC/aspnetwebstack/blob/5118a14040b13f95bf778d1fc4522eb4ea2eef18/src/Common/TaskHelpers.cs#L10\n                return Task.FromResult<AsyncVoid>(default);\n            };\n        }\n\n        /// <summary>\n        /// Used as the T in a \"conversion\" of a Task into a Task{T}\n        /// </summary>\n        // https://github.com/ASP-NET-MVC/aspnetwebstack/blob/5118a14040b13f95bf778d1fc4522eb4ea2eef18/src/Common/TaskHelpers.cs#L65\n        struct AsyncVoid { }\n\n        /// <summary>\n        /// When this method is called, it calls the action provided in the constructor with the output\n        /// stream to write to. Once the action has completed its work it closes the stream which will\n        /// close this content instance and complete the HTTP request or response.\n        /// </summary>\n        /// <param name=\"stream\">The <see cref=\"Stream\"/> to which to write.</param>\n        /// <param name=\"context\">The associated <see cref=\"TransportContext\"/>.</param>\n        /// <returns>A <see cref=\"Task\"/> instance that is asynchronously serializing the object's content.</returns>\n        protected override async Task SerializeToStreamAsync(\n            Stream stream,\n            TransportContext? context\n        )\n        {\n            var serializeToStreamTask = new TaskCompletionSource<bool>();\n\n            using Stream wrappedStream = new CompleteTaskOnCloseStream(stream, serializeToStreamTask);\n            await onStreamAvailable(wrappedStream, this, context).ConfigureAwait(false);\n\n            // wait for wrappedStream.Close/Dispose to get called.\n            await serializeToStreamTask.Task.ConfigureAwait(false);\n        }\n\n        /// <summary>\n        /// Computes the length of the stream if possible.\n        /// </summary>\n        /// <param name=\"length\">The computed length of the stream.</param>\n        /// <returns><c>true</c> if the length has been computed; otherwise <c>false</c>.</returns>\n        protected override bool TryComputeLength(out long length)\n        {\n            // We can't know the length of the content being pushed to the output stream.\n            length = -1;\n            return false;\n        }\n\n        internal class CompleteTaskOnCloseStream : DelegatingStream\n        {\n            readonly TaskCompletionSource<bool> serializeToStreamTask;\n\n            public CompleteTaskOnCloseStream(\n                Stream innerStream,\n                TaskCompletionSource<bool> serializeToStreamTask\n            )\n                : base(innerStream)\n            {\n                Contract.Assert(serializeToStreamTask != null);\n                this.serializeToStreamTask =\n                    serializeToStreamTask\n                    ?? throw new ArgumentNullException(nameof(serializeToStreamTask));\n            }\n\n            [SuppressMessage(\"Usage\", \"CA2215:Dispose methods should call base class dispose\", Justification = \"We don't dispose the underlying stream because we don't own it. Dispose in this case just signifies that the user's action is finished.\")]\n            protected override void Dispose(bool disposing)\n            {\n                // We don't dispose the underlying stream because we don't own it. Dispose in this case just signifies\n                // that the user's action is finished.\n                serializeToStreamTask.TrySetResult(true);\n            }\n        }\n    }\n\n    /// <summary>\n    /// Stream that delegates to inner stream.\n    /// This is taken from System.Net.Http\n    /// </summary>\n    // https://github.com/ASP-NET-MVC/aspnetwebstack/blob/d5188c8a75b5b26b09ab89bedfd7ee635ae2ff17/src/System.Net.Http.Formatting/Internal/DelegatingStream.cs\n    [ExcludeFromCodeCoverage]\n    abstract class DelegatingStream(Stream innerStream) : Stream\n    {\n        protected Stream InnerStream { get; private set; } =\n            innerStream ?? throw new ArgumentNullException(nameof(innerStream));\n\n        public override bool CanRead\n        {\n            get { return InnerStream.CanRead; }\n        }\n\n        public override bool CanSeek\n        {\n            get { return InnerStream.CanSeek; }\n        }\n\n        public override bool CanWrite\n        {\n            get { return InnerStream.CanWrite; }\n        }\n\n        public override long Length\n        {\n            get { return InnerStream.Length; }\n        }\n\n        public override long Position\n        {\n            get { return InnerStream.Position; }\n            set { InnerStream.Position = value; }\n        }\n\n        public override int ReadTimeout\n        {\n            get { return InnerStream.ReadTimeout; }\n            set { InnerStream.ReadTimeout = value; }\n        }\n\n        public override bool CanTimeout\n        {\n            get { return InnerStream.CanTimeout; }\n        }\n\n        public override int WriteTimeout\n        {\n            get { return InnerStream.WriteTimeout; }\n            set { InnerStream.WriteTimeout = value; }\n        }\n\n        protected override void Dispose(bool disposing)\n        {\n            if (disposing)\n            {\n                InnerStream.Dispose();\n            }\n            base.Dispose(disposing);\n        }\n\n        public override long Seek(long offset, SeekOrigin origin)\n        {\n            return InnerStream.Seek(offset, origin);\n        }\n\n        public override int Read(byte[] buffer, int offset, int count)\n        {\n            return InnerStream.Read(buffer, offset, count);\n        }\n\n        public override Task<int> ReadAsync(\n            byte[] buffer,\n            int offset,\n            int count,\n            CancellationToken cancellationToken\n        )\n        {\n            return InnerStream.ReadAsync(buffer, offset, count, cancellationToken);\n        }\n\n        public override int ReadByte()\n        {\n            return InnerStream.ReadByte();\n        }\n\n        public override void Flush()\n        {\n            InnerStream.Flush();\n        }\n\n        public override Task CopyToAsync(\n            Stream destination,\n            int bufferSize,\n            CancellationToken cancellationToken\n        )\n        {\n            return InnerStream.CopyToAsync(destination, bufferSize, cancellationToken);\n        }\n\n        public override Task FlushAsync(CancellationToken cancellationToken)\n        {\n            return InnerStream.FlushAsync(cancellationToken);\n        }\n\n        public override void SetLength(long value)\n        {\n            InnerStream.SetLength(value);\n        }\n\n        public override void Write(byte[] buffer, int offset, int count)\n        {\n            InnerStream.Write(buffer, offset, count);\n        }\n\n        public override Task WriteAsync(\n            byte[] buffer,\n            int offset,\n            int count,\n            CancellationToken cancellationToken\n        )\n        {\n            return InnerStream.WriteAsync(buffer, offset, count, cancellationToken);\n        }\n\n        public override void WriteByte(byte value)\n        {\n            InnerStream.WriteByte(value);\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/Refit.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <Product>Refit ($(TargetFramework))</Product>\n    <TargetFrameworks>$(RefitTargets)</TargetFrameworks>\n    <GenerateDocumentationFile Condition=\" '$(Configuration)' == 'Release' \">true</GenerateDocumentationFile>\n\n    <Nullable>enable</Nullable>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"$(TargetFramework.StartsWith('net8.0')) or $(TargetFramework.StartsWith('net9.0')) or $(TargetFramework.StartsWith('net10.0'))\">\n    <IsAotCompatible>true</IsAotCompatible>\n    <PublishAotSupported>true</PublishAotSupported>\n    <TrimMode>link</TrimMode>\n    <IsTrimmable>true</IsTrimmable>\n    <IlcGenerateCompleteTypeMetadata>true</IlcGenerateCompleteTypeMetadata>\n  </PropertyGroup>\n\n  <!-- Ensure DisableRuntimeMarshalling is only emitted for .NET 10, not .NET 8/9 -->\n  <PropertyGroup Condition=\"$(TargetFramework.StartsWith('net8.0')) or $(TargetFramework.StartsWith('net9.0'))\">\n    <DisableRuntimeMarshalling>false</DisableRuntimeMarshalling>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"$(TargetFramework.StartsWith('net10.0'))\">\n    <DisableRuntimeMarshalling>true</DisableRuntimeMarshalling>\n  </PropertyGroup>\n\n  <ItemGroup Condition=\"'$(TargetFramework)' == 'netstandard2.0' Or '$(TargetFramework)' == 'net462'\">\n    <PackageReference Include=\"System.Text.Json\" Version=\"9.0.9\" />\n    <PackageReference Include=\"System.Net.Http.Json\" Version=\"9.0.9\" />\n  </ItemGroup>\n\n  <ItemGroup Condition=\"'$(TargetFramework)' == 'net462'\">\n    <Reference Include=\"System.Web\" />\n    <ProjectReference Include=\"..\\InterfaceStubGenerator.Roslyn38\\InterfaceStubGenerator.Roslyn38.csproj\" ReferenceOutputAssembly=\"false\" />\n    <ProjectReference Include=\"..\\InterfaceStubGenerator.Roslyn41\\InterfaceStubGenerator.Roslyn41.csproj\" ReferenceOutputAssembly=\"false\" />\n    <ProjectReference Include=\"..\\InterfaceStubGenerator.Roslyn50\\InterfaceStubGenerator.Roslyn50.csproj\" ReferenceOutputAssembly=\"false\" />\n  </ItemGroup>\n\n  <ItemGroup Label=\"Package\">\n    <None Include=\"targets\\refit.targets\" PackagePath=\"buildTransitive\\netstandard2.0\" Pack=\"true\" />\n    <None Include=\"targets\\refit.props\" PackagePath=\"buildTransitive\\netstandard2.0\" Pack=\"true\" />\n\n    <!-- We need this one to catch older clients -->\n    <None Include=\"targets\\refit.targets\" PackagePath=\"build\\netstandard2.0\" Pack=\"true\" />\n\n    <None Include=\"..\\InterfaceStubGenerator.Roslyn38\\bin\\$(Configuration)\\netstandard2.0\\InterfaceStubGeneratorV1.dll\" PackagePath=\"analyzers\\dotnet\\roslyn3.8\\cs\" Pack=\"true\" Visible=\"false\" />\n\n    <None Include=\"..\\InterfaceStubGenerator.Roslyn41\\bin\\$(Configuration)\\netstandard2.0\\InterfaceStubGeneratorV2.dll\" PackagePath=\"analyzers\\dotnet\\roslyn4.1\\cs\" Pack=\"true\" Visible=\"false\" />\n\n    <None Include=\"..\\InterfaceStubGenerator.Roslyn50\\bin\\$(Configuration)\\netstandard2.0\\InterfaceStubGeneratorV3.dll\" PackagePath=\"analyzers\\dotnet\\roslyn5.0\\cs\" Pack=\"true\" Visible=\"false\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "Refit/RefitSettings.cs",
    "content": "﻿using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Refit\n{\n    /// <summary>\n    /// Defines various parameters on how Refit should work.\n    /// </summary>\n    public class RefitSettings\n    {\n        /// <summary>\n        /// Creates a new <see cref=\"RefitSettings\"/> instance with the default parameters\n        /// </summary>\n        public RefitSettings()\n        {\n            ContentSerializer = new SystemTextJsonContentSerializer();\n            UrlParameterKeyFormatter = new DefaultUrlParameterKeyFormatter();\n            UrlParameterFormatter = new DefaultUrlParameterFormatter();\n            FormUrlEncodedParameterFormatter = new DefaultFormUrlEncodedParameterFormatter();\n            ExceptionFactory = new DefaultApiExceptionFactory(this).CreateAsync;\n        }\n\n        /// <summary>\n        /// Creates a new <see cref=\"RefitSettings\"/> instance with the specified parameters\n        /// </summary>\n        /// <param name=\"contentSerializer\">The <see cref=\"IHttpContentSerializer\"/> instance to use</param>\n        /// <param name=\"urlParameterFormatter\">The <see cref=\"IUrlParameterFormatter\"/> instance to use (defaults to <see cref=\"DefaultUrlParameterFormatter\"/>)</param>\n        /// <param name=\"formUrlEncodedParameterFormatter\">The <see cref=\"IFormUrlEncodedParameterFormatter\"/> instance to use (defaults to <see cref=\"DefaultFormUrlEncodedParameterFormatter\"/>)</param>\n        public RefitSettings(\n            IHttpContentSerializer contentSerializer,\n            IUrlParameterFormatter? urlParameterFormatter,\n            IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter\n        )\n            : this(contentSerializer, urlParameterFormatter, formUrlEncodedParameterFormatter, null)\n        {\n        }\n\n        /// <summary>\n        /// Creates a new <see cref=\"RefitSettings\"/> instance with the specified parameters\n        /// </summary>\n        /// <param name=\"contentSerializer\">The <see cref=\"IHttpContentSerializer\"/> instance to use</param>\n        /// <param name=\"urlParameterFormatter\">The <see cref=\"IUrlParameterFormatter\"/> instance to use (defaults to <see cref=\"DefaultUrlParameterFormatter\"/>)</param>\n        /// <param name=\"formUrlEncodedParameterFormatter\">The <see cref=\"IFormUrlEncodedParameterFormatter\"/> instance to use (defaults to <see cref=\"DefaultFormUrlEncodedParameterFormatter\"/>)</param>\n        /// <param name=\"urlParameterKeyFormatter\">The <see cref=\"IUrlParameterKeyFormatter\"/> instance to use (defaults to <see cref=\"DefaultUrlParameterKeyFormatter\"/>)</param>\n        public RefitSettings(\n            IHttpContentSerializer contentSerializer,\n            IUrlParameterFormatter? urlParameterFormatter = null,\n            IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter = null,\n            IUrlParameterKeyFormatter? urlParameterKeyFormatter = null\n        )\n        {\n            ContentSerializer =\n                contentSerializer\n                ?? throw new ArgumentNullException(\n                    nameof(contentSerializer),\n                    \"The content serializer can't be null\"\n                );\n            UrlParameterFormatter = urlParameterFormatter ?? new DefaultUrlParameterFormatter();\n            FormUrlEncodedParameterFormatter =\n                formUrlEncodedParameterFormatter ?? new DefaultFormUrlEncodedParameterFormatter();\n            UrlParameterKeyFormatter =\n                urlParameterKeyFormatter ?? new DefaultUrlParameterKeyFormatter();\n            ExceptionFactory = new DefaultApiExceptionFactory(this).CreateAsync;\n        }\n\n        /// <summary>\n        /// Supply a function to provide the Authorization header. Does not work if you supply an HttpClient instance.\n        /// </summary>\n        public Func<\n            HttpRequestMessage,\n            CancellationToken,\n            Task<string>\n        >? AuthorizationHeaderValueGetter { get; set; }\n\n        /// <summary>\n        /// Supply a custom inner HttpMessageHandler. Does not work if you supply an HttpClient instance.\n        /// </summary>\n        public Func<HttpMessageHandler>? HttpMessageHandlerFactory { get; set; }\n\n        /// <summary>\n        /// Supply a function to provide <see cref=\"Exception\"/> based on <see cref=\"HttpResponseMessage\"/>.\n        /// If function returns null - no exception is thrown.\n        /// </summary>\n        public Func<HttpResponseMessage, Task<Exception?>> ExceptionFactory { get; set; }\n\n        /// <summary>\n        /// Supply a function to provide <see cref=\"Exception\"/> when deserialization exception is encountered.\n        /// If function returns null - no exception is thrown.\n        /// </summary>\n        public Func<HttpResponseMessage, Exception, Task<Exception?>>? DeserializationExceptionFactory { get; set; }\n\n        /// <summary>\n        /// Defines how requests' content should be serialized. (defaults to <see cref=\"SystemTextJsonContentSerializer\"/>)\n        /// </summary>\n        public IHttpContentSerializer ContentSerializer { get; set; }\n\n        /// <summary>\n        /// The <see cref=\"IUrlParameterKeyFormatter\"/> instance to use for formatting URL parameter keys (defaults to <see cref=\"DefaultUrlParameterKeyFormatter\" />.\n        /// Allows customization of key naming conventions.\n        /// </summary>\n        public IUrlParameterKeyFormatter UrlParameterKeyFormatter { get; set; }\n\n        /// <summary>\n        /// The <see cref=\"IUrlParameterFormatter\"/> instance to use (defaults to <see cref=\"DefaultUrlParameterFormatter\"/>)\n        /// </summary>\n        public IUrlParameterFormatter UrlParameterFormatter { get; set; }\n\n        /// <summary>\n        /// The <see cref=\"IFormUrlEncodedParameterFormatter\"/> instance to use (defaults to <see cref=\"DefaultFormUrlEncodedParameterFormatter\"/>)\n        /// </summary>\n        public IFormUrlEncodedParameterFormatter FormUrlEncodedParameterFormatter { get; set; }\n\n        /// <summary>\n        /// Sets the default collection format to use. (defaults to <see cref=\"CollectionFormat.RefitParameterFormatter\"/>)\n        /// </summary>\n        public CollectionFormat CollectionFormat { get; set; } =\n            CollectionFormat.RefitParameterFormatter;\n\n        /// <summary>\n        /// Sets the default behavior when sending a request's body content. (defaults to false, request body is not streamed to the server)\n        /// </summary>\n        public bool Buffered { get; set; }\n\n        /// <summary>\n        /// Optional Key-Value pairs, which are displayed in the property <see cref=\"HttpRequestMessage.Properties\"/>.\n        /// </summary>\n        public Dictionary<string, object>? HttpRequestMessageOptions { get; set; }\n\n#if NET6_0_OR_GREATER\n\n        /// <summary>\n        /// Gets or sets the version.\n        /// </summary>\n        /// <value>\n        /// The version.\n        /// </value>\n        public Version Version { get; set; } = HttpVersion.Version11;\n\n        /// <summary>\n        /// Gets or sets the version policy.\n        /// </summary>\n        /// <value>\n        /// The version policy.\n        /// </value>\n        public System.Net.Http.HttpVersionPolicy VersionPolicy { get; set; } = HttpVersionPolicy.RequestVersionOrLower;\n#endif\n    }\n\n    /// <summary>\n    /// Provides content serialization to <see cref=\"HttpContent\"/>.\n    /// </summary>\n    public interface IHttpContentSerializer\n    {\n        /// <summary>\n        /// Serializes an object of type <typeparamref name=\"T\"/> to <see cref=\"HttpContent\"/>\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the object to serialize from.</typeparam>\n        /// <param name=\"item\">Object to serialize.</param>\n        /// <returns><see cref=\"HttpContent\"/> that contains the serialized <typeparamref name=\"T\"/> object.</returns>\n        HttpContent ToHttpContent<T>(T item);\n\n        /// <summary>\n        /// Deserializes an object of type <typeparamref name=\"T\"/> from an <see cref=\"HttpContent\"/> object.\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the object to serialize to.</typeparam>\n        /// <param name=\"content\">HttpContent object to deserialize.</param>\n        /// <param name=\"cancellationToken\">CancellationToken to abort the deserialization.</param>\n        /// <returns>The deserialized object of type <typeparamref name=\"T\"/>.</returns>\n        Task<T?> FromHttpContentAsync<T>(\n            HttpContent content,\n            CancellationToken cancellationToken = default\n        );\n\n        /// <summary>\n        /// Calculates what the field name should be for the given property. This may be affected by custom attributes the serializer understands\n        /// </summary>\n        /// <param name=\"propertyInfo\">A PropertyInfo object.</param>\n        /// <returns>The calculated field name.</returns>\n        string? GetFieldNameForProperty(PropertyInfo propertyInfo);\n    }\n\n    /// <summary>\n    /// Provides a mechanism for formatting URL parameter keys, allowing customization of key naming conventions.\n    /// </summary>\n    public interface IUrlParameterKeyFormatter\n    {\n        /// <summary>\n        /// Formats the specified key.\n        /// </summary>\n        /// <param name=\"key\">The key.</param>\n        /// <returns></returns>\n        string Format(string key);\n    }\n\n    /// <summary>\n    /// Provides Url parameter formatting.\n    /// </summary>\n    public interface IUrlParameterFormatter\n    {\n        /// <summary>\n        /// Formats the specified value.\n        /// </summary>\n        /// <param name=\"value\">The value.</param>\n        /// <param name=\"attributeProvider\">The attribute provider.</param>\n        /// <param name=\"type\">Container class type.</param>\n        /// <returns></returns>\n        string? Format(object? value, ICustomAttributeProvider attributeProvider, Type type);\n    }\n\n    /// <summary>\n    /// Provides form Url-encoded parameter formatting.\n    /// </summary>\n    public interface IFormUrlEncodedParameterFormatter\n    {\n        /// <summary>\n        /// Formats the specified value.\n        /// </summary>\n        /// <param name=\"value\">The value.</param>\n        /// <param name=\"formatString\">The format string.</param>\n        /// <returns></returns>\n        string? Format(object? value, string? formatString);\n    }\n\n    /// <summary>\n    /// Default Url parameter key formatter. Does not do any formatting.\n    /// </summary>\n    public class DefaultUrlParameterKeyFormatter : IUrlParameterKeyFormatter\n    {\n        /// <summary>\n        /// Formats the specified key.\n        /// </summary>\n        /// <param name=\"key\">The key.</param>\n        /// <returns></returns>\n        public virtual string Format(string key) => key;\n    }\n\n    /// <summary>\n    /// Default Url parameter formater.\n    /// </summary>\n    public class DefaultUrlParameterFormatter : IUrlParameterFormatter\n    {\n        static readonly ConcurrentDictionary<\n            Type,\n            ConcurrentDictionary<string, EnumMemberAttribute?>\n        > EnumMemberCache = new();\n\n        Dictionary<(Type containerType, Type parameterType), string> SpecificFormats { get; } = new();\n\n        Dictionary<Type, string> GeneralFormats { get; } = new();\n\n        /// <summary>\n        /// Add format for specified parameter type contained within container class of specified type.\n        /// Might be suppressed by a QueryAttribute format.\n        /// </summary>\n        /// <param name=\"format\">The format string.</param>\n        /// <typeparam name=\"TContainer\">Container class type.</typeparam>\n        /// <typeparam name=\"TParameter\">Parameter type.</typeparam>\n        public void AddFormat<TContainer, TParameter>(string format)\n        {\n            SpecificFormats.Add((typeof(TContainer), typeof(TParameter)), format);\n        }\n\n        /// <summary>\n        /// Add format for specified parameter type.\n        /// Might be suppressed by a QueryAttribute format or a container specific format.\n        /// </summary>\n        /// <param name=\"format\">The format string.</param>\n        /// <typeparam name=\"TParameter\">Parameter type.</typeparam>\n        public void AddFormat<TParameter>(string format)\n        {\n            GeneralFormats.Add(typeof(TParameter), format);\n        }\n\n        /// <summary>\n        /// Formats the specified parameter value.\n        /// </summary>\n        /// <param name=\"parameterValue\">The parameter value.</param>\n        /// <param name=\"attributeProvider\">The attribute provider.</param>\n        /// <param name=\"type\">Container class type.</param>\n        /// <returns></returns>\n        /// <exception cref=\"ArgumentNullException\">attributeProvider</exception>\n        public virtual string? Format(\n            object? parameterValue,\n            ICustomAttributeProvider attributeProvider,\n            Type type\n        )\n        {\n            if (attributeProvider is null)\n            {\n                throw new ArgumentNullException(nameof(attributeProvider));\n            }\n\n            if (parameterValue == null)\n            {\n                return null;\n            }\n\n            // See if we have a format\n            var formatString = attributeProvider\n                .GetCustomAttributes(typeof(QueryAttribute), true)\n                .OfType<QueryAttribute>()\n                .FirstOrDefault()\n                ?.Format;\n\n            EnumMemberAttribute? enumMember = null;\n            var parameterType = parameterValue.GetType();\n            if (parameterType.IsEnum)\n            {\n                var cached = EnumMemberCache.GetOrAdd(\n                    parameterType,\n                    t => new ConcurrentDictionary<string, EnumMemberAttribute?>()\n                );\n                enumMember = cached.GetOrAdd(\n                    parameterValue.ToString()!,\n                    val =>\n                        parameterType\n                            .GetMember(val)\n                            .First()\n                            .GetCustomAttribute<EnumMemberAttribute>()\n                );\n            }\n\n            if (string.IsNullOrWhiteSpace(formatString) &&\n                SpecificFormats.TryGetValue((type, parameterType), out var specificFormat))\n            {\n                formatString = specificFormat;\n            }\n\n            if (string.IsNullOrWhiteSpace(formatString) &&\n                GeneralFormats.TryGetValue(parameterType, out var generalFormat))\n            {\n                formatString = generalFormat;\n            }\n\n            return string.Format(\n                CultureInfo.InvariantCulture,\n                string.IsNullOrWhiteSpace(formatString) ? \"{0}\" : $\"{{0:{formatString}}}\",\n                enumMember?.Value ?? parameterValue\n            );\n        }\n    }\n\n    /// <summary>\n    /// Default form Url-encoded parameter formatter.\n    /// </summary>\n    public class DefaultFormUrlEncodedParameterFormatter : IFormUrlEncodedParameterFormatter\n    {\n        static readonly ConcurrentDictionary<\n            Type,\n            ConcurrentDictionary<string, EnumMemberAttribute?>\n        > EnumMemberCache = new();\n\n        /// <summary>\n        /// Formats the specified parameter value.\n        /// </summary>\n        /// <param name=\"parameterValue\">The parameter value.</param>\n        /// <param name=\"formatString\">The format string.</param>\n        /// <returns></returns>\n        public virtual string? Format(object? parameterValue, string? formatString)\n        {\n            if (parameterValue == null)\n            {\n                return null;\n            }\n\n            var parameterType = parameterValue.GetType();\n\n            EnumMemberAttribute? enumMember = null;\n            if (parameterType.GetTypeInfo().IsEnum)\n            {\n                var cached = EnumMemberCache.GetOrAdd(\n                    parameterType,\n                    t => new ConcurrentDictionary<string, EnumMemberAttribute?>()\n                );\n                enumMember = cached.GetOrAdd(\n                    parameterValue.ToString()!,\n                    val =>\n                        parameterType\n                            .GetMember(val)\n                            .First()\n                            .GetCustomAttribute<EnumMemberAttribute>()\n                );\n            }\n\n            return string.Format(\n                CultureInfo.InvariantCulture,\n                string.IsNullOrWhiteSpace(formatString) ? \"{0}\" : $\"{{0:{formatString}}}\",\n                enumMember?.Value ?? parameterValue\n            );\n        }\n    }\n\n    /// <summary>\n    /// Default Api exception factory.\n    /// </summary>\n    public class DefaultApiExceptionFactory(RefitSettings refitSettings)\n    {\n        static readonly Task<Exception?> NullTask = Task.FromResult<Exception?>(null);\n\n        /// <summary>\n        /// Creates the asynchronous.\n        /// </summary>\n        /// <param name=\"responseMessage\">The response message.</param>\n        /// <returns></returns>\n        public Task<Exception?> CreateAsync(HttpResponseMessage responseMessage)\n        {\n            if (responseMessage?.IsSuccessStatusCode == false)\n            {\n                return CreateExceptionAsync(responseMessage, refitSettings)!;\n            }\n            else\n            {\n                return NullTask;\n            }\n        }\n\n        static async Task<Exception> CreateExceptionAsync(\n            HttpResponseMessage responseMessage,\n            RefitSettings refitSettings\n        )\n        {\n            var requestMessage = responseMessage.RequestMessage!;\n            var method = requestMessage.Method;\n\n            return await ApiException\n                .Create(requestMessage, method, responseMessage, refitSettings)\n                .ConfigureAwait(false);\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/RequestBuilder.cs",
    "content": "﻿using System.Net.Http;\n#if NET8_0_OR_GREATER\nusing System.Diagnostics.CodeAnalysis;\n#endif\n\nnamespace Refit\n{\n    /// <summary>\n    /// Defines a method for creating a delegate that executes a REST API method with the specified parameters and\n    /// returns the result.\n    /// </summary>\n    /// <remarks>The returned delegate can be used to invoke a REST API method dynamically, given an HTTP\n    /// client and an array of arguments. This interface is typically used by code generation or dynamic proxy libraries\n    /// to construct method invokers at runtime. Implementations may use reflection and may require referenced types to\n    /// be preserved when trimming assemblies.</remarks>\n    public interface IRequestBuilder\n    {\n        /// <summary>\n        /// Builds a delegate that executes the specified REST method using the provided HTTP client and arguments.\n        /// </summary>\n        /// <remarks>The returned delegate uses reflection to invoke the specified method and may require\n        /// referenced interfaces and data transfer objects (DTOs) to be preserved when trimming assemblies. This method\n        /// is typically used to dynamically generate REST API client calls at runtime.</remarks>\n        /// <param name=\"methodName\">The name of the interface method to generate the REST call delegate for. Must correspond to a method defined\n        /// on the target interface.</param>\n        /// <param name=\"parameterTypes\">An array of parameter types for the target method, or null to infer from the method signature. The order\n        /// must match the method's parameter list if specified.</param>\n        /// <param name=\"genericArgumentTypes\">An array of generic argument types to use when constructing a generic method, or null if the method is not\n        /// generic.</param>\n        /// <returns>A delegate that takes an HttpClient and an array of argument values, and returns the result of invoking the\n        /// specified REST method. The return type matches the method's declared return type.</returns>\n#if NET8_0_OR_GREATER\n        [RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces and DTOs are preserved when trimming.\")]\n#endif\n        Func<HttpClient, object[], object?> BuildRestResultFuncForMethod(\n            string methodName,\n            Type[]? parameterTypes = null,\n            Type[]? genericArgumentTypes = null\n        );\n    }\n\n    /// <summary>\n    /// Defines a generic contract for building requests with a specified result type.\n    /// </summary>\n    /// <typeparam name=\"T\">The type of the result produced by the request builder.</typeparam>\n    public interface IRequestBuilder<T> : IRequestBuilder { }\n\n    /// <summary>\n    /// Provides static methods for creating request builders for Refit interface types. This class enables the\n    /// generation of strongly-typed HTTP client implementations based on interface definitions and optional settings.\n    /// </summary>\n    /// <remarks>Request builders generated by this class use reflection to analyze the provided interface\n    /// type and create implementations for HTTP API calls. When using trimming or linking, ensure that referenced\n    /// interfaces and data transfer objects are preserved, as reflection is required for correct operation. All members\n    /// of this class are thread-safe and can be used concurrently across multiple threads.</remarks>\n    public static class RequestBuilder\n    {\n        static readonly RequestBuilderFactory PlatformRequestBuilderFactory = new();\n\n        /// <summary>\n        /// Creates an HTTP request builder for the specified interface type.\n        /// </summary>\n        /// <remarks>Use this method to obtain a request builder for a given API interface, typically for\n        /// advanced scenarios such as custom client generation or integration with dependency injection. The returned\n        /// builder can be used to create HTTP requests corresponding to the methods defined on the interface.</remarks>\n        /// <typeparam name=\"T\">The interface type that defines the HTTP API methods to be implemented by the request builder. Must be an\n        /// interface.</typeparam>\n        /// <param name=\"settings\">The Refit settings to use for configuring the request builder. May be null to use default settings.</param>\n        /// <returns>An instance of IRequestBuilder T that can be used to construct HTTP requests for the specified interface\n        /// type.</returns>\n#if NET8_0_OR_GREATER\n        public static IRequestBuilder<T> ForType< [\n            DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] T >(RefitSettings? settings) =>\n            PlatformRequestBuilderFactory.Create<T>(settings);\n#else\n        public static IRequestBuilder<T> ForType<T>(RefitSettings? settings) =>\n            PlatformRequestBuilderFactory.Create<T>(settings);\n#endif\n\n        /// <summary>\n        /// Creates a request builder for the specified type, enabling the construction of requests targeting members of\n        /// that type.\n        /// </summary>\n        /// <typeparam name=\"T\">The type for which to create the request builder. This type's methods will be available for request\n        /// construction.</typeparam>\n        /// <returns>An object that can be used to build requests for the specified type.</returns>\n#if NET8_0_OR_GREATER\n        public static IRequestBuilder<T> ForType< [\n            DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] T >() =>\n            PlatformRequestBuilderFactory.Create<T>(null);\n#else\n        public static IRequestBuilder<T> ForType<T>() =>\n            PlatformRequestBuilderFactory.Create<T>(null);\n#endif\n\n        /// <summary>\n        /// Creates an implementation of the specified Refit interface for making HTTP requests.\n        /// </summary>\n        /// <remarks>The returned IRequestBuilder uses reflection to analyze the provided interface type.\n        /// When using trimming or linking, ensure that all referenced interfaces and data transfer objects are\n        /// preserved to avoid runtime errors.</remarks>\n        /// <param name=\"refitInterfaceType\">The interface type that defines the HTTP API contract. Must be a non-generic interface decorated with Refit\n        /// attributes.</param>\n        /// <param name=\"settings\">Optional settings to customize the behavior of the generated request builder. If null, default settings are\n        /// used.</param>\n        /// <returns>An IRequestBuilder instance that can be used to construct HTTP requests for the specified interface.</returns>\n#if NET8_0_OR_GREATER\n        [RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces and DTOs are preserved when trimming.\")]\n        public static IRequestBuilder ForType(\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] Type refitInterfaceType,\n            RefitSettings? settings\n        )\n#else\n        public static IRequestBuilder ForType(\n            Type refitInterfaceType,\n            RefitSettings? settings\n        )\n#endif\n        {\n            return new CachedRequestBuilderImplementation(\n                new RequestBuilderImplementation(refitInterfaceType, settings)\n            );\n        }\n\n        /// <summary>\n        /// Creates an instance of an IRequestBuilder for the specified Refit interface type.\n        /// </summary>\n        /// <remarks>The specified interface type must be decorated with Refit attributes to define the\n        /// API endpoints. If trimming is enabled, ensure that all referenced interfaces and data transfer objects are\n        /// preserved, as reflection is used to analyze the interface methods.</remarks>\n        /// <param name=\"refitInterfaceType\">The interface type that defines the Refit API contract. Must be a non-generic interface decorated with Refit\n        /// attributes.</param>\n        /// <returns>An IRequestBuilder instance that can be used to construct HTTP requests for the specified interface type.</returns>\n#if NET8_0_OR_GREATER\n        [RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces and DTOs are preserved when trimming.\")]\n#endif\n        public static IRequestBuilder ForType(Type refitInterfaceType) =>\n            ForType(refitInterfaceType, null);\n    }\n}\n"
  },
  {
    "path": "Refit/RequestBuilderFactory.cs",
    "content": "﻿#if NET8_0_OR_GREATER\nusing System.Diagnostics.CodeAnalysis;\n#endif\n\nnamespace Refit\n{\n    interface IRequestBuilderFactory\n    {\n#if NET8_0_OR_GREATER\n        IRequestBuilder<T> Create<\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] T>(RefitSettings? settings);\n        [RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces and DTOs are preserved when trimming.\")]\n        IRequestBuilder Create(\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] Type refitInterfaceType,\n            RefitSettings? settings\n        );\n#else\n        IRequestBuilder<T> Create<T>(RefitSettings? settings);\n        IRequestBuilder Create(Type refitInterfaceType, RefitSettings? settings);\n#endif\n    }\n\n    class RequestBuilderFactory : IRequestBuilderFactory\n    {\n#if NET8_0_OR_GREATER\n        public IRequestBuilder<T> Create<\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] T>(RefitSettings? settings = null)\n#else\n        public IRequestBuilder<T> Create<T>(RefitSettings? settings = null)\n#endif\n        {\n            return new CachedRequestBuilderImplementation<T>(\n                new RequestBuilderImplementation<T>(settings)\n            );\n        }\n\n#if NET8_0_OR_GREATER\n        [RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces and DTOs are preserved when trimming.\")]\n        public IRequestBuilder Create(\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] Type refitInterfaceType,\n            RefitSettings? settings = null\n        )\n#else\n        public IRequestBuilder Create(Type refitInterfaceType, RefitSettings? settings = null)\n#endif\n        {\n            return new CachedRequestBuilderImplementation(\n                new RequestBuilderImplementation(refitInterfaceType, settings)\n            );\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/RequestBuilderImplementation.TaskToObservable.cs",
    "content": "﻿namespace Refit\n{\n    partial class RequestBuilderImplementation\n    {\n        sealed class TaskToObservable<T> : IObservable<T?>\n        {\n            readonly Func<CancellationToken, Task<T?>> taskFactory;\n\n            public TaskToObservable(Func<CancellationToken, Task<T?>> taskFactory)\n            {\n                this.taskFactory = taskFactory;\n            }\n\n            public IDisposable Subscribe(IObserver<T?> observer)\n            {\n                var cts = new CancellationTokenSource();\n#pragma warning disable VSTHRD110 // Observe result of async calls\n                taskFactory(cts.Token)\n                    .ContinueWith(\n                        t =>\n                        {\n                            if (cts.IsCancellationRequested)\n                                return;\n\n                            ToObservableDone(t, observer);\n                        },\n                        TaskScheduler.Default\n                    );\n\n#pragma warning restore VSTHRD110 // Observe result of async calls\n\n                return new AnonymousDisposable(cts.Cancel);\n            }\n\n            static void ToObservableDone<TResult>(Task<TResult?> task, IObserver<TResult?> subject)\n            {\n                switch (task.Status)\n                {\n                    case TaskStatus.RanToCompletion:\n#pragma warning disable VSTHRD002 // Avoid problematic synchronous waits\n                        subject.OnNext(task.Result);\n#pragma warning restore VSTHRD002 // Avoid problematic synchronous waits\n                        subject.OnCompleted();\n                        break;\n                    case TaskStatus.Faulted:\n                        subject.OnError(task.Exception!.InnerException!);\n                        break;\n                    case TaskStatus.Canceled:\n                        subject.OnError(new TaskCanceledException(task));\n                        break;\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/RequestBuilderImplementation.cs",
    "content": "﻿using System.Collections;\nusing System.Collections.Concurrent;\nusing System.Diagnostics;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Reflection;\nusing System.Text;\nusing System.Web;\n#if NET5_0_OR_GREATER\nusing System.Diagnostics.CodeAnalysis;\n#endif\n\nnamespace Refit\n{\n#if NET5_0_OR_GREATER\n    class RequestBuilderImplementation<\n        [\n            DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] TApi> : RequestBuilderImplementation, IRequestBuilder<TApi>\n#else\n    class RequestBuilderImplementation<TApi> : RequestBuilderImplementation, IRequestBuilder<TApi>\n#endif\n    {\n        public RequestBuilderImplementation(RefitSettings? refitSettings = null)\n            : base(typeof(TApi), refitSettings)\n        {\n        }\n    }\n\n    partial class RequestBuilderImplementation : IRequestBuilder\n    {\n        private const int StackallocThreshold = 512;\n        static readonly QueryAttribute DefaultQueryAttribute = new ();\n        static readonly Uri BaseUri = new (\"http://api\");\n        readonly Dictionary<string, List<RestMethodInfoInternal>> interfaceHttpMethods;\n        readonly ConcurrentDictionary<\n            CloseGenericMethodKey,\n            RestMethodInfoInternal\n        > interfaceGenericHttpMethods;\n        readonly IHttpContentSerializer serializer;\n        readonly RefitSettings settings;\n        public Type TargetType { get; }\n\n#if NET5_0_OR_GREATER\n        [RequiresUnreferencedCode(\"RequestBuilder uses reflection on the provided Refit interface and DTO types. Ensure necessary members are preserved when trimming.\")]\n#endif\n        public RequestBuilderImplementation(\n#if NET5_0_OR_GREATER\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods\n            )]\n#endif\n            Type refitInterfaceType,\n            RefitSettings? refitSettings = null\n        )\n        {\n            var targetInterfaceInheritedInterfaces = refitInterfaceType.GetInterfaces();\n\n            settings = refitSettings ?? new RefitSettings();\n            serializer = settings.ContentSerializer;\n            interfaceGenericHttpMethods =\n                new ConcurrentDictionary<CloseGenericMethodKey, RestMethodInfoInternal>();\n\n            if (refitInterfaceType == null || !refitInterfaceType.GetTypeInfo().IsInterface)\n            {\n                throw new ArgumentException(\"targetInterface must be an Interface\");\n            }\n\n            TargetType = refitInterfaceType;\n\n            var dict = new Dictionary<string, List<RestMethodInfoInternal>>(StringComparer.Ordinal);\n\n            AddInterfaceHttpMethods(refitInterfaceType, dict);\n            foreach (var inheritedInterface in targetInterfaceInheritedInterfaces)\n            {\n                AddInterfaceHttpMethods(inheritedInterface, dict);\n            }\n\n            interfaceHttpMethods = dict;\n        }\n\n        static string GetLookupKeyForMethod(MethodInfo methodInfo)\n        {\n            var name = methodInfo.Name;\n            var lastDot = name.LastIndexOf('.');\n            return lastDot >= 0 ? name.Substring(lastDot + 1) : name;\n        }\n\n        void AddInterfaceHttpMethods(\n#if NET5_0_OR_GREATER\n            [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)]\n#endif\n            Type interfaceType,\n            Dictionary<string, List<RestMethodInfoInternal>> methods\n        )\n        {\n            var methodInfos = interfaceType\n                .GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)\n                .Where(i => i.IsAbstract);\n\n            foreach (var methodInfo in methodInfos)\n            {\n                var attrs = methodInfo.GetCustomAttributes(true);\n                var hasHttpMethod = attrs.OfType<HttpMethodAttribute>().Any();\n                if (hasHttpMethod)\n                {\n                    var key = GetLookupKeyForMethod(methodInfo);\n                    if (!methods.TryGetValue(key, out var value))\n                    {\n                        value = [];\n                        methods.Add(key, value);\n                    }\n\n                    var restinfo = new RestMethodInfoInternal(interfaceType, methodInfo, settings);\n                    value.Add(restinfo);\n                }\n            }\n        }\n\n        RestMethodInfoInternal FindMatchingRestMethodInfo(\n            string key,\n            Type[]? parameterTypes,\n            Type[]? genericArgumentTypes\n        )\n        {\n            if (!interfaceHttpMethods.TryGetValue(key, out var httpMethods))\n            {\n                throw new ArgumentException(\n                    \"Method must be defined and have an HTTP Method attribute\"\n                );\n            }\n\n            if (parameterTypes == null)\n            {\n                if (httpMethods.Count > 1)\n                {\n                    throw new ArgumentException(\n                        $\"MethodName exists more than once, '{nameof(parameterTypes)}' mut be defined\"\n                    );\n                }\n\n                return CloseGenericMethodIfNeeded(httpMethods[0], genericArgumentTypes);\n            }\n\n            var isGeneric = genericArgumentTypes?.Length > 0;\n\n            var possibleMethodsCollection = httpMethods.Where(\n                method => method.MethodInfo.GetParameters().Length == parameterTypes.Length\n            );\n\n            if (isGeneric)\n                possibleMethodsCollection = possibleMethodsCollection.Where(\n                    method =>\n                        method.MethodInfo.IsGenericMethod\n                        && method.MethodInfo.GetGenericArguments().Length\n                            == genericArgumentTypes!.Length\n                );\n            else\n                possibleMethodsCollection = possibleMethodsCollection.Where(\n                    method => !method.MethodInfo.IsGenericMethod\n                );\n\n            var possibleMethods = possibleMethodsCollection.ToArray();\n\n            if (possibleMethods.Length == 1)\n                return CloseGenericMethodIfNeeded(possibleMethods[0], genericArgumentTypes);\n\n            foreach (var method in possibleMethods)\n            {\n                var match = method\n                    .MethodInfo.GetParameters()\n                    .Select(p => p.ParameterType)\n                    .SequenceEqual(parameterTypes);\n                if (match)\n                {\n                    return CloseGenericMethodIfNeeded(method, genericArgumentTypes);\n                }\n            }\n\n            throw new Exception(\"No suitable Method found...\");\n        }\n\n        RestMethodInfoInternal CloseGenericMethodIfNeeded(\n            RestMethodInfoInternal restMethodInfo,\n            Type[]? genericArgumentTypes\n        )\n        {\n            if (genericArgumentTypes != null)\n            {\n                return interfaceGenericHttpMethods.GetOrAdd(\n                    new CloseGenericMethodKey(restMethodInfo.MethodInfo, genericArgumentTypes),\n                    _ =>\n                        new RestMethodInfoInternal(\n                            restMethodInfo.Type,\n                            restMethodInfo.MethodInfo.MakeGenericMethod(genericArgumentTypes),\n                            restMethodInfo.RefitSettings\n                        )\n                );\n            }\n            return restMethodInfo;\n        }\n\n#if NET5_0_OR_GREATER\n        [RequiresUnreferencedCode(\"Building rest result delegates uses reflection over interface methods and DTOs. Ensure required members are preserved.\")]\n#endif\n        public Func<HttpClient, object[], object?> BuildRestResultFuncForMethod(\n            string methodName,\n            Type[]? parameterTypes = null,\n            Type[]? genericArgumentTypes = null\n        )\n        {\n            if (!interfaceHttpMethods.ContainsKey(methodName))\n            {\n                throw new ArgumentException(\n                    \"Method must be defined and have an HTTP Method attribute\"\n                );\n            }\n\n            var restMethod = FindMatchingRestMethodInfo(\n                methodName,\n                parameterTypes,\n                genericArgumentTypes\n            );\n\n            // Task (void)\n            if (restMethod.ReturnType == typeof(Task))\n            {\n                return BuildVoidTaskFuncForMethod(restMethod);\n            }\n\n            // Task<T>\n            if (restMethod.ReturnType.GetTypeInfo().IsGenericType && restMethod.ReturnType.GetGenericTypeDefinition() == typeof(Task<>))\n            {\n                var taskFuncMi = typeof(RequestBuilderImplementation).GetMethod(\n                    nameof(BuildTaskFuncForMethod),\n                    BindingFlags.NonPublic | BindingFlags.Instance\n                );\n                var taskFunc = (MulticastDelegate?)\n                    (\n                        taskFuncMi!.MakeGenericMethod(\n                            restMethod.ReturnResultType,\n                            restMethod.DeserializedResultType\n                        )\n                    ).Invoke(this, [restMethod]);\n\n                return (client, args) => taskFunc!.DynamicInvoke(client, args);\n            }\n\n            // IObservable<T>\n            if (restMethod.ReturnType.GetTypeInfo().IsGenericType && restMethod.ReturnType.GetGenericTypeDefinition() == typeof(IObservable<>))\n            {\n                var rxFuncMi = typeof(RequestBuilderImplementation).GetMethod(\n                    nameof(BuildRxFuncForMethod),\n                    BindingFlags.NonPublic | BindingFlags.Instance\n                );\n                var rxFunc = (MulticastDelegate?)\n                    (\n                        rxFuncMi!.MakeGenericMethod(\n                            restMethod.ReturnResultType,\n                            restMethod.DeserializedResultType\n                        )\n                    ).Invoke(this, [restMethod]);\n\n                return (client, args) => rxFunc!.DynamicInvoke(client, args);\n            }\n\n            // Synchronous return types: build a sync wrapper that awaits internally and returns the value\n            var syncFuncMi = typeof(RequestBuilderImplementation).GetMethod(\n                nameof(BuildSyncFuncForMethod),\n                BindingFlags.NonPublic | BindingFlags.Instance\n            );\n            var syncFunc = (MulticastDelegate?)\n                (\n                    syncFuncMi!.MakeGenericMethod(\n                        restMethod.ReturnResultType,\n                        restMethod.DeserializedResultType\n                    )\n                ).Invoke(this, [restMethod]);\n\n            return (client, args) => syncFunc!.DynamicInvoke(client, args);\n        }\n\n        private Func<HttpClient, object[], object?> BuildSyncFuncForMethod<T, TBody>(RestMethodInfoInternal restMethod)\n        {\n            var taskFunc = BuildTaskFuncForMethod<T, TBody>(restMethod);\n            return (client, paramList) =>\n            {\n                var task = taskFunc(client, paramList);\n                return (object?)task.GetAwaiter().GetResult();\n            };\n        }\n\n        void AddMultipartItem(\n            MultipartFormDataContent multiPartContent,\n            string fileName,\n            string parameterName,\n            object itemValue\n        )\n        {\n            if (itemValue is HttpContent content)\n            {\n                multiPartContent.Add(content);\n                return;\n            }\n            if (itemValue is MultipartItem multipartItem)\n            {\n                var httpContent = multipartItem.ToContent();\n                multiPartContent.Add(\n                    httpContent,\n                    multipartItem.Name ?? parameterName,\n                    string.IsNullOrEmpty(multipartItem.FileName) ? fileName : multipartItem.FileName\n                );\n                return;\n            }\n\n            if (itemValue is Stream streamValue)\n            {\n                var streamContent = new StreamContent(streamValue);\n                multiPartContent.Add(streamContent, parameterName, fileName);\n                return;\n            }\n\n            if (itemValue is string stringValue)\n            {\n                multiPartContent.Add(new StringContent(stringValue), parameterName);\n                return;\n            }\n\n            if (itemValue is FileInfo fileInfoValue)\n            {\n                var fileContent = new StreamContent(fileInfoValue.OpenRead());\n                multiPartContent.Add(fileContent, parameterName, fileInfoValue.Name);\n                return;\n            }\n\n            if (itemValue is byte[] byteArrayValue)\n            {\n                var fileContent = new ByteArrayContent(byteArrayValue);\n                multiPartContent.Add(fileContent, parameterName, fileName);\n                return;\n            }\n\n            // Fallback to serializer\n            Exception e;\n            try\n            {\n                multiPartContent.Add(\n                    settings.ContentSerializer.ToHttpContent(itemValue),\n                    parameterName\n                );\n                return;\n            }\n            catch (Exception ex)\n            {\n                // Eat this since we're about to throw as a fallback anyway\n                e = ex;\n            }\n\n            throw new ArgumentException(\n                $\"Unexpected parameter type in a Multipart request. Parameter {fileName} is of type {itemValue.GetType().Name}, whereas allowed types are String, Stream, FileInfo, Byte array and anything that's JSON serializable\",\n                nameof(itemValue),\n                e\n            );\n        }\n\n        Func<HttpClient, CancellationToken, object[], Task<T?>> BuildCancellableTaskFuncForMethod<\n            T,\n            TBody\n        >(RestMethodInfoInternal restMethod)\n        {\n            return async (client, ct, paramList) =>\n            {\n                if (client.BaseAddress == null)\n                    throw new InvalidOperationException(\n                        \"BaseAddress must be set on the HttpClient instance\"\n                    );\n\n                var factory = BuildRequestFactoryForMethod(\n                    restMethod,\n                    client.BaseAddress.AbsolutePath,\n                    restMethod.CancellationToken != null\n                );\n                var rq = factory(paramList);\n                HttpResponseMessage? resp = null;\n                HttpContent? content = null;\n                var disposeResponse = true;\n                try\n                {\n                    // Load the data into buffer when body should be buffered.\n                    if (IsBodyBuffered(restMethod, rq))\n                    {\n                        await rq.Content!.LoadIntoBufferAsync().ConfigureAwait(false);\n                    }\n                    resp = await client\n                        .SendAsync(rq, HttpCompletionOption.ResponseHeadersRead, ct)\n                        .ConfigureAwait(false);\n                    content = resp.Content ?? new StringContent(string.Empty);\n                    Exception? e = null;\n                    disposeResponse = restMethod.ShouldDisposeResponse;\n\n                    if (typeof(T) != typeof(HttpResponseMessage))\n                    {\n                        e = await settings.ExceptionFactory(resp).ConfigureAwait(false);\n                    }\n\n                    if (restMethod.IsApiResponse)\n                    {\n                        var body = default(TBody);\n\n                        try\n                        {\n                            // Only attempt to deserialize content if no error present for backward-compatibility\n                            body =\n                                e == null\n                                    ? await DeserializeContentAsync<TBody>(resp, content, ct)\n                                        .ConfigureAwait(false)\n                                    : default;\n                        }\n                        catch (Exception ex)\n                        {\n                            //if an error occured while attempting to deserialize return the wrapped ApiException\n                            if (settings.DeserializationExceptionFactory != null)\n                                e = await settings.DeserializationExceptionFactory(resp, ex).ConfigureAwait(false);\n                            else\n                            {\n                                e = await ApiException.Create(\n                                    \"An error occured deserializing the response.\",\n                                    resp.RequestMessage!,\n                                    resp.RequestMessage!.Method,\n                                    resp,\n                                    settings,\n                                    ex\n                                ).ConfigureAwait(false);\n                            }\n                        }\n\n                        return ApiResponse.Create<T, TBody>(\n                            resp,\n                            body,\n                            settings,\n                            e as ApiException\n                        );\n                    }\n                    else if (e != null)\n                    {\n                        disposeResponse = false; // caller has to dispose\n                        throw e;\n                    }\n                    else\n                    {\n                        try\n                        {\n                            return await DeserializeContentAsync<T>(resp, content, ct)\n                                .ConfigureAwait(false);\n                        }\n                        catch (Exception ex)\n                        {\n                            if (settings.DeserializationExceptionFactory != null)\n                            {\n                                var customEx = await settings.DeserializationExceptionFactory(resp, ex).ConfigureAwait(false);\n                                if (customEx != null)\n                                    throw customEx;\n                                return default;\n                            }\n                            else\n                            {\n                                throw await ApiException.Create(\n                                    \"An error occured deserializing the response.\",\n                                    resp.RequestMessage!,\n                                    resp.RequestMessage!.Method,\n                                    resp,\n                                    settings,\n                                    ex\n                                ).ConfigureAwait(false);\n                            }\n                        }\n                    }\n                }\n                finally\n                {\n                    // Ensure we clean up the request\n                    // Especially important if it has open files/streams\n                    rq.Dispose();\n                    if (disposeResponse)\n                    {\n                        resp?.Dispose();\n                        content?.Dispose();\n                    }\n                }\n            };\n        }\n\n        async Task<T?> DeserializeContentAsync<T>(\n            HttpResponseMessage resp,\n            HttpContent content,\n            CancellationToken cancellationToken\n        )\n        {\n            T? result;\n            if (typeof(T) == typeof(HttpResponseMessage))\n            {\n                // NB: This double-casting manual-boxing hate crime is the only way to make\n                // this work without a 'class' generic constraint. It could blow up at runtime\n                // and would be A Bad Idea if we hadn't already vetted the return type.\n                result = (T)(object)resp;\n            }\n            else if (typeof(T) == typeof(HttpContent))\n            {\n                result = (T)(object)content;\n            }\n            else if (typeof(T) == typeof(Stream))\n            {\n                var stream = (object)\n                    await content.ReadAsStreamAsync(cancellationToken).ConfigureAwait(false);\n                result = (T)stream;\n            }\n            else if (typeof(T) == typeof(string))\n            {\n                using var stream = await content\n                    .ReadAsStreamAsync(cancellationToken)\n                    .ConfigureAwait(false);\n                using var reader = new StreamReader(stream);\n                var str = (object)await reader.ReadToEndAsync().ConfigureAwait(false);\n                result = (T)str;\n            }\n            else\n            {\n                result = await serializer\n                    .FromHttpContentAsync<T>(content, cancellationToken)\n                    .ConfigureAwait(false);\n            }\n            return result;\n        }\n\n        List<KeyValuePair<string, object?>> BuildQueryMap(\n            object? @object,\n            string? delimiter = null,\n            RestMethodParameterInfo? parameterInfo = null\n        )\n        {\n            if (@object is IDictionary idictionary)\n            {\n                return BuildQueryMap(idictionary, delimiter);\n            }\n\n            var kvps = new List<KeyValuePair<string, object?>>();\n\n            if (@object is null)\n                return kvps;\n\n            var props = @object\n                .GetType()\n                .GetProperties(BindingFlags.Instance | BindingFlags.Public)\n                .Where(p => p.CanRead && p.GetMethod?.IsPublic == true);\n\n            foreach (var propertyInfo in props)\n            {\n                if (ShouldIgnorePropertyInQueryMap(propertyInfo))\n                    continue;\n\n                var obj = propertyInfo.GetValue(@object);\n                if (obj == null)\n                    continue;\n\n                //if we have a parameter info lets check it to make sure it isn't bound to the path\n                if (parameterInfo is { IsObjectPropertyParameter: true })\n                {\n                    if (parameterInfo.ParameterProperties.Any(x => x.PropertyInfo == propertyInfo))\n                    {\n                        continue;\n                    }\n                }\n\n                var key = propertyInfo.Name;\n\n                var aliasAttribute = propertyInfo.GetCustomAttribute<AliasAsAttribute>();\n                key = aliasAttribute?.Name ?? settings.UrlParameterKeyFormatter.Format(key);\n\n                // Look to see if the property has a Query attribute, and if so, format it accordingly\n                var queryAttribute = propertyInfo.GetCustomAttribute<QueryAttribute>();\n                if (queryAttribute is { Format: not null })\n                {\n                    obj = settings.FormUrlEncodedParameterFormatter.Format(\n                        obj,\n                        queryAttribute.Format\n                    );\n                }\n\n                // If obj is IEnumerable - format it accounting for Query attribute and CollectionFormat\n                if (obj is not string && obj is IEnumerable ienu && obj is not IDictionary)\n                {\n                    foreach (\n                        var value in ParseEnumerableQueryParameterValue(\n                            ienu,\n                            propertyInfo,\n                            propertyInfo.PropertyType,\n                            queryAttribute\n                        )\n                    )\n                    {\n                        kvps.Add(new KeyValuePair<string, object?>(key, value));\n                    }\n\n                    continue;\n                }\n\n                if (DoNotConvertToQueryMap(obj))\n                {\n                    kvps.Add(new KeyValuePair<string, object?>(key, obj));\n                    continue;\n                }\n\n                switch (obj)\n                {\n                    case IDictionary idict:\n                        foreach (var keyValuePair in BuildQueryMap(idict, delimiter))\n                        {\n                            kvps.Add(\n                                new KeyValuePair<string, object?>(\n                                    $\"{key}{delimiter}{keyValuePair.Key}\",\n                                    keyValuePair.Value\n                                )\n                            );\n                        }\n\n                        break;\n\n                    default:\n                        foreach (var keyValuePair in BuildQueryMap(obj, delimiter))\n                        {\n                            kvps.Add(\n                                new KeyValuePair<string, object?>(\n                                    $\"{key}{delimiter}{keyValuePair.Key}\",\n                                    keyValuePair.Value\n                                )\n                            );\n                        }\n\n                        break;\n                }\n            }\n\n            return kvps;\n        }\n\n        List<KeyValuePair<string, object?>> BuildQueryMap(\n            IDictionary dictionary,\n            string? delimiter = null\n        )\n        {\n            var kvps = new List<KeyValuePair<string, object?>>();\n\n            foreach (var key in dictionary.Keys)\n            {\n                var obj = dictionary[key];\n                if (obj == null)\n                    continue;\n\n                var keyType = key.GetType();\n                var formattedKey = settings.UrlParameterFormatter.Format(key, keyType, keyType);\n\n                if (string.IsNullOrWhiteSpace(formattedKey)) // blank keys can't be put in the query string\n                {\n                    continue;\n                }\n\n                if (DoNotConvertToQueryMap(obj))\n                {\n                    kvps.Add(new KeyValuePair<string, object?>(formattedKey!, obj));\n                }\n                else\n                {\n                    foreach (var keyValuePair in BuildQueryMap(obj, delimiter))\n                    {\n                        kvps.Add(\n                            new KeyValuePair<string, object?>(\n                                $\"{formattedKey}{delimiter}{keyValuePair.Key}\",\n                                keyValuePair.Value\n                            )\n                        );\n                    }\n                }\n            }\n\n            return kvps;\n        }\n\n        static bool ShouldIgnorePropertyInQueryMap(PropertyInfo propertyInfo)\n        {\n            foreach (var attributeData in propertyInfo.GetCustomAttributesData())\n            {\n                var fullName = attributeData.AttributeType.FullName;\n                if (\n                    fullName == \"System.Runtime.Serialization.IgnoreDataMemberAttribute\"\n                    || fullName == \"System.Text.Json.Serialization.JsonIgnoreAttribute\"\n                    || fullName == \"Newtonsoft.Json.JsonIgnoreAttribute\"\n                )\n                {\n                    return true;\n                }\n            }\n\n            return false;\n        }\n\n        Func<object[], HttpRequestMessage> BuildRequestFactoryForMethod(\n            RestMethodInfoInternal restMethod,\n            string basePath,\n            bool paramsContainsCancellationToken\n        )\n        {\n            return paramList =>\n            {\n                var cancellationToken = CancellationToken.None;\n\n                // make sure we strip out any cancellation tokens\n                if (paramsContainsCancellationToken)\n                {\n                    cancellationToken = paramList.OfType<CancellationToken>().FirstOrDefault();\n                    paramList = paramList\n                        .Where(o => o == null || o.GetType() != typeof(CancellationToken))\n                        .ToArray();\n                }\n\n                var ret = new HttpRequestMessage { Method = restMethod.HttpMethod };\n\n                // set up multipart content\n                MultipartFormDataContent? multiPartContent = null;\n                if (restMethod.IsMultipart)\n                {\n                    multiPartContent = new MultipartFormDataContent(restMethod.MultipartBoundary);\n                    ret.Content = multiPartContent;\n                }\n\n                List<KeyValuePair<string, string?>>? queryParamsToAdd = null;\n                var headersToAdd = restMethod.Headers.Count > 0 ?\n                    new Dictionary<string, string?>(restMethod.Headers)\n                    : null;\n\n                RestMethodParameterInfo? parameterInfo = null;\n\n                for (var i = 0; i < paramList.Length; i++)\n                {\n                    var isParameterMappedToRequest = false;\n                    var param = paramList[i];\n                    // if part of REST resource URL, substitute it in\n                    if (restMethod.ParameterMap.TryGetValue(i, out var parameterMapValue))\n                    {\n                        parameterInfo = parameterMapValue;\n                        if (!parameterInfo.IsObjectPropertyParameter)\n                        {\n                            // mark parameter mapped if not an object\n                            // we want objects to fall through so any parameters on this object not bound here get passed as query parameters\n                            isParameterMappedToRequest = true;\n                        }\n                    }\n\n                    // if marked as body, add to content\n                    if (\n                        restMethod.BodyParameterInfo != null\n                        && restMethod.BodyParameterInfo.Item3 == i\n                    )\n                    {\n                        AddBodyToRequest(restMethod, param, ret);\n                        isParameterMappedToRequest = true;\n                    }\n\n                    // if header, add to request headers\n                    if (restMethod.HeaderParameterMap.TryGetValue(i, out var headerParameterValue))\n                    {\n                        headersToAdd ??= [];\n                        headersToAdd[headerParameterValue] = param?.ToString();\n                        isParameterMappedToRequest = true;\n                    }\n\n                    //if header collection, add to request headers\n                    if (restMethod.HeaderCollectionAt(i))\n                    {\n                        if (param is IDictionary<string, string> headerCollection)\n                        {\n                            foreach (var header in headerCollection)\n                            {\n                                headersToAdd ??= [];\n                                headersToAdd[header.Key] = header.Value;\n                            }\n                        }\n\n                        isParameterMappedToRequest = true;\n                    }\n\n                    //if authorize, add to request headers with scheme\n                    if (\n                        restMethod.AuthorizeParameterInfo != null\n                        && restMethod.AuthorizeParameterInfo.Item2 == i\n                    )\n                    {\n                        headersToAdd ??= [];\n                        headersToAdd[\"Authorization\"] =\n                            $\"{restMethod.AuthorizeParameterInfo.Item1} {param}\";\n                        isParameterMappedToRequest = true;\n                    }\n\n                    //if property, add to populate into HttpRequestMessage.Properties\n                    if (restMethod.PropertyParameterMap.ContainsKey(i))\n                    {\n                        isParameterMappedToRequest = true;\n                    }\n\n                    // ignore nulls and already processed parameters\n                    if (isParameterMappedToRequest || param == null)\n                        continue;\n\n                    // for anything that fell through to here, if this is not a multipart method add the parameter to the query string\n                    // or if is an object bound to the path add any non-path bound properties to query string\n                    // or if it's an object with a query attribute\n                    var queryAttribute = restMethod\n                        .ParameterInfoArray[i]\n                        .GetCustomAttribute<QueryAttribute>();\n                    if (\n                        !restMethod.IsMultipart\n                        || restMethod.ParameterMap.ContainsKey(i)\n                            && restMethod.ParameterMap[i].IsObjectPropertyParameter\n                        || queryAttribute != null\n                    )\n                    {\n                        queryParamsToAdd ??= [];\n                        AddQueryParameters(restMethod, queryAttribute, param, queryParamsToAdd, i, parameterInfo);\n                        continue;\n                    }\n\n                    AddMultiPart(restMethod, i, param, multiPartContent);\n                }\n\n                AddHeadersToRequest(headersToAdd, ret);\n                AddAuthorizationHeadersFromGetterAsync(ret, cancellationToken)\n                    .GetAwaiter()\n                    .GetResult();\n\n                AddPropertiesToRequest(restMethod, ret, paramList);\n#if NET6_0_OR_GREATER\n                AddVersionToRequest(ret);\n#endif\n                // NB: The URI methods in .NET are dumb. Also, we do this\n                // UriBuilder business so that we preserve any hardcoded query\n                // parameters as well as add the parameterized ones.\n                var urlTarget = BuildRelativePath(basePath, restMethod, paramList);\n\n                var uri = new UriBuilder(new Uri(BaseUri, urlTarget));\n                ParseExistingQueryString(uri, ref queryParamsToAdd);\n\n                if (queryParamsToAdd is not null && queryParamsToAdd.Count != 0)\n                {\n                    uri.Query = CreateQueryString(queryParamsToAdd);;\n                }\n                else\n                {\n                    uri.Query = null;\n                }\n\n                ret.RequestUri = new Uri(\n                    uri.Uri.GetComponents(UriComponents.PathAndQuery, restMethod.QueryUriFormat),\n                    UriKind.Relative\n                );\n                return ret;\n            };\n        }\n\n        string BuildRelativePath(string basePath, RestMethodInfoInternal restMethod, object[] paramList)\n        {\n            basePath = basePath == \"/\" ? string.Empty : basePath;\n            var pathFragments = restMethod.FragmentPath;\n            if (pathFragments.Count == 0)\n            {\n                return basePath;\n            }\n            if (string.IsNullOrEmpty(basePath) && pathFragments.Count == 1)\n            {\n                Debug.Assert(pathFragments[0].IsConstant);\n                return pathFragments[0].Value!;\n            }\n\n#pragma warning disable CA2000\n            var vsb = new ValueStringBuilder(stackalloc char[StackallocThreshold]);\n#pragma warning restore CA2000\n            vsb.Append(basePath);\n\n            foreach (var fragment in pathFragments)\n            {\n                AppendPathFragmentValue(ref vsb, restMethod, paramList, fragment);\n            }\n\n            return vsb.ToString();\n        }\n\n        void AppendPathFragmentValue(ref ValueStringBuilder vsb, RestMethodInfoInternal restMethod, object[] paramList,\n            ParameterFragment fragment)\n        {\n            if (fragment.IsConstant)\n            {\n                vsb.Append(fragment.Value!);\n                return;\n            }\n\n            var contains = restMethod.ParameterMap.TryGetValue(fragment.ArgumentIndex, out var parameterMapValue);\n            if (!contains || parameterMapValue is null)\n                throw new InvalidOperationException($\"{restMethod.ParameterMap} should contain parameter.\");\n\n            if (fragment.IsObjectProperty)\n            {\n                var param = paramList[fragment.ArgumentIndex];\n                var property = parameterMapValue.ParameterProperties[fragment.PropertyIndex];\n                var propertyObject = property.PropertyInfo.GetValue(param);\n\n                vsb.Append(Uri.EscapeDataString(settings.UrlParameterFormatter.Format(\n                    propertyObject,\n                    property.PropertyInfo,\n                    property.PropertyInfo.PropertyType\n                ) ?? string.Empty));\n                return;\n            }\n\n            if (fragment.IsDynamicRoute)\n            {\n                var param = paramList[fragment.ArgumentIndex];\n\n                if (parameterMapValue.Type == ParameterType.Normal)\n                {\n                    vsb.Append(Uri.EscapeDataString(\n                        settings.UrlParameterFormatter.Format(\n                            param,\n                            restMethod.ParameterInfoArray[fragment.ArgumentIndex],\n                            restMethod.ParameterInfoArray[fragment.ArgumentIndex].ParameterType\n                        ) ?? string.Empty\n                    ));\n                    return;\n                }\n\n                // If round tripping, split string up, format each segment and append to vsb.\n                Debug.Assert(parameterMapValue.Type == ParameterType.RoundTripping);\n                var paramValue = (string)param;\n                var split = paramValue.Split('/');\n\n                var firstSection = true;\n                foreach (var section in split)\n                {\n                    if(!firstSection)\n                        vsb.Append('/');\n\n                    vsb.Append(\n                        Uri.EscapeDataString(\n                            settings.UrlParameterFormatter.Format(\n                                section,\n                                restMethod.ParameterInfoArray[fragment.ArgumentIndex],\n                                restMethod.ParameterInfoArray[fragment.ArgumentIndex].ParameterType\n                            ) ?? string.Empty\n                        ));\n                    firstSection = false;\n                }\n\n                return;\n            }\n\n            throw new ArgumentException($\"{nameof(ParameterFragment)} is in an invalid form.\");\n        }\n\n        void AddBodyToRequest(RestMethodInfoInternal restMethod, object param, HttpRequestMessage ret)\n        {\n            if (param is HttpContent httpContentParam)\n            {\n                ret.Content = httpContentParam;\n            }\n            else if (param is Stream streamParam)\n            {\n                ret.Content = new StreamContent(streamParam);\n            }\n            // Default sends raw strings\n            else if (\n                restMethod.BodyParameterInfo!.Item1 == BodySerializationMethod.Default\n                && param is string stringParam\n            )\n            {\n                ret.Content = new StringContent(stringParam);\n            }\n            else\n            {\n                switch (restMethod.BodyParameterInfo.Item1)\n                {\n                    case BodySerializationMethod.UrlEncoded:\n                        ret.Content = param is string str\n                            ? (HttpContent)\n                            new StringContent(\n                                Uri.EscapeDataString(str),\n                                Encoding.UTF8,\n                                \"application/x-www-form-urlencoded\"\n                            )\n                            : new FormUrlEncodedContent(\n                                new FormValueMultimap(param, settings)\n                            );\n                        break;\n                    case BodySerializationMethod.Default:\n#pragma warning disable CS0618 // Type or member is obsolete\n                    case BodySerializationMethod.Json:\n#pragma warning restore CS0618 // Type or member is obsolete\n                    case BodySerializationMethod.Serialized:\n                        var content = serializer.ToHttpContent(param);\n                        switch (restMethod.BodyParameterInfo.Item2)\n                        {\n                            case false:\n                                ret.Content = new PushStreamContent(\n#pragma warning disable IDE1006 // Naming Styles\n                                    async (stream, _, __) =>\n#pragma warning restore IDE1006 // Naming Styles\n                                    {\n                                        using (stream)\n                                        {\n                                            await content\n                                                .CopyToAsync(stream)\n                                                .ConfigureAwait(false);\n                                        }\n                                    },\n                                    content.Headers.ContentType\n                                );\n                                break;\n                            case true:\n                                ret.Content = content;\n                                break;\n                        }\n\n                        break;\n                }\n            }\n        }\n\n        void AddQueryParameters(RestMethodInfoInternal restMethod, QueryAttribute? queryAttribute, object param,\n            List<KeyValuePair<string, string?>> queryParamsToAdd, int i, RestMethodParameterInfo? parameterInfo)\n        {\n            var attr = queryAttribute ?? DefaultQueryAttribute;\n            if (attr.TreatAsString)\n            {\n                queryParamsToAdd.AddRange(\n                    ParseQueryParameter(\n                        param.ToString(),\n                        restMethod.ParameterInfoArray[i],\n                        restMethod.QueryParameterMap[i],\n                        attr\n                    )\n                );\n            }\n            else if (DoNotConvertToQueryMap(param))\n            {\n                queryParamsToAdd.AddRange(\n                    ParseQueryParameter(\n                        param,\n                        restMethod.ParameterInfoArray[i],\n                        restMethod.QueryParameterMap[i],\n                        attr\n                    )\n                );\n            }\n            else\n            {\n                foreach (var kvp in BuildQueryMap(param, attr.Delimiter, parameterInfo))\n                {\n                    var path = !string.IsNullOrWhiteSpace(attr.Prefix)\n                        ? $\"{attr.Prefix}{attr.Delimiter}{kvp.Key}\"\n                        : kvp.Key;\n                    queryParamsToAdd.AddRange(\n                        ParseQueryParameter(\n                            kvp.Value,\n                            restMethod.ParameterInfoArray[i],\n                            path,\n                            attr\n                        )\n                    );\n                }\n            }\n        }\n\n        void AddMultiPart(RestMethodInfoInternal restMethod, int i, object param,\n            MultipartFormDataContent? multiPartContent)\n        {\n            // we are in a multipart method, add the part to the content\n            // the parameter name should be either the attachment name or the parameter name (as fallback)\n            string itemName;\n            string parameterName;\n\n            if (!restMethod.AttachmentNameMap.TryGetValue(i, out var attachment))\n            {\n                itemName = restMethod.QueryParameterMap[i];\n                parameterName = itemName;\n            }\n            else\n            {\n                itemName = attachment.Item1;\n                parameterName = attachment.Item2;\n            }\n\n            // Check to see if it's an IEnumerable\n            if (param is IEnumerable<object> enumerable)\n            {\n                foreach (var item in enumerable!)\n                {\n                    AddMultipartItem(multiPartContent!, itemName, parameterName, item);\n                }\n            }\n            else\n            {\n                AddMultipartItem(multiPartContent!, itemName, parameterName, param);\n            }\n        }\n\n        static void AddHeadersToRequest(Dictionary<string, string?>? headersToAdd, HttpRequestMessage ret)\n        {\n            // NB: We defer setting headers until the body has been\n            // added so any custom content headers don't get left out.\n            if (headersToAdd is null || headersToAdd.Count <= 0)\n                return;\n\n            // We could have content headers, so we need to make\n            // sure we have an HttpContent object to add them to,\n            // provided the HttpClient will allow it for the method\n            if (ret.Content == null && !IsBodyless(ret.Method))\n                ret.Content = new ByteArrayContent([]);\n\n            foreach (var header in headersToAdd)\n            {\n                SetHeader(ret, header.Key, header.Value);\n            }\n        }\n\n        async Task AddAuthorizationHeadersFromGetterAsync(HttpRequestMessage request, CancellationToken cancellationToken)\n        {\n            if (settings.AuthorizationHeaderValueGetter == null)\n                return;\n\n            var auth = request.Headers.Authorization;\n            if (auth == null || !string.IsNullOrWhiteSpace(auth.Parameter))\n                return;\n\n            var token = await settings.AuthorizationHeaderValueGetter(request, cancellationToken)\n                .ConfigureAwait(false);\n            request.Headers.Authorization = new AuthenticationHeaderValue(auth.Scheme, token);\n        }\n\n        void AddPropertiesToRequest(RestMethodInfoInternal restMethod, HttpRequestMessage ret, object[] paramList)\n        {\n            // Add RefitSetting.HttpRequestMessageOptions to the HttpRequestMessage\n            if (settings.HttpRequestMessageOptions != null)\n            {\n                foreach (var p in settings.HttpRequestMessageOptions)\n                {\n#if NET6_0_OR_GREATER\n                    ret.Options.Set(new HttpRequestOptionsKey<object>(p.Key), p.Value);\n#else\n                    ret.Properties.Add(p);\n#endif\n                }\n            }\n\n            for (var i = 0; i < paramList.Length; i++)\n            {\n                if (restMethod.PropertyParameterMap.TryGetValue(i, out var propertyKey))\n                {\n#if NET6_0_OR_GREATER\n                    ret.Options.Set(\n                        new HttpRequestOptionsKey<object?>(propertyKey),\n                        paramList[i]\n                    );\n#else\n                    ret.Properties[propertyKey] = paramList[i];\n#endif\n                }\n            }\n\n            // Always add the top-level type of the interface to the properties\n#if NET6_0_OR_GREATER\n                ret.Options.Set(\n                    new HttpRequestOptionsKey<Type>(HttpRequestMessageOptions.InterfaceType),\n                    TargetType\n                );\n                ret.Options.Set(\n                    new HttpRequestOptionsKey<RestMethodInfo>(\n                        HttpRequestMessageOptions.RestMethodInfo\n                    ),\n                    restMethod.RestMethodInfo\n                );\n#else\n            ret.Properties[HttpRequestMessageOptions.InterfaceType] = TargetType;\n            ret.Properties[HttpRequestMessageOptions.RestMethodInfo] =\n                restMethod.RestMethodInfo;\n#endif\n        }\n\n#if NET6_0_OR_GREATER\n        void AddVersionToRequest(HttpRequestMessage ret)\n        {\n            ret.Version = settings.Version;\n            ret.VersionPolicy = settings.VersionPolicy;\n        }\n#endif\n\n        IEnumerable<KeyValuePair<string, string?>> ParseQueryParameter(\n            object? param,\n            ParameterInfo parameterInfo,\n            string queryPath,\n            QueryAttribute queryAttribute\n        )\n        {\n            if (param is not string && param is IEnumerable paramValues)\n            {\n                foreach (\n                    var value in ParseEnumerableQueryParameterValue(\n                        paramValues,\n                        parameterInfo,\n                        parameterInfo.ParameterType,\n                        queryAttribute\n                    )\n                )\n                {\n                    yield return new KeyValuePair<string, string?>(queryPath, value);\n                }\n            }\n            else\n            {\n                yield return new KeyValuePair<string, string?>(\n                    queryPath,\n                    settings.UrlParameterFormatter.Format(\n                        param,\n                        parameterInfo,\n                        parameterInfo.ParameterType\n                    )\n                );\n            }\n        }\n\n        IEnumerable<string?> ParseEnumerableQueryParameterValue(\n            IEnumerable paramValues,\n            ICustomAttributeProvider customAttributeProvider,\n            Type type,\n            QueryAttribute? queryAttribute\n        )\n        {\n            var collectionFormat =\n                queryAttribute != null && queryAttribute.IsCollectionFormatSpecified\n                    ? queryAttribute.CollectionFormat\n                    : settings.CollectionFormat;\n\n            switch (collectionFormat)\n            {\n                case CollectionFormat.Multi:\n                    foreach (var paramValue in paramValues)\n                    {\n                        yield return settings.UrlParameterFormatter.Format(\n                            paramValue,\n                            customAttributeProvider,\n                            type\n                        );\n                    }\n\n                    break;\n\n                default:\n                    var delimiter =\n                        collectionFormat switch\n                        {\n                            CollectionFormat.Ssv => \" \",\n                            CollectionFormat.Tsv => \"\\t\",\n                            CollectionFormat.Pipes => \"|\",\n                            _ => \",\" \n                        };\n\n                    // Missing a \"default\" clause was preventing the collection from serializing at all, as it was hitting \"continue\" thus causing an off-by-one error\n                    var formattedValues = paramValues\n                        .Cast<object> ()\n                        .Select(\n                            v =>\n                                settings.UrlParameterFormatter.Format(\n                                    v,\n                                    customAttributeProvider,\n                                    type\n                                )\n                        );\n\n                    yield return string.Join(delimiter, formattedValues);\n\n                    break;\n            }\n        }\n\n        static void ParseExistingQueryString(UriBuilder uri, ref List<KeyValuePair<string, string?>>? queryParamsToAdd)\n        {\n            if (string.IsNullOrEmpty(uri.Query))\n                return;\n\n            queryParamsToAdd ??= [];\n            var query = HttpUtility.ParseQueryString(uri.Query);\n            var index = 0;\n            foreach (var key in query.AllKeys)\n            {\n                if (!string.IsNullOrWhiteSpace(key))\n                {\n                    queryParamsToAdd.Insert(\n                        index++,\n                        new KeyValuePair<string, string?>(key, query[key])\n                    );\n                }\n            }\n        }\n\n        static string CreateQueryString(List<KeyValuePair<string, string?>> queryParamsToAdd)\n        {\n            // Suppress warning as ValueStringBuilder.ToString calls Dispose()\n#pragma warning disable CA2000\n            var vsb = new ValueStringBuilder(stackalloc char[StackallocThreshold]);\n#pragma warning restore CA2000\n            var firstQuery = true;\n            foreach (var queryParam in queryParamsToAdd)\n            {\n                if(queryParam is not { Key: not null, Value: not null })\n                    continue;\n                if(!firstQuery)\n                {\n                    // for all items after the first we add a & symbol\n                    vsb.Append('&');\n                }\n                var key = Uri.EscapeDataString(queryParam.Key);\n#if NET6_0_OR_GREATER\n                // if first query does not start with ? then prepend it\n                if (vsb.Length == 0 && key.Length > 0 && key[0] != '?')\n                {\n                    // query starts with ?\n                    vsb.Append('?');\n                }\n#endif\n                vsb.Append(key);\n                vsb.Append('=');\n                vsb.Append(Uri.EscapeDataString(queryParam.Value ?? string.Empty));\n                if (firstQuery)\n                    firstQuery = false;\n            }\n\n            return vsb.ToString();\n        }\n\n        Func<HttpClient, object[], IObservable<T?>> BuildRxFuncForMethod<T, TBody>(\n            RestMethodInfoInternal restMethod\n        )\n        {\n            var taskFunc = BuildCancellableTaskFuncForMethod<T, TBody>(restMethod);\n\n            return (client, paramList) =>\n            {\n                return new TaskToObservable<T>(ct =>\n                {\n                    var methodCt = CancellationToken.None;\n                    if (restMethod.CancellationToken != null)\n                    {\n                        methodCt = paramList.OfType<CancellationToken>().FirstOrDefault();\n                    }\n\n                    // link the two\n                    var cts = CancellationTokenSource.CreateLinkedTokenSource(methodCt, ct);\n\n                    return taskFunc(client, cts.Token, paramList);\n                });\n            };\n        }\n\n        Func<HttpClient, object[], Task<T?>> BuildTaskFuncForMethod<T, TBody>(\n            RestMethodInfoInternal restMethod\n        )\n        {\n            var ret = BuildCancellableTaskFuncForMethod<T, TBody>(restMethod);\n\n            return (client, paramList) =>\n            {\n                if (restMethod.CancellationToken != null)\n                {\n                    return ret(\n                        client,\n                        paramList.OfType<CancellationToken>().FirstOrDefault(),\n                        paramList\n                    );\n                }\n\n                return ret(client, CancellationToken.None, paramList);\n            };\n        }\n\n        Func<HttpClient, object[], Task> BuildVoidTaskFuncForMethod(\n            RestMethodInfoInternal restMethod\n        )\n        {\n            return async (client, paramList) =>\n            {\n                if (client.BaseAddress == null)\n                    throw new InvalidOperationException(\n                        \"BaseAddress must be set on the HttpClient instance\"\n                    );\n\n                var factory = BuildRequestFactoryForMethod(\n                    restMethod,\n                    client.BaseAddress.AbsolutePath,\n                    restMethod.CancellationToken != null\n                );\n                var rq = factory(paramList);\n\n                var ct = CancellationToken.None;\n\n                if (restMethod.CancellationToken != null)\n                {\n                    ct = paramList.OfType<CancellationToken>().FirstOrDefault();\n                }\n\n                // Load the data into buffer when body should be buffered.\n                if (IsBodyBuffered(restMethod, rq))\n                {\n                    await rq.Content!.LoadIntoBufferAsync().ConfigureAwait(false);\n                }\n                using var resp = await client.SendAsync(rq, ct).ConfigureAwait(false);\n\n                var exception = await settings.ExceptionFactory(resp).ConfigureAwait(false);\n                if (exception != null)\n                {\n                    throw exception;\n                }\n            };\n        }\n\n        private static bool IsBodyBuffered(\n            RestMethodInfoInternal restMethod,\n            HttpRequestMessage? request\n        )\n        {\n            return (restMethod.BodyParameterInfo?.Item2 ?? false) && (request?.Content != null);\n        }\n\n        static bool DoNotConvertToQueryMap(object? value)\n        {\n            if (value == null)\n                return false;\n\n            var type = value.GetType();\n\n            // Bail out early & match string\n            if (ShouldReturn(type))\n                return true;\n\n            if (value is not IEnumerable)\n                return false;\n\n            // Get the element type for enumerables\n            var ienu = typeof(IEnumerable<>);\n            // We don't want to enumerate to get the type, so we'll just look for IEnumerable<T>\n            var intType = type.GetInterfaces()\n                .FirstOrDefault(\n                    i => i.GetTypeInfo().IsGenericType && i.GetGenericTypeDefinition() == ienu\n                );\n\n            if (intType == null)\n                return false;\n\n            type = intType.GetGenericArguments()[0];\n            return ShouldReturn(type);\n\n            // Check if type is a simple string or IFormattable type, check underlying type if Nullable<T>\n            static bool ShouldReturn(Type type) =>\n                Nullable.GetUnderlyingType(type) is { } underlyingType\n                    ? ShouldReturn(underlyingType)\n                    : type == typeof(string)\n                      || type == typeof(bool)\n                      || type == typeof(char)\n                      || typeof(IFormattable).IsAssignableFrom(type)\n                      || type == typeof(Uri);\n        }\n\n        static void SetHeader(HttpRequestMessage request, string name, string? value)\n        {\n            // Clear any existing version of this header that might be set, because\n            // we want to allow removal/redefinition of headers.\n            // We also don't want to double up content headers which may have been\n            // set for us automatically.\n\n            // NB: We have to enumerate the header names to check existence because\n            // Contains throws if it's the wrong header type for the collection.\n            if (request.Headers.Any(x => x.Key == name))\n            {\n                request.Headers.Remove(name);\n            }\n\n            if (request.Content != null && request.Content.Headers.Any(x => x.Key == name))\n            {\n                request.Content.Headers.Remove(name);\n            }\n\n            if (value == null)\n                return;\n\n            // CRLF injection protection\n            name = EnsureSafe(name);\n            value = EnsureSafe(value);\n\n            var added = request.Headers.TryAddWithoutValidation(name, value);\n\n            // Don't even bother trying to add the header as a content header\n            // if we just added it to the other collection.\n            if (!added && request.Content != null)\n            {\n                request.Content.Headers.TryAddWithoutValidation(name, value);\n            }\n        }\n\n        static string EnsureSafe(string value)\n        {\n            // Remove CR and LF characters\n#pragma warning disable CA1307 // Specify StringComparison for clarity\n            return value.Replace(\"\\r\", string.Empty).Replace(\"\\n\", string.Empty);\n#pragma warning restore CA1307 // Specify StringComparison for clarity\n        }\n\n        static bool IsBodyless(HttpMethod method) => method == HttpMethod.Get || method == HttpMethod.Head;\n    }\n}\n"
  },
  {
    "path": "Refit/RestMethodInfo.cs",
    "content": "﻿using System.Diagnostics;\nusing System.Net.Http;\nusing System.Reflection;\nusing System.Text.RegularExpressions;\n\n// Enable support for C# 9 record types\n#if !NET6_0_OR_GREATER\nnamespace System.Runtime.CompilerServices\n{\n    internal static class IsExternalInit { }\n}\n#endif\n\nnamespace Refit\n{\n    /// <summary>\n    /// RestMethodInfo\n    /// </summary>\n    public record RestMethodInfo(\n        string Name,\n        Type HostingType,\n        MethodInfo MethodInfo,\n        string RelativePath,\n        Type ReturnType\n    );\n\n    [DebuggerDisplay(\"{MethodInfo}\")]\n    internal class RestMethodInfoInternal\n    {\n        private int HeaderCollectionParameterIndex { get;  }\n        private string Name => MethodInfo.Name;\n        public Type Type { get; }\n        public MethodInfo MethodInfo { get; }\n        public HttpMethod HttpMethod { get; }\n        public string RelativePath { get; }\n        public bool IsMultipart { get; }\n        public string MultipartBoundary { get; private set; }\n        public RestMethodInfo RestMethodInfo { get; }\n        public ParameterInfo? CancellationToken { get; }\n        public UriFormat QueryUriFormat { get; }\n        public Dictionary<string, string?> Headers { get; }\n        public Dictionary<int, string> HeaderParameterMap { get; }\n        public Dictionary<int, string> PropertyParameterMap { get; }\n        public Tuple<BodySerializationMethod, bool, int>? BodyParameterInfo { get; }\n        public Tuple<string, int>? AuthorizeParameterInfo { get; }\n        public Dictionary<int, string> QueryParameterMap { get; }\n        public Dictionary<int, Tuple<string, string>> AttachmentNameMap { get; }\n        public ParameterInfo[] ParameterInfoArray { get; }\n        public Dictionary<int, RestMethodParameterInfo> ParameterMap { get; }\n        public List<ParameterFragment> FragmentPath { get ; set ; }\n        public Type ReturnType { get; set; }\n        public Type ReturnResultType { get; set; }\n        public Type DeserializedResultType { get; set; }\n        public RefitSettings RefitSettings { get; }\n        public bool IsApiResponse { get; }\n        public bool ShouldDisposeResponse { get; private set; }\n\n        static readonly Regex ParameterRegex = new(\"{(([^/?\\r\\n])*?)}\");\n        static readonly HttpMethod PatchMethod = new(\"PATCH\");\n\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.\n        public RestMethodInfoInternal(\n            Type targetInterface,\n            MethodInfo methodInfo,\n            RefitSettings? refitSettings = null\n        )\n#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.\n        {\n            RefitSettings = refitSettings ?? new RefitSettings();\n            Type = targetInterface ?? throw new ArgumentNullException(nameof(targetInterface));\n            MethodInfo = methodInfo ?? throw new ArgumentNullException(nameof(methodInfo));\n\n            var hma = methodInfo.GetCustomAttributes(true).OfType<HttpMethodAttribute>().First();\n\n            HttpMethod = hma.Method;\n            RelativePath = hma.Path;\n\n            IsMultipart = methodInfo.GetCustomAttributes(true).OfType<MultipartAttribute>().Any();\n\n            MultipartBoundary = IsMultipart\n                ? methodInfo.GetCustomAttribute<MultipartAttribute>(true)?.BoundaryText\n                    ?? new MultipartAttribute().BoundaryText\n                : string.Empty;\n\n            VerifyUrlPathIsSane(RelativePath);\n            DetermineReturnTypeInfo(methodInfo);\n            DetermineIfResponseMustBeDisposed();\n\n            // Exclude cancellation token parameters from this list\n            ParameterInfoArray = methodInfo\n                .GetParameters()\n                .Where(static p => p.ParameterType != typeof(CancellationToken) && p.ParameterType != typeof(CancellationToken?))\n                .ToArray();\n            (ParameterMap, FragmentPath) = BuildParameterMap(RelativePath, ParameterInfoArray);\n            BodyParameterInfo = FindBodyParameter(ParameterInfoArray, IsMultipart, hma.Method);\n            AuthorizeParameterInfo = FindAuthorizationParameter(ParameterInfoArray);\n\n            Headers = ParseHeaders(methodInfo);\n            HeaderParameterMap = BuildHeaderParameterMap(ParameterInfoArray);\n            HeaderCollectionParameterIndex = GetHeaderCollectionParameterIndex(\n                ParameterInfoArray\n            );\n            PropertyParameterMap = BuildRequestPropertyMap(ParameterInfoArray);\n\n            // get names for multipart attachments\n            Dictionary<int, Tuple<string, string>>? attachmentDict = null;\n            if (IsMultipart)\n            {\n                for (var i = 0; i < ParameterInfoArray.Length; i++)\n                {\n                    if (\n                        ParameterMap.ContainsKey(i)\n                        || HeaderParameterMap.ContainsKey(i)\n                        || PropertyParameterMap.ContainsKey(i)\n                        || HeaderCollectionAt(i)\n                    )\n                    {\n                        continue;\n                    }\n\n                    var attachmentName = GetAttachmentNameForParameter(ParameterInfoArray[i]);\n                    if (attachmentName == null)\n                        continue;\n\n                    attachmentDict ??= [];\n                    attachmentDict[i] = Tuple.Create(\n                        attachmentName,\n                        GetUrlNameForParameter(ParameterInfoArray[i])\n                    );\n                }\n            }\n\n            AttachmentNameMap = attachmentDict ?? EmptyDictionary<int, Tuple<string, string>>.Get();\n\n            Dictionary<int, string>? queryDict = null;\n            for (var i = 0; i < ParameterInfoArray.Length; i++)\n            {\n                if (\n                    ParameterMap.ContainsKey(i)\n                    || HeaderParameterMap.ContainsKey(i)\n                    || PropertyParameterMap.ContainsKey(i)\n                    || HeaderCollectionAt(i)\n                    || (BodyParameterInfo != null && BodyParameterInfo.Item3 == i)\n                    || (AuthorizeParameterInfo != null && AuthorizeParameterInfo.Item2 == i)\n                )\n                {\n                    continue;\n                }\n\n                queryDict ??= [];\n                queryDict.Add(i, GetUrlNameForParameter(ParameterInfoArray[i]));\n            }\n\n            QueryParameterMap = queryDict ?? EmptyDictionary<int, string>.Get();\n\n            var ctParamEnumerable = methodInfo\n                .GetParameters()\n                .Where(p => p.ParameterType == typeof(CancellationToken))\n                .TryGetSingle(out var ctParam);\n            if (ctParamEnumerable == EnumerablePeek.Many)\n            {\n                throw new ArgumentException(\n                    $\"Argument list to method \\\"{methodInfo.Name}\\\" can only contain a single CancellationToken\"\n                );\n            }\n\n            RestMethodInfo = new RestMethodInfo(Name, Type, MethodInfo, RelativePath, ReturnType!);\n            CancellationToken = ctParam;\n\n            QueryUriFormat =  methodInfo.GetCustomAttribute<QueryUriFormatAttribute>()?.UriFormat\n                              ?? UriFormat.UriEscaped;\n\n            IsApiResponse =\n                ReturnResultType!.GetTypeInfo().IsGenericType\n                    && (\n                        ReturnResultType!.GetGenericTypeDefinition() == typeof(ApiResponse<>)\n                        || ReturnResultType.GetGenericTypeDefinition() == typeof(IApiResponse<>)\n                    )\n                || ReturnResultType == typeof(IApiResponse);\n        }\n\n        public bool HasHeaderCollection => HeaderCollectionParameterIndex >= 0;\n\n        public bool HeaderCollectionAt(int index) => HeaderCollectionParameterIndex >= 0 && HeaderCollectionParameterIndex == index;\n\n        static int GetHeaderCollectionParameterIndex(ParameterInfo[] parameterArray)\n        {\n            var headerIndex = -1;\n\n            for (var i = 0; i < parameterArray.Length; i++)\n            {\n                var param = parameterArray[i];\n                var headerCollection = param\n                    .GetCustomAttributes(true)\n                    .OfType<HeaderCollectionAttribute>()\n                    .FirstOrDefault();\n\n                if (headerCollection == null) continue;\n\n                //opted for IDictionary<string, string> semantics here as opposed to the looser IEnumerable<KeyValuePair<string, string>> because IDictionary will enforce uniqueness of keys\n                if (param.ParameterType.IsAssignableFrom(typeof(IDictionary<string, string>)))\n                {\n                    // throw if there is already a HeaderCollection parameter\n                    if(headerIndex >= 0)\n                        throw new ArgumentException(\"Only one parameter can be a HeaderCollection parameter\");\n\n                    headerIndex = i;\n                }\n                else\n                {\n                    throw new ArgumentException(\n                        $\"HeaderCollection parameter of type {param.ParameterType.Name} is not assignable from IDictionary<string, string>\"\n                    );\n                }\n            }\n\n            return headerIndex;\n        }\n\n        static Dictionary<int, string> BuildRequestPropertyMap(ParameterInfo[] parameterArray)\n        {\n            Dictionary<int, string>? propertyMap = null;\n\n            for (var i = 0; i < parameterArray.Length; i++)\n            {\n                var param = parameterArray[i];\n                var propertyAttribute = param\n                    .GetCustomAttributes(true)\n                    .OfType<PropertyAttribute>()\n                    .FirstOrDefault();\n\n                if (propertyAttribute != null)\n                {\n                    var propertyKey = !string.IsNullOrEmpty(propertyAttribute.Key)\n                        ? propertyAttribute.Key\n                        : param.Name!;\n                    propertyMap ??= new Dictionary<int, string>();\n                    propertyMap[i] = propertyKey!;\n                }\n            }\n\n            return propertyMap ?? EmptyDictionary<int, string>.Get();\n        }\n\n        static IEnumerable<PropertyInfo> GetParameterProperties(ParameterInfo parameter)\n        {\n            return parameter\n                .ParameterType.GetProperties(BindingFlags.Public | BindingFlags.Instance)\n                .Where(static p => p.CanRead && p.GetMethod?.IsPublic == true);\n        }\n\n        static void VerifyUrlPathIsSane(string relativePath)\n        {\n            if (string.IsNullOrEmpty(relativePath))\n                return;\n\n            if (!relativePath.StartsWith(\"/\"))\n                throw new ArgumentException(\n                    $\"URL path {relativePath} must start with '/' and be of the form '/foo/bar/baz'\"\n                );\n\n            // CRLF injection protection\n            if (relativePath.Contains('\\r') || relativePath.Contains('\\n'))\n                throw new ArgumentException(\n                    $\"URL path {relativePath} must not contain CR or LF characters\"\n                );\n        }\n\n        static (Dictionary<int, RestMethodParameterInfo> ret, List<ParameterFragment> fragmentList) BuildParameterMap(\n            string relativePath,\n            ParameterInfo[] parameterInfo\n        )\n        {\n            var ret = new Dictionary<int, RestMethodParameterInfo>();\n\n            // This section handles pattern matching in the URL. We also need it to add parameter key/values for any attribute with a [Query]\n            var parameterizedParts = ParameterRegex.Matches(relativePath).Cast<Match>().ToArray();\n\n            if (parameterizedParts.Length == 0)\n            {\n                if(string.IsNullOrEmpty(relativePath))\n                    return (ret, []);\n\n                return (ret, [ParameterFragment.Constant(relativePath)]);\n            }\n\n            var paramValidationDict = parameterInfo.ToDictionary(\n                k => GetUrlNameForParameter(k).ToLowerInvariant(),\n                v => v\n            );\n            //if the param is an lets make a dictionary for all it's potential parameters\n            var objectParamValidationDict = parameterInfo\n                .Where(x => x.ParameterType.GetTypeInfo().IsClass)\n                .SelectMany(x => GetParameterProperties(x).Select(p => Tuple.Create(x, p)))\n                .GroupBy(\n                    i => $\"{i.Item1.Name}.{GetUrlNameForProperty(i.Item2)}\".ToLowerInvariant()\n                )\n                .ToDictionary(k => k.Key, v => v.First());\n\n            var fragmentList = new List<ParameterFragment>();\n            var index = 0;\n\n           foreach (var match in parameterizedParts)\n            {\n                // Add constant value from given http path\n                if (match.Index != index)\n                {\n                    fragmentList.Add(ParameterFragment.Constant(relativePath.Substring(index, match.Index - index)));\n                }\n                index = match.Index + match.Length;\n\n                var rawName = match.Groups[1].Value.ToLowerInvariant();\n                var isRoundTripping = rawName.StartsWith(\"**\");\n                var name = isRoundTripping ? rawName.Substring(2) : rawName;\n\n                if (paramValidationDict.TryGetValue(name, out var value)) //if it's a standard parameter\n                {\n                    var paramType = value.ParameterType;\n                    if (isRoundTripping && paramType != typeof(string))\n                    {\n                        throw new ArgumentException(\n                            $\"URL {relativePath} has round-tripping parameter {rawName}, but the type of matched method parameter is {paramType.FullName}. It must be a string.\"\n                        );\n                    }\n                    var parameterType = isRoundTripping\n                        ? ParameterType.RoundTripping\n                        : ParameterType.Normal;\n                    var restMethodParameterInfo = new RestMethodParameterInfo(name, value)\n                    {\n                        Type = parameterType\n                    };\n\n                    var parameterIndex = Array.IndexOf(parameterInfo, restMethodParameterInfo.ParameterInfo);\n                    fragmentList.Add(ParameterFragment.Dynamic(parameterIndex));\n#if NET6_0_OR_GREATER\n                    ret.TryAdd(\n                        parameterIndex,\n                        restMethodParameterInfo\n                    );\n#else\n                    if (!ret.ContainsKey(parameterIndex))\n                    {\n                        ret.Add(parameterIndex, restMethodParameterInfo);\n                    }\n#endif\n                }\n                //else if it's a property on a object parameter\n                else if (\n                    objectParamValidationDict.TryGetValue(name, out var value1)\n                    && !isRoundTripping\n                )\n                {\n                    var property = value1;\n                    var parameterIndex = Array.IndexOf(parameterInfo, property.Item1);\n                    //If we already have this parameter, add additional ParameterProperty\n                    if (ret.TryGetValue(parameterIndex, out var value2))\n                    {\n                        if (!value2.IsObjectPropertyParameter)\n                        {\n                            throw new ArgumentException(\n                                $\"Parameter {property.Item1.Name} matches both a parameter and nested parameter on a parameter object\"\n                            );\n                        }\n\n                        value2.ParameterProperties.Add(\n                            new RestMethodParameterProperty(name, property.Item2)\n                        );\n                        fragmentList.Add(ParameterFragment.DynamicObject(parameterIndex, value2.ParameterProperties.Count - 1));\n                    }\n                    else\n                    {\n                        var restMethodParameterInfo = new RestMethodParameterInfo(\n                            true,\n                            property.Item1\n                        );\n                        restMethodParameterInfo.ParameterProperties.Add(\n                            new RestMethodParameterProperty(name, property.Item2)\n                        );\n\n                        var idx = Array.IndexOf(parameterInfo, restMethodParameterInfo.ParameterInfo);\n                        fragmentList.Add(ParameterFragment.DynamicObject(idx, 0));\n#if NET6_0_OR_GREATER\n                        ret.TryAdd(\n                            idx,\n                            restMethodParameterInfo\n                        );\n#else\n                        // Do the contains check\n                        if (!ret.ContainsKey(idx))\n                        {\n                            ret.Add(idx, restMethodParameterInfo);\n                        }\n#endif\n                    }\n                }\n                else\n                {\n                    throw new ArgumentException(\n                        $\"URL {relativePath} has parameter {rawName}, but no method parameter matches\"\n                    );\n                }\n            }\n\n            if (index >= relativePath.Length) return (ret, fragmentList);\n\n            // add trailing string\n            var trailingConstant = relativePath.Substring(index);\n            fragmentList.Add(ParameterFragment.Constant(trailingConstant));\n\n            return (ret, fragmentList);\n        }\n\n        static string GetUrlNameForParameter(ParameterInfo paramInfo)\n        {\n            var aliasAttr = paramInfo\n                .GetCustomAttributes(true)\n                .OfType<AliasAsAttribute>()\n                .FirstOrDefault();\n            return aliasAttr != null ? aliasAttr.Name : paramInfo.Name!;\n        }\n\n        static string GetUrlNameForProperty(PropertyInfo propInfo)\n        {\n            var aliasAttr = propInfo\n                .GetCustomAttributes(true)\n                .OfType<AliasAsAttribute>()\n                .FirstOrDefault();\n            return aliasAttr != null ? aliasAttr.Name : propInfo.Name;\n        }\n\n        static string GetAttachmentNameForParameter(ParameterInfo paramInfo)\n        {\n#pragma warning disable CS0618 // Type or member is obsolete\n            var nameAttr = paramInfo\n                .GetCustomAttributes<AttachmentNameAttribute>(true)\n#pragma warning restore CS0618 // Type or member is obsolete\n                .FirstOrDefault();\n\n            // also check for AliasAs\n            return nameAttr?.Name\n                ?? paramInfo.GetCustomAttributes<AliasAsAttribute>(true).FirstOrDefault()?.Name!;\n        }\n\n        Tuple<BodySerializationMethod, bool, int>? FindBodyParameter(\n            ParameterInfo[] parameterArray,\n            bool isMultipart,\n            HttpMethod method\n        )\n        {\n            // The body parameter is found using the following logic / order of precedence:\n            // 1) [Body] attribute\n            // 2) POST/PUT/PATCH: Reference type other than string\n            // 3) If there are two reference types other than string, without the body attribute, throw\n\n            var bodyParamEnumerable = parameterArray\n                .Select(\n                    x =>\n                    (\n                        Parameter: x,\n                        BodyAttribute: x.GetCustomAttributes(true)\n                            .OfType<BodyAttribute>()\n                            .FirstOrDefault()\n                    )\n                )\n                .Where(x => x.BodyAttribute != null)\n                .TryGetSingle(out var bodyParam);\n\n            // multipart requests may not contain a body, implicit or explicit\n            if (isMultipart)\n            {\n                if (bodyParamEnumerable != EnumerablePeek.Empty)\n                {\n                    throw new ArgumentException(\n                        \"Multipart requests may not contain a Body parameter\"\n                    );\n                }\n                return null;\n            }\n\n            if (bodyParamEnumerable == EnumerablePeek.Many)\n            {\n                throw new ArgumentException(\"Only one parameter can be a Body parameter\");\n            }\n\n            // #1, body attribute wins\n            if (bodyParamEnumerable == EnumerablePeek.Single)\n            {\n                return Tuple.Create(\n                    bodyParam!.BodyAttribute!.SerializationMethod,\n                    bodyParam.BodyAttribute.Buffered ?? RefitSettings.Buffered,\n                    Array.IndexOf(parameterArray, bodyParam.Parameter)\n                );\n            }\n\n            // Not in post/put/patch? bail\n            if (\n                !method.Equals(HttpMethod.Post)\n                && !method.Equals(HttpMethod.Put)\n                && !method.Equals(PatchMethod)\n            )\n            {\n                return null;\n            }\n\n            // see if we're a post/put/patch\n            // explicitly skip [Query], [HeaderCollection], and [Property]-denoted params\n            var refParamEnumerable = parameterArray\n                .Where(\n                    pi =>\n                        !pi.ParameterType.GetTypeInfo().IsValueType\n                        && pi.ParameterType != typeof(string)\n                        && pi.GetCustomAttribute<QueryAttribute>() == null\n                        && pi.GetCustomAttribute<HeaderCollectionAttribute>() == null\n                        && pi.GetCustomAttribute<PropertyAttribute>() == null\n                )\n                .TryGetSingle(out var refParam);\n\n            // Check for rule #3\n            if (refParamEnumerable == EnumerablePeek.Many)\n            {\n                throw new ArgumentException(\n                    \"Multiple complex types found. Specify one parameter as the body using BodyAttribute\"\n                );\n            }\n\n            if (refParamEnumerable == EnumerablePeek.Single)\n            {\n                return Tuple.Create(\n                    BodySerializationMethod.Serialized,\n                    RefitSettings.Buffered,\n                    Array.IndexOf(parameterArray, refParam!)\n                );\n            }\n\n            return null;\n        }\n\n        static Tuple<string, int>? FindAuthorizationParameter(ParameterInfo[] parameterArray)\n        {\n            var authorizeParamsEnumerable = parameterArray\n                .Select(\n                    x =>\n                    (\n                        Parameter: x,\n                        AuthorizeAttribute: x.GetCustomAttributes(true)\n                            .OfType<AuthorizeAttribute>()\n                            .FirstOrDefault()\n                    )\n                )\n                .Where(x => x.AuthorizeAttribute != null)\n                .TryGetSingle(out var authorizeParam);\n\n            if (authorizeParamsEnumerable == EnumerablePeek.Many)\n            {\n                throw new ArgumentException(\"Only one parameter can be an Authorize parameter\");\n            }\n\n            if (authorizeParamsEnumerable == EnumerablePeek.Single)\n            {\n                return Tuple.Create(\n                    authorizeParam!.AuthorizeAttribute!.Scheme,\n                        Array.IndexOf(parameterArray, authorizeParam.Parameter)\n                );\n            }\n\n            return null;\n        }\n\n        static Dictionary<string, string?> ParseHeaders(MethodInfo methodInfo)\n        {\n            var inheritedAttributes =\n                methodInfo.DeclaringType != null\n                    ? methodInfo\n                        .DeclaringType.GetInterfaces()\n                        .SelectMany(i => i.GetTypeInfo().GetCustomAttributes(true))\n                        .Reverse()\n                    : [];\n\n            var declaringTypeAttributes =\n                methodInfo.DeclaringType != null\n                    ? methodInfo.DeclaringType.GetTypeInfo().GetCustomAttributes(true)\n                    : [];\n\n            // Headers set on the declaring type have to come first,\n            // so headers set on the method can replace them. Switching\n            // the order here will break stuff.\n            var headers = inheritedAttributes\n                .Concat(declaringTypeAttributes)\n                .Concat(methodInfo.GetCustomAttributes(true))\n                .OfType<HeadersAttribute>()\n                .SelectMany(ha => ha.Headers);\n\n            Dictionary<string, string?>? ret = null;\n\n            foreach (var header in headers)\n            {\n                if (string.IsNullOrWhiteSpace(header))\n                    continue;\n\n                ret ??= [];\n\n                // NB: Silverlight doesn't have an overload for String.Split()\n                // with a count parameter, but header values can contain\n                // ':' so we have to re-join all but the first part to get the\n                // value.\n                var parts = header.Split(':');\n                ret[parts[0].Trim()] =\n                    parts.Length > 1 ? string.Join(\":\", parts.Skip(1)).Trim() : null;\n            }\n\n            return ret ?? EmptyDictionary<string, string?>.Get();\n        }\n\n        static Dictionary<int, string> BuildHeaderParameterMap(ParameterInfo[] parameterArray)\n        {\n            Dictionary<int, string>? ret = null;\n\n            for (var i = 0; i < parameterArray.Length; i++)\n            {\n                var header = parameterArray[i]\n                    .GetCustomAttributes(true)\n                    .OfType<HeaderAttribute>()\n                    .Select(ha => ha.Header)\n                    .FirstOrDefault();\n\n                if (!string.IsNullOrWhiteSpace(header))\n                {\n                    ret ??= [];\n                    ret[i] = header.Trim();\n                }\n            }\n\n            return ret ?? EmptyDictionary<int, string>.Get();\n        }\n\n        void DetermineReturnTypeInfo(MethodInfo methodInfo)\n        {\n            var returnType = methodInfo.ReturnType;\n            if (\n                returnType.IsGenericType\n                && (\n                    methodInfo.ReturnType.GetGenericTypeDefinition() == typeof(Task<>)\n                    || methodInfo.ReturnType.GetGenericTypeDefinition() == typeof(ValueTask<>)\n                    || methodInfo.ReturnType.GetGenericTypeDefinition() == typeof(IObservable<>)\n                )\n            )\n            {\n                ReturnType = returnType;\n                ReturnResultType = returnType.GetGenericArguments()[0];\n\n                if (\n                    ReturnResultType.IsGenericType\n                    && (\n                        ReturnResultType.GetGenericTypeDefinition() == typeof(ApiResponse<>)\n                        || ReturnResultType.GetGenericTypeDefinition() == typeof(IApiResponse<>)\n                    )\n                )\n                {\n                    DeserializedResultType = ReturnResultType.GetGenericArguments()[0];\n                }\n                else if (ReturnResultType == typeof(IApiResponse))\n                {\n                    DeserializedResultType = typeof(HttpContent);\n                }\n                else\n                    DeserializedResultType = ReturnResultType;\n            }\n            else if (returnType == typeof(Task))\n            {\n                ReturnType = methodInfo.ReturnType;\n                ReturnResultType = typeof(void);\n                DeserializedResultType = typeof(void);\n            }\n            else\n            {\n                // Allow synchronous return types only for non-public or explicit interface members.\n                // This supports internal Refit methods and explicit interface members annotated with Refit attributes.\n                var isExplicitInterfaceMember = methodInfo.Name.IndexOf('.') >= 0;\n                var isNonPublic = !(methodInfo.IsPublic);\n                if (!(isExplicitInterfaceMember || isNonPublic))\n                {\n                    throw new ArgumentException(\n                        $\"Method \\\"{methodInfo.Name}\\\" is invalid. All REST Methods must return either Task<T> or ValueTask<T> or IObservable<T>\"\n                    );\n                }\n\n                ReturnType = methodInfo.ReturnType;\n                ReturnResultType = methodInfo.ReturnType;\n                DeserializedResultType = methodInfo.ReturnType == typeof(IApiResponse)\n                    ? typeof(HttpContent)\n                    : methodInfo.ReturnType;\n            }\n        }\n\n        void DetermineIfResponseMustBeDisposed()\n        {\n            // Rest method caller will have to dispose if it's one of those 3\n            ShouldDisposeResponse =\n                DeserializedResultType != typeof(HttpResponseMessage)\n                && DeserializedResultType != typeof(HttpContent)\n                && DeserializedResultType != typeof(Stream);\n        }\n    }\n\n    internal record struct ParameterFragment(string? Value, int ArgumentIndex, int PropertyIndex)\n    {\n        public bool IsConstant => Value != null;\n        public bool IsDynamicRoute => ArgumentIndex >= 0 && PropertyIndex < 0;\n        public bool IsObjectProperty => ArgumentIndex >= 0 && PropertyIndex >= 0;\n\n        public static ParameterFragment Constant(string value) => new (value, -1, -1);\n        public static ParameterFragment Dynamic(int index) => new (null, index, -1);\n        public static ParameterFragment DynamicObject(int index, int propertyIndex) => new (null, index, propertyIndex);\n    }\n}\n"
  },
  {
    "path": "Refit/RestMethodParameterInfo.cs",
    "content": "﻿using System.Reflection;\n\nnamespace Refit\n{\n    /// <summary>\n    /// RestMethodParameterInfo.\n    /// </summary>\n    public class RestMethodParameterInfo\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"RestMethodParameterInfo\"/> class.\n        /// </summary>\n        /// <param name=\"name\">The name.</param>\n        /// <param name=\"parameterInfo\">The parameter information.</param>\n        public RestMethodParameterInfo(string name, ParameterInfo parameterInfo)\n        {\n            Name = name;\n            ParameterInfo = parameterInfo;\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"RestMethodParameterInfo\"/> class.\n        /// </summary>\n        /// <param name=\"isObjectPropertyParameter\">if set to <c>true</c> [is object property parameter].</param>\n        /// <param name=\"parameterInfo\">The parameter information.</param>\n        public RestMethodParameterInfo(bool isObjectPropertyParameter, ParameterInfo parameterInfo)\n        {\n            IsObjectPropertyParameter = isObjectPropertyParameter;\n            ParameterInfo = parameterInfo;\n        }\n\n        /// <summary>\n        /// Gets or sets the name.\n        /// </summary>\n        /// <value>\n        /// The name.\n        /// </value>\n        public string? Name { get; set; }\n\n        /// <summary>\n        /// Gets or sets the parameter information.\n        /// </summary>\n        /// <value>\n        /// The parameter information.\n        /// </value>\n        public ParameterInfo ParameterInfo { get; set; }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether this instance is object property parameter.\n        /// </summary>\n        /// <value>\n        ///   <c>true</c> if this instance is object property parameter; otherwise, <c>false</c>.\n        /// </value>\n        public bool IsObjectPropertyParameter { get; set; }\n\n        /// <summary>\n        /// Gets or sets the parameter properties.\n        /// </summary>\n        /// <value>\n        /// The parameter properties.\n        /// </value>\n        public List<RestMethodParameterProperty> ParameterProperties { get; set; } = [];\n\n        /// <summary>\n        /// Gets or sets the type.\n        /// </summary>\n        /// <value>\n        /// The type.\n        /// </value>\n        public ParameterType Type { get; set; } = ParameterType.Normal;\n    }\n\n    /// <summary>\n    /// RestMethodParameterProperty.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"RestMethodParameterProperty\"/> class.\n    /// </remarks>\n    /// <param name=\"name\">The name.</param>\n    /// <param name=\"propertyInfo\">The property information.</param>\n    public class RestMethodParameterProperty(string name, PropertyInfo propertyInfo)\n    {\n        /// <summary>\n        /// Gets or sets the name.\n        /// </summary>\n        /// <value>\n        /// The name.\n        /// </value>\n        public string Name { get; set; } = name;\n\n        /// <summary>\n        /// Gets or sets the property information.\n        /// </summary>\n        /// <value>\n        /// The property information.\n        /// </value>\n        public PropertyInfo PropertyInfo { get; set; } = propertyInfo;\n    }\n\n    /// <summary>\n    /// ParameterType.\n    /// </summary>\n    public enum ParameterType\n    {\n        /// <summary>\n        /// The normal\n        /// </summary>\n        Normal,\n\n        /// <summary>\n        /// The round tripping\n        /// </summary>\n        RoundTripping\n    }\n}\n"
  },
  {
    "path": "Refit/RestService.cs",
    "content": "﻿using System.Collections.Concurrent;\nusing System.Net.Http;\n#if NET8_0_OR_GREATER\nusing System.Diagnostics.CodeAnalysis;\n#endif\n\nnamespace Refit\n{\n    /// <summary>\n    /// RestService.\n    /// </summary>\n    public static class RestService\n    {\n        static readonly ConcurrentDictionary<Type, Type> TypeMapping = new();\n\n        /// <summary>\n        /// Generate a Refit implementation of the specified interface.\n        /// </summary>\n        /// <typeparam name=\"T\">Interface to create the implementation for.</typeparam>\n        /// <param name=\"client\">The <see cref=\"HttpClient\"/> the implementation will use to send requests.</param>\n        /// <param name=\"builder\"><see cref=\"IRequestBuilder\"/> to use to build requests.</param>\n        /// <returns>An instance that implements <typeparamref name=\"T\"/>.</returns>\n#if NET8_0_OR_GREATER\n        public static T For<\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] T>(HttpClient client, IRequestBuilder<T> builder) => (T)For(typeof(T), client, builder);\n#else\n        public static T For<T>(HttpClient client, IRequestBuilder<T> builder) => (T)For(typeof(T), client, builder);\n#endif\n\n        /// <summary>\n        /// Generate a Refit implementation of the specified interface.\n        /// </summary>\n        /// <typeparam name=\"T\">Interface to create the implementation for.</typeparam>\n        /// <param name=\"client\">The <see cref=\"HttpClient\"/> the implementation will use to send requests.</param>\n        /// <param name=\"settings\"><see cref=\"RefitSettings\"/> to use to configure the HttpClient.</param>\n        /// <returns>An instance that implements <typeparamref name=\"T\"/>.</returns>\n#if NET8_0_OR_GREATER\n        public static T For<\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] T>(HttpClient client, RefitSettings? settings)\n#else\n        public static T For<T>(HttpClient client, RefitSettings? settings)\n#endif\n        {\n            var requestBuilder = RequestBuilder.ForType<T>(settings);\n\n            return For(client, requestBuilder);\n        }\n\n        /// <summary>\n        /// Generate a Refit implementation of the specified interface.\n        /// </summary>\n        /// <typeparam name=\"T\">Interface to create the implementation for.</typeparam>\n        /// <param name=\"client\">The <see cref=\"HttpClient\"/> the implementation will use to send requests.</param>\n        /// <returns>An instance that implements <typeparamref name=\"T\"/>.</returns>\n#if NET8_0_OR_GREATER\n        public static T For<\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] T>(HttpClient client) => For<T>(client, (RefitSettings?)null);\n#else\n        public static T For<T>(HttpClient client) => For<T>(client, (RefitSettings?)null);\n#endif\n\n        /// <summary>\n        /// Generate a Refit implementation of the specified interface.\n        /// </summary>\n        /// <typeparam name=\"T\">Interface to create the implementation for.</typeparam>\n        /// <param name=\"hostUrl\">Base address the implementation will use.</param>\n        /// <param name=\"settings\"><see cref=\"RefitSettings\"/> to use to configure the HttpClient.</param>\n        /// <returns>An instance that implements <typeparamref name=\"T\"/>.</returns>\n#if NET8_0_OR_GREATER\n        public static T For<\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] T>(string hostUrl, RefitSettings? settings)\n#else\n        public static T For<T>(string hostUrl, RefitSettings? settings)\n#endif\n        {\n            var client = CreateHttpClient(hostUrl, settings);\n\n            return For<T>(client, settings);\n        }\n\n        /// <summary>\n        /// Generate a Refit implementation of the specified interface.\n        /// </summary>\n        /// <typeparam name=\"T\">Interface to create the implementation for.</typeparam>\n        /// <param name=\"hostUrl\">Base address the implementation will use.</param>\n        /// <returns>An instance that implements <typeparamref name=\"T\"/>.</returns>\n#if NET8_0_OR_GREATER\n        public static T For<\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] T>(string hostUrl) => For<T>(hostUrl, null);\n#else\n        public static T For<T>(string hostUrl) => For<T>(hostUrl, null);\n#endif\n\n        /// <summary>\n        /// Generate a Refit implementation of the specified interface.\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Interface to create the implementation for.</param>\n        /// <param name=\"client\">The <see cref=\"HttpClient\"/> the implementation will use to send requests.</param>\n        /// <param name=\"builder\"><see cref=\"IRequestBuilder\"/> to use to build requests.</param>\n        /// <returns>An instance that implements <paramref name=\"refitInterfaceType\"/>.</returns>\n#if NET8_0_OR_GREATER\n        public static object For(\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] Type refitInterfaceType,\n            HttpClient client,\n            IRequestBuilder builder\n        )\n#else\n        public static object For(\n            Type refitInterfaceType,\n            HttpClient client,\n            IRequestBuilder builder\n        )\n#endif\n        {\n            var generatedType = TypeMapping.GetOrAdd(refitInterfaceType, GetGeneratedType);\n\n            return Activator.CreateInstance(generatedType, client, builder)!;\n        }\n\n        /// <summary>\n        /// Generate a Refit implementation of the specified interface.\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Interface to create the implementation for.</param>\n        /// <param name=\"client\">The <see cref=\"HttpClient\"/> the implementation will use to send requests.</param>\n        /// <param name=\"settings\"><see cref=\"RefitSettings\"/> to use to configure the HttpClient.</param>\n        /// <returns>An instance that implements <paramref name=\"refitInterfaceType\"/>.</returns>\n#if NET8_0_OR_GREATER\n        public static object For(\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] Type refitInterfaceType,\n            HttpClient client,\n            RefitSettings? settings\n        )\n#else\n        public static object For(\n            Type refitInterfaceType,\n            HttpClient client,\n            RefitSettings? settings\n        )\n#endif\n        {\n            var requestBuilder = RequestBuilder.ForType(refitInterfaceType, settings);\n\n            return For(refitInterfaceType, client, requestBuilder);\n        }\n\n        /// <summary>\n        /// Generate a Refit implementation of the specified interface.\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Interface to create the implementation for.</param>\n        /// <param name=\"client\">The <see cref=\"HttpClient\"/> the implementation will use to send requests.</param>\n        /// <returns>An instance that implements <paramref name=\"refitInterfaceType\"/>.</returns>\n#if NET8_0_OR_GREATER\n        public static object For(\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] Type refitInterfaceType,\n            HttpClient client\n        ) => For(refitInterfaceType, client, (RefitSettings?)null);\n#else\n        public static object For(Type refitInterfaceType, HttpClient client) =>\n            For(refitInterfaceType, client, (RefitSettings?)null);\n#endif\n\n        /// <summary>\n        /// Generate a Refit implementation of the specified interface.\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Interface to create the implementation for.</param>\n        /// <param name=\"hostUrl\">Base address the implementation will use.</param>\n        /// <param name=\"settings\"><see cref=\"RefitSettings\"/> to use to configure the HttpClient.</param>\n        /// <returns>An instance that implements <paramref name=\"refitInterfaceType\"/>.</returns>\n#if NET8_0_OR_GREATER\n        public static object For(\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] Type refitInterfaceType,\n            string hostUrl,\n            RefitSettings? settings\n        )\n#else\n        public static object For(Type refitInterfaceType, string hostUrl, RefitSettings? settings)\n#endif\n        {\n            var client = CreateHttpClient(hostUrl, settings);\n\n            return For(refitInterfaceType, client, settings);\n        }\n\n        /// <summary>\n        /// Generate a Refit implementation of the specified interface.\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Interface to create the implementation for.</param>\n        /// <param name=\"hostUrl\">Base address the implementation will use.</param>\n        /// <returns>An instance that implements <paramref name=\"refitInterfaceType\"/>.</returns>\n#if NET8_0_OR_GREATER\n        public static object For(\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] Type refitInterfaceType,\n            string hostUrl\n        ) => For(refitInterfaceType, hostUrl, null);\n#else\n        public static object For(Type refitInterfaceType, string hostUrl) =>\n            For(refitInterfaceType, hostUrl, null);\n#endif\n\n        /// <summary>\n        /// Create an <see cref=\"HttpClient\"/> with <paramref name=\"hostUrl\"/> as the base address.\n        /// </summary>\n        /// <param name=\"hostUrl\">Base address.</param>\n        /// <param name=\"settings\"><see cref=\"RefitSettings\"/> to use to configure the HttpClient.</param>\n        /// <returns>A <see cref=\"HttpClient\"/> with the various parameters provided.</returns>\n        /// <exception cref=\"ArgumentException\"></exception>\n        public static HttpClient CreateHttpClient(string hostUrl, RefitSettings? settings)\n        {\n            if (string.IsNullOrWhiteSpace(hostUrl))\n            {\n                throw new ArgumentException(\n                    $\"`{nameof(hostUrl)}` must not be null or whitespace.\",\n                    nameof(hostUrl)\n                );\n            }\n\n            // check to see if user provided custom auth token\n            HttpMessageHandler? innerHandler = null;\n            if (settings != null)\n            {\n                if (settings.HttpMessageHandlerFactory != null)\n                {\n                    innerHandler = settings.HttpMessageHandlerFactory();\n                }\n\n                if (settings.AuthorizationHeaderValueGetter != null)\n                {\n                    innerHandler = new AuthenticatedHttpClientHandler(\n                        settings.AuthorizationHeaderValueGetter,\n                        innerHandler\n                    );\n                }\n            }\n\n            return new HttpClient(innerHandler ?? new HttpClientHandler())\n            {\n                BaseAddress = new Uri(hostUrl.TrimEnd('/'))\n            };\n        }\n\n#if NET8_0_OR_GREATER\n        [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]\n        static Type GetGeneratedType(\n            [DynamicallyAccessedMembers(\n                DynamicallyAccessedMemberTypes.PublicMethods |\n                DynamicallyAccessedMemberTypes.NonPublicMethods\n            )] Type refitInterfaceType\n        )\n#else\n        static Type GetGeneratedType(Type refitInterfaceType)\n#endif\n        {\n            var typeName = UniqueName.ForType(refitInterfaceType);\n\n            var generatedType = Type.GetType(typeName, throwOnError: false);\n\n            if (generatedType == null)\n            {\n                var message =\n                    refitInterfaceType.Name\n                    + \" doesn't look like a Refit interface. Make sure it has at least one \"\n                    + \"method with a Refit HTTP method attribute, the Refit source generator is installed in the project, \"\n                    + \"and your build produced the generated client. For Native AOT or trimmed apps, prefer generated clients \"\n                    + \"plus source-generated System.Text.Json metadata.\";\n\n                throw new InvalidOperationException(message);\n            }\n\n            return generatedType;\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/SystemTextJsonContentSerializer.cs",
    "content": "﻿using System.Net.Http;\nusing System.Net.Http.Json;\nusing System.Reflection;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\n#if NET8_0_OR_GREATER\nusing System.Text.Json.Serialization.Metadata;\n#endif\n\nnamespace Refit\n{\n    /// <summary>\n    /// A <see langword=\"class\"/> implementing <see cref=\"IHttpContentSerializer\"/> using the System.Text.Json APIs\n    /// </summary>\n    /// <remarks>\n    /// Creates a new <see cref=\"SystemTextJsonContentSerializer\"/> instance with the specified parameters\n    /// </remarks>\n    /// <param name=\"jsonSerializerOptions\">The serialization options to use for the current instance</param>\n    public sealed class SystemTextJsonContentSerializer(JsonSerializerOptions jsonSerializerOptions) : IHttpContentSerializer\n    {\n        /// <summary>\n        /// Creates a new <see cref=\"SystemTextJsonContentSerializer\"/> instance\n        /// </summary>\n        public SystemTextJsonContentSerializer()\n            : this(GetDefaultJsonSerializerOptions()) { }\n\n        /// <inheritdoc/>\n        public HttpContent ToHttpContent<T>(T item)\n        {\n#if NET8_0_OR_GREATER\n            if (TryGetJsonTypeInfo<T>(out var jsonTypeInfo))\n            {\n                return JsonContent.Create(item, jsonTypeInfo);\n            }\n#endif\n            return JsonContent.Create(item, options: jsonSerializerOptions);\n        }\n\n        /// <inheritdoc/>\n        public async Task<T?> FromHttpContentAsync<T>(\n            HttpContent content,\n            CancellationToken cancellationToken = default\n        )\n        {\n#if NET8_0_OR_GREATER\n            if (TryGetJsonTypeInfo<T>(out var jsonTypeInfo))\n            {\n                return await content.ReadFromJsonAsync(jsonTypeInfo, cancellationToken).ConfigureAwait(false);\n            }\n#endif\n            return await content\n                .ReadFromJsonAsync<T>(jsonSerializerOptions, cancellationToken)\n                .ConfigureAwait(false);\n        }\n\n        /// <summary>\n        /// Calculates what the field name should be for the given property. This may be affected by custom attributes the serializer understands\n        /// </summary>\n        /// <param name=\"propertyInfo\">A PropertyInfo object.</param>\n        /// <returns>\n        /// The calculated field name.\n        /// </returns>\n        /// <exception cref=\"System.ArgumentNullException\">propertyInfo</exception>\n        public string? GetFieldNameForProperty(PropertyInfo propertyInfo) => propertyInfo switch\n        {\n            null => throw new ArgumentNullException(nameof(propertyInfo)),\n            _ => propertyInfo\n            .GetCustomAttributes<JsonPropertyNameAttribute>(true)\n            .Select(a => a.Name)\n            .FirstOrDefault()\n        };\n\n        /// <summary>\n        /// Creates new <see cref=\"JsonSerializerOptions\"/> and fills it with default parameters\n        /// </summary>\n        public static JsonSerializerOptions GetDefaultJsonSerializerOptions()\n        {\n            // Default to case insensitive property name matching as that's likely the behavior most users expect\n            var jsonSerializerOptions = new JsonSerializerOptions\n            {\n                PropertyNameCaseInsensitive = true,\n                PropertyNamingPolicy = JsonNamingPolicy.CamelCase\n            };\n            jsonSerializerOptions.Converters.Add(new ObjectToInferredTypesConverter());\n            jsonSerializerOptions.Converters.Add(new CamelCaseStringEnumConverter());\n\n            return jsonSerializerOptions;\n        }\n\n#if NET8_0_OR_GREATER\n        bool TryGetJsonTypeInfo<T>(out JsonTypeInfo<T> jsonTypeInfo)\n        {\n            if (jsonSerializerOptions.TypeInfoResolver is not null)\n            {\n                var typeInfo = jsonSerializerOptions.GetTypeInfo(typeof(T));\n                if (typeInfo is JsonTypeInfo<T> typedTypeInfo)\n                {\n                    jsonTypeInfo = typedTypeInfo;\n                    return true;\n                }\n            }\n\n            jsonTypeInfo = null!;\n            return false;\n        }\n#endif\n    }\n\n    /// <summary>\n    /// ObjectToInferredTypesConverter.\n    /// From https://docs.microsoft.com/en-us/dotnet/standard/serialization/system-text-json-converters-how-to?pivots=dotnet-5-0#deserialize-inferred-types-to-object-properties\n    /// </summary>\n    public class ObjectToInferredTypesConverter : JsonConverter<object>\n    {\n        /// <summary>\n        /// Reads and converts the JSON to type typeToConvert />.\n        /// </summary>\n        /// <param name=\"reader\">The reader.</param>\n        /// <param name=\"typeToConvert\">The type to convert.</param>\n        /// <param name=\"options\">An object that specifies serialization options to use.</param>\n        /// <returns>\n        /// The converted value.\n        /// </returns>\n        public override object? Read(\n            ref Utf8JsonReader reader,\n            Type typeToConvert,\n            JsonSerializerOptions options\n        ) =>\n            reader.TokenType switch\n            {\n                JsonTokenType.True => true,\n                JsonTokenType.False => false,\n                JsonTokenType.Number when reader.TryGetInt64(out var l) => l,\n                JsonTokenType.Number => reader.GetDouble(),\n                JsonTokenType.String when reader.TryGetDateTime(out var datetime) => datetime,\n                JsonTokenType.String => reader.GetString(),\n                _ => JsonDocument.ParseValue(ref reader).RootElement.Clone()\n            };\n\n        /// <summary>\n        /// Writes the specified writer.\n        /// </summary>\n        /// <param name=\"writer\">The writer.</param>\n        /// <param name=\"objectToWrite\">The object to write.</param>\n        /// <param name=\"options\">The options.</param>\n        public override void Write(\n            Utf8JsonWriter writer,\n            object objectToWrite,\n            JsonSerializerOptions options\n        )\n        {\n#if NET8_0_OR_GREATER\n            if (options.TypeInfoResolver is not null)\n            {\n                JsonSerializer.Serialize(writer, objectToWrite, options.GetTypeInfo(objectToWrite.GetType()));\n                return;\n            }\n#endif\n            JsonSerializer.Serialize(writer, objectToWrite, objectToWrite.GetType(), options);\n        }\n    }\n\n    sealed class CamelCaseStringEnumConverter : JsonConverterFactory\n    {\n        public override bool CanConvert(Type typeToConvert) =>\n            (Nullable.GetUnderlyingType(typeToConvert) ?? typeToConvert).IsEnum;\n\n        public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)\n        {\n            var enumType = Nullable.GetUnderlyingType(typeToConvert) ?? typeToConvert;\n            var isNullable = Nullable.GetUnderlyingType(typeToConvert) != null;\n\n            return new NonGenericEnumConverter(typeToConvert, enumType, isNullable);\n        }\n\n        sealed class NonGenericEnumConverter(Type targetType, Type enumType, bool isNullable)\n            : JsonConverter<object?>\n        {\n            public override bool CanConvert(Type typeToConvert) => typeToConvert == targetType;\n\n            public override object? Read(\n                ref Utf8JsonReader reader,\n                Type typeToConvert,\n                JsonSerializerOptions options\n            )\n            {\n                if (reader.TokenType == JsonTokenType.Null)\n                {\n                    if (!isNullable)\n                        throw new JsonException($\"Cannot convert null to {targetType}.\");\n\n                    return null;\n                }\n\n                if (reader.TokenType == JsonTokenType.String)\n                {\n                    var value = reader.GetString();\n                    if (string.IsNullOrWhiteSpace(value))\n                    {\n                        if (isNullable)\n                            return null;\n\n                        throw new JsonException($\"Cannot convert an empty value to {targetType}.\");\n                    }\n\n                    foreach (var name in Enum.GetNames(enumType))\n                    {\n                        if (string.Equals(ToCamelCase(name), value, StringComparison.Ordinal))\n                            return Enum.Parse(enumType, name, ignoreCase: false);\n                    }\n\n                    try\n                    {\n                        return Enum.Parse(enumType, value, ignoreCase: true);\n                    }\n                    catch (ArgumentException)\n                    {\n                        throw new JsonException($\"Unable to convert '{value}' to {targetType}.\");\n                    }\n                }\n\n                if (reader.TokenType == JsonTokenType.Number)\n                {\n                    var numericValue = reader.GetInt64();\n                    return Enum.ToObject(enumType, numericValue);\n                }\n\n                throw new JsonException($\"Unexpected token {reader.TokenType} when parsing {targetType}.\");\n            }\n\n            public override void Write(\n                Utf8JsonWriter writer,\n                object? value,\n                JsonSerializerOptions options\n            )\n            {\n                if (value is null)\n                {\n                    writer.WriteNullValue();\n                    return;\n                }\n\n                var name = Enum.GetName(enumType, value);\n                if (name is null)\n                {\n                    writer.WriteNumberValue(Convert.ToInt64(value));\n                    return;\n                }\n\n                writer.WriteStringValue(ToCamelCase(name));\n            }\n\n            static string ToCamelCase(string value) =>\n                string.IsNullOrEmpty(value) || !char.IsUpper(value[0])\n                    ? value\n                    : char.ToLowerInvariant(value[0]) + value.Substring(1);\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/UniqueName.cs",
    "content": "﻿namespace Refit\n{\n    class UniqueName\n    {\n        public static string ForType<T>()\n        {\n            return ForType(typeof(T));\n        }\n\n        public static string ForType<T>(object? serviceKey)\n        {\n            return ForType(typeof(T), serviceKey);\n        }\n\n        public static string ForType(Type refitInterfaceType, object? serviceKey)\n        {\n            return ForType(refitInterfaceType) + GetServiceKeySuffix(serviceKey);\n        }\n\n        public static string ForType(Type refitInterfaceType)\n        {\n            var interfaceTypeName = refitInterfaceType.FullName!;\n\n            // remove namespace/nested, up to anything before a `\n            var searchEnd = interfaceTypeName.IndexOf('`');\n            if (searchEnd < 0)\n                searchEnd = interfaceTypeName.Length;\n\n            var lastDot = interfaceTypeName.Substring(0, searchEnd).LastIndexOf('.');\n            if (lastDot > 0)\n            {\n                interfaceTypeName = interfaceTypeName.Substring(lastDot + 1);\n            }\n\n            // Now we have the interface name like IFooBar`1[[Some Generic Args]]\n            // Or Nested+IFrob\n            var genericArgs = string.Empty;\n            // if there's any generics, split that\n            if (refitInterfaceType.IsGenericType)\n            {\n                genericArgs = interfaceTypeName.Substring(interfaceTypeName.IndexOf(\"[\"));\n                interfaceTypeName = interfaceTypeName.Substring(\n                    0,\n                    interfaceTypeName.Length - genericArgs.Length\n                );\n            }\n\n            // Remove any + from the type name portion\n            interfaceTypeName = interfaceTypeName.Replace(\"+\", \"\");\n\n            // Get the namespace and remove the dots\n            var ns = refitInterfaceType.Namespace?.Replace(\".\", \"\");\n\n            // Refit types will be generated as private classes within a Generated type in namespace\n            // Refit.Implementation\n            // E.g., Refit.Implementation.Generated.NamespaceContainingTpeInterfaceType\n\n            var refitTypeName =\n                $\"Refit.Implementation.Generated+{ns}{interfaceTypeName}{genericArgs}\";\n\n            var assmQualified = $\"{refitTypeName}, {refitInterfaceType.Assembly.FullName}\";\n\n            return assmQualified;\n        }\n\n        /// <summary>\n        /// Returns the suffix for the service key to be added to the unique name for a given type.\n        /// </summary>\n        /// <param name=\"serviceKey\">The service key to create the suffix from.</param>\n        /// <returns>The suffix to be added to the unique name of a given type.</returns>\n        static string GetServiceKeySuffix(object? serviceKey)\n        {\n            return serviceKey is null or \"\" ? string.Empty : $\", ServiceKey={serviceKey}\";\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/ValidationApiException.cs",
    "content": "﻿using System.Text.Json;\n\nnamespace Refit\n{\n    /// <summary>\n    /// An ApiException that is raised according to RFC 7807, which contains problem details for validation exceptions.\n    /// </summary>\n    [Serializable]\n    public class ValidationApiException : ApiException\n    {\n        static readonly JsonSerializerOptions SerializerOptions = new();\n\n        static ValidationApiException()\n        {\n            SerializerOptions.PropertyNameCaseInsensitive = true;\n            SerializerOptions.PropertyNamingPolicy = JsonNamingPolicy.CamelCase;\n            SerializerOptions.Converters.Add(new ObjectToInferredTypesConverter());\n        }\n\n        ValidationApiException(ApiException apiException)\n            : base(\n                apiException.RequestMessage,\n                apiException.HttpMethod,\n                apiException.Content,\n                apiException.StatusCode,\n                apiException.ReasonPhrase,\n                apiException.Headers,\n                apiException.RefitSettings\n            ) { }\n\n        /// <summary>\n        /// Creates a new instance of a ValidationException from an existing ApiException.\n        /// </summary>\n        /// <param name=\"exception\">An instance of an ApiException to use to build a ValidationException.</param>\n        /// <returns>ValidationApiException</returns>\n        public static ValidationApiException Create(ApiException exception)\n        {\n            if (exception is null)\n                throw new ArgumentNullException(nameof(exception));\n            if (string.IsNullOrWhiteSpace(exception.Content))\n                throw new ArgumentException(\n                    \"Content must be an 'application/problem+json' compliant json string.\"\n                );\n\n            var ex = new ValidationApiException(exception);\n\n            if (!string.IsNullOrWhiteSpace(exception.Content))\n            {\n                ex.Content = JsonSerializer.Deserialize<ProblemDetails>(\n                    exception.Content!,\n                    SerializerOptions\n                );\n            }\n\n            return ex;\n        }\n\n        /// <summary>\n        /// The problem details of the RFC 7807 validation exception.\n        /// </summary>\n        public new ProblemDetails? Content { get; private set; }\n    }\n}\n"
  },
  {
    "path": "Refit/ValueStringBuilder.cs",
    "content": "﻿using System.Buffers;\nusing System.Diagnostics;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\nnamespace Refit;\n\n// From https://github/dotnet/runtime/blob/main/src/libraries/Common/src/System/Text/ValueStringBuilder.cs\ninternal ref struct ValueStringBuilder\n{\n    private char[]? _arrayToReturnToPool;\n    private Span<char> _chars;\n    private int _pos;\n\n    public ValueStringBuilder(Span<char> initialBuffer)\n    {\n        _arrayToReturnToPool = null;\n        _chars = initialBuffer;\n        _pos = 0;\n    }\n\n    public ValueStringBuilder(int initialCapacity)\n    {\n        _arrayToReturnToPool = ArrayPool<char>.Shared.Rent(initialCapacity);\n        _chars = _arrayToReturnToPool;\n        _pos = 0;\n    }\n\n    public int Length\n    {\n        get => _pos;\n        set\n        {\n            Debug.Assert(value >= 0);\n            Debug.Assert(value <= _chars.Length);\n            _pos = value;\n        }\n    }\n\n    public int Capacity => _chars.Length;\n\n    public void EnsureCapacity(int capacity)\n    {\n        // This is not expected to be called this with negative capacity\n        Debug.Assert(capacity >= 0);\n\n        // If the caller has a bug and calls this with negative capacity, make sure to call Grow to throw an exception.\n        if ((uint)capacity > (uint)_chars.Length)\n            Grow(capacity - _pos);\n    }\n\n    /// <summary>\n    /// Get a pinnable reference to the builder.\n    /// Does not ensure there is a null char after <see cref=\"Length\"/>\n    /// This overload is pattern matched in the C# 7.3+ compiler so you can omit\n    /// the explicit method call, and write eg \"fixed (char* c = builder)\"\n    /// </summary>\n    public ref char GetPinnableReference() => ref MemoryMarshal.GetReference(_chars);\n\n    /// <summary>\n    /// Get a pinnable reference to the builder.\n    /// </summary>\n    /// <param name=\"terminate\">Ensures that the builder has a null char after <see cref=\"Length\"/></param>\n    public ref char GetPinnableReference(bool terminate)\n    {\n        if (terminate)\n        {\n            EnsureCapacity(Length + 1);\n            _chars[Length] = '\\0';\n        }\n        return ref MemoryMarshal.GetReference(_chars);\n    }\n\n    public ref char this[int index]\n    {\n        get\n        {\n            Debug.Assert(index < _pos);\n            return ref _chars[index];\n        }\n    }\n\n    public override string ToString()\n    {\n        var s = _chars.Slice(0, _pos).ToString();\n        Dispose();\n        return s;\n    }\n\n    /// <summary>Returns the underlying storage of the builder.</summary>\n    public Span<char> RawChars => _chars;\n\n    /// <summary>\n    /// Returns a span around the contents of the builder.\n    /// </summary>\n    /// <param name=\"terminate\">Ensures that the builder has a null char after <see cref=\"Length\"/></param>\n    public ReadOnlySpan<char> AsSpan(bool terminate)\n    {\n        if (terminate)\n        {\n            EnsureCapacity(Length + 1);\n            _chars[Length] = '\\0';\n        }\n        return _chars.Slice(0, _pos);\n    }\n\n    public ReadOnlySpan<char> AsSpan() => _chars.Slice(0, _pos);\n    public ReadOnlySpan<char> AsSpan(int start) => _chars.Slice(start, _pos - start);\n    public ReadOnlySpan<char> AsSpan(int start, int length) => _chars.Slice(start, length);\n\n    public bool TryCopyTo(Span<char> destination, out int charsWritten)\n    {\n        if (_chars.Slice(0, _pos).TryCopyTo(destination))\n        {\n            charsWritten = _pos;\n            Dispose();\n            return true;\n        }\n        else\n        {\n            charsWritten = 0;\n            Dispose();\n            return false;\n        }\n    }\n\n    public void Insert(int index, char value, int count)\n    {\n        if (_pos > _chars.Length - count)\n        {\n            Grow(count);\n        }\n\n        var remaining = _pos - index;\n        _chars.Slice(index, remaining).CopyTo(_chars.Slice(index + count));\n        _chars.Slice(index, count).Fill(value);\n        _pos += count;\n    }\n\n    public void Insert(int index, string? s)\n    {\n        if (s == null)\n        {\n            return;\n        }\n\n        var count = s.Length;\n\n        if (_pos > (_chars.Length - count))\n        {\n            Grow(count);\n        }\n\n        var remaining = _pos - index;\n        _chars.Slice(index, remaining).CopyTo(_chars.Slice(index + count));\n        s\n#if !NETCOREAPP\n            .AsSpan()\n#endif\n            .CopyTo(_chars.Slice(index));\n        _pos += count;\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    public void Append(char c)\n    {\n        var pos = _pos;\n        var chars = _chars;\n        if ((uint)pos < (uint)chars.Length)\n        {\n            chars[pos] = c;\n            _pos = pos + 1;\n        }\n        else\n        {\n            GrowAndAppend(c);\n        }\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    public void Append(string? s)\n    {\n        if (s == null)\n        {\n            return;\n        }\n\n        var pos = _pos;\n        if (s.Length == 1 && (uint)pos < (uint)_chars.Length) // very common case, e.g. appending strings from NumberFormatInfo like separators, percent symbols, etc.\n        {\n            _chars[pos] = s[0];\n            _pos = pos + 1;\n        }\n        else\n        {\n            AppendSlow(s);\n        }\n    }\n\n    private void AppendSlow(string s)\n    {\n        var pos = _pos;\n        if (pos > _chars.Length - s.Length)\n        {\n            Grow(s.Length);\n        }\n\n        s\n#if !NETCOREAPP\n            .AsSpan()\n#endif\n            .CopyTo(_chars.Slice(pos));\n        _pos += s.Length;\n    }\n\n    public void Append(char c, int count)\n    {\n        if (_pos > _chars.Length - count)\n        {\n            Grow(count);\n        }\n\n        var dst = _chars.Slice(_pos, count);\n        for (var i = 0; i < dst.Length; i++)\n        {\n            dst[i] = c;\n        }\n        _pos += count;\n    }\n\n    public void Append(ReadOnlySpan<char> value)\n    {\n        var pos = _pos;\n        if (pos > _chars.Length - value.Length)\n        {\n            Grow(value.Length);\n        }\n\n        value.CopyTo(_chars.Slice(_pos));\n        _pos += value.Length;\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    public Span<char> AppendSpan(int length)\n    {\n        var origPos = _pos;\n        if (origPos > _chars.Length - length)\n        {\n            Grow(length);\n        }\n\n        _pos = origPos + length;\n        return _chars.Slice(origPos, length);\n    }\n\n    [MethodImpl(MethodImplOptions.NoInlining)]\n    private void GrowAndAppend(char c)\n    {\n        Grow(1);\n        Append(c);\n    }\n\n    /// <summary>\n    /// Resize the internal buffer either by doubling current buffer size or\n    /// by adding <paramref name=\"additionalCapacityBeyondPos\"/> to\n    /// <see cref=\"_pos\"/> whichever is greater.\n    /// </summary>\n    /// <param name=\"additionalCapacityBeyondPos\">\n    /// Number of chars requested beyond current position.\n    /// </param>\n    [MethodImpl(MethodImplOptions.NoInlining)]\n    private void Grow(int additionalCapacityBeyondPos)\n    {\n        Debug.Assert(additionalCapacityBeyondPos > 0);\n        Debug.Assert(_pos > _chars.Length - additionalCapacityBeyondPos, \"Grow called incorrectly, no resize is needed.\");\n\n        const uint ArrayMaxLength = 0x7FFFFFC7; // same as Array.MaxLength\n\n        // Increase to at least the required size (_pos + additionalCapacityBeyondPos), but try\n        // to double the size if possible, bounding the doubling to not go beyond the max array length.\n        var newCapacity = (int)Math.Max(\n            (uint)(_pos + additionalCapacityBeyondPos),\n            Math.Min((uint)_chars.Length * 2, ArrayMaxLength));\n\n        // Make sure to let Rent throw an exception if the caller has a bug and the desired capacity is negative.\n        // This could also go negative if the actual required length wraps around.\n        var poolArray = ArrayPool<char>.Shared.Rent(newCapacity);\n\n        _chars.Slice(0, _pos).CopyTo(poolArray);\n\n        var toReturn = _arrayToReturnToPool;\n        _chars = _arrayToReturnToPool = poolArray;\n        if (toReturn != null)\n        {\n            ArrayPool<char>.Shared.Return(toReturn);\n        }\n    }\n\n    [MethodImpl(MethodImplOptions.AggressiveInlining)]\n    public void Dispose()\n    {\n        var toReturn = _arrayToReturnToPool;\n        this = default; // for safety, to avoid using pooled array if this instance is erroneously appended to again\n        if (toReturn != null)\n        {\n            ArrayPool<char>.Shared.Return(toReturn);\n        }\n    }\n}\n"
  },
  {
    "path": "Refit/targets/refit.props",
    "content": "<Project>\n\n  <ItemGroup>\n    <CompilerVisibleProperty Include=\"RefitInternalNamespace\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "Refit/targets/refit.targets",
    "content": "<Project>\n\n  <PropertyGroup>\n\n    <!--\n    Refit internal namespace to be added to internally generated Refit code. \n    Can be overriden by user in case of namespace clashes.\n    -->\n    <RefitInternalNamespace Condition=\" '$(RefitInternalNamespace)' == '' \">$(RootNamespace)</RefitInternalNamespace>\n\n    <_RefitMSBuildMinVersion>16.8.0</_RefitMSBuildMinVersion>\n    \n  </PropertyGroup>\n\n  <Target Name=\"_RefitGatherAnalyzers\">\n    <ItemGroup>\n      <_RefitAnalyzer Include=\"@(Analyzer)\" Condition=\"'%(Analyzer.NuGetPackageId)' == 'Refit'\" />\n    </ItemGroup>\n  </Target>\n\n  <Target Name=\"_RefitAnalyzerMultiTargeting\" \n          Condition=\"'$(SupportsRoslynComponentVersioning)' != 'true'\" \n          AfterTargets=\"ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets\"\n          DependsOnTargets=\"_RefitGatherAnalyzers\">\n\n    <ItemGroup>\n      <!-- Remove our analyzers targeting roslyn4.x -->\n      <Analyzer Remove=\"@(_RefitAnalyzer)\"\n                Condition=\"$([System.String]::Copy('%(_RefitAnalyzer.Identity)').IndexOf('roslyn4')) &gt;= 0\"/>\n    </ItemGroup>\n  </Target>\n\n  <Target Name=\"_RefitRemoveAnalyzers\" \n          Condition=\"'$(DisableRefitSourceGenerator)' == 'true'\"\n          AfterTargets=\"ResolvePackageDependenciesForBuild;ResolveNuGetPackageAssets\"\n          DependsOnTargets=\"_RefitGatherAnalyzers\">\n\n    <!-- Remove all our analyzers -->\n    <ItemGroup>\n      <Analyzer Remove=\"@(_RefitAnalyzer)\" />\n    </ItemGroup>\n  </Target>\n\n  <Target Name=\"_RefitMSBuildVersionCheck\"\n          Condition=\" '$([System.Version]::Parse($(_RefitMSBuildMinVersion)).CompareTo($([System.Version]::Parse($(MSBuildVersion)))))' &gt; '0' \"\n     BeforeTargets=\"ResolveAssemblyReferences;Build;Rebuild\" >\n    <Error\n        Text = \"Projects using Refit cannot build using MSBuild '$(MSBuildVersion)'. MSBuild '$(_RefitMSBuildMinVersion)' or later is required.\" />\n  </Target>\n\n  <Target Name=\"_RefitProjectRestoreTypeCheck\" BeforeTargets=\"ResolveAssemblyReferences;Build;Rebuild\" DependsOnTargets=\"_GetRestoreProjectStyle\">\n    <Error Condition=\"'$(RestoreProjectStyle)' == 'PackagesConfig'\"\n           Text=\"Packages.config does not support Analyzers, including Source Generators. Migrate to PackageReference: 'https://devblogs.microsoft.com/nuget/migrate-packages-config-to-package-reference/'\" />\n  </Target>\n</Project>\n"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net5.0/Benchmark_AllReturnTypes.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net5.0/Benchmark_ObservableHttpResponseMessage.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *ObservableHttpResponseMessage* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net5.0/Benchmark_Task.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *Task_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net5.0/Benchmark_TaskApiResponseT.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskApiResponseT_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net5.0/Benchmark_TaskHttpContent.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskHttpContent_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net5.0/Benchmark_TaskHttpResponseMessage.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskHttpResponseMessage_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net5.0/Benchmark_TaskStream.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskStream_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net5.0/Benchmark_TaskString.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskString_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net5.0/Benchmark_TaskT.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskT_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net6.0/Benchmark_AllReturnTypes.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net6.0/Benchmark_ObservableHttpResponseMessage.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *ObservableHttpResponseMessage* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net6.0/Benchmark_Task.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *Task_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net6.0/Benchmark_TaskApiResponseT.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskApiResponseT_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net6.0/Benchmark_TaskHttpContent.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskHttpContent_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net6.0/Benchmark_TaskHttpResponseMessage.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskHttpResponseMessage_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net6.0/Benchmark_TaskStream.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskStream_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net6.0/Benchmark_TaskString.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskString_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/net6.0/Benchmark_TaskT.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskT_Async* --framework=net6.0"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/netcoreapp3.1/Benchmark_AllReturnTypes.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --framework=netcoreapp3.1"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/netcoreapp3.1/Benchmark_ObservableHttpResponseMessage.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *ObservableHttpResponseMessage* --framework=netcoreapp3.1"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/netcoreapp3.1/Benchmark_Task.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *Task_Async* --framework=netcoreapp3.1"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/netcoreapp3.1/Benchmark_TaskApiResponseT.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskApiResponseT_Async* --framework=netcoreapp3.1"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/netcoreapp3.1/Benchmark_TaskHttpContent.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskHttpContent_Async* --framework=netcoreapp3.1"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/netcoreapp3.1/Benchmark_TaskHttpResponseMessage.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskHttpResponseMessage_Async* --framework=netcoreapp3.1"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/netcoreapp3.1/Benchmark_TaskStream.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskStream_Async* --framework=netcoreapp3.1"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/netcoreapp3.1/Benchmark_TaskString.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskString_Async* --framework=netcoreapp3.1"
  },
  {
    "path": "Refit.Benchmarks/Benchmarks/netcoreapp3.1/Benchmark_TaskT.bat",
    "content": "dotnet run --project ../../Refit.Benchmarks.csproj -c Release --filter *TaskT_Async* --framework=netcoreapp3.1"
  },
  {
    "path": "Refit.Benchmarks/EndToEndBenchmark.cs",
    "content": "﻿using System.Net;\nusing AutoFixture;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Refit.Benchmarks;\n\n[MemoryDiagnoser]\npublic class EndToEndBenchmark\n{\n    private readonly Fixture autoFixture = new();\n    private const string Host = \"https://github.com\";\n    private SystemTextJsonContentSerializer systemTextJsonContentSerializer;\n    private NewtonsoftJsonContentSerializer newtonsoftJsonContentSerializer;\n    private readonly IDictionary<int, IEnumerable<User>> users =\n        new Dictionary<int, IEnumerable<User>>();\n    private readonly IDictionary<\n        SerializationStrategy,\n        IDictionary<HttpStatusCode, IGitHubService>\n    > refitClient = new Dictionary<\n        SerializationStrategy,\n        IDictionary<HttpStatusCode, IGitHubService>\n    >\n    {\n        {\n            SerializationStrategy.SystemTextJson,\n            new Dictionary<HttpStatusCode, IGitHubService>()\n        },\n        {\n            SerializationStrategy.NewtonsoftJson,\n            new Dictionary<HttpStatusCode, IGitHubService>()\n        }\n    };\n\n    private readonly IDictionary<HttpVerb, HttpMethod> httpMethod = new Dictionary<\n        HttpVerb,\n        HttpMethod\n    >\n    {\n        { HttpVerb.Get, HttpMethod.Get },\n        { HttpVerb.Post, HttpMethod.Post }\n    };\n\n    private const int TenUsers = 10;\n\n    public enum SerializationStrategy\n    {\n        SystemTextJson,\n        NewtonsoftJson\n    }\n\n    public enum HttpVerb\n    {\n        Get,\n        Post\n    }\n\n    [GlobalSetup]\n    public Task SetupAsync()\n    {\n        systemTextJsonContentSerializer = new SystemTextJsonContentSerializer();\n        refitClient[SerializationStrategy.SystemTextJson][HttpStatusCode.OK] =\n            RestService.For<IGitHubService>(\n                Host,\n                new RefitSettings(systemTextJsonContentSerializer)\n                {\n                    HttpMessageHandlerFactory = () =>\n                        new StaticFileHttpResponseHandler(\n                            \"system-text-json-10-users.json\",\n                            HttpStatusCode.OK\n                        )\n                }\n            );\n        refitClient[SerializationStrategy.SystemTextJson][HttpStatusCode.InternalServerError] =\n            RestService.For<IGitHubService>(\n                Host,\n                new RefitSettings(systemTextJsonContentSerializer)\n                {\n                    HttpMessageHandlerFactory = () =>\n                        new StaticFileHttpResponseHandler(\n                            \"system-text-json-10-users.json\",\n                            HttpStatusCode.InternalServerError\n                        )\n                }\n            );\n\n        newtonsoftJsonContentSerializer = new NewtonsoftJsonContentSerializer();\n        refitClient[SerializationStrategy.NewtonsoftJson][HttpStatusCode.OK] =\n            RestService.For<IGitHubService>(\n                Host,\n                new RefitSettings(newtonsoftJsonContentSerializer)\n                {\n                    HttpMessageHandlerFactory = () =>\n                        new StaticFileHttpResponseHandler(\n                            \"newtonsoft-json-10-users.json\",\n                            System.Net.HttpStatusCode.OK\n                        )\n                }\n            );\n        refitClient[SerializationStrategy.NewtonsoftJson][HttpStatusCode.InternalServerError] =\n            RestService.For<IGitHubService>(\n                Host,\n                new RefitSettings(newtonsoftJsonContentSerializer)\n                {\n                    HttpMessageHandlerFactory = () =>\n                        new StaticFileHttpResponseHandler(\n                            \"newtonsoft-json-10-users.json\",\n                            System.Net.HttpStatusCode.InternalServerError\n                        )\n                }\n            );\n\n        users[TenUsers] = autoFixture.CreateMany<User>(TenUsers);\n\n        return Task.CompletedTask;\n    }\n\n    /*\n     * Each [Benchmark] tests one return type that Refit allows and is parameterized to test different, serializers, and http methods, and status codes\n     */\n\n    [Params(HttpStatusCode.OK, HttpStatusCode.InternalServerError)]\n    public HttpStatusCode HttpStatusCode { get; set; }\n\n    [Params(TenUsers)]\n    public int ModelCount { get; set; }\n\n    [ParamsAllValues]\n    public HttpVerb Verb { get; set; }\n\n    [ParamsAllValues]\n    public SerializationStrategy Serializer { get; set; }\n\n    [Benchmark]\n    public async Task Task_Async()\n    {\n        try\n        {\n            switch (Verb)\n            {\n                case HttpVerb.Get:\n                    await refitClient[Serializer][HttpStatusCode].GetUsersTaskAsync();\n                    break;\n                case HttpVerb.Post:\n                    await refitClient[Serializer]\n                        [HttpStatusCode]\n                        .PostUsersTaskAsync(users[ModelCount]);\n                    break;\n                default:\n                    throw new ArgumentOutOfRangeException(nameof(Verb));\n            }\n        }\n        catch\n        {\n            //swallow\n        }\n    }\n\n    [Benchmark]\n    public async Task<string> TaskString_Async()\n    {\n        try\n        {\n            switch (Verb)\n            {\n                case HttpVerb.Get:\n                    return await refitClient[Serializer]\n                        [HttpStatusCode]\n                        .GetUsersTaskStringAsync();\n                case HttpVerb.Post:\n                    return await refitClient[Serializer]\n                        [HttpStatusCode]\n                        .PostUsersTaskStringAsync(users[ModelCount]);\n                default:\n                    throw new ArgumentOutOfRangeException(nameof(Verb));\n            }\n        }\n        catch\n        {\n            //swallow\n        }\n\n        return default;\n    }\n\n    [Benchmark]\n    public async Task<Stream> TaskStream_Async()\n    {\n        try\n        {\n            switch (Verb)\n            {\n                case HttpVerb.Get:\n                    return await refitClient[Serializer]\n                        [HttpStatusCode]\n                        .GetUsersTaskStreamAsync();\n                case HttpVerb.Post:\n                    return await refitClient[Serializer]\n                        [HttpStatusCode]\n                        .PostUsersTaskStreamAsync(users[ModelCount]);\n                default:\n                    throw new ArgumentOutOfRangeException(nameof(Verb));\n            }\n        }\n        catch\n        {\n            //swallow\n        }\n\n        return default;\n    }\n\n    [Benchmark]\n    public async Task<HttpContent> TaskHttpContent_Async()\n    {\n        try\n        {\n            switch (Verb)\n            {\n                case HttpVerb.Get:\n                    return await refitClient[Serializer]\n                        [HttpStatusCode]\n                        .GetUsersTaskHttpContentAsync();\n                case HttpVerb.Post:\n                    return await refitClient[Serializer]\n                        [HttpStatusCode]\n                        .PostUsersTaskHttpContentAsync(users[ModelCount]);\n                default:\n                    throw new ArgumentOutOfRangeException(nameof(Verb));\n            }\n        }\n        catch\n        {\n            //swallow\n        }\n\n        return default;\n    }\n\n    [Benchmark]\n    public async Task<HttpResponseMessage> TaskHttpResponseMessage_Async()\n    {\n        switch (Verb)\n        {\n            case HttpVerb.Get:\n                return await refitClient[Serializer]\n                    [HttpStatusCode]\n                    .GetUsersTaskHttpResponseMessageAsync();\n            case HttpVerb.Post:\n                return await refitClient[Serializer]\n                    [HttpStatusCode]\n                    .PostUsersTaskHttpResponseMessageAsync(users[ModelCount]);\n            default:\n                throw new ArgumentOutOfRangeException(nameof(Verb));\n        }\n    }\n\n    [Benchmark]\n    public IObservable<HttpResponseMessage> ObservableHttpResponseMessage()\n    {\n        switch (Verb)\n        {\n            case HttpVerb.Get:\n                return refitClient[Serializer]\n                    [HttpStatusCode]\n                    .GetUsersObservableHttpResponseMessage();\n            case HttpVerb.Post:\n                return refitClient[Serializer]\n                    [HttpStatusCode]\n                    .PostUsersObservableHttpResponseMessage(users[ModelCount]);\n            default:\n                throw new ArgumentOutOfRangeException(nameof(Verb));\n        }\n    }\n\n    [Benchmark]\n    public async Task<List<User>> TaskT_Async()\n    {\n        try\n        {\n            switch (Verb)\n            {\n                case HttpVerb.Get:\n                    return await refitClient[Serializer][HttpStatusCode].GetUsersTaskTAsync();\n                case HttpVerb.Post:\n                    return await refitClient[Serializer]\n                        [HttpStatusCode]\n                        .PostUsersTaskTAsync(users[ModelCount]);\n                default:\n                    throw new ArgumentOutOfRangeException(nameof(Verb));\n            }\n        }\n        catch\n        {\n            //swallow\n        }\n\n        return default;\n    }\n\n    [Benchmark]\n    public async Task<ApiResponse<List<User>>> TaskApiResponseT_Async()\n    {\n        switch (Verb)\n        {\n            case HttpVerb.Get:\n                return await refitClient[Serializer]\n                    [HttpStatusCode]\n                    .GetUsersTaskApiResponseTAsync();\n            case HttpVerb.Post:\n                return await refitClient[Serializer]\n                    [HttpStatusCode]\n                    .PostUsersTaskApiResponseTAsync(users[ModelCount]);\n            default:\n                throw new ArgumentOutOfRangeException(nameof(Verb));\n        }\n    }\n}\n"
  },
  {
    "path": "Refit.Benchmarks/IGitHubService.cs",
    "content": "﻿namespace Refit.Benchmarks;\n\npublic interface IGitHubService\n{\n    //Task - throws\n    [Get(\"/users\")]\n    public Task GetUsersTaskAsync();\n\n    [Post(\"/users\")]\n    public Task PostUsersTaskAsync([Body] IEnumerable<User> users);\n\n    //Task<string> - throws\n    [Get(\"/users\")]\n    public Task<string> GetUsersTaskStringAsync();\n\n    [Post(\"/users\")]\n    public Task<string> PostUsersTaskStringAsync([Body] IEnumerable<User> users);\n\n    //Task<Stream> - throws\n    [Get(\"/users\")]\n    public Task<Stream> GetUsersTaskStreamAsync();\n\n    [Post(\"/users\")]\n    public Task<Stream> PostUsersTaskStreamAsync([Body] IEnumerable<User> users);\n\n    //Task<HttpContent> - throws\n    [Get(\"/users\")]\n    public Task<HttpContent> GetUsersTaskHttpContentAsync();\n\n    [Post(\"/users\")]\n    public Task<HttpContent> PostUsersTaskHttpContentAsync([Body] IEnumerable<User> users);\n\n    //Task<HttpResponseMessage>\n    [Get(\"/users\")]\n    public Task<HttpResponseMessage> GetUsersTaskHttpResponseMessageAsync();\n\n    [Post(\"/users\")]\n    public Task<HttpResponseMessage> PostUsersTaskHttpResponseMessageAsync(\n        [Body] IEnumerable<User> users\n    );\n\n    //IObservable<HttpResponseMessage>\n    [Get(\"/users\")]\n    public IObservable<HttpResponseMessage> GetUsersObservableHttpResponseMessage();\n\n    [Post(\"/users\")]\n    public IObservable<HttpResponseMessage> PostUsersObservableHttpResponseMessage(\n        [Body] IEnumerable<User> users\n    );\n\n    //Task<<T>> - throws\n    [Get(\"/users\")]\n    public Task<List<User>> GetUsersTaskTAsync();\n\n    [Post(\"/users\")]\n    public Task<List<User>> PostUsersTaskTAsync([Body] IEnumerable<User> users);\n\n    //Task<ApiResponse<T>>\n    [Get(\"/users\")]\n    public Task<ApiResponse<List<User>>> GetUsersTaskApiResponseTAsync();\n\n    [Post(\"/users\")]\n    public Task<ApiResponse<List<User>>> PostUsersTaskApiResponseTAsync(\n        [Body] IEnumerable<User> users\n    );\n}\n\npublic class User\n{\n    public int Id { get; set; }\n    public string Name { get; set; }\n    public string Bio { get; set; }\n    public int Followers { get; set; }\n    public int Following { get; set; }\n    public string Url { get; set; }\n}"
  },
  {
    "path": "Refit.Benchmarks/IPerformanceService.cs",
    "content": "﻿namespace Refit.Benchmarks;\n\npublic interface IPerformanceService\n{\n    [Get(\"/users\")]\n    public Task<HttpResponseMessage> ConstantRoute();\n\n    [Get(\"/users/{id}\")]\n    public Task<HttpResponseMessage> DynamicRoute(int id);\n\n    [Get(\"/users/{id}/{user}/{status}\")]\n    public Task<HttpResponseMessage> ComplexDynamicRoute(int id, string user, string status);\n\n    [Get(\"/users/{request.someProperty}\")]\n    public Task<HttpResponseMessage> ObjectRequest(PathBoundObject request);\n\n    [Post(\"/users/{id}/{request.someProperty}\")]\n    [Headers(\"User-Agent: Awesome Octocat App\", \"X-Emoji: :smile_cat:\")]\n    public Task<HttpResponseMessage> ComplexRequest(int id, PathBoundObject request, [Query(CollectionFormat.Multi)]int[] queries);\n}\n\npublic class PathBoundObject\n{\n    public string SomeProperty { get; set; }\n\n    [Query]\n    public string SomeQuery { get; set; }\n}\n"
  },
  {
    "path": "Refit.Benchmarks/PerformanceBenchmark.cs",
    "content": "﻿using System.Net;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Refit.Benchmarks;\n\n[MemoryDiagnoser]\npublic class PerformanceBenchmark\n{\n    private IPerformanceService? service;\n\n    private const string Host = \"https://github.com\";\n    private SystemTextJsonContentSerializer systemTextJsonContentSerializer;\n\n    [GlobalSetup]\n    public Task SetupAsync()\n    {\n        systemTextJsonContentSerializer = new SystemTextJsonContentSerializer();\n        service =\n            RestService.For<IPerformanceService>(\n                Host,\n                new RefitSettings(systemTextJsonContentSerializer)\n                {\n                    HttpMessageHandlerFactory = () =>\n                        new StaticValueHttpResponseHandler(\n                            \"Ok\",\n                            HttpStatusCode.OK\n                        )\n                }\n            );\n\n        return Task.CompletedTask;\n    }\n\n    [Benchmark]\n    public async Task<HttpResponseMessage> ConstantRouteAsync() => await service.ConstantRoute();\n\n    [Benchmark]\n    public async Task<HttpResponseMessage> DynamicRouteAsync() => await service.DynamicRoute(101);\n\n    [Benchmark]\n    public async Task<HttpResponseMessage> ComplexDynamicRouteAsync() => await service.ComplexDynamicRoute(101, \"tom\", \"yCxv\");\n\n    [Benchmark]\n    public async Task<HttpResponseMessage> ObjectRequestAsync() => await service.ObjectRequest(new PathBoundObject(){SomeProperty = \"myProperty\", SomeQuery = \"myQuery\"});\n\n    [Benchmark]\n    public async Task<HttpResponseMessage> ComplexRequestAsync() => await service.ComplexRequest(101, new PathBoundObject(){SomeProperty = \"myProperty\", SomeQuery = \"myQuery\"}, [1,2,3,4,5,6]);\n}\n"
  },
  {
    "path": "Refit.Benchmarks/Program.cs",
    "content": "﻿using BenchmarkDotNet.Running;\nusing Refit.Benchmarks;\n\nif (args is { Length: > 0 })\n{\n    BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);\n}\nelse\n{\n    BenchmarkRunner.Run<EndToEndBenchmark>();\n    // BenchmarkRunner.Run<StartupBenchmark>();\n    // BenchmarkRunner.Run<PerformanceBenchmark>();\n    // BenchmarkRunner.Run<SourceGeneratorBenchmark>();\n}\n"
  },
  {
    "path": "Refit.Benchmarks/Refit.Benchmarks.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n    <Import Project=\"..\\Refit\\targets\\refit.props\" />\n  \n    <PropertyGroup>\n      <OutputType>Exe</OutputType>\n      <TargetFrameworks>net8.0</TargetFrameworks>\n      <IsPackable>false</IsPackable>\n      <NoWarn>$(NoWarn);CS1591</NoWarn>\n    </PropertyGroup>\n  \n    <ItemGroup>\n      <ProjectReference Include=\"..\\Refit.Newtonsoft.Json\\Refit.Newtonsoft.Json.csproj\" />\n      <ProjectReference Include=\"..\\Refit\\Refit.csproj\" />\n      <ProjectReference Include=\"..\\Refit.Xml\\Refit.Xml.csproj\" />\n      <ProjectReference Include=\"..\\InterfaceStubGenerator.Roslyn38\\InterfaceStubGenerator.Roslyn38.csproj\" OutputItemType=\"Analyzer\" ReferenceOutputAssembly=\"true\" />\n      <ProjectReference Include=\"..\\InterfaceStubGenerator.Roslyn41\\InterfaceStubGenerator.Roslyn41.csproj\" />\n    </ItemGroup>\n\n    <ItemGroup>\n      <PackageReference Include=\"System.Net.Http\" Version=\"4.3.4\" />\n      <PackageReference Include=\"System.Text.RegularExpressions\" Version=\"4.3.1\" />\n      <PackageReference Include=\"AutoFixture\" Version=\"4.18.1\" />\n      <PackageReference Include=\"BenchmarkDotNet\" Version=\"0.14.0\" />\n      <PackageReference Include=\"Microsoft.CodeAnalysis.CSharp.Workspaces\" Version=\"4.12.0-3.24523.4\" />\n    </ItemGroup>\n\n    <ItemGroup>\n      <None Remove=\"newtonsoft-json-10-users.json\" />\n      <EmbeddedResource Include=\"newtonsoft-json-10-users.json\">\n        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      </EmbeddedResource>\n      <None Remove=\"system-text-json-10-users.json\" />\n      <EmbeddedResource Include=\"system-text-json-10-users.json\">\n        <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      </EmbeddedResource>\n    </ItemGroup>\n  \n    <Import Project=\"..\\Refit\\targets\\refit.targets\" />\n</Project>\n"
  },
  {
    "path": "Refit.Benchmarks/SourceGeneratorBenchmark.cs",
    "content": "﻿using System.Reflection;\n\nusing BenchmarkDotNet.Attributes;\n\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp;\n\nusing Refit.Generator;\n\nnamespace Refit.Benchmarks;\n\n[MemoryDiagnoser]\npublic class SourceGeneratorBenchmark\n{\n    static readonly MetadataReference RefitAssembly = MetadataReference.CreateFromFile(\n        typeof(GetAttribute).Assembly.Location,\n        documentation: XmlDocumentationProvider.CreateFromFile(\n            Path.ChangeExtension(typeof(GetAttribute).Assembly.Location, \".xml\")\n        )\n    );\n    static readonly Type[] ImportantAssemblies = {\n        typeof(Binder),\n        typeof(GetAttribute),\n        typeof(Enumerable),\n        typeof(Newtonsoft.Json.JsonConvert),\n        typeof(HttpContent),\n        typeof(Attribute)\n    };\n\n    static Assembly[] AssemblyReferencesForCodegen =>\n        AppDomain.CurrentDomain\n            .GetAssemblies()\n            .Concat(ImportantAssemblies.Select(x=>x.Assembly))\n            .Distinct()\n            .Where(a => !a.IsDynamic)\n            .ToArray();\n\n    private Compilation compilation;\n    private CSharpGeneratorDriver driver;\n\n    private void Setup(string sourceText)\n    {\n        var references = new List<MetadataReference>();\n        var assemblies = AssemblyReferencesForCodegen;\n        foreach (var assembly in assemblies)\n        {\n            if (!assembly.IsDynamic)\n            {\n                references.Add(MetadataReference.CreateFromFile(assembly.Location));\n            }\n        }\n\n        references.Add(RefitAssembly);\n        compilation = CSharpCompilation.Create(\n            \"compilation\",\n            [CSharpSyntaxTree.ParseText(sourceText)],\n            references,\n            new CSharpCompilationOptions(OutputKind.ConsoleApplication)\n        );\n\n        var generator = new InterfaceStubGeneratorV2().AsSourceGenerator();\n        driver = CSharpGeneratorDriver.Create(generator);\n    }\n\n    [GlobalSetup(Target = nameof(Compile))]\n    public void SetupSmall() => Setup(SourceGeneratorBenchmarksProjects.SmallInterface);\n\n    [Benchmark]\n    public GeneratorDriver Compile()\n    {\n        return driver.RunGeneratorsAndUpdateCompilation(compilation, out _, out _);\n    }\n\n    [GlobalSetup(Target = nameof(Cached))]\n    public void SetupCached()\n    {\n        Setup(SourceGeneratorBenchmarksProjects.SmallInterface);\n        driver = (CSharpGeneratorDriver)driver.RunGeneratorsAndUpdateCompilation(compilation, out _, out _);\n        compilation = compilation.AddSyntaxTrees(CSharpSyntaxTree.ParseText(\"struct MyValue {}\"));\n    }\n\n    [Benchmark]\n    public GeneratorDriver Cached()\n    {\n        return driver.RunGeneratorsAndUpdateCompilation(compilation, out _, out _);\n    }\n\n    [GlobalSetup(Target = nameof(CompileMany))]\n    public void SetupMany() => Setup(SourceGeneratorBenchmarksProjects.ManyInterfaces);\n\n    [Benchmark]\n    public GeneratorDriver CompileMany()\n    {\n        return driver.RunGeneratorsAndUpdateCompilation(compilation, out _, out _);\n    }\n\n    [GlobalSetup(Target = nameof(CachedMany))]\n    public void SetupCachedMany()\n    {\n        Setup(SourceGeneratorBenchmarksProjects.ManyInterfaces);\n        driver = (CSharpGeneratorDriver)driver.RunGeneratorsAndUpdateCompilation(compilation, out _, out _);\n        compilation = compilation.AddSyntaxTrees(CSharpSyntaxTree.ParseText(\"struct MyValue {}\"));\n    }\n\n    [Benchmark]\n    public GeneratorDriver CachedMany()\n    {\n        return driver.RunGeneratorsAndUpdateCompilation(compilation, out _, out _);\n    }\n}\n"
  },
  {
    "path": "Refit.Benchmarks/SourceGeneratorBenchmarksProjects.cs",
    "content": "﻿namespace Refit.Benchmarks;\n\npublic static class SourceGeneratorBenchmarksProjects\n{\n    #region SmallInterface\n    public const string SmallInterface =\n        \"\"\"\n        using System;\n        using System.Collections.Generic;\n        using System.Linq;\n        using System.Net.Http;\n        using System.Text;\n        using System.Threading;\n        using System.Threading.Tasks;\n        using Refit;\n\n        namespace RefitGeneratorTest;\n\n        public interface IReallyExcitingCrudApi<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        \"\"\";\n    #endregion\n\n    #region LargeInterface\n    public const string ManyInterfaces =\n        \"\"\"\n        using System;\n        using System.Collections.Generic;\n        using System.Linq;\n        using System.Net.Http;\n        using System.Text;\n        using System.Threading;\n        using System.Threading.Tasks;\n        using Refit;\n\n        namespace RefitGeneratorTest;\n\n        public interface IReallyExcitingCrudApi0<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi1<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi2<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi3<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi4<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi5<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi6<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi7<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi8<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi9<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi10<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi11<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi12<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi13<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi14<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi15<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi16<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi17<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi18<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi19<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi20<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi21<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi22<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi23<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi24<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi25<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi26<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi27<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi28<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi29<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi30<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi31<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi32<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi33<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi34<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi35<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi36<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi37<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi38<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi39<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi40<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi41<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi42<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi43<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi44<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi45<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi46<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi47<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi48<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi49<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi50<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi51<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi52<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi53<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi54<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi55<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi56<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi57<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi58<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi59<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi60<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi61<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi62<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi63<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi64<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi65<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi66<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi67<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi68<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi69<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi70<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi71<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi72<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi73<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi74<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi75<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi76<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi77<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi78<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi79<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi80<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi81<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi82<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi83<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi84<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi85<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi86<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi87<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi88<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi89<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi90<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi91<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi92<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi93<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi94<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi95<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi96<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi97<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi98<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        public interface IReallyExcitingCrudApi99<T, in TKey> where T : class\n        {\n            [Post(\"\")]\n            Task<T> Create([Body] T payload);\n\n            [Get(\"\")]\n            Task<List<T>> ReadAll();\n\n            [Get(\"/{key}\")]\n            Task<T> ReadOne(TKey key);\n\n            [Put(\"/{key}\")]\n            Task Update(TKey key, [Body]T payload);\n\n            [Delete(\"/{key}\")]\n            Task Delete(TKey key);\n        }\n        \"\"\";\n    #endregion\n}\n"
  },
  {
    "path": "Refit.Benchmarks/StartupBenchmark.cs",
    "content": "﻿using System.Net;\nusing BenchmarkDotNet.Attributes;\n\nnamespace Refit.Benchmarks;\n\n[MemoryDiagnoser]\npublic class StartupBenchmark\n{\n    private IPerformanceService initialisedService;\n    private const string Host = \"https://github.com\";\n    private readonly RefitSettings settings = new RefitSettings()\n    {\n        HttpMessageHandlerFactory = () =>\n            new StaticValueHttpResponseHandler(\n                \"Ok\",\n                HttpStatusCode.OK\n            )\n    };\n\n\n    [IterationSetup(Targets = [nameof(FirstCallConstantRouteAsync), nameof(FirstCallComplexRequestAsync)])]\n    public void Setup()\n    {\n        initialisedService = RestService.For<IPerformanceService>(Host, settings);\n    }\n\n    [Benchmark]\n    public IPerformanceService CreateService() => RestService.For<IPerformanceService>(Host, settings);\n\n    [Benchmark]\n    public async Task<HttpResponseMessage> FirstCallConstantRouteAsync() => await initialisedService.ConstantRoute();\n\n    [Benchmark]\n    public async Task<HttpResponseMessage> ConstantRouteAsync()\n    {\n        var service = RestService.For<IPerformanceService>(Host, settings);\n        return await service.ConstantRoute();\n    }\n\n    [Benchmark]\n    public async Task<HttpResponseMessage> FirstCallComplexRequestAsync() => await initialisedService.ObjectRequest(new PathBoundObject(){SomeProperty = \"myProperty\", SomeQuery = \"myQuery\"});\n\n    [Benchmark]\n    public async Task<HttpResponseMessage> ComplexRequestAsync()\n    {\n        var service = RestService.For<IPerformanceService>(Host, settings);\n        return await service.ObjectRequest(new PathBoundObject(){SomeProperty = \"myProperty\", SomeQuery = \"myQuery\"});\n    }\n}\n"
  },
  {
    "path": "Refit.Benchmarks/StaticFileHttpResponseHandler.cs",
    "content": "﻿using System.Net;\n\nnamespace Refit.Benchmarks;\n\npublic class StaticFileHttpResponseHandler : HttpMessageHandler\n{\n    private readonly HttpStatusCode responseCode;\n    private readonly string responsePayload;\n\n    public StaticFileHttpResponseHandler(string fileName, HttpStatusCode responseCode)\n    {\n            if (string.IsNullOrEmpty(fileName))\n                throw new ArgumentNullException(nameof(fileName));\n\n            responsePayload = File.ReadAllText(fileName);\n            ;\n            this.responseCode = responseCode;\n        }\n\n    protected override Task<HttpResponseMessage> SendAsync(\n        HttpRequestMessage request,\n        CancellationToken cancellationToken\n    )\n    {\n            return Task.FromResult(\n                new HttpResponseMessage(responseCode)\n                {\n                    RequestMessage = request,\n                    Content = new StringContent(responsePayload)\n                }\n            );\n        }\n}"
  },
  {
    "path": "Refit.Benchmarks/StaticValueHttpResponseHandler.cs",
    "content": "﻿using System.Net;\n\nnamespace Refit.Benchmarks;\n\npublic class StaticValueHttpResponseHandler (string response, HttpStatusCode code) : HttpMessageHandler\n{\n    protected override Task<HttpResponseMessage> SendAsync(\n        HttpRequestMessage request,\n        CancellationToken cancellationToken\n    )\n    {\n            return Task.FromResult(\n                new HttpResponseMessage(code)\n                {\n                    RequestMessage = request,\n                    Content = new StringContent(response)\n                }\n            );\n        }\n}\n"
  },
  {
    "path": "Refit.Benchmarks/newtonsoft-json-10-users.json",
    "content": "[\n  {\n    \"Id\": 253,\n    \"Name\": \"Namee3a23814-bfe9-4d4b-96db-8fc95d209ea8\",\n    \"Bio\": \"Biof413d158-7ca7-4b1b-9073-565b3621bb83\",\n    \"Followers\": 154,\n    \"Following\": 136,\n    \"Url\": \"Url70f46596-f86f-4e82-900d-0f07d7dc468c\"\n  },\n  {\n    \"Id\": 122,\n    \"Name\": \"Namef5407028-0d39-41bf-86a3-94890dabff6c\",\n    \"Bio\": \"Bioed5c52a9-37ed-4bc3-94fc-ab2de047ad31\",\n    \"Followers\": 48,\n    \"Following\": 188,\n    \"Url\": \"Url7d04e0a5-63d8-42e9-996a-af1efeee6b3d\"\n  },\n  {\n    \"Id\": 78,\n    \"Name\": \"Name3176c49e-d65d-44f6-89af-14a79aa6103e\",\n    \"Bio\": \"Bioc901bb07-874a-449e-8cc7-892ea008de32\",\n    \"Followers\": 218,\n    \"Following\": 229,\n    \"Url\": \"Urlf2a24e82-c01e-4ca5-86c7-4360dbffd955\"\n  },\n  {\n    \"Id\": 169,\n    \"Name\": \"Namebf433061-810b-4e0e-b9a4-33690ba557a7\",\n    \"Bio\": \"Bioe43d91cd-a399-401e-b126-a94f4f35ac97\",\n    \"Followers\": 167,\n    \"Following\": 142,\n    \"Url\": \"Urlea793c4a-436f-4ba8-8f3b-e48d88f8ff16\"\n  },\n  {\n    \"Id\": 173,\n    \"Name\": \"Name2ff320b0-4c21-4799-825f-2da0b00eecb7\",\n    \"Bio\": \"Bio4d33933d-484c-468b-a433-7cbf5801795a\",\n    \"Followers\": 255,\n    \"Following\": 198,\n    \"Url\": \"Url84860aea-c2d1-4b0d-8be3-9c961b06d08a\"\n  },\n  {\n    \"Id\": 100,\n    \"Name\": \"Name13c3cb21-4a84-4c02-8fc5-30b2287c203d\",\n    \"Bio\": \"Bio90233954-82e4-4e36-9152-3bc8e1ca37ab\",\n    \"Followers\": 128,\n    \"Following\": 84,\n    \"Url\": \"Url126ac70f-429a-458e-8138-957883491938\"\n  },\n  {\n    \"Id\": 172,\n    \"Name\": \"Name97594a03-d0a8-4711-8d9f-af2067da734c\",\n    \"Bio\": \"Bio9feb6a20-49ae-480c-a819-a2655ef44a9b\",\n    \"Followers\": 41,\n    \"Following\": 146,\n    \"Url\": \"Urldaa25203-cf3a-4744-b5b0-58505a602980\"\n  },\n  {\n    \"Id\": 243,\n    \"Name\": \"Name74b11b10-f465-4217-9de4-d8d9884a4c99\",\n    \"Bio\": \"Bio4733a1be-9b5f-44bc-ada1-2154265e3dec\",\n    \"Followers\": 120,\n    \"Following\": 45,\n    \"Url\": \"Urleb4bb38d-ae61-4cc4-b9f7-111f2d6e06b8\"\n  },\n  {\n    \"Id\": 106,\n    \"Name\": \"Name4c1a2b16-ebaf-4d5b-b262-a0b33562fc6b\",\n    \"Bio\": \"Bioa9ff296d-921b-4f8f-95bb-5a569e0cb176\",\n    \"Followers\": 79,\n    \"Following\": 133,\n    \"Url\": \"Url732335eb-f081-4842-940e-e130bb8a475b\"\n  },\n  {\n    \"Id\": 245,\n    \"Name\": \"Name0c42a076-95d3-49b8-a2ea-711fc1569c19\",\n    \"Bio\": \"Bio78b6cbf1-7595-4ed1-b530-f438ea6320ce\",\n    \"Followers\": 5,\n    \"Following\": 212,\n    \"Url\": \"Urlc2a5296a-ea03-4b6a-bbc9-92e1e1e56d21\"\n  }\n]"
  },
  {
    "path": "Refit.Benchmarks/system-text-json-10-users.json",
    "content": "[\n  {\n    \"id\": 253,\n    \"name\": \"Namee3a23814-bfe9-4d4b-96db-8fc95d209ea8\",\n    \"bio\": \"Biof413d158-7ca7-4b1b-9073-565b3621bb83\",\n    \"followers\": 154,\n    \"following\": 136,\n    \"url\": \"Url70f46596-f86f-4e82-900d-0f07d7dc468c\"\n  },\n  {\n    \"id\": 122,\n    \"name\": \"Namef5407028-0d39-41bf-86a3-94890dabff6c\",\n    \"bio\": \"Bioed5c52a9-37ed-4bc3-94fc-ab2de047ad31\",\n    \"followers\": 48,\n    \"following\": 188,\n    \"url\": \"Url7d04e0a5-63d8-42e9-996a-af1efeee6b3d\"\n  },\n  {\n    \"id\": 78,\n    \"name\": \"Name3176c49e-d65d-44f6-89af-14a79aa6103e\",\n    \"bio\": \"Bioc901bb07-874a-449e-8cc7-892ea008de32\",\n    \"followers\": 218,\n    \"following\": 229,\n    \"url\": \"Urlf2a24e82-c01e-4ca5-86c7-4360dbffd955\"\n  },\n  {\n    \"id\": 169,\n    \"name\": \"Namebf433061-810b-4e0e-b9a4-33690ba557a7\",\n    \"bio\": \"Bioe43d91cd-a399-401e-b126-a94f4f35ac97\",\n    \"followers\": 167,\n    \"following\": 142,\n    \"url\": \"Urlea793c4a-436f-4ba8-8f3b-e48d88f8ff16\"\n  },\n  {\n    \"id\": 173,\n    \"name\": \"Name2ff320b0-4c21-4799-825f-2da0b00eecb7\",\n    \"bio\": \"Bio4d33933d-484c-468b-a433-7cbf5801795a\",\n    \"followers\": 255,\n    \"following\": 198,\n    \"url\": \"Url84860aea-c2d1-4b0d-8be3-9c961b06d08a\"\n  },\n  {\n    \"id\": 100,\n    \"name\": \"Name13c3cb21-4a84-4c02-8fc5-30b2287c203d\",\n    \"bio\": \"Bio90233954-82e4-4e36-9152-3bc8e1ca37ab\",\n    \"followers\": 128,\n    \"following\": 84,\n    \"url\": \"Url126ac70f-429a-458e-8138-957883491938\"\n  },\n  {\n    \"id\": 172,\n    \"name\": \"Name97594a03-d0a8-4711-8d9f-af2067da734c\",\n    \"bio\": \"Bio9feb6a20-49ae-480c-a819-a2655ef44a9b\",\n    \"followers\": 41,\n    \"following\": 146,\n    \"url\": \"Urldaa25203-cf3a-4744-b5b0-58505a602980\"\n  },\n  {\n    \"id\": 243,\n    \"name\": \"Name74b11b10-f465-4217-9de4-d8d9884a4c99\",\n    \"bio\": \"Bio4733a1be-9b5f-44bc-ada1-2154265e3dec\",\n    \"followers\": 120,\n    \"following\": 45,\n    \"url\": \"Urleb4bb38d-ae61-4cc4-b9f7-111f2d6e06b8\"\n  },\n  {\n    \"id\": 106,\n    \"name\": \"Name4c1a2b16-ebaf-4d5b-b262-a0b33562fc6b\",\n    \"bio\": \"Bioa9ff296d-921b-4f8f-95bb-5a569e0cb176\",\n    \"followers\": 79,\n    \"following\": 133,\n    \"url\": \"Url732335eb-f081-4842-940e-e130bb8a475b\"\n  },\n  {\n    \"id\": 245,\n    \"name\": \"Name0c42a076-95d3-49b8-a2ea-711fc1569c19\",\n    \"bio\": \"Bio78b6cbf1-7595-4ed1-b530-f438ea6320ce\",\n    \"followers\": 5,\n    \"following\": 212,\n    \"url\": \"Urlc2a5296a-ea03-4b6a-bbc9-92e1e1e56d21\"\n  }\n]"
  },
  {
    "path": "Refit.GeneratorTests/Fixture.cs",
    "content": "﻿using System.Reflection;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Refit.Generator;\n\nnamespace Refit.GeneratorTests;\n\npublic static class Fixture\n{\n    static readonly MetadataReference RefitAssembly = MetadataReference.CreateFromFile(\n        typeof(GetAttribute).Assembly.Location,\n        documentation: XmlDocumentationProvider.CreateFromFile(\n            Path.ChangeExtension(typeof(GetAttribute).Assembly.Location, \".xml\")\n        )\n    );\n\n    private static readonly Type[] ImportantAssemblies = {\n        typeof(Binder),\n        typeof(GetAttribute),\n        typeof(System.Reactive.Unit),\n        typeof(Enumerable),\n        typeof(Newtonsoft.Json.JsonConvert),\n        typeof(FactAttribute),\n        typeof(HttpContent),\n        typeof(Attribute)\n    };\n\n    private static Assembly[] AssemblyReferencesForCodegen =>\n        AppDomain.CurrentDomain\n            .GetAssemblies()\n            .Concat(ImportantAssemblies.Select(x=>x.Assembly))\n            .Distinct()\n            .Where(a => !a.IsDynamic)\n            .ToArray();\n\n    public static Task VerifyForBody(string body, bool ignoreNonInterfaces = true)\n    {\n        var source =\n            $$\"\"\"\n              using System;\n              using System.Collections.Generic;\n              using System.Linq;\n              using System.Net.Http;\n              using System.Text;\n              using System.Threading;\n              using System.Threading.Tasks;\n              using Refit;\n\n              namespace RefitGeneratorTest;\n\n              public interface IGeneratedClient\n              {\n              {{body}}\n              }\n              \"\"\";\n\n        return VerifyGenerator(source, ignoreNonInterfaces);\n    }\n\n    public static Task VerifyForType(string declarations)\n    {\n        var source =\n            $$\"\"\"\n              using System;\n              using System.Collections.Generic;\n              using System.Linq;\n              using System.Net.Http;\n              using System.Text;\n              using System.Threading;\n              using System.Threading.Tasks;\n              using Refit;\n\n              namespace RefitGeneratorTest;\n\n              {{declarations}}\n              \"\"\";\n\n        return VerifyGenerator(source);\n    }\n\n    public static Task VerifyForDeclaration(string declarations)\n    {\n        var source =\n            $$\"\"\"\n              using System;\n              using System.Collections.Generic;\n              using System.Linq;\n              using System.Net.Http;\n              using System.Text;\n              using System.Threading;\n              using System.Threading.Tasks;\n              using Refit;\n\n              {{declarations}}\n              \"\"\";\n\n        return VerifyGenerator(source);\n    }\n\n    public static CSharpCompilation CreateLibrary(params SyntaxTree[] source)\n    {\n        var references = new List<MetadataReference>();\n        var assemblies = AssemblyReferencesForCodegen;\n        foreach (var assembly in assemblies)\n        {\n            if (!assembly.IsDynamic)\n            {\n                references.Add(MetadataReference.CreateFromFile(assembly.Location));\n            }\n        }\n\n        references.Add(RefitAssembly);\n        var compilation = CSharpCompilation.Create(\n            \"compilation\",\n            source,\n            references,\n            new CSharpCompilationOptions(OutputKind.ConsoleApplication)\n        );\n\n        return compilation;\n    }\n\n    private static CSharpCompilation CreateLibrary(params string[] source)\n    {\n        return CreateLibrary(source.Select(s => CSharpSyntaxTree.ParseText(s)).ToArray());\n    }\n\n    private static Task<VerifyResult> VerifyGenerator(string source, bool ignoreNonInterfaces = true)\n    {\n        var compilation = CreateLibrary(source);\n\n        var generator = new InterfaceStubGeneratorV2();\n        var driver = CSharpGeneratorDriver.Create(generator);\n\n        var ranDriver = driver.RunGenerators(compilation);\n        var settings = new VerifySettings();\n        if (ignoreNonInterfaces)\n        {\n            settings.IgnoreGeneratedResult(x => x.HintName.Contains(\"PreserveAttribute.g.cs\", StringComparison.Ordinal));\n            settings.IgnoreGeneratedResult(x => x.HintName.Contains(\"Generated.g.cs\", StringComparison.Ordinal));\n        }\n\n        var verify = Verify(ranDriver, settings);\n        return verify.ToTask();\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/GeneratedTest.cs",
    "content": "﻿namespace Refit.GeneratorTests;\n\npublic class GeneratedTest\n{\n    [Fact]\n    public Task ShouldEmitAllFiles()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users\")]\n            Task<string> Get();\n            \"\"\", false);\n    }\n\n    [Fact]\n    public Task ShouldNotEmitFilesWhenNoRefitInterfaces()\n    {\n        // Refit should not generate any code when no valid Refit interfaces are present.\n        return Fixture.VerifyForBody(\"\", false);\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/Incremental/FunctionTest.cs",
    "content": "﻿using Microsoft.CodeAnalysis.CSharp;\n\nnamespace Refit.GeneratorTests.Incremental;\n\npublic class FunctionTest\n{\n    private const string DefaultInterface =\n        \"\"\"\n        #nullable enabled\n        using System;\n        using System.Collections.Generic;\n        using System.Linq;\n        using System.Net.Http;\n        using System.Text;\n        using System.Threading;\n        using System.Threading.Tasks;\n        using Refit;\n\n        namespace RefitGeneratorTest;\n\n        public interface IGitHubApi\n        {\n            [Get(\"/users/{user}\")]\n            Task<string> GetUser(string user);\n        }\n        \"\"\";\n\n    private const string ReturnValueInterface =\n        \"\"\"\n        #nullable enabled\n        using System;\n        using System.Collections.Generic;\n        using System.Linq;\n        using System.Net.Http;\n        using System.Text;\n        using System.Threading;\n        using System.Threading.Tasks;\n        using Refit;\n\n        namespace RefitGeneratorTest;\n\n        public interface IGitHubApi\n        {\n            [Get(\"/users/{user}\")]\n            Task<int> GetUser(string user);\n        }\n        \"\"\";\n\n    [Fact]\n    public void ModifyParameterNameDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // change parameter name\n        var newInterface =\n            \"\"\"\n            public interface IGitHubApi\n            {\n                [Get(\"/users/{myUser}\")]\n                Task<string> GetUser(string myUser);\n            }\n            \"\"\";\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(compilation1, \"IGitHubApi\", newInterface);\n\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n\n    [Fact]\n    public void ModifyParameterTypeDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // change parameter type\n        var newInterface =\n            \"\"\"\n            public interface IGitHubApi\n            {\n                [Get(\"/users/{user}\")]\n                Task<string> GetUser(int user);\n            }\n            \"\"\";\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(compilation1, \"IGitHubApi\", newInterface);\n\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n\n    [Fact]\n    public void ModifyParameterNullabilityDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // change parameter nullability\n        var newInterface =\n            \"\"\"\n            public interface IGitHubApi\n            {\n                [Get(\"/users/{user}\")]\n                Task<string> GetUser(string? user);\n            }\n            \"\"\";\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(compilation1, \"IGitHubApi\", newInterface);\n\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n\n    [Fact]\n    public void AddParameterDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // add parameter\n        var newInterface =\n            \"\"\"\n            public interface IGitHubApi\n            {\n                [Get(\"/users/{user}\")]\n                Task<string> GetUser(string user, [Query] int myParam);\n            }\n            \"\"\";\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(compilation1, \"IGitHubApi\", newInterface);\n\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n\n    [Fact]\n    public void ModifyReturnTypeDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // change return type\n        var newInterface =\n            \"\"\"\n            public interface IGitHubApi\n            {\n                [Get(\"/users/{user}\")]\n                Task<int> GetUser(string user);\n            }\n            \"\"\";\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(compilation1, \"IGitHubApi\", newInterface);\n\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n\n    [Fact]\n    public void ModifyReturnObjectNullabilityDoesNotRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // change return nullability\n        var newInterface =\n            \"\"\"\n            public interface IGitHubApi\n            {\n                [Get(\"/users/{user}\")]\n                Task<string?> GetUser(string user);\n            }\n            \"\"\";\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(compilation1, \"IGitHubApi\", newInterface);\n\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.Cached);\n    }\n\n    [Fact]\n    public void ModifyReturnValueNullabilityDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // change return nullability\n        var newInterface =\n            \"\"\"\n            public interface IGitHubApi\n            {\n                [Get(\"/users/{user}\")]\n                Task<int?> GetUser(string user);\n            }\n            \"\"\";\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(compilation1, \"IGitHubApi\", newInterface);\n\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n\n    [Fact]\n    public void AddNonRefitMethodDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // change parameter name\n        var newInterface =\n            \"\"\"\n            public interface IGitHubApi\n            {\n                [Get(\"/users/{user}\")]\n                Task<string> GetUser(string user);\n\n                void NonRefitMethod();\n            }\n            \"\"\";\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(compilation1, \"IGitHubApi\", newInterface);\n\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.Modified);\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/Incremental/GenericTest.cs",
    "content": "﻿using Microsoft.CodeAnalysis.CSharp;\n\nnamespace Refit.GeneratorTests.Incremental;\n\npublic class GenericTest\n{\n    private const string GenericInterface =\n        \"\"\"\n        using System;\n        using System.Collections.Generic;\n        using System.Linq;\n        using System.Net.Http;\n        using System.Text;\n        using System.Threading;\n        using System.Threading.Tasks;\n        using Refit;\n\n        namespace RefitGeneratorTest;\n\n        public interface IGeneratedInterface<T1>\n        {\n            [Get(\"/users\")]\n            Task<string> Get();\n        }\n        \"\"\";\n\n    [Fact]\n    public void RenameGenericTypeDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(GenericInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // rename generic type\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(\n            compilation1,\n            \"IGeneratedInterface\",\n            \"\"\"\n            public interface IGeneratedInterface<T>\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\"\n        );\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n\n    [Fact]\n    public void AddGenericConstraintDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(GenericInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // add generic constraint\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(\n            compilation1,\n            \"IGeneratedInterface\",\n            \"\"\"\n            public interface IGeneratedInterface<T1>\n                where T1 : class\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\"\n        );\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n\n        // add new generic constraint\n        var compilation3 = TestHelper.ReplaceMemberDeclaration(\n            compilation2,\n            \"IGeneratedInterface\",\n            \"\"\"\n            public interface IGeneratedInterface<T1>\n                where T1 : class, new()\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\"\n        );\n        var driver3 = driver2.RunGenerators(compilation3);\n        TestHelper.AssertRunReasons(driver3, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n\n    [Fact]\n    public void AddObjectGenericConstraintDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(GenericInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // add object generic constraint\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(\n            compilation1,\n            \"IGeneratedInterface\",\n            \"\"\"\n            public interface IGeneratedInterface<T1>\n                where T1 : IDisposable\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\"\n        );\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n\n    [Fact]\n    public void AddGenericTypeDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(GenericInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // add second generic type\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(\n            compilation1,\n            \"IGeneratedInterface\",\n            \"\"\"\n            public interface IGeneratedInterface<T1, T2>\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\"\n        );\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/Incremental/IncrementalGeneratorRunReasons.cs",
    "content": "﻿using Microsoft.CodeAnalysis;\n\nnamespace Refit.GeneratorTests.Incremental;\n\ninternal record IncrementalGeneratorRunReasons(\n    IncrementalStepRunReason BuildRefitStep,\n    IncrementalStepRunReason ReportDiagnosticsStep\n)\n{\n    public static readonly IncrementalGeneratorRunReasons New =\n        new(IncrementalStepRunReason.New, IncrementalStepRunReason.New);\n\n    public static readonly IncrementalGeneratorRunReasons Cached =\n        new(\n            // compilation step should always be modified as each time a new compilation is passed\n            IncrementalStepRunReason.Cached,\n            IncrementalStepRunReason.Unchanged\n        );\n\n    public static readonly IncrementalGeneratorRunReasons Modified = Cached with\n    {\n        ReportDiagnosticsStep = IncrementalStepRunReason.Modified,\n        BuildRefitStep = IncrementalStepRunReason.Modified,\n    };\n\n    public static readonly IncrementalGeneratorRunReasons ModifiedSource = Cached with\n    {\n        ReportDiagnosticsStep = IncrementalStepRunReason.Unchanged,\n        BuildRefitStep = IncrementalStepRunReason.Modified,\n    };\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/Incremental/IncrementalTest.cs",
    "content": "﻿using Microsoft.CodeAnalysis.CSharp;\n\nnamespace Refit.GeneratorTests.Incremental;\n\npublic class IncrementalTest\n{\n    private const string DefaultInterface =\n        \"\"\"\n        #nullable enabled\n        using System;\n        using System.Collections.Generic;\n        using System.Linq;\n        using System.Net.Http;\n        using System.Text;\n        using System.Threading;\n        using System.Threading.Tasks;\n        using Refit;\n\n        namespace RefitGeneratorTest;\n\n        public interface IGitHubApi\n        {\n            [Get(\"/users/{user}\")]\n            Task<string> GetUser(string user);\n        }\n        \"\"\";\n\n    [Fact]\n    public void AddUnrelatedTypeDoesntRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        var compilation2 = compilation1.AddSyntaxTrees(CSharpSyntaxTree.ParseText(\"struct MyValue {}\"));\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.Cached);\n    }\n\n    [Fact]\n    public void SmallChangeDoesntRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // update syntax tree by replacing interface with itself\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(\n            compilation1,\n            \"IGitHubApi\",\n            \"\"\"\n            public interface IGitHubApi\n            {\n                [Get(\"/users/{user}\")]\n                Task<string> GetUser(string user);\n            }\n            \"\"\"\n        );\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.Cached);\n    }\n\n    [Fact]\n    public void AddNewMemberDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // add unrelated member, don't change the method\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(\n            compilation1,\n            \"IGitHubApi\",\n            \"\"\"\n            public interface IGitHubApi\n            {\n                [Get(\"/users/{user}\")]\n                Task<string> GetUser(string user);\n\n                private record Temp();\n            }\n            \"\"\"\n        );\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/Incremental/InheritanceTest.cs",
    "content": "﻿using Microsoft.CodeAnalysis.CSharp;\n\nnamespace Refit.GeneratorTests.Incremental;\n\npublic class InheritanceTest\n{\n    private const string DefaultInterface =\n        \"\"\"\n        using System;\n        using System.Collections.Generic;\n        using System.Linq;\n        using System.Net.Http;\n        using System.Text;\n        using System.Threading;\n        using System.Threading.Tasks;\n        using Refit;\n\n        namespace RefitGeneratorTest;\n\n        public interface IGitHubApi\n        {\n            [Get(\"/users/{user}\")]\n            Task<string> GetUser(string user);\n        }\n        \"\"\";\n\n    private const string TwoInterface =\n        \"\"\"\n        using System;\n        using System.Collections.Generic;\n        using System.Linq;\n        using System.Net.Http;\n        using System.Text;\n        using System.Threading;\n        using System.Threading.Tasks;\n        using Refit;\n\n        namespace RefitGeneratorTest;\n\n        public interface IGitHubApi\n        {\n            [Get(\"/users/{user}\")]\n            Task<string> GetUser(string user);\n        }\n\n        public interface IBaseInterface { void NonRefitMethod(); }\n        \"\"\";\n\n    [Fact]\n    public void InheritFromIDisposableDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(DefaultInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // inherit from IDisposable\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(\n            compilation1,\n            \"IGitHubApi\",\n            \"\"\"\n            public interface IGitHubApi : IDisposable\n            {\n                [Get(\"/users/{user}\")]\n                Task<string> GetUser(string user);\n            }\n            \"\"\"\n        );\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.ModifiedSource);\n    }\n\n    [Fact]\n    public void InheritFromInterfaceDoesRegenerate()\n    {\n        var syntaxTree = CSharpSyntaxTree.ParseText(TwoInterface, CSharpParseOptions.Default);\n        var compilation1 = Fixture.CreateLibrary(syntaxTree);\n\n        var driver1 = TestHelper.GenerateTracked(compilation1);\n        TestHelper.AssertRunReasons(driver1, IncrementalGeneratorRunReasons.New);\n\n        // inherit from second interface\n        var compilation2 = TestHelper.ReplaceMemberDeclaration(\n            compilation1,\n            \"IGitHubApi\",\n            \"\"\"\n            public interface IGitHubApi : IBaseInterface\n            {\n                [Get(\"/users/{user}\")]\n                Task<string> GetUser(string user);\n            }\n            \"\"\"\n        );\n        var driver2 = driver1.RunGenerators(compilation2);\n        TestHelper.AssertRunReasons(driver2, IncrementalGeneratorRunReasons.Modified);\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/Incremental/TestHelper.cs",
    "content": "﻿using Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.Syntax;\n\nusing Refit.Generator;\n\nnamespace Refit.GeneratorTests.Incremental;\n\ninternal static class TestHelper\n{\n private static readonly GeneratorDriverOptions EnableIncrementalTrackingDriverOptions =\n        new(IncrementalGeneratorOutputKind.None, trackIncrementalGeneratorSteps: true);\n\n    internal static GeneratorDriver GenerateTracked(Compilation compilation)\n    {\n        var generator = new InterfaceStubGeneratorV2();\n\n        var driver = CSharpGeneratorDriver.Create(\n            new[] { generator.AsSourceGenerator() },\n            driverOptions: EnableIncrementalTrackingDriverOptions\n        );\n        return driver.RunGenerators(compilation);\n    }\n\n    internal static CSharpCompilation ReplaceMemberDeclaration(\n        CSharpCompilation compilation,\n        string memberName,\n        string newMember\n    )\n    {\n        var syntaxTree = compilation.SyntaxTrees.Single();\n        var memberDeclaration = syntaxTree\n            .GetCompilationUnitRoot()\n            .DescendantNodes()\n            .OfType<TypeDeclarationSyntax>()\n            .Single(x => x.Identifier.Text == memberName);\n        var updatedMemberDeclaration = SyntaxFactory.ParseMemberDeclaration(newMember)!;\n\n        var newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceNode(memberDeclaration, updatedMemberDeclaration);\n        var newTree = syntaxTree.WithRootAndOptions(newRoot, syntaxTree.Options);\n\n        return compilation.ReplaceSyntaxTree(compilation.SyntaxTrees.First(), newTree);\n    }\n\n    internal static CSharpCompilation ReplaceLocalDeclaration(\n        CSharpCompilation compilation,\n        string variableName,\n        string newDeclaration\n    )\n    {\n        var syntaxTree = compilation.SyntaxTrees.Single();\n\n        var memberDeclaration = syntaxTree\n            .GetCompilationUnitRoot()\n            .DescendantNodes()\n            .OfType<LocalDeclarationStatementSyntax>()\n            .Single(x => x.Declaration.Variables.Any(x => x.Identifier.ToString() == variableName));\n        var updatedMemberDeclaration = SyntaxFactory.ParseStatement(newDeclaration)!;\n\n        var newRoot = syntaxTree.GetCompilationUnitRoot().ReplaceNode(memberDeclaration, updatedMemberDeclaration);\n        var newTree = syntaxTree.WithRootAndOptions(newRoot, syntaxTree.Options);\n\n        return compilation.ReplaceSyntaxTree(compilation.SyntaxTrees.First(), newTree);\n    }\n\n    internal static void AssertRunReasons(\n        GeneratorDriver driver,\n        IncrementalGeneratorRunReasons reasons,\n        int outputIndex = 0\n    )\n    {\n        var runResult = driver.GetRunResult().Results[0];\n\n        AssertRunReason(\n            runResult,\n            RefitGeneratorStepName.ReportDiagnostics,\n            reasons.ReportDiagnosticsStep,\n            outputIndex\n        );\n        AssertRunReason(runResult, RefitGeneratorStepName.BuildRefit, reasons.BuildRefitStep, outputIndex);\n    }\n\n    private static void AssertRunReason(\n        GeneratorRunResult runResult,\n        string stepName,\n        IncrementalStepRunReason expectedStepReason,\n        int outputIndex\n    )\n    {\n        var actualStepReason = runResult\n            .TrackedSteps[stepName]\n            .SelectMany(x => x.Outputs)\n            .ElementAt(outputIndex)\n            .Reason;\n        Assert.Equal(expectedStepReason, actualStepReason);\n    }\n}\n\ninternal static class RefitGeneratorStepName\n{\n    public const string ReportDiagnostics = \"ReportDiagnostics\";\n    public const string BuildRefit = \"BuildRefit\";\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/InterfaceTests.cs",
    "content": "﻿namespace Refit.GeneratorTests;\n\npublic class InterfaceTests\n{\n    [Fact]\n    public Task ContainedInterfaceTest()\n    {\n        return Fixture.VerifyForType(\n            \"\"\"\n            public class ContainerType\n            {\n                public interface IContainedInterface\n                {\n                    [Get(\"/users\")]\n                    Task<string> Get();\n                }\n            }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task RefitInterfaceDerivedFromRefitBaseTest()\n    {\n        return Fixture.VerifyForType(\n            \"\"\"\n            public interface IGeneratedInterface : IBaseInterface\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n\n            public interface IBaseInterface\n            {\n                [Get(\"/posts\")]\n                Task<string> GetPosts();\n            }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task RefitInterfaceDerivedFromBaseTest()\n    {\n        return Fixture.VerifyForType(\n            \"\"\"\n            public interface IGeneratedInterface : IBaseInterface\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n\n            public interface IBaseInterface\n            {\n                void NonRefitMethod();\n            }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task InterfaceDerivedFromRefitBaseTest()\n    {\n        return Fixture.VerifyForType(\n            \"\"\"\n            public interface IBaseInterface\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n\n            public interface IDerivedInterface : IBaseInterface { }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task DefaultInterfaceMethod()\n    {\n        return Fixture.VerifyForType(\n            \"\"\"\n            public interface IGeneratedInterface\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n\n                void Default() {{ Console.WriteLine(\"Default\"); }}\n            }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task DerivedDefaultInterfaceMethod()\n    {\n        return Fixture.VerifyForType(\n            \"\"\"\n            public interface IGeneratedInterface : IBaseInterface\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n\n            public interface IBaseInterface\n            {\n                [Get(\"/posts\")]\n                Task<string> GetPosts();\n\n                void Default() {{ Console.WriteLine(\"Default\"); }}\n            }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task InterfacesWithDifferentCasing()\n    {\n        return Fixture.VerifyForType(\n            \"\"\"\n            public interface IApi\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n\n            public interface Iapi\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task InterfacesWithDifferentSignature()\n    {\n        return Fixture.VerifyForType(\n            \"\"\"\n            public interface IApi\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n\n            public interface IApi<T>\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task NestedNamespaceTest()\n    {\n        return Fixture.VerifyForDeclaration(\n            \"\"\"\n            namespace Nested.RefitGeneratorTest;\n\n            public interface IGeneratedInterface\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task GlobalNamespaceTest()\n    {\n        return Fixture.VerifyForDeclaration(\n            \"\"\"\n            public interface IGeneratedInterface\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task DisposableTest()\n    {\n        return Fixture.VerifyForDeclaration(\n            \"\"\"\n            public interface IGeneratedInterface : IDisposable\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\");\n    }\n\n    [Fact]\n    public Task NonRefitMethodShouldRaiseDiagnostic()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users\")]\n            Task<string> Get();\n\n            void NonRefitMethod();\n            \"\"\");\n    }\n\n    [Fact]\n    public Task InterfaceWithGenericConstraint()\n    {\n        return Fixture.VerifyForDeclaration(\n            \"\"\"\n            public interface IGeneratedInterface<T1, T2, T3, T4, T5>\n                where T1 : class\n                where T2 : unmanaged\n                where T3 : struct\n                where T4 : notnull\n                where T5 : class, IDisposable, new()\n            {\n                [Get(\"/users\")]\n                Task<string> Get();\n            }\n            \"\"\");\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/MethodTests.cs",
    "content": "﻿namespace Refit.GeneratorTests;\n\npublic class MethodTests\n{\n    [Fact]\n    public Task MethodsWithGenericConstraints()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users\")]\n            Task<string> Get<T1, T2, T3, T4, T5>()\n                where T1 : class\n                where T2 : unmanaged\n                where T3 : struct\n                where T4 : notnull\n                where T5 : class, IDisposable, new();\n\n            void NonRefitMethod<T1, T2, T3, T4, T5>()\n                where T1 : class\n                where T2 : unmanaged\n                where T3 : struct\n                where T4 : notnull\n                where T5 : class, IDisposable, new();\n            \"\"\");\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/ModuleInitializer.cs",
    "content": "﻿using System.Runtime.CompilerServices;\nusing VerifyTests.DiffPlex;\n\nnamespace Refit.GeneratorTests;\n\npublic static class ModuleInitializer\n{\n    // ModuleInitializer should only be used in apps\n#pragma warning disable CA2255\n    [ModuleInitializer]\n#pragma warning restore CA2255\n    public static void Init()\n    {\n        DerivePathInfo((file, _, type, method) => new(Path.Combine(Path.GetDirectoryName(file), \"_snapshots\"), type.Name, method.Name));\n\n        VerifySourceGenerators.Initialize();\n        VerifyDiffPlex.Initialize(OutputType.Compact);\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/ParameterTests.cs",
    "content": "﻿namespace Refit.GeneratorTests;\n\npublic class ParameterTests\n{\n    [Fact]\n    public Task RouteParameter()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users/{user}\")]\n            Task<string> Get(string user);\n            \"\"\");\n    }\n\n    [Fact]\n    public Task NullableRouteParameter()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users/{user}\")]\n            Task<string> Get(string? user);\n            \"\"\");\n    }\n\n    [Fact]\n    public Task ValueTypeRouteParameter()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users/{user}\")]\n            Task<string> Get(int user);\n            \"\"\");\n    }\n\n    [Fact]\n    public Task NullableValueTypeRouteParameter()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users/{user}\")]\n            Task<string> Get(int? user);\n            \"\"\");\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/Refit.GeneratorTests.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <Import Project=\"..\\Refit\\targets\\refit.props\" />\n\n  <PropertyGroup>\n    <TargetFrameworks>net8.0;net9.0</TargetFrameworks>\n    <ImplicitUsings>enable</ImplicitUsings>\n    <Nullable>enable</Nullable>\n\n    <IsPackable>false</IsPackable>\n    <IsTestProject>true</IsTestProject>\n    <NoWarn>$(NoWarn);CS1591;CA1819;CA2000;CA2007;CA1056;CA1707;CA1861;xUnit1031</NoWarn>\n  </PropertyGroup>\n  <ItemGroup Condition=\"$(TargetFramework.StartsWith('net9.0'))\">\n    <PackageReference Include=\"Microsoft.AspNetCore.WebUtilities\" Version=\"9.0.*\" />\n  </ItemGroup>\n\n  <ItemGroup Condition=\"$(TargetFramework.StartsWith('net8.0'))\">\n    <PackageReference Include=\"Microsoft.AspNetCore.WebUtilities\" Version=\"8.0.*\" />\n  </ItemGroup>\n  <ItemGroup>\n    <PackageReference Include=\"System.Formats.Asn1\" Version=\"9.0.*\" />\n    <PackageReference Include=\"coverlet.collector\" Version=\"8.0.1\" />\n    <PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"18.3.0\" />\n     <PackageReference Include=\"System.Text.RegularExpressions\" Version=\"4.3.1\" /> \n    <PackageReference Include=\"xunit\" Version=\"2.9.3\" />\n    <PackageReference Include=\"xunit.runner.visualstudio\" Version=\"3.1.5\" />\n    <PackageReference Include=\"System.Collections.Immutable\" Version=\"9.0.*\" />\n    <PackageReference Include=\"Verify.DiffPlex\" Version=\"3.1.2\" />\n    <PackageReference Include=\"Verify.SourceGenerators\" Version=\"2.5.0\" />\n    <PackageReference Include=\"Verify.Xunit\" Version=\"31.12.5\" />\n    <PackageReference Include=\"System.Reactive\" Version=\"6.1.0\" />\n    <PackageReference Include=\"Microsoft.CodeAnalysis.CSharp.Workspaces\" Version=\"4.11.0\" />\n    <PackageReference Include=\"Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing\" Version=\"1.1.3\" />\n    <ProjectReference Include=\"..\\Refit.Newtonsoft.Json\\Refit.Newtonsoft.Json.csproj\" />\n    <ProjectReference Include=\"..\\Refit.Xml\\Refit.Xml.csproj\" />\n    <ProjectReference Include=\"..\\InterfaceStubGenerator.Roslyn38\\InterfaceStubGenerator.Roslyn38.csproj\" OutputItemType=\"Analyzer\" ReferenceOutputAssembly=\"true\" />\n    <ProjectReference Include=\"..\\InterfaceStubGenerator.Roslyn41\\InterfaceStubGenerator.Roslyn41.csproj\" />\n    <ProjectReference Include=\"..\\Refit\\Refit.csproj\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <None Include=\"..\\Refit.GeneratorTests\\_snapshots\\**\">\n      <Link>%(RecursiveDir)\\resources\\%(Filename)%(Extension)</Link>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </None>\n    <Using Include=\"Xunit\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <Folder Include=\"_snapshots\\\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "Refit.GeneratorTests/ReturnTypeTests.cs",
    "content": "﻿namespace Refit.GeneratorTests;\n\npublic class ReturnTypeTests\n{\n    [Fact]\n    public Task GenericTaskShouldWork()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users\")]\n            Task<string> Get();\n            \"\"\");\n    }\n\n    [Fact]\n    public Task ReturnNullableObject()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users\")]\n            Task<string?> Get();\n            \"\"\");\n    }\n\n    [Fact]\n    public Task ReturnNullableValueType()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users\")]\n            Task<int?> Get();\n            \"\"\");\n    }\n\n    [Fact]\n    public Task VoidTaskShouldWork()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Post(\"/users\")]\n            Task Post();\n            \"\"\");\n    }\n\n    [Fact]\n    public Task GenericConstraintReturnTask()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users\")]\n            Task<string> Get<T>() where T : class, IDisposable, new();\n            \"\"\");\n    }\n\n    [Fact]\n    public Task GenericUnmanagedConstraintReturnTask()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users\")]\n            Task<string> Get<T>() where T : unmanaged;\n            \"\"\");\n    }\n\n    [Fact]\n    public Task GenericStructConstraintReturnTask()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users\")]\n            Task<string> Get<T>() where T : struct\n            \"\"\");\n    }\n\n    [Fact]\n    public Task ReturnIObservable()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users/{user}\")]\n            IObservable<HttpResponseMessage> GetUser(string user);\n            \"\"\");\n    }\n\n    [Fact]\n    public Task ReturnUnsupportedType()\n    {\n        return Fixture.VerifyForBody(\n            \"\"\"\n            [Get(\"/users/{user}\")]\n            string GetUser(string user);\n            \"\"\");\n    }\n}\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/GeneratedTest.ShouldEmitAllFiles#Generated.g.verified.cs",
    "content": "﻿//HintName: Generated.g.cs\n\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    internal static partial class Generated\n    {\n#if NET5_0_OR_GREATER\n        [System.Runtime.CompilerServices.ModuleInitializer]\n        [System.Diagnostics.CodeAnalysis.DynamicDependency(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All, typeof(global::Refit.Implementation.Generated))]\n        public static void Initialize()\n        {\n        }\n#endif\n    }\n}\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/GeneratedTest.ShouldEmitAllFiles#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/GeneratedTest.ShouldEmitAllFiles#PreserveAttribute.g.verified.cs",
    "content": "﻿//HintName: PreserveAttribute.g.cs\n\n#pragma warning disable\nnamespace RefitInternalGenerated\n{\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    [global::System.AttributeUsage (global::System.AttributeTargets.Class | global::System.AttributeTargets.Struct | global::System.AttributeTargets.Enum | global::System.AttributeTargets.Constructor | global::System.AttributeTargets.Method | global::System.AttributeTargets.Property | global::System.AttributeTargets.Field | global::System.AttributeTargets.Event | global::System.AttributeTargets.Interface | global::System.AttributeTargets.Delegate)]\n    sealed class PreserveAttribute : global::System.Attribute\n    {\n        //\n        // Fields\n        //\n        public bool AllMembers;\n\n        public bool Conditional;\n    }\n}\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.ContainedInterfaceTest#IContainedInterface.g.verified.cs",
    "content": "﻿//HintName: IContainedInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestContainerTypeIContainedInterface\n        : global::RefitGeneratorTest.ContainerType.IContainedInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestContainerTypeIContainedInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.DefaultInterfaceMethod#IGeneratedInterface.g.verified.cs",
    "content": "﻿//HintName: IGeneratedInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedInterface\n        : global::RefitGeneratorTest.IGeneratedInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.DerivedDefaultInterfaceMethod#IBaseInterface.g.verified.cs",
    "content": "﻿//HintName: IBaseInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIBaseInterface\n        : global::RefitGeneratorTest.IBaseInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIBaseInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> GetPosts()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetPosts\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.DerivedDefaultInterfaceMethod#IGeneratedInterface.g.verified.cs",
    "content": "﻿//HintName: IGeneratedInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedInterface\n        : global::RefitGeneratorTest.IGeneratedInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        async global::System.Threading.Tasks.Task<string> global::RefitGeneratorTest.IBaseInterface.GetPosts()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetPosts\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.DisposableTest#IGeneratedInterface.g.verified.cs",
    "content": "﻿//HintName: IGeneratedInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class IGeneratedInterface\n        : global::IGeneratedInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public IGeneratedInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        void global::System.IDisposable.Dispose()\n        {\n                Client?.Dispose();\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.GlobalNamespaceTest#IGeneratedInterface.g.verified.cs",
    "content": "﻿//HintName: IGeneratedInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class IGeneratedInterface\n        : global::IGeneratedInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public IGeneratedInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.InterfaceDerivedFromRefitBaseTest#IBaseInterface.g.verified.cs",
    "content": "﻿//HintName: IBaseInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIBaseInterface\n        : global::RefitGeneratorTest.IBaseInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIBaseInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.InterfaceDerivedFromRefitBaseTest#IDerivedInterface.g.verified.cs",
    "content": "﻿//HintName: IDerivedInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIDerivedInterface\n        : global::RefitGeneratorTest.IDerivedInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIDerivedInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        async global::System.Threading.Tasks.Task<string> global::RefitGeneratorTest.IBaseInterface.Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.InterfaceWithGenericConstraint#IGeneratedInterface.g.verified.cs",
    "content": "﻿//HintName: IGeneratedInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class IGeneratedInterface<T1, T2, T3, T4, T5>\n        : global::IGeneratedInterface<T1, T2, T3, T4, T5>\n        where T1 : class\n        where T2 : unmanaged\n        where T3 : struct\n        where T4 : notnull\n        where T5 : class, global::System.IDisposable, new()\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public IGeneratedInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.InterfacesWithDifferentCasing#IApi.g.verified.cs",
    "content": "﻿//HintName: IApi.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIApi\n        : global::RefitGeneratorTest.IApi\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIApi(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.InterfacesWithDifferentCasing#Iapi1.g.verified.cs",
    "content": "﻿//HintName: Iapi1.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIapi\n        : global::RefitGeneratorTest.Iapi\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIapi(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.InterfacesWithDifferentSignature#IApi.g.verified.cs",
    "content": "﻿//HintName: IApi.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIApi\n        : global::RefitGeneratorTest.IApi\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIApi(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.InterfacesWithDifferentSignature#IApi1.g.verified.cs",
    "content": "﻿//HintName: IApi1.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIApi<T>\n        : global::RefitGeneratorTest.IApi<T>\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIApi(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.NestedNamespaceTest#IGeneratedInterface.g.verified.cs",
    "content": "﻿//HintName: IGeneratedInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class NestedRefitGeneratorTestIGeneratedInterface\n        : global::Nested.RefitGeneratorTest.IGeneratedInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public NestedRefitGeneratorTestIGeneratedInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.NonRefitMethodShouldRaiseDiagnostic#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        public void NonRefitMethod()\n        {\n            throw new global::System.NotImplementedException(\"Either this method has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument.\");\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.NonRefitMethodShouldRaiseDiagnostic.verified.txt",
    "content": "﻿{\n  Diagnostics: [\n    {\n      Location: /*\n\nvoid NonRefitMethod();\n     ^^^^^^^^^^^^^^\n}\n*/\n : (16,5)-(16,19),\n      Message: Method IGeneratedClient.NonRefitMethod either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument,\n      Severity: Warning,\n      WarningLevel: 1,\n      Descriptor: {\n        Id: RF001,\n        Title: Refit types must have Refit HTTP method attributes,\n        MessageFormat: Method {0}.{1} either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument,\n        Category: Refit,\n        DefaultSeverity: Warning,\n        IsEnabledByDefault: true\n      }\n    }\n  ]\n}"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.RefitInterfaceDerivedFromBaseTest#IGeneratedInterface.g.verified.cs",
    "content": "﻿//HintName: IGeneratedInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedInterface\n        : global::RefitGeneratorTest.IGeneratedInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        void global::RefitGeneratorTest.IBaseInterface.NonRefitMethod()\n        {\n            throw new global::System.NotImplementedException(\"Either this method has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument.\");\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.RefitInterfaceDerivedFromBaseTest.verified.txt",
    "content": "﻿{\n  Diagnostics: [\n    {\n      Location: /*\n{\n    void NonRefitMethod();\n         ^^^^^^^^^^^^^^\n}\n*/\n : (19,9)-(19,23),\n      Message: Method IBaseInterface.NonRefitMethod either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument,\n      Severity: Warning,\n      WarningLevel: 1,\n      Descriptor: {\n        Id: RF001,\n        Title: Refit types must have Refit HTTP method attributes,\n        MessageFormat: Method {0}.{1} either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument,\n        Category: Refit,\n        DefaultSeverity: Warning,\n        IsEnabledByDefault: true\n      }\n    }\n  ]\n}"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.RefitInterfaceDerivedFromRefitBaseTest#IBaseInterface.g.verified.cs",
    "content": "﻿//HintName: IBaseInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIBaseInterface\n        : global::RefitGeneratorTest.IBaseInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIBaseInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> GetPosts()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetPosts\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/InterfaceTests.RefitInterfaceDerivedFromRefitBaseTest#IGeneratedInterface.g.verified.cs",
    "content": "﻿//HintName: IGeneratedInterface.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedInterface\n        : global::RefitGeneratorTest.IGeneratedInterface\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedInterface(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        async global::System.Threading.Tasks.Task<string> global::RefitGeneratorTest.IBaseInterface.GetPosts()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetPosts\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/MethodTests.MethodsWithGenericConstraints#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get<T1, T2, T3, T4, T5>()\n            where T1 : class\n            where T2 : unmanaged\n            where T3 : struct\n            where T4 : notnull\n            where T5 : class, global::System.IDisposable, new()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>(), new global::System.Type[] { typeof(T1), typeof(T2), typeof(T3), typeof(T4), typeof(T5) } );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        public void NonRefitMethod<T1, T2, T3, T4, T5>()\n            where T1 : class\n            where T2 : unmanaged\n            where T3 : struct\n            where T4 : notnull\n            where T5 : class, global::System.IDisposable, new()\n        {\n            throw new global::System.NotImplementedException(\"Either this method has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument.\");\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/MethodTests.MethodsWithGenericConstraints.verified.txt",
    "content": "﻿{\n  Diagnostics: [\n    {\n      Location: /*\n\nvoid NonRefitMethod<T1, T2, T3, T4, T5>()\n     ^^^^^^^^^^^^^^\n    where T1 : class\n*/\n : (21,5)-(21,19),\n      Message: Method IGeneratedClient.NonRefitMethod either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument,\n      Severity: Warning,\n      WarningLevel: 1,\n      Descriptor: {\n        Id: RF001,\n        Title: Refit types must have Refit HTTP method attributes,\n        MessageFormat: Method {0}.{1} either has no Refit HTTP method attribute or you've used something other than a string literal for the 'path' argument,\n        Category: Refit,\n        DefaultSeverity: Warning,\n        IsEnabledByDefault: true\n      }\n    }\n  ]\n}"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ParameterTests.NullableRouteParameter#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        private static readonly global::System.Type[] ______typeParameters = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get(string? @user)\n        {\n            var ______arguments = new object[] { @user };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", ______typeParameters );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ParameterTests.NullableValueTypeRouteParameter#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        private static readonly global::System.Type[] ______typeParameters = new global::System.Type[] {typeof(int?) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get(int? @user)\n        {\n            var ______arguments = new object[] { @user };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", ______typeParameters );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ParameterTests.RouteParameter#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        private static readonly global::System.Type[] ______typeParameters = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get(string @user)\n        {\n            var ______arguments = new object[] { @user };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", ______typeParameters );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ParameterTests.ValueTypeRouteParameter#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        private static readonly global::System.Type[] ______typeParameters = new global::System.Type[] {typeof(int) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get(int @user)\n        {\n            var ______arguments = new object[] { @user };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", ______typeParameters );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ReturnTypeTests.GenericConstraintReturnTask#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get<T>()\n            where T : class, global::System.IDisposable, new()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>(), new global::System.Type[] { typeof(T) } );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ReturnTypeTests.GenericStructConstraintReturnTask#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get<T>()\n            where T : struct\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>(), new global::System.Type[] { typeof(T) } );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ReturnTypeTests.GenericTaskShouldWork#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ReturnTypeTests.GenericUnmanagedConstraintReturnTask#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get<T>()\n            where T : unmanaged\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>(), new global::System.Type[] { typeof(T) } );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ReturnTypeTests.ReturnIObservable#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        private static readonly global::System.Type[] ______typeParameters = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public global::System.IObservable<global::System.Net.Http.HttpResponseMessage> GetUser(string @user)\n        {\n            var ______arguments = new object[] { @user };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUser\", ______typeParameters );\n\n            return (global::System.IObservable<global::System.Net.Http.HttpResponseMessage>)______func(this.Client, ______arguments);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ReturnTypeTests.ReturnNullableObject#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<string> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<string>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ReturnTypeTests.ReturnNullableValueType#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<int?> Get()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Get\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<int?>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ReturnTypeTests.ReturnUnsupportedType#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        private static readonly global::System.Type[] ______typeParameters = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public string GetUser(string @user)\n        {\n            var ______arguments = new object[] { @user };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUser\", ______typeParameters );\n\n            return (string)______func(this.Client, ______arguments);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.GeneratorTests/_snapshots/ReturnTypeTests.VoidTaskShouldWork#IGeneratedClient.g.verified.cs",
    "content": "﻿//HintName: IGeneratedClient.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitGeneratorTestIGeneratedClient\n        : global::RefitGeneratorTest.IGeneratedClient\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitGeneratorTestIGeneratedClient(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task Post()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"Post\", global::System.Array.Empty<global::System.Type>() );\n\n            await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.HttpClientFactory/HttpClientFactoryCore.cs",
    "content": "﻿\nusing System;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Http;\n\nnamespace Refit\n{\n    /// <summary>\n    /// HttpClientFactoryExtensions\n    /// </summary>\n    internal static class HttpClientFactoryCore\n    {\n\n        internal static IHttpClientBuilder AddRefitClientCore(\n             IServiceCollection services,\n             Type refitInterfaceType,\n             Func<IServiceProvider, RefitSettings?>? settings,\n             string? httpClientName\n         )\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n\n            // register settings\n            var settingsType = typeof(SettingsFor<>).MakeGenericType(refitInterfaceType);\n            services.AddSingleton(\n                settingsType,\n                provider => Activator.CreateInstance(\n                    typeof(SettingsFor<>).MakeGenericType(refitInterfaceType)!,\n                    settings?.Invoke(provider)\n                )!\n            );\n\n            // register RequestBuilder\n            var requestBuilderType = typeof(IRequestBuilder<>).MakeGenericType(refitInterfaceType);\n            services.AddSingleton(\n                requestBuilderType,\n                provider => RequestBuilderGenericForTypeMethod\n                    .MakeGenericMethod(refitInterfaceType)\n                    .Invoke(\n                        null,\n                        [((ISettingsFor)provider.GetRequiredService(settingsType)).Settings]\n                    )!\n            );\n\n            // create HttpClientBuilder\n            var builder = services.AddHttpClient(httpClientName ?? UniqueName.ForType(refitInterfaceType));\n\n            // configure message handler\n            builder.ConfigureHttpMessageHandlerBuilder(builderConfig =>\n            {\n                var handler = CreateInnerHandlerIfProvided(\n                    ((ISettingsFor)builderConfig.Services.GetRequiredService(settingsType)).Settings\n                );\n                if (handler != null)\n                {\n                    builderConfig.PrimaryHandler = handler;\n                }\n            });\n\n            // add typed client (register transient that resolves HttpClient from IHttpClientFactory and creates Refit client)\n            builder.Services.AddTransient(\n                refitInterfaceType,\n                s =>\n                {\n                    var httpClientFactory = s.GetRequiredService<IHttpClientFactory>();\n                    var httpClient = httpClientFactory.CreateClient(builder.Name);\n                    return RestService.For(\n                        refitInterfaceType,\n                        httpClient,\n                        (IRequestBuilder)s.GetRequiredService(requestBuilderType)\n                    );\n                }\n            );\n\n            return builder;\n        }\n\n        internal static IHttpClientBuilder AddKeyedRefitClientCore(\n            IServiceCollection services,\n            Type refitInterfaceType,\n            object? serviceKey,\n            Func<IServiceProvider, RefitSettings?>? settings,\n            string? httpClientName\n        )\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n\n            // register settings\n            var settingsType = typeof(SettingsFor<>).MakeGenericType(refitInterfaceType);\n            services.AddKeyedSingleton(\n                settingsType,\n                serviceKey,\n                (provider, _) => Activator.CreateInstance(\n                    typeof(SettingsFor<>).MakeGenericType(refitInterfaceType)!,\n                    settings?.Invoke(provider)\n                )!\n            );\n\n            // register RequestBuilder\n            var requestBuilderType = typeof(IRequestBuilder<>).MakeGenericType(refitInterfaceType);\n            services.AddKeyedSingleton(\n                requestBuilderType,\n                serviceKey,\n                (provider, _) => RequestBuilderGenericForTypeMethod\n                    .MakeGenericMethod(refitInterfaceType)\n                    .Invoke(\n                        null,\n                        [((ISettingsFor)provider.GetRequiredKeyedService(settingsType, serviceKey)).Settings]\n                    )!\n            );\n\n            // create HttpClientBuilder\n            var builder = services.AddHttpClient(httpClientName ?? UniqueName.ForType(refitInterfaceType, serviceKey));\n\n            // configure primary handler\n            builder.ConfigurePrimaryHttpMessageHandler(serviceProvider =>\n            {\n                var settingsInstance = (ISettingsFor)serviceProvider.GetRequiredKeyedService(settingsType, serviceKey);\n                return settingsInstance.Settings?.HttpMessageHandlerFactory?.Invoke() ?? new HttpClientHandler();\n            });\n\n            // configure additional handlers\n            builder.ConfigureAdditionalHttpMessageHandlers((handlers, serviceProvider) =>\n            {\n                var settingsInstance = (ISettingsFor)serviceProvider.GetRequiredKeyedService(settingsType, serviceKey);\n                if (settingsInstance.Settings?.AuthorizationHeaderValueGetter is { } getToken)\n                {\n                    handlers.Add(new AuthenticatedHttpClientHandler(null, getToken));\n                }\n            });\n\n            // add keyed typed client (register keyed transient that resolves HttpClient and creates Refit client)\n            builder.Services.AddKeyedTransient(\n                refitInterfaceType,\n                serviceKey,\n                (s, _) =>\n                {\n                    var httpClientFactory = s.GetRequiredService<IHttpClientFactory>();\n                    var httpClient = httpClientFactory.CreateClient(builder.Name);\n                    return RestService.For(\n                        refitInterfaceType,\n                        httpClient,\n                        (IRequestBuilder)s.GetRequiredKeyedService(requestBuilderType, serviceKey)\n                    );\n                }\n            );\n\n            return builder;\n        }\n\n        internal static IHttpClientBuilder AddRefitClientCore<T>(\n            IServiceCollection services,\n            Type refitInterfaceType,\n            Func<IServiceProvider, RefitSettings?>? settings,\n            string? httpClientName\n        ) where T : class\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n\n            // register settings\n            services.AddSingleton(provider => new SettingsFor<T>(settings?.Invoke(provider)));\n\n            // register RequestBuilder\n            services.AddSingleton(provider =>\n                RequestBuilder.ForType<T>(provider.GetRequiredService<SettingsFor<T>>().Settings)\n            );\n\n            // create HttpClientBuilder\n            var builder = services.AddHttpClient(httpClientName ?? UniqueName.ForType<T>());\n\n            // configure message handler\n            builder.ConfigureHttpMessageHandlerBuilder(builderConfig =>\n            {\n                var handler = CreateInnerHandlerIfProvided(\n                    builderConfig.Services.GetRequiredService<SettingsFor<T>>().Settings\n                );\n                if (handler != null)\n                {\n                    builderConfig.PrimaryHandler = handler;\n                }\n            });\n\n            // add typed client using framework AddTypedClient\n            return builder.AddTypedClient((client, serviceProvider) =>\n                RestService.For<T>(\n                    client,\n                    serviceProvider.GetRequiredService<IRequestBuilder<T>>()\n                )\n            );\n        }\n\n        internal static IHttpClientBuilder AddKeyedRefitClientCore<T>(\n            IServiceCollection services,\n            Type refitInterfaceType,\n            object? serviceKey,\n            Func<IServiceProvider, RefitSettings?>? settings,\n            string? httpClientName\n        ) where T : class\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n\n            // register settings\n            services.AddKeyedSingleton(\n                serviceKey,\n                (provider, _) => new SettingsFor<T>(settings?.Invoke(provider))\n            );\n\n            // register RequestBuilder\n            services.AddKeyedSingleton(\n                serviceKey,\n                (provider, _) =>\n                    RequestBuilder.ForType<T>(\n                        provider.GetRequiredKeyedService<SettingsFor<T>>(serviceKey).Settings\n                    )\n            );\n\n            // create HttpClientBuilder\n            var builder = services.AddHttpClient(httpClientName ?? UniqueName.ForType<T>(serviceKey));\n\n            // configure primary handler\n            builder.ConfigurePrimaryHttpMessageHandler(serviceProvider =>\n            {\n                var settingsInstance = serviceProvider.GetRequiredKeyedService<SettingsFor<T>>(serviceKey).Settings;\n                return settingsInstance?.HttpMessageHandlerFactory?.Invoke() ?? new HttpClientHandler();\n            });\n\n            // configure additional handlers\n            builder.ConfigureAdditionalHttpMessageHandlers((handlers, serviceProvider) =>\n            {\n                var settingsInstance = serviceProvider.GetRequiredKeyedService<SettingsFor<T>>(serviceKey).Settings;\n                if (settingsInstance?.AuthorizationHeaderValueGetter is { } getToken)\n                {\n                    handlers.Add(new AuthenticatedHttpClientHandler(null, getToken));\n                }\n            });\n\n            // add keyed typed client (inline keyed registration)\n            builder.Services.AddKeyedTransient(\n                serviceKey,\n                (s, _) =>\n                {\n                    var httpClientFactory = s.GetRequiredService<IHttpClientFactory>();\n                    var httpClient = httpClientFactory.CreateClient(builder.Name);\n                    return RestService.For<T>(\n                        httpClient,\n                        s.GetRequiredKeyedService<IRequestBuilder<T>>(serviceKey)\n                    );\n                }\n            );\n\n            return builder;\n        }\n\n        // helper - used by AddRefitClientCore and AddRefitClientCore<T>\n        private static HttpMessageHandler? CreateInnerHandlerIfProvided(RefitSettings? settings)\n        {\n            HttpMessageHandler? innerHandler = null;\n            if (settings != null)\n            {\n                if (settings.HttpMessageHandlerFactory != null)\n                {\n                    innerHandler = settings.HttpMessageHandlerFactory();\n                }\n\n                if (settings.AuthorizationHeaderValueGetter != null)\n                {\n                    innerHandler = new AuthenticatedHttpClientHandler(\n                        settings.AuthorizationHeaderValueGetter,\n                        innerHandler\n                    );\n                }\n            }\n\n            return innerHandler;\n        }\n\n        private static readonly MethodInfo RequestBuilderGenericForTypeMethod =\n            typeof(RequestBuilder)\n                .GetMethods(BindingFlags.Public | BindingFlags.Static)\n                .Single(z => z.IsGenericMethodDefinition && z.GetParameters().Length == 1);\n    }\n}\n"
  },
  {
    "path": "Refit.HttpClientFactory/HttpClientFactoryExtensions.cs",
    "content": "﻿using System;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Reflection;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Http;\n\nnamespace Refit\n{\n    /// <summary>\n    /// HttpClientFactoryExtensions.\n    /// </summary>\n    public static class HttpClientFactoryExtensions\n    {\n        /// <summary>\n        /// Adds a Refit client to the DI container\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Type of the Refit interface</param>\n        /// <param name=\"services\">container</param>\n        /// <param name=\"settings\">Optional. Settings to configure the instance with</param>\n        /// <param name=\"httpClientName\">Optional. Allows users to change the HttpClient name.</param>\n        /// <returns></returns>\n        public static IHttpClientBuilder AddRefitClient(\n            this IServiceCollection services,\n            Type refitInterfaceType,\n            RefitSettings? settings = null,\n            string? httpClientName = null\n        )\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n\n            return HttpClientFactoryCore.AddRefitClientCore(services, refitInterfaceType, _ => settings, httpClientName);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container with a specified service key\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Type of the Refit interface</param>\n        /// <param name=\"services\">container</param>\n        /// <param name=\"serviceKey\">An optional key to associate with the specific Refit client instance</param>\n        /// <param name=\"settings\">Optional. Settings to configure the instance with</param>\n        /// <param name=\"httpClientName\">Optional. Allows users to change the HttpClient name.</param>\n        /// <returns></returns>\n        public static IHttpClientBuilder AddKeyedRefitClient(\n            this IServiceCollection services,\n            Type refitInterfaceType,\n            object? serviceKey,\n            RefitSettings? settings = null,\n            string? httpClientName = null\n        )\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n\n            return HttpClientFactoryCore.AddKeyedRefitClientCore(services, refitInterfaceType, serviceKey, _ => settings, httpClientName);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the Refit interface</typeparam>\n        /// <param name=\"services\">container</param>\n        /// <param name=\"settings\">Optional. Settings to configure the instance with</param>\n        /// <param name=\"httpClientName\">Optional. Allows users to change the HttpClient name.</param>\n        /// <returns></returns>\n        public static IHttpClientBuilder AddRefitClient<T>(\n            this IServiceCollection services,\n            RefitSettings? settings = null,\n            string? httpClientName = null\n        )\n            where T : class\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n\n            return HttpClientFactoryCore.AddRefitClientCore<T>(services, typeof(T), _ => settings, httpClientName);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container with a specified service key\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the Refit interface</typeparam>\n        /// <param name=\"services\">container</param>\n        /// <param name=\"serviceKey\">An optional key to associate with the specific Refit client instance</param>\n        /// <param name=\"settings\">Optional. Settings to configure the instance with</param>\n        /// <param name=\"httpClientName\">Optional. Allows users to change the HttpClient name.</param>\n        /// <returns></returns>\n        public static IHttpClientBuilder AddKeyedRefitClient<T>(\n            this IServiceCollection services,\n            object? serviceKey,\n            RefitSettings? settings = null,\n            string? httpClientName = null\n        )\n            where T : class\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n\n            return HttpClientFactoryCore.AddKeyedRefitClientCore<T>(services, typeof(T), serviceKey, _ => settings, httpClientName);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Type of the Refit interface</param>\n        /// <param name=\"builder\">The HTTP client builder</param>\n        /// <param name=\"settings\">Optional. Settings to configure the instance with</param>\n        /// <returns></returns>\n        public static IHttpClientBuilder AddRefitClient(\n            this IHttpClientBuilder builder,\n            Type refitInterfaceType,\n            RefitSettings? settings = null\n        )\n        {\n            if (builder == null) throw new ArgumentNullException(nameof(builder));\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n\n            return HttpClientFactoryCore.AddRefitClientCore(builder.Services, refitInterfaceType, _ => settings, builder.Name);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container with a specified service key\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Type of the Refit interface</param>\n        /// <param name=\"builder\">The HTTP client builder</param>\n        /// <param name=\"serviceKey\">An optional key to associate with the specific Refit client instance</param>\n        /// <param name=\"settings\">Optional. Settings to configure the instance with</param>\n        /// <returns></returns>\n        public static IHttpClientBuilder AddKeyedRefitClient(\n            this IHttpClientBuilder builder,\n            Type refitInterfaceType,\n            object? serviceKey,\n            RefitSettings? settings = null\n        )\n        {\n            if (builder == null) throw new ArgumentNullException(nameof(builder));\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n\n            return HttpClientFactoryCore.AddKeyedRefitClientCore(builder.Services, refitInterfaceType, serviceKey, _ => settings, builder.Name);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the Refit interface</typeparam>\n        /// <param name=\"builder\">The HTTP client builder</param>\n        /// <param name=\"settings\">Optional. Settings to configure the instance with</param>\n        /// <returns></returns>\n        public static IHttpClientBuilder AddRefitClient<T>(\n            this IHttpClientBuilder builder,\n            RefitSettings? settings = null\n        )\n            where T : class\n        {\n            if (builder == null) throw new ArgumentNullException(nameof(builder));\n\n            return HttpClientFactoryCore.AddRefitClientCore<T>(builder.Services, typeof(T), _ => settings, builder.Name);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container with a specified service key\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the Refit interface</typeparam>\n        /// <param name=\"builder\">The HTTP client builder</param>\n        /// <param name=\"serviceKey\">An optional key to associate with the specific Refit client instance</param>\n        /// <param name=\"settings\">Optional. Settings to configure the instance with</param>\n        /// <returns></returns>\n        public static IHttpClientBuilder AddKeyedRefitClient<T>(\n            this IHttpClientBuilder builder,\n            object? serviceKey,\n            RefitSettings? settings = null\n        )\n            where T : class\n        {\n            if (builder == null) throw new ArgumentNullException(nameof(builder));\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n\n            return HttpClientFactoryCore.AddKeyedRefitClientCore<T>(builder.Services, typeof(T), serviceKey, _ => settings, builder.Name);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Type of the Refit interface</param>\n        /// <param name=\"services\">container</param>\n        /// <param name=\"settingsAction\">Optional. Action to configure refit settings.</param>\n        /// <param name=\"httpClientName\">Optional. Allows users to change the HttpClient name.</param>\n        /// <returns></returns>\n#if NET9_0_OR_GREATER\n        [System.Runtime.CompilerServices.OverloadResolutionPriority(1)]\n#endif\n        public static IHttpClientBuilder AddRefitClient(\n            this IServiceCollection services,\n            Type refitInterfaceType,\n            Func<IServiceProvider, RefitSettings?>? settingsAction,\n            string? httpClientName = null\n        )\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n\n            return HttpClientFactoryCore.AddRefitClientCore(services, refitInterfaceType, settingsAction, httpClientName);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container with a specified service key\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Type of the Refit interface</param>\n        /// <param name=\"services\">container</param>\n        /// <param name=\"serviceKey\">An optional key to associate with the specific Refit client instance</param>\n        /// <param name=\"settingsAction\">Optional. Action to configure refit settings.</param>\n        /// <param name=\"httpClientName\">Optional. Allows users to change the HttpClient name.</param>\n        /// <returns></returns>\n#if NET9_0_OR_GREATER\n        [System.Runtime.CompilerServices.OverloadResolutionPriority(1)]\n#endif\n        public static IHttpClientBuilder AddKeyedRefitClient(\n            this IServiceCollection services,\n            Type refitInterfaceType,\n            object? serviceKey,\n            Func<IServiceProvider, RefitSettings?>? settingsAction,\n            string? httpClientName = null\n        )\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n\n            return HttpClientFactoryCore.AddKeyedRefitClientCore(services, refitInterfaceType, serviceKey, settingsAction, httpClientName);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the Refit interface</typeparam>\n        /// <param name=\"services\">container</param>\n        /// <param name=\"settingsAction\">Optional. Action to configure refit settings.</param>\n        /// <param name=\"httpClientName\">Optional. Allows users to change the HttpClient name.</param>\n        /// <returns></returns>\n#if NET9_0_OR_GREATER\n        [System.Runtime.CompilerServices.OverloadResolutionPriority(1)]\n#endif\n        public static IHttpClientBuilder AddRefitClient<T>(\n            this IServiceCollection services,\n            Func<IServiceProvider, RefitSettings?>? settingsAction,\n            string? httpClientName = null\n        )\n            where T : class\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n\n            return HttpClientFactoryCore.AddRefitClientCore<T>(services, typeof(T), settingsAction, httpClientName);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container with a specified service key\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the Refit interface</typeparam>\n        /// <param name=\"services\">container</param>\n        /// <param name=\"serviceKey\">An optional key to associate with the specific Refit client instance</param>\n        /// <param name=\"settingsAction\">Optional. Action to configure refit settings.</param>\n        /// <param name=\"httpClientName\">Optional. Allows users to change the HttpClient name.</param>\n        /// <returns></returns>\n#if NET9_0_OR_GREATER\n        [System.Runtime.CompilerServices.OverloadResolutionPriority(1)]\n#endif\n        public static IHttpClientBuilder AddKeyedRefitClient<T>(\n            this IServiceCollection services,\n            object? serviceKey,\n            Func<IServiceProvider, RefitSettings?>? settingsAction,\n            string? httpClientName = null\n        )\n            where T : class\n        {\n            if (services == null) throw new ArgumentNullException(nameof(services));\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n\n            return HttpClientFactoryCore.AddKeyedRefitClientCore<T>(services, typeof(T), serviceKey, settingsAction, httpClientName);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Type of the Refit interface</param>\n        /// <param name=\"builder\">The HTTP client builder</param>\n        /// <param name=\"settingsAction\">Optional. Action to configure refit settings.</param>\n        /// <returns></returns>\n#if NET9_0_OR_GREATER\n        [System.Runtime.CompilerServices.OverloadResolutionPriority(1)]\n#endif\n        public static IHttpClientBuilder AddRefitClient(\n            this IHttpClientBuilder builder,\n            Type refitInterfaceType,\n            Func<IServiceProvider, RefitSettings?>? settingsAction\n        )\n        {\n            if (builder == null) throw new ArgumentNullException(nameof(builder));\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n\n            return HttpClientFactoryCore.AddRefitClientCore(builder.Services, refitInterfaceType, settingsAction, builder.Name);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container with a specified service key\n        /// </summary>\n        /// <param name=\"refitInterfaceType\">Type of the Refit interface</param>\n        /// <param name=\"builder\">The HTTP client builder</param>\n        /// <param name=\"serviceKey\">An optional key to associate with the specific Refit client instance</param>\n        /// <param name=\"settingsAction\">Optional. Action to configure refit settings.</param>\n        /// <returns></returns>\n#if NET9_0_OR_GREATER\n        [System.Runtime.CompilerServices.OverloadResolutionPriority(1)]\n#endif\n        public static IHttpClientBuilder AddKeyedRefitClient(\n            this IHttpClientBuilder builder,\n            Type refitInterfaceType,\n            object? serviceKey,\n            Func<IServiceProvider, RefitSettings?>? settingsAction\n        )\n        {\n            if (builder == null) throw new ArgumentNullException(nameof(builder));\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n\n            return HttpClientFactoryCore.AddKeyedRefitClientCore(builder.Services, refitInterfaceType, serviceKey, settingsAction, builder.Name);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the Refit interface</typeparam>\n        /// <param name=\"builder\">The HTTP client builder</param>\n        /// <param name=\"settingsAction\">Optional. Action to configure refit settings.</param>\n        /// <returns></returns>\n#if NET9_0_OR_GREATER\n        [System.Runtime.CompilerServices.OverloadResolutionPriority(1)]\n#endif\n        public static IHttpClientBuilder AddRefitClient<T>(\n            this IHttpClientBuilder builder,\n            Func<IServiceProvider, RefitSettings?>? settingsAction\n        )\n            where T : class\n        {\n            if (builder == null) throw new ArgumentNullException(nameof(builder));\n\n            return HttpClientFactoryCore.AddRefitClientCore<T>(builder.Services, typeof(T), settingsAction, builder.Name);\n        }\n\n        /// <summary>\n        /// Adds a Refit client to the DI container with a specified service key\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the Refit interface</typeparam>\n        /// <param name=\"builder\">The HTTP client builder</param>\n        /// <param name=\"serviceKey\">An optional key to associate with the specific Refit client instance</param>\n        /// <param name=\"settingsAction\">Optional. Action to configure refit settings.</param>\n        /// <returns></returns>\n#if NET9_0_OR_GREATER\n        [System.Runtime.CompilerServices.OverloadResolutionPriority(1)]\n#endif\n        public static IHttpClientBuilder AddKeyedRefitClient<T>(\n            this IHttpClientBuilder builder,\n            object? serviceKey,\n            Func<IServiceProvider, RefitSettings?>? settingsAction\n        )\n            where T : class\n        {\n            if (builder == null) throw new ArgumentNullException(nameof(builder));\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n\n            return HttpClientFactoryCore.AddKeyedRefitClientCore<T>(builder.Services, typeof(T), serviceKey, settingsAction, builder.Name);\n        }\n\n    }\n}"
  },
  {
    "path": "Refit.HttpClientFactory/HttpClientFactoryExtensions.tt",
    "content": "﻿<#@ template debug=\"false\" hostspecific=\"false\" language=\"C#\" #>\n<#@ output extension=\".cs\" #>\nusing System;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Reflection;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Http;\n\nnamespace Refit\n{\n    /// <summary>\n    /// HttpClientFactoryExtensions.\n    /// </summary>\n    public static class HttpClientFactoryExtensions\n    {\n<#\n    // 位运算控制组合\n    for (int bits = 0; bits < 16; bits++)\n    {\n        bool hasKeyed = (bits & 1) != 0;      // 0001: 是否有Keyed\n        bool hasGeneric = (bits & 2) != 0;    // 0010: 是否泛型\n        bool isBuilder = (bits & 4) != 0;     // 0100: 是否builder扩展\n        bool hasAction = (bits & 8) != 0;     // 1000: 是否有settingsAction\n        \n        // 生成XML注释\n#>\n        /// <summary>\n<# if (hasKeyed) { #>\n        /// Adds a Refit client to the DI container with a specified service key\n<# } else { #>\n        /// Adds a Refit client to the DI container\n<# } #>\n        /// </summary>\n<# if (hasGeneric) { #>\n        /// <typeparam name=\"T\">Type of the Refit interface</typeparam>\n<# } else { #>\n        /// <param name=\"refitInterfaceType\">Type of the Refit interface</param>\n<# } #>\n<# if (isBuilder) { #>\n        /// <param name=\"builder\">The HTTP client builder</param>\n<# } else { #>\n        /// <param name=\"services\">container</param>\n<# } #>\n<# if (hasKeyed) { #>\n        /// <param name=\"serviceKey\">An optional key to associate with the specific Refit client instance</param>\n<# } #>\n<# if (hasAction) { #>\n        /// <param name=\"settingsAction\">Optional. Action to configure refit settings.</param>\n<# } else { #>\n        /// <param name=\"settings\">Optional. Settings to configure the instance with</param>\n<# } #>\n<# if (!isBuilder) { #>\n        /// <param name=\"httpClientName\">Optional. Allows users to change the HttpClient name.</param>\n<# } #>\n        /// <returns></returns>\n<# if(hasAction) { #>\n#if NET9_0_OR_GREATER\n        [System.Runtime.CompilerServices.OverloadResolutionPriority(1)]\n#endif\n<# } #>\n<# \n        // 生成方法签名\n        string methodName = (hasKeyed ? \"AddKeyedRefitClient\" : \"AddRefitClient\"); \n#>\n        public static IHttpClientBuilder <#= methodName #><#= hasGeneric ? \"<T>\" : \"\" #>(\n            this <#= isBuilder ? \"IHttpClientBuilder\" : \"IServiceCollection\" #> <#= isBuilder ? \"builder\" : \"services\" #>,\n<# if (!hasGeneric) { #>\n            Type refitInterfaceType,\n<# } #>\n<# if (hasKeyed) { #>\n            object? serviceKey,\n<# } #>\n<# if (hasAction) { #>\n            Func<IServiceProvider, RefitSettings?>? settingsAction<#= !isBuilder ? \",\" : \"\" #>\n<# } else { #>\n            RefitSettings? settings = null<#= !isBuilder ? \",\" : \"\" #>\n<# } #>\n<# if (!isBuilder) { #>\n            string? httpClientName = null\n<# } #>\n        )\n<# if (hasGeneric) { #>\n            where T : class\n<# } #>\n        {\n<# \n        // 生成参数验证\n        if (isBuilder) \n        { \n#>\n            if (builder == null) throw new ArgumentNullException(nameof(builder));\n<# \n        } \n        else \n        { \n#>\n            if (services == null) throw new ArgumentNullException(nameof(services));\n<# \n        } \n        \n        if (!hasGeneric) \n        { \n#>\n            if (refitInterfaceType == null) throw new ArgumentNullException(nameof(refitInterfaceType));\n<# \n        } \n        \n        if (hasKeyed) \n        { \n#>\n            if (serviceKey == null) throw new ArgumentNullException(nameof(serviceKey));\n<# \n        }  \n#>\n\n<# \n        // 生成Core方法调用\n        string coreMethod = \"HttpClientFactoryCore.\";\n        coreMethod += (hasKeyed ? \"AddKeyedRefitClient\" : \"AddRefitClient\") + \"Core\";\n        coreMethod += hasGeneric ? \"<T>\" : \"\";\n        coreMethod += \"(\";\n        \n        // 第一个参数：services\n        if (isBuilder)\n        {\n            coreMethod += \"builder.Services\";\n        }\n        else\n        {\n            coreMethod += \"services\";\n        }\n        \n        // 第二个参数：Type\n        if (hasGeneric)\n        {\n            coreMethod += \", typeof(T)\";\n        }\n        else\n        {\n            coreMethod += \", refitInterfaceType\";\n        }\n        \n        // 第三个参数：serviceKey\n        if (hasKeyed)\n        {\n            coreMethod += \", serviceKey\";\n        }\n        \n        // 第四个参数：settingsAction\n        if (hasAction)\n        {\n            coreMethod += \", settingsAction\";\n        }\n        else\n        {\n            coreMethod += \", _ => settings\";\n        }\n        \n        // 第五个参数：httpClientName\n        if (isBuilder)\n        {\n            // IHttpClientBuilder 版本使用 builder.Name\n            coreMethod += \", builder.Name\";\n        }\n        else\n        {\n            // IServiceCollection 版本使用传入的 httpClientName\n            coreMethod += \", httpClientName\";\n        }\n        \n        coreMethod += \")\";\n#>\n            return <#= coreMethod #>;\n        }\n\n<#\n    }\n#>\n    }\n}"
  },
  {
    "path": "Refit.HttpClientFactory/Refit.HttpClientFactory.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <Product>Refit HTTP Client Factory Extensions</Product>\n    <Description>Refit HTTP Client Factory Extensions</Description>\n    <TargetFrameworks>$(RefitTargets)</TargetFrameworks>\n    <Nullable>enable</Nullable>\n    <IsTrimmable>true</IsTrimmable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\Refit\\Refit.csproj\" PrivateAssets=\"Analyzers\" />\n    <PackageReference Include=\"Microsoft.Extensions.Http\" Version=\"9.0.3\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <None Update=\"HttpClientFactoryExtensions.tt\">\n      <Generator>TextTemplatingFileGenerator</Generator>\n      <LastGenOutput>HttpClientFactoryExtensions.cs</LastGenOutput>\n    </None>\n  </ItemGroup>\n\n  <ItemGroup>\n    <Service Include=\"{508349b6-6b84-4df5-91f0-309beebad82d}\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <Compile Update=\"HttpClientFactoryExtensions.cs\">\n      <DesignTime>True</DesignTime>\n      <AutoGen>True</AutoGen>\n      <DependentUpon>HttpClientFactoryExtensions.tt</DependentUpon>\n    </Compile>\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "Refit.HttpClientFactory/SettingsFor.cs",
    "content": "﻿namespace Refit\n{\n    /// <summary>\n    /// ISettingsFor\n    /// </summary>\n    public interface ISettingsFor\n    {\n        /// <summary>\n        /// Gets the settings.\n        /// </summary>\n        /// <value>\n        /// The settings.\n        /// </value>\n        RefitSettings? Settings { get; }\n    }\n\n    /// <summary>\n    /// SettingsFor.\n    /// </summary>\n    /// <typeparam name=\"T\"></typeparam>\n    /// <seealso cref=\"Refit.ISettingsFor\" />\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"SettingsFor{T}\"/> class.\n    /// </remarks>\n    /// <param name=\"settings\">The settings.</param>\n    public class SettingsFor<T>(RefitSettings? settings) : ISettingsFor\n    {\n        /// <summary>\n        /// Gets the settings.\n        /// </summary>\n        /// <value>\n        /// The settings.\n        /// </value>\n        public RefitSettings? Settings { get; } = settings;\n    }\n}\n"
  },
  {
    "path": "Refit.Newtonsoft.Json/NewtonsoftJsonContentSerializer.cs",
    "content": "﻿using System.Net.Http;\nusing System.Reflection;\nusing System.Text;\nusing Newtonsoft.Json;\n\nnamespace Refit\n{\n    /// <summary>\n    /// A <see langword=\"class\"/> implementing <see cref=\"IHttpContentSerializer\"/> using the Newtonsoft.Json APIs\n    /// </summary>\n    /// <remarks>\n    /// Creates a new <see cref=\"NewtonsoftJsonContentSerializer\"/> instance with the specified parameters\n    /// </remarks>\n    /// <param name=\"jsonSerializerSettings\">The serialization settings to use for the current instance</param>\n    public sealed class NewtonsoftJsonContentSerializer(\n        JsonSerializerSettings? jsonSerializerSettings\n    ) : IHttpContentSerializer\n    {\n        /// <summary>\n        /// The <see cref=\"Lazy{T}\"/> instance providing the JSON serialization settings to use\n        /// </summary>\n        readonly Lazy<JsonSerializerSettings> jsonSerializerSettings =\n            new(\n                () =>\n                    jsonSerializerSettings\n                    ?? JsonConvert.DefaultSettings?.Invoke()\n                    ?? new JsonSerializerSettings()\n            );\n\n        /// <summary>\n        /// Creates a new <see cref=\"NewtonsoftJsonContentSerializer\"/> instance\n        /// </summary>\n        public NewtonsoftJsonContentSerializer()\n            : this(null) { }\n\n        /// <inheritdoc/>\n        public HttpContent ToHttpContent<T>(T item)\n        {\n            var content = new StringContent(\n                JsonConvert.SerializeObject(item, jsonSerializerSettings.Value),\n                Encoding.UTF8,\n                \"application/json\"\n            );\n\n            return content;\n        }\n\n        /// <inheritdoc/>\n        public async Task<T?> FromHttpContentAsync<T>(\n            HttpContent content,\n            CancellationToken cancellationToken = default\n        )\n        {\n            if (content == null)\n            {\n                return default;\n            }\n\n            var serializer = JsonSerializer.Create(jsonSerializerSettings.Value);\n\n            var json = await content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);\n            using var reader = new StringReader(json);\n            using var jsonTextReader = new JsonTextReader(reader);\n\n            return serializer.Deserialize<T>(jsonTextReader);\n        }\n\n        /// <summary>\n        /// Calculates what the field name should be for the given property. This may be affected by custom attributes the serializer understands\n        /// </summary>\n        /// <param name=\"propertyInfo\">A PropertyInfo object.</param>\n        /// <returns>\n        /// The calculated field name.\n        /// </returns>\n        /// <exception cref=\"System.ArgumentNullException\">propertyInfo</exception>\n        public string? GetFieldNameForProperty(PropertyInfo propertyInfo)\n        {\n            return propertyInfo switch\n            {\n                null => throw new ArgumentNullException(nameof(propertyInfo)),\n                _\n                    => propertyInfo\n                        .GetCustomAttributes<JsonPropertyAttribute>(true)\n                        .Select(a => a.PropertyName)\n                        .FirstOrDefault()\n            };\n        }\n    }\n}\n"
  },
  {
    "path": "Refit.Newtonsoft.Json/Refit.Newtonsoft.Json.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <Product>Refit Serializer for Newtonsoft.Json ($(TargetFramework))</Product>\n    <Description>Refit Serializers for Newtonsoft.Json</Description>\n    <TargetFrameworks>$(RefitTargets)</TargetFrameworks>\n    <GenerateDocumentationFile Condition=\" '$(Configuration)' == 'Release' \">true</GenerateDocumentationFile>\n    <RootNamespace>Refit</RootNamespace>\n    <Nullable>enable</Nullable>\n    <IsTrimmable>true</IsTrimmable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Newtonsoft.Json\" Version=\"13.0.4\" />    \n  </ItemGroup>\n\n  <ItemGroup Condition=\"'$(TargetFramework)' == 'net462'\">\n    <PackageReference Include=\"Microsoft.NETFramework.ReferenceAssemblies\"\n                      Version=\"1.0.3\"\n                      PrivateAssets=\"All\" />\n    <Reference Include=\"System.Web\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\Refit\\Refit.csproj\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "Refit.Tests/API/ApiApprovalTests.Refit.DotNet8_0.verified.txt",
    "content": "﻿[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.HttpClientFactory\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Newtonsoft.Json\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Tests\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Xml\")]\n[assembly: System.Runtime.Versioning.TargetFramework(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName=\".NET 8.0\")]\nnamespace Refit\n{\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    public class AliasAsAttribute : System.Attribute\n    {\n        public AliasAsAttribute(string name) { }\n        public string Name { get; protected set; }\n    }\n    [System.Serializable]\n    public class ApiException : System.Exception\n    {\n        protected ApiException(System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        protected ApiException(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        public string? Content { get; }\n        public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        public bool HasContent { get; }\n        public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        public System.Net.Http.HttpMethod HttpMethod { get; }\n        public string? ReasonPhrase { get; }\n        public Refit.RefitSettings RefitSettings { get; }\n        public System.Net.Http.HttpRequestMessage RequestMessage { get; }\n        public System.Net.HttpStatusCode StatusCode { get; }\n        public System.Uri? Uri { get; }\n        public System.Threading.Tasks.Task<T?> GetContentAsAsync<T>() { }\n        public static System.Threading.Tasks.Task<Refit.ApiException> Create(System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, System.Net.Http.HttpResponseMessage response, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        public static System.Threading.Tasks.Task<Refit.ApiException> Create(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, System.Net.Http.HttpResponseMessage response, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n    }\n    public sealed class ApiResponse<T> : Refit.IApiResponse, Refit.IApiResponse<T>, System.IDisposable\n    {\n        public ApiResponse(System.Net.Http.HttpResponseMessage response, T? content, Refit.RefitSettings settings, Refit.ApiException? error = null) { }\n        public T Content { get; }\n        public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        public Refit.ApiException? Error { get; }\n        public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        public bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        public bool IsSuccessful { get; }\n        public string? ReasonPhrase { get; }\n        public System.Net.Http.HttpRequestMessage? RequestMessage { get; }\n        public Refit.RefitSettings Settings { get; }\n        public System.Net.HttpStatusCode StatusCode { get; }\n        public System.Version Version { get; }\n        public void Dispose() { }\n        public System.Threading.Tasks.Task<Refit.ApiResponse<T>> EnsureSuccessStatusCodeAsync() { }\n        public System.Threading.Tasks.Task<Refit.ApiResponse<T>> EnsureSuccessfulAsync() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    [System.Obsolete(\"Use Refit.StreamPart, Refit.ByteArrayPart, Refit.FileInfoPart or if necessary, in\" +\n        \"herit from Refit.MultipartItem\", false)]\n    public class AttachmentNameAttribute : System.Attribute\n    {\n        public AttachmentNameAttribute(string name) { }\n        public string Name { get; protected set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class AuthorizeAttribute : System.Attribute\n    {\n        public AuthorizeAttribute(string scheme = \"Bearer\") { }\n        public string Scheme { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class BodyAttribute : System.Attribute\n    {\n        public BodyAttribute() { }\n        public BodyAttribute(Refit.BodySerializationMethod serializationMethod = 0) { }\n        public BodyAttribute(bool buffered) { }\n        public BodyAttribute(Refit.BodySerializationMethod serializationMethod, bool buffered) { }\n        public bool? Buffered { get; }\n        public Refit.BodySerializationMethod SerializationMethod { get; }\n    }\n    public enum BodySerializationMethod\n    {\n        Default = 0,\n        [System.Obsolete(\"Use BodySerializationMethod.Serialized instead\", false)]\n        Json = 1,\n        UrlEncoded = 2,\n        Serialized = 3,\n    }\n    public class ByteArrayPart : Refit.MultipartItem\n    {\n        public ByteArrayPart(byte[] value, string fileName, string? contentType = null, string? name = null) { }\n        public byte[] Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    public class CamelCaseUrlParameterKeyFormatter : Refit.IUrlParameterKeyFormatter\n    {\n        public CamelCaseUrlParameterKeyFormatter() { }\n        public string Format(string key) { }\n    }\n    public enum CollectionFormat\n    {\n        RefitParameterFormatter = 0,\n        Csv = 1,\n        Ssv = 2,\n        Tsv = 3,\n        Pipes = 4,\n        Multi = 5,\n    }\n    public class DefaultApiExceptionFactory\n    {\n        public DefaultApiExceptionFactory(Refit.RefitSettings refitSettings) { }\n        public System.Threading.Tasks.Task<System.Exception?> CreateAsync(System.Net.Http.HttpResponseMessage responseMessage) { }\n    }\n    public class DefaultFormUrlEncodedParameterFormatter : Refit.IFormUrlEncodedParameterFormatter\n    {\n        public DefaultFormUrlEncodedParameterFormatter() { }\n        public virtual string? Format(object? parameterValue, string? formatString) { }\n    }\n    public class DefaultUrlParameterFormatter : Refit.IUrlParameterFormatter\n    {\n        public DefaultUrlParameterFormatter() { }\n        public void AddFormat<TParameter>(string format) { }\n        public void AddFormat<TContainer, TParameter>(string format) { }\n        public virtual string? Format(object? parameterValue, System.Reflection.ICustomAttributeProvider attributeProvider, System.Type type) { }\n    }\n    public class DefaultUrlParameterKeyFormatter : Refit.IUrlParameterKeyFormatter\n    {\n        public DefaultUrlParameterKeyFormatter() { }\n        public virtual string Format(string key) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class DeleteAttribute : Refit.HttpMethodAttribute\n    {\n        public DeleteAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public class FileInfoPart : Refit.MultipartItem\n    {\n        public FileInfoPart(System.IO.FileInfo value, string fileName, string? contentType = null, string? name = null) { }\n        public System.IO.FileInfo Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class GetAttribute : Refit.HttpMethodAttribute\n    {\n        public GetAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class HeadAttribute : Refit.HttpMethodAttribute\n    {\n        public HeadAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class HeaderAttribute : System.Attribute\n    {\n        public HeaderAttribute(string header) { }\n        public string Header { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class HeaderCollectionAttribute : System.Attribute\n    {\n        public HeaderCollectionAttribute() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Interface)]\n    public class HeadersAttribute : System.Attribute\n    {\n        public HeadersAttribute(params string[] headers) { }\n        public string[] Headers { get; }\n    }\n    public abstract class HttpMethodAttribute : System.Attribute\n    {\n        protected HttpMethodAttribute(string path) { }\n        public abstract System.Net.Http.HttpMethod Method { get; }\n        public virtual string Path { get; protected set; }\n    }\n    public static class HttpRequestMessageOptions\n    {\n        public static string InterfaceType { get; }\n        public static string RestMethodInfo { get; }\n    }\n    public interface IApiResponse : System.IDisposable\n    {\n        System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        Refit.ApiException? Error { get; }\n        System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        bool IsSuccessful { get; }\n        string? ReasonPhrase { get; }\n        System.Net.Http.HttpRequestMessage? RequestMessage { get; }\n        System.Net.HttpStatusCode StatusCode { get; }\n        System.Version Version { get; }\n    }\n    public interface IApiResponse<out T> : Refit.IApiResponse, System.IDisposable\n    {\n        T Content { get; }\n        new System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        new Refit.ApiException? Error { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        new bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        new bool IsSuccessful { get; }\n    }\n    public interface IFormUrlEncodedParameterFormatter\n    {\n        string? Format(object? value, string? formatString);\n    }\n    public interface IHttpContentSerializer\n    {\n        System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default);\n        string? GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo);\n        System.Net.Http.HttpContent ToHttpContent<T>(T item);\n    }\n    public interface IRequestBuilder\n    {\n        System.Func<System.Net.Http.HttpClient, object[], object?> BuildRestResultFuncForMethod(string methodName, System.Type[]? parameterTypes = null, System.Type[]? genericArgumentTypes = null);\n    }\n    public interface IRequestBuilder<T> : Refit.IRequestBuilder { }\n    public interface IUrlParameterFormatter\n    {\n        string? Format(object? value, System.Reflection.ICustomAttributeProvider attributeProvider, System.Type type);\n    }\n    public interface IUrlParameterKeyFormatter\n    {\n        string Format(string key);\n    }\n    [System.Obsolete(\"Use NewtonsoftJsonContentSerializer in the Refit.Newtonsoft.Json package instead\", true)]\n    public class JsonContentSerializer : Refit.IHttpContentSerializer\n    {\n        public JsonContentSerializer() { }\n        public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default) { }\n        public string GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo) { }\n        public System.Net.Http.HttpContent ToHttpContent<T>(T item) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class MultipartAttribute : System.Attribute\n    {\n        public MultipartAttribute(string boundaryText = \"----MyGreatBoundary\") { }\n        public string BoundaryText { get; }\n    }\n    public abstract class MultipartItem\n    {\n        protected MultipartItem(string fileName, string? contentType) { }\n        public MultipartItem(string fileName, string? contentType, string? name) { }\n        public string? ContentType { get; }\n        public string FileName { get; }\n        public string? Name { get; }\n        protected abstract System.Net.Http.HttpContent CreateContent();\n        public System.Net.Http.HttpContent ToContent() { }\n    }\n    public class ObjectToInferredTypesConverter : System.Text.Json.Serialization.JsonConverter<object>\n    {\n        public ObjectToInferredTypesConverter() { }\n        public override object? Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { }\n        public override void Write(System.Text.Json.Utf8JsonWriter writer, object objectToWrite, System.Text.Json.JsonSerializerOptions options) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class OptionsAttribute : Refit.HttpMethodAttribute\n    {\n        public OptionsAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public enum ParameterType\n    {\n        Normal = 0,\n        RoundTripping = 1,\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PatchAttribute : Refit.HttpMethodAttribute\n    {\n        public PatchAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PostAttribute : Refit.HttpMethodAttribute\n    {\n        public PostAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public class ProblemDetails\n    {\n        public ProblemDetails() { }\n        public string? Detail { get; set; }\n        public System.Collections.Generic.Dictionary<string, string[]> Errors { get; set; }\n        [System.Text.Json.Serialization.JsonExtensionData]\n        public System.Collections.Generic.IDictionary<string, object> Extensions { get; set; }\n        public string? Instance { get; set; }\n        public int Status { get; set; }\n        public string? Title { get; set; }\n        public string? Type { get; set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class PropertyAttribute : System.Attribute\n    {\n        public PropertyAttribute() { }\n        public PropertyAttribute(string key) { }\n        public string? Key { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PutAttribute : Refit.HttpMethodAttribute\n    {\n        public PutAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    public class QueryAttribute : System.Attribute\n    {\n        public QueryAttribute() { }\n        public QueryAttribute(Refit.CollectionFormat collectionFormat) { }\n        public QueryAttribute(string delimiter) { }\n        public QueryAttribute(string delimiter, string prefix) { }\n        public QueryAttribute(string delimiter, string prefix, string format) { }\n        public Refit.CollectionFormat CollectionFormat { get; set; }\n        public string Delimiter { get; protected set; }\n        public string? Format { get; set; }\n        public bool IsCollectionFormatSpecified { get; }\n        public string? Prefix { get; protected set; }\n        public bool TreatAsString { get; set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class QueryUriFormatAttribute : System.Attribute\n    {\n        public QueryUriFormatAttribute(System.UriFormat uriFormat) { }\n        public System.UriFormat UriFormat { get; }\n    }\n    public class RefitSettings\n    {\n        public RefitSettings() { }\n        public RefitSettings(Refit.IHttpContentSerializer contentSerializer, Refit.IUrlParameterFormatter? urlParameterFormatter, Refit.IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter) { }\n        public RefitSettings(Refit.IHttpContentSerializer contentSerializer, Refit.IUrlParameterFormatter? urlParameterFormatter = null, Refit.IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter = null, Refit.IUrlParameterKeyFormatter? urlParameterKeyFormatter = null) { }\n        public System.Func<System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken, System.Threading.Tasks.Task<string>>? AuthorizationHeaderValueGetter { get; set; }\n        public bool Buffered { get; set; }\n        public Refit.CollectionFormat CollectionFormat { get; set; }\n        public Refit.IHttpContentSerializer ContentSerializer { get; set; }\n        public System.Func<System.Net.Http.HttpResponseMessage, System.Exception, System.Threading.Tasks.Task<System.Exception?>>? DeserializationExceptionFactory { get; set; }\n        public System.Func<System.Net.Http.HttpResponseMessage, System.Threading.Tasks.Task<System.Exception?>> ExceptionFactory { get; set; }\n        public Refit.IFormUrlEncodedParameterFormatter FormUrlEncodedParameterFormatter { get; set; }\n        public System.Func<System.Net.Http.HttpMessageHandler>? HttpMessageHandlerFactory { get; set; }\n        public System.Collections.Generic.Dictionary<string, object>? HttpRequestMessageOptions { get; set; }\n        public Refit.IUrlParameterFormatter UrlParameterFormatter { get; set; }\n        public Refit.IUrlParameterKeyFormatter UrlParameterKeyFormatter { get; set; }\n        public System.Version Version { get; set; }\n        public System.Net.Http.HttpVersionPolicy VersionPolicy { get; set; }\n    }\n    public static class RequestBuilder\n    {\n        public static Refit.IRequestBuilder ForType(System.Type refitInterfaceType) { }\n        public static Refit.IRequestBuilder ForType(System.Type refitInterfaceType, Refit.RefitSettings? settings) { }\n        public static Refit.IRequestBuilder<T> ForType<T>() { }\n        public static Refit.IRequestBuilder<T> ForType<T>(Refit.RefitSettings? settings) { }\n    }\n    public class RestMethodInfo : System.IEquatable<Refit.RestMethodInfo>\n    {\n        public RestMethodInfo(string Name, System.Type HostingType, System.Reflection.MethodInfo MethodInfo, string RelativePath, System.Type ReturnType) { }\n        public System.Type HostingType { get; init; }\n        public System.Reflection.MethodInfo MethodInfo { get; init; }\n        public string Name { get; init; }\n        public string RelativePath { get; init; }\n        public System.Type ReturnType { get; init; }\n    }\n    public class RestMethodParameterInfo\n    {\n        public RestMethodParameterInfo(bool isObjectPropertyParameter, System.Reflection.ParameterInfo parameterInfo) { }\n        public RestMethodParameterInfo(string name, System.Reflection.ParameterInfo parameterInfo) { }\n        public bool IsObjectPropertyParameter { get; set; }\n        public string? Name { get; set; }\n        public System.Reflection.ParameterInfo ParameterInfo { get; set; }\n        public System.Collections.Generic.List<Refit.RestMethodParameterProperty> ParameterProperties { get; set; }\n        public Refit.ParameterType Type { get; set; }\n    }\n    public class RestMethodParameterProperty\n    {\n        public RestMethodParameterProperty(string name, System.Reflection.PropertyInfo propertyInfo) { }\n        public string Name { get; set; }\n        public System.Reflection.PropertyInfo PropertyInfo { get; set; }\n    }\n    public static class RestService\n    {\n        public static System.Net.Http.HttpClient CreateHttpClient(string hostUrl, Refit.RefitSettings? settings) { }\n        public static object For(System.Type refitInterfaceType, System.Net.Http.HttpClient client) { }\n        public static object For(System.Type refitInterfaceType, string hostUrl) { }\n        public static object For(System.Type refitInterfaceType, System.Net.Http.HttpClient client, Refit.IRequestBuilder builder) { }\n        public static object For(System.Type refitInterfaceType, System.Net.Http.HttpClient client, Refit.RefitSettings? settings) { }\n        public static object For(System.Type refitInterfaceType, string hostUrl, Refit.RefitSettings? settings) { }\n        public static T For<T>(System.Net.Http.HttpClient client) { }\n        public static T For<T>(string hostUrl) { }\n        public static T For<T>(System.Net.Http.HttpClient client, Refit.IRequestBuilder<T> builder) { }\n        public static T For<T>(System.Net.Http.HttpClient client, Refit.RefitSettings? settings) { }\n        public static T For<T>(string hostUrl, Refit.RefitSettings? settings) { }\n    }\n    public class StreamPart : Refit.MultipartItem\n    {\n        public StreamPart(System.IO.Stream value, string fileName, string? contentType = null, string? name = null) { }\n        public System.IO.Stream Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    public sealed class SystemTextJsonContentSerializer : Refit.IHttpContentSerializer\n    {\n        public SystemTextJsonContentSerializer() { }\n        public SystemTextJsonContentSerializer(System.Text.Json.JsonSerializerOptions jsonSerializerOptions) { }\n        public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default) { }\n        public string? GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo) { }\n        public System.Net.Http.HttpContent ToHttpContent<T>(T item) { }\n        public static System.Text.Json.JsonSerializerOptions GetDefaultJsonSerializerOptions() { }\n    }\n    [System.Serializable]\n    public class ValidationApiException : Refit.ApiException\n    {\n        public new Refit.ProblemDetails? Content { get; }\n        public static Refit.ValidationApiException Create(Refit.ApiException exception) { }\n    }\n}"
  },
  {
    "path": "Refit.Tests/API/ApiApprovalTests.Refit.DotNet9_0.verified.txt",
    "content": "﻿[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.HttpClientFactory\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Newtonsoft.Json\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Tests\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Xml\")]\n[assembly: System.Runtime.Versioning.TargetFramework(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName=\".NET 9.0\")]\nnamespace Refit\n{\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    public class AliasAsAttribute : System.Attribute\n    {\n        public AliasAsAttribute(string name) { }\n        public string Name { get; protected set; }\n    }\n    [System.Serializable]\n    public class ApiException : System.Exception\n    {\n        protected ApiException(System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        protected ApiException(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        public string? Content { get; }\n        public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        public bool HasContent { get; }\n        public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        public System.Net.Http.HttpMethod HttpMethod { get; }\n        public string? ReasonPhrase { get; }\n        public Refit.RefitSettings RefitSettings { get; }\n        public System.Net.Http.HttpRequestMessage RequestMessage { get; }\n        public System.Net.HttpStatusCode StatusCode { get; }\n        public System.Uri? Uri { get; }\n        public System.Threading.Tasks.Task<T?> GetContentAsAsync<T>() { }\n        public static System.Threading.Tasks.Task<Refit.ApiException> Create(System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, System.Net.Http.HttpResponseMessage response, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        public static System.Threading.Tasks.Task<Refit.ApiException> Create(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, System.Net.Http.HttpResponseMessage response, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n    }\n    public sealed class ApiResponse<T> : Refit.IApiResponse, Refit.IApiResponse<T>, System.IDisposable\n    {\n        public ApiResponse(System.Net.Http.HttpResponseMessage response, T? content, Refit.RefitSettings settings, Refit.ApiException? error = null) { }\n        public T Content { get; }\n        public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        public Refit.ApiException? Error { get; }\n        public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        public bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        public bool IsSuccessful { get; }\n        public string? ReasonPhrase { get; }\n        public System.Net.Http.HttpRequestMessage? RequestMessage { get; }\n        public Refit.RefitSettings Settings { get; }\n        public System.Net.HttpStatusCode StatusCode { get; }\n        public System.Version Version { get; }\n        public void Dispose() { }\n        public System.Threading.Tasks.Task<Refit.ApiResponse<T>> EnsureSuccessStatusCodeAsync() { }\n        public System.Threading.Tasks.Task<Refit.ApiResponse<T>> EnsureSuccessfulAsync() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    [System.Obsolete(\"Use Refit.StreamPart, Refit.ByteArrayPart, Refit.FileInfoPart or if necessary, in\" +\n        \"herit from Refit.MultipartItem\", false)]\n    public class AttachmentNameAttribute : System.Attribute\n    {\n        public AttachmentNameAttribute(string name) { }\n        public string Name { get; protected set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class AuthorizeAttribute : System.Attribute\n    {\n        public AuthorizeAttribute(string scheme = \"Bearer\") { }\n        public string Scheme { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class BodyAttribute : System.Attribute\n    {\n        public BodyAttribute() { }\n        public BodyAttribute(Refit.BodySerializationMethod serializationMethod = 0) { }\n        public BodyAttribute(bool buffered) { }\n        public BodyAttribute(Refit.BodySerializationMethod serializationMethod, bool buffered) { }\n        public bool? Buffered { get; }\n        public Refit.BodySerializationMethod SerializationMethod { get; }\n    }\n    public enum BodySerializationMethod\n    {\n        Default = 0,\n        [System.Obsolete(\"Use BodySerializationMethod.Serialized instead\", false)]\n        Json = 1,\n        UrlEncoded = 2,\n        Serialized = 3,\n    }\n    public class ByteArrayPart : Refit.MultipartItem\n    {\n        public ByteArrayPart(byte[] value, string fileName, string? contentType = null, string? name = null) { }\n        public byte[] Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    public class CamelCaseUrlParameterKeyFormatter : Refit.IUrlParameterKeyFormatter\n    {\n        public CamelCaseUrlParameterKeyFormatter() { }\n        public string Format(string key) { }\n    }\n    public enum CollectionFormat\n    {\n        RefitParameterFormatter = 0,\n        Csv = 1,\n        Ssv = 2,\n        Tsv = 3,\n        Pipes = 4,\n        Multi = 5,\n    }\n    public class DefaultApiExceptionFactory\n    {\n        public DefaultApiExceptionFactory(Refit.RefitSettings refitSettings) { }\n        public System.Threading.Tasks.Task<System.Exception?> CreateAsync(System.Net.Http.HttpResponseMessage responseMessage) { }\n    }\n    public class DefaultFormUrlEncodedParameterFormatter : Refit.IFormUrlEncodedParameterFormatter\n    {\n        public DefaultFormUrlEncodedParameterFormatter() { }\n        public virtual string? Format(object? parameterValue, string? formatString) { }\n    }\n    public class DefaultUrlParameterFormatter : Refit.IUrlParameterFormatter\n    {\n        public DefaultUrlParameterFormatter() { }\n        public void AddFormat<TParameter>(string format) { }\n        public void AddFormat<TContainer, TParameter>(string format) { }\n        public virtual string? Format(object? parameterValue, System.Reflection.ICustomAttributeProvider attributeProvider, System.Type type) { }\n    }\n    public class DefaultUrlParameterKeyFormatter : Refit.IUrlParameterKeyFormatter\n    {\n        public DefaultUrlParameterKeyFormatter() { }\n        public virtual string Format(string key) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class DeleteAttribute : Refit.HttpMethodAttribute\n    {\n        public DeleteAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public class FileInfoPart : Refit.MultipartItem\n    {\n        public FileInfoPart(System.IO.FileInfo value, string fileName, string? contentType = null, string? name = null) { }\n        public System.IO.FileInfo Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class GetAttribute : Refit.HttpMethodAttribute\n    {\n        public GetAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class HeadAttribute : Refit.HttpMethodAttribute\n    {\n        public HeadAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class HeaderAttribute : System.Attribute\n    {\n        public HeaderAttribute(string header) { }\n        public string Header { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class HeaderCollectionAttribute : System.Attribute\n    {\n        public HeaderCollectionAttribute() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Interface)]\n    public class HeadersAttribute : System.Attribute\n    {\n        public HeadersAttribute(params string[] headers) { }\n        public string[] Headers { get; }\n    }\n    public abstract class HttpMethodAttribute : System.Attribute\n    {\n        protected HttpMethodAttribute(string path) { }\n        public abstract System.Net.Http.HttpMethod Method { get; }\n        public virtual string Path { get; protected set; }\n    }\n    public static class HttpRequestMessageOptions\n    {\n        public static string InterfaceType { get; }\n        public static string RestMethodInfo { get; }\n    }\n    public interface IApiResponse : System.IDisposable\n    {\n        System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        Refit.ApiException? Error { get; }\n        System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        bool IsSuccessful { get; }\n        string? ReasonPhrase { get; }\n        System.Net.Http.HttpRequestMessage? RequestMessage { get; }\n        System.Net.HttpStatusCode StatusCode { get; }\n        System.Version Version { get; }\n    }\n    public interface IApiResponse<out T> : Refit.IApiResponse, System.IDisposable\n    {\n        T Content { get; }\n        new System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        new Refit.ApiException? Error { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        new bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        new bool IsSuccessful { get; }\n    }\n    public interface IFormUrlEncodedParameterFormatter\n    {\n        string? Format(object? value, string? formatString);\n    }\n    public interface IHttpContentSerializer\n    {\n        System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default);\n        string? GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo);\n        System.Net.Http.HttpContent ToHttpContent<T>(T item);\n    }\n    public interface IRequestBuilder\n    {\n        System.Func<System.Net.Http.HttpClient, object[], object?> BuildRestResultFuncForMethod(string methodName, System.Type[]? parameterTypes = null, System.Type[]? genericArgumentTypes = null);\n    }\n    public interface IRequestBuilder<T> : Refit.IRequestBuilder { }\n    public interface IUrlParameterFormatter\n    {\n        string? Format(object? value, System.Reflection.ICustomAttributeProvider attributeProvider, System.Type type);\n    }\n    public interface IUrlParameterKeyFormatter\n    {\n        string Format(string key);\n    }\n    [System.Obsolete(\"Use NewtonsoftJsonContentSerializer in the Refit.Newtonsoft.Json package instead\", true)]\n    public class JsonContentSerializer : Refit.IHttpContentSerializer\n    {\n        public JsonContentSerializer() { }\n        public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default) { }\n        public string GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo) { }\n        public System.Net.Http.HttpContent ToHttpContent<T>(T item) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class MultipartAttribute : System.Attribute\n    {\n        public MultipartAttribute(string boundaryText = \"----MyGreatBoundary\") { }\n        public string BoundaryText { get; }\n    }\n    public abstract class MultipartItem\n    {\n        protected MultipartItem(string fileName, string? contentType) { }\n        public MultipartItem(string fileName, string? contentType, string? name) { }\n        public string? ContentType { get; }\n        public string FileName { get; }\n        public string? Name { get; }\n        protected abstract System.Net.Http.HttpContent CreateContent();\n        public System.Net.Http.HttpContent ToContent() { }\n    }\n    public class ObjectToInferredTypesConverter : System.Text.Json.Serialization.JsonConverter<object>\n    {\n        public ObjectToInferredTypesConverter() { }\n        public override object? Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { }\n        public override void Write(System.Text.Json.Utf8JsonWriter writer, object objectToWrite, System.Text.Json.JsonSerializerOptions options) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class OptionsAttribute : Refit.HttpMethodAttribute\n    {\n        public OptionsAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public enum ParameterType\n    {\n        Normal = 0,\n        RoundTripping = 1,\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PatchAttribute : Refit.HttpMethodAttribute\n    {\n        public PatchAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PostAttribute : Refit.HttpMethodAttribute\n    {\n        public PostAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public class ProblemDetails\n    {\n        public ProblemDetails() { }\n        public string? Detail { get; set; }\n        public System.Collections.Generic.Dictionary<string, string[]> Errors { get; set; }\n        [System.Text.Json.Serialization.JsonExtensionData]\n        public System.Collections.Generic.IDictionary<string, object> Extensions { get; set; }\n        public string? Instance { get; set; }\n        public int Status { get; set; }\n        public string? Title { get; set; }\n        public string? Type { get; set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class PropertyAttribute : System.Attribute\n    {\n        public PropertyAttribute() { }\n        public PropertyAttribute(string key) { }\n        public string? Key { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PutAttribute : Refit.HttpMethodAttribute\n    {\n        public PutAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    public class QueryAttribute : System.Attribute\n    {\n        public QueryAttribute() { }\n        public QueryAttribute(Refit.CollectionFormat collectionFormat) { }\n        public QueryAttribute(string delimiter) { }\n        public QueryAttribute(string delimiter, string prefix) { }\n        public QueryAttribute(string delimiter, string prefix, string format) { }\n        public Refit.CollectionFormat CollectionFormat { get; set; }\n        public string Delimiter { get; protected set; }\n        public string? Format { get; set; }\n        public bool IsCollectionFormatSpecified { get; }\n        public string? Prefix { get; protected set; }\n        public bool TreatAsString { get; set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class QueryUriFormatAttribute : System.Attribute\n    {\n        public QueryUriFormatAttribute(System.UriFormat uriFormat) { }\n        public System.UriFormat UriFormat { get; }\n    }\n    public class RefitSettings\n    {\n        public RefitSettings() { }\n        public RefitSettings(Refit.IHttpContentSerializer contentSerializer, Refit.IUrlParameterFormatter? urlParameterFormatter, Refit.IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter) { }\n        public RefitSettings(Refit.IHttpContentSerializer contentSerializer, Refit.IUrlParameterFormatter? urlParameterFormatter = null, Refit.IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter = null, Refit.IUrlParameterKeyFormatter? urlParameterKeyFormatter = null) { }\n        public System.Func<System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken, System.Threading.Tasks.Task<string>>? AuthorizationHeaderValueGetter { get; set; }\n        public bool Buffered { get; set; }\n        public Refit.CollectionFormat CollectionFormat { get; set; }\n        public Refit.IHttpContentSerializer ContentSerializer { get; set; }\n        public System.Func<System.Net.Http.HttpResponseMessage, System.Exception, System.Threading.Tasks.Task<System.Exception?>>? DeserializationExceptionFactory { get; set; }\n        public System.Func<System.Net.Http.HttpResponseMessage, System.Threading.Tasks.Task<System.Exception?>> ExceptionFactory { get; set; }\n        public Refit.IFormUrlEncodedParameterFormatter FormUrlEncodedParameterFormatter { get; set; }\n        public System.Func<System.Net.Http.HttpMessageHandler>? HttpMessageHandlerFactory { get; set; }\n        public System.Collections.Generic.Dictionary<string, object>? HttpRequestMessageOptions { get; set; }\n        public Refit.IUrlParameterFormatter UrlParameterFormatter { get; set; }\n        public Refit.IUrlParameterKeyFormatter UrlParameterKeyFormatter { get; set; }\n        public System.Version Version { get; set; }\n        public System.Net.Http.HttpVersionPolicy VersionPolicy { get; set; }\n    }\n    public static class RequestBuilder\n    {\n        public static Refit.IRequestBuilder ForType(System.Type refitInterfaceType) { }\n        public static Refit.IRequestBuilder ForType(System.Type refitInterfaceType, Refit.RefitSettings? settings) { }\n        public static Refit.IRequestBuilder<T> ForType<T>() { }\n        public static Refit.IRequestBuilder<T> ForType<T>(Refit.RefitSettings? settings) { }\n    }\n    public class RestMethodInfo : System.IEquatable<Refit.RestMethodInfo>\n    {\n        public RestMethodInfo(string Name, System.Type HostingType, System.Reflection.MethodInfo MethodInfo, string RelativePath, System.Type ReturnType) { }\n        public System.Type HostingType { get; init; }\n        public System.Reflection.MethodInfo MethodInfo { get; init; }\n        public string Name { get; init; }\n        public string RelativePath { get; init; }\n        public System.Type ReturnType { get; init; }\n    }\n    public class RestMethodParameterInfo\n    {\n        public RestMethodParameterInfo(bool isObjectPropertyParameter, System.Reflection.ParameterInfo parameterInfo) { }\n        public RestMethodParameterInfo(string name, System.Reflection.ParameterInfo parameterInfo) { }\n        public bool IsObjectPropertyParameter { get; set; }\n        public string? Name { get; set; }\n        public System.Reflection.ParameterInfo ParameterInfo { get; set; }\n        public System.Collections.Generic.List<Refit.RestMethodParameterProperty> ParameterProperties { get; set; }\n        public Refit.ParameterType Type { get; set; }\n    }\n    public class RestMethodParameterProperty\n    {\n        public RestMethodParameterProperty(string name, System.Reflection.PropertyInfo propertyInfo) { }\n        public string Name { get; set; }\n        public System.Reflection.PropertyInfo PropertyInfo { get; set; }\n    }\n    public static class RestService\n    {\n        public static System.Net.Http.HttpClient CreateHttpClient(string hostUrl, Refit.RefitSettings? settings) { }\n        public static object For(System.Type refitInterfaceType, System.Net.Http.HttpClient client) { }\n        public static object For(System.Type refitInterfaceType, string hostUrl) { }\n        public static object For(System.Type refitInterfaceType, System.Net.Http.HttpClient client, Refit.IRequestBuilder builder) { }\n        public static object For(System.Type refitInterfaceType, System.Net.Http.HttpClient client, Refit.RefitSettings? settings) { }\n        public static object For(System.Type refitInterfaceType, string hostUrl, Refit.RefitSettings? settings) { }\n        public static T For<T>(System.Net.Http.HttpClient client) { }\n        public static T For<T>(string hostUrl) { }\n        public static T For<T>(System.Net.Http.HttpClient client, Refit.IRequestBuilder<T> builder) { }\n        public static T For<T>(System.Net.Http.HttpClient client, Refit.RefitSettings? settings) { }\n        public static T For<T>(string hostUrl, Refit.RefitSettings? settings) { }\n    }\n    public class StreamPart : Refit.MultipartItem\n    {\n        public StreamPart(System.IO.Stream value, string fileName, string? contentType = null, string? name = null) { }\n        public System.IO.Stream Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    public sealed class SystemTextJsonContentSerializer : Refit.IHttpContentSerializer\n    {\n        public SystemTextJsonContentSerializer() { }\n        public SystemTextJsonContentSerializer(System.Text.Json.JsonSerializerOptions jsonSerializerOptions) { }\n        public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default) { }\n        public string? GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo) { }\n        public System.Net.Http.HttpContent ToHttpContent<T>(T item) { }\n        public static System.Text.Json.JsonSerializerOptions GetDefaultJsonSerializerOptions() { }\n    }\n    [System.Serializable]\n    public class ValidationApiException : Refit.ApiException\n    {\n        public new Refit.ProblemDetails? Content { get; }\n        public static Refit.ValidationApiException Create(Refit.ApiException exception) { }\n    }\n}"
  },
  {
    "path": "Refit.Tests/API/ApiApprovalTests.cs",
    "content": "﻿// Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved.\n// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for full license information.\n\n#if !NET48\nusing System.Diagnostics.CodeAnalysis;\n\nnamespace Refit.Tests.API;\n\n/// <summary>\n/// Checks to make sure that the API is consistent with previous releases, and new API changes are highlighted.\n/// </summary>\n[ExcludeFromCodeCoverage]\npublic class ApiApprovalTests\n{\n    /// <summary>\n    /// Generates public API for the ReactiveUI API.\n    /// </summary>\n    /// <returns>A task to monitor the process.</returns>\n    [Fact]\n    public Task Refit() => typeof(ApiResponse).Assembly.CheckApproval([\"Refit\"]);\n}\n#endif\n"
  },
  {
    "path": "Refit.Tests/API/ApiExtensions.cs",
    "content": "﻿// Copyright (c) 2024 .NET Foundation and Contributors. All rights reserved.\n// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for full license information.\n\n#if !NET48\nusing System.Diagnostics.CodeAnalysis;\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\n\nusing PublicApiGenerator;\n\nusing VerifyXunit;\n\nnamespace Refit.Tests;\n\n/// <summary>\n/// A helper for doing API approvals.\n/// </summary>\n[ExcludeFromCodeCoverage]\npublic static class ApiExtensions\n{\n    /// <summary>\n    /// Checks to make sure the API is approved.\n    /// </summary>\n    /// <param name=\"assembly\">The assembly that is being checked.</param>\n    /// <param name=\"namespaces\">The namespaces.</param>\n    /// <param name=\"filePath\">The caller file path.</param>\n    /// <returns>\n    /// A Task.\n    /// </returns>\n    public static async Task CheckApproval(this Assembly assembly, string[] namespaces, [CallerFilePath] string filePath = \"\")\n    {\n        var generatorOptions = new ApiGeneratorOptions { AllowNamespacePrefixes = namespaces };\n        var apiText = assembly.GeneratePublicApi(generatorOptions);\n        var result = await Verifier.Verify(apiText, null, filePath)\n            .UniqueForRuntimeAndVersion()\n            .ScrubEmptyLines()\n            .ScrubLines(l =>\n                l.StartsWith(\"[assembly: AssemblyVersion(\", StringComparison.InvariantCulture) ||\n                l.StartsWith(\"[assembly: AssemblyFileVersion(\", StringComparison.InvariantCulture) ||\n                l.StartsWith(\"[assembly: AssemblyInformationalVersion(\", StringComparison.InvariantCulture) ||\n                l.StartsWith(\"[assembly: System.Reflection.AssemblyMetadata(\", StringComparison.InvariantCulture));\n    }\n}\n#endif\n"
  },
  {
    "path": "Refit.Tests/API/_snapshots/ApiApprovalTests.Refit.DotNet10_0.verified.txt",
    "content": "﻿[assembly: System.Runtime.CompilerServices.DisableRuntimeMarshalling]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.HttpClientFactory\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Newtonsoft.Json\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Tests\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Xml\")]\n[assembly: System.Runtime.Versioning.TargetFramework(\".NETCoreApp,Version=v10.0\", FrameworkDisplayName=\".NET 10.0\")]\nnamespace Refit\n{\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    public class AliasAsAttribute : System.Attribute\n    {\n        public AliasAsAttribute(string name) { }\n        public string Name { get; protected set; }\n    }\n    [System.Serializable]\n    public class ApiException : System.Exception\n    {\n        protected ApiException(System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        protected ApiException(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        public string? Content { get; }\n        public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        public bool HasContent { get; }\n        public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        public System.Net.Http.HttpMethod HttpMethod { get; }\n        public string? ReasonPhrase { get; }\n        public Refit.RefitSettings RefitSettings { get; }\n        public System.Net.Http.HttpRequestMessage RequestMessage { get; }\n        public System.Net.HttpStatusCode StatusCode { get; }\n        public System.Uri? Uri { get; }\n        public System.Threading.Tasks.Task<T?> GetContentAsAsync<T>() { }\n        public static System.Threading.Tasks.Task<Refit.ApiException> Create(System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, System.Net.Http.HttpResponseMessage response, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        public static System.Threading.Tasks.Task<Refit.ApiException> Create(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, System.Net.Http.HttpResponseMessage response, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n    }\n    public sealed class ApiResponse<T> : Refit.IApiResponse, Refit.IApiResponse<T>, System.IDisposable\n    {\n        public ApiResponse(System.Net.Http.HttpResponseMessage response, T? content, Refit.RefitSettings settings, Refit.ApiException? error = null) { }\n        public T Content { get; }\n        public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        public Refit.ApiException? Error { get; }\n        public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        public bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        public bool IsSuccessful { get; }\n        public string? ReasonPhrase { get; }\n        public System.Net.Http.HttpRequestMessage? RequestMessage { get; }\n        public Refit.RefitSettings Settings { get; }\n        public System.Net.HttpStatusCode StatusCode { get; }\n        public System.Version Version { get; }\n        public void Dispose() { }\n        public System.Threading.Tasks.Task<Refit.ApiResponse<T>> EnsureSuccessStatusCodeAsync() { }\n        public System.Threading.Tasks.Task<Refit.ApiResponse<T>> EnsureSuccessfulAsync() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    [System.Obsolete(\"Use Refit.StreamPart, Refit.ByteArrayPart, Refit.FileInfoPart or if necessary, in\" +\n        \"herit from Refit.MultipartItem\", false)]\n    public class AttachmentNameAttribute : System.Attribute\n    {\n        public AttachmentNameAttribute(string name) { }\n        public string Name { get; protected set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class AuthorizeAttribute : System.Attribute\n    {\n        public AuthorizeAttribute(string scheme = \"Bearer\") { }\n        public string Scheme { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class BodyAttribute : System.Attribute\n    {\n        public BodyAttribute() { }\n        public BodyAttribute(Refit.BodySerializationMethod serializationMethod = 0) { }\n        public BodyAttribute(bool buffered) { }\n        public BodyAttribute(Refit.BodySerializationMethod serializationMethod, bool buffered) { }\n        public bool? Buffered { get; }\n        public Refit.BodySerializationMethod SerializationMethod { get; }\n    }\n    public enum BodySerializationMethod\n    {\n        Default = 0,\n        [System.Obsolete(\"Use BodySerializationMethod.Serialized instead\", false)]\n        Json = 1,\n        UrlEncoded = 2,\n        Serialized = 3,\n    }\n    public class ByteArrayPart : Refit.MultipartItem\n    {\n        public ByteArrayPart(byte[] value, string fileName, string? contentType = null, string? name = null) { }\n        public byte[] Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    public class CamelCaseUrlParameterKeyFormatter : Refit.IUrlParameterKeyFormatter\n    {\n        public CamelCaseUrlParameterKeyFormatter() { }\n        public string Format(string key) { }\n    }\n    public enum CollectionFormat\n    {\n        RefitParameterFormatter = 0,\n        Csv = 1,\n        Ssv = 2,\n        Tsv = 3,\n        Pipes = 4,\n        Multi = 5,\n    }\n    public class DefaultApiExceptionFactory\n    {\n        public DefaultApiExceptionFactory(Refit.RefitSettings refitSettings) { }\n        public System.Threading.Tasks.Task<System.Exception?> CreateAsync(System.Net.Http.HttpResponseMessage responseMessage) { }\n    }\n    public class DefaultFormUrlEncodedParameterFormatter : Refit.IFormUrlEncodedParameterFormatter\n    {\n        public DefaultFormUrlEncodedParameterFormatter() { }\n        public virtual string? Format(object? parameterValue, string? formatString) { }\n    }\n    public class DefaultUrlParameterFormatter : Refit.IUrlParameterFormatter\n    {\n        public DefaultUrlParameterFormatter() { }\n        public void AddFormat<TParameter>(string format) { }\n        public void AddFormat<TContainer, TParameter>(string format) { }\n        public virtual string? Format(object? parameterValue, System.Reflection.ICustomAttributeProvider attributeProvider, System.Type type) { }\n    }\n    public class DefaultUrlParameterKeyFormatter : Refit.IUrlParameterKeyFormatter\n    {\n        public DefaultUrlParameterKeyFormatter() { }\n        public virtual string Format(string key) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class DeleteAttribute : Refit.HttpMethodAttribute\n    {\n        public DeleteAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public class FileInfoPart : Refit.MultipartItem\n    {\n        public FileInfoPart(System.IO.FileInfo value, string fileName, string? contentType = null, string? name = null) { }\n        public System.IO.FileInfo Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class GetAttribute : Refit.HttpMethodAttribute\n    {\n        public GetAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class HeadAttribute : Refit.HttpMethodAttribute\n    {\n        public HeadAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class HeaderAttribute : System.Attribute\n    {\n        public HeaderAttribute(string header) { }\n        public string Header { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class HeaderCollectionAttribute : System.Attribute\n    {\n        public HeaderCollectionAttribute() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Interface)]\n    public class HeadersAttribute : System.Attribute\n    {\n        public HeadersAttribute(params string[] headers) { }\n        public string[] Headers { get; }\n    }\n    public abstract class HttpMethodAttribute : System.Attribute\n    {\n        protected HttpMethodAttribute(string path) { }\n        public abstract System.Net.Http.HttpMethod Method { get; }\n        public virtual string Path { get; protected set; }\n    }\n    public static class HttpRequestMessageOptions\n    {\n        public static string InterfaceType { get; }\n        public static string RestMethodInfo { get; }\n    }\n    public interface IApiResponse : System.IDisposable\n    {\n        System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        Refit.ApiException? Error { get; }\n        System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        bool IsSuccessful { get; }\n        string? ReasonPhrase { get; }\n        System.Net.Http.HttpRequestMessage? RequestMessage { get; }\n        System.Net.HttpStatusCode StatusCode { get; }\n        System.Version Version { get; }\n    }\n    public interface IApiResponse<out T> : Refit.IApiResponse, System.IDisposable\n    {\n        T Content { get; }\n        new System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        new Refit.ApiException? Error { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        new bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        new bool IsSuccessful { get; }\n    }\n    public interface IFormUrlEncodedParameterFormatter\n    {\n        string? Format(object? value, string? formatString);\n    }\n    public interface IHttpContentSerializer\n    {\n        System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default);\n        string? GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo);\n        System.Net.Http.HttpContent ToHttpContent<T>(T item);\n    }\n    public interface IRequestBuilder\n    {\n        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces \" +\n            \"and DTOs are preserved when trimming.\")]\n        System.Func<System.Net.Http.HttpClient, object[], object?> BuildRestResultFuncForMethod(string methodName, System.Type[]? parameterTypes = null, System.Type[]? genericArgumentTypes = null);\n    }\n    public interface IRequestBuilder<T> : Refit.IRequestBuilder { }\n    public interface IUrlParameterFormatter\n    {\n        string? Format(object? value, System.Reflection.ICustomAttributeProvider attributeProvider, System.Type type);\n    }\n    public interface IUrlParameterKeyFormatter\n    {\n        string Format(string key);\n    }\n    [System.Obsolete(\"Use NewtonsoftJsonContentSerializer in the Refit.Newtonsoft.Json package instead\", true)]\n    public class JsonContentSerializer : Refit.IHttpContentSerializer\n    {\n        public JsonContentSerializer() { }\n        public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default) { }\n        public string GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo) { }\n        public System.Net.Http.HttpContent ToHttpContent<T>(T item) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class MultipartAttribute : System.Attribute\n    {\n        public MultipartAttribute(string boundaryText = \"----MyGreatBoundary\") { }\n        public string BoundaryText { get; }\n    }\n    public abstract class MultipartItem\n    {\n        protected MultipartItem(string fileName, string? contentType) { }\n        public MultipartItem(string fileName, string? contentType, string? name) { }\n        public string? ContentType { get; }\n        public string FileName { get; }\n        public string? Name { get; }\n        protected abstract System.Net.Http.HttpContent CreateContent();\n        public System.Net.Http.HttpContent ToContent() { }\n    }\n    public class ObjectToInferredTypesConverter : System.Text.Json.Serialization.JsonConverter<object>\n    {\n        public ObjectToInferredTypesConverter() { }\n        public override object? Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { }\n        public override void Write(System.Text.Json.Utf8JsonWriter writer, object objectToWrite, System.Text.Json.JsonSerializerOptions options) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class OptionsAttribute : Refit.HttpMethodAttribute\n    {\n        public OptionsAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public enum ParameterType\n    {\n        Normal = 0,\n        RoundTripping = 1,\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PatchAttribute : Refit.HttpMethodAttribute\n    {\n        public PatchAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PostAttribute : Refit.HttpMethodAttribute\n    {\n        public PostAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public class ProblemDetails\n    {\n        public ProblemDetails() { }\n        public string? Detail { get; set; }\n        public System.Collections.Generic.Dictionary<string, string[]> Errors { get; set; }\n        [System.Text.Json.Serialization.JsonExtensionData]\n        public System.Collections.Generic.IDictionary<string, object> Extensions { get; set; }\n        public string? Instance { get; set; }\n        public int Status { get; set; }\n        public string? Title { get; set; }\n        public string? Type { get; set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class PropertyAttribute : System.Attribute\n    {\n        public PropertyAttribute() { }\n        public PropertyAttribute(string key) { }\n        public string? Key { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PutAttribute : Refit.HttpMethodAttribute\n    {\n        public PutAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    public class QueryAttribute : System.Attribute\n    {\n        public QueryAttribute() { }\n        public QueryAttribute(Refit.CollectionFormat collectionFormat) { }\n        public QueryAttribute(string delimiter) { }\n        public QueryAttribute(string delimiter, string prefix) { }\n        public QueryAttribute(string delimiter, string prefix, string format) { }\n        public Refit.CollectionFormat CollectionFormat { get; set; }\n        public string Delimiter { get; protected set; }\n        public string? Format { get; set; }\n        public bool IsCollectionFormatSpecified { get; }\n        public string? Prefix { get; protected set; }\n        public bool TreatAsString { get; set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class QueryUriFormatAttribute : System.Attribute\n    {\n        public QueryUriFormatAttribute(System.UriFormat uriFormat) { }\n        public System.UriFormat UriFormat { get; }\n    }\n    public class RefitSettings\n    {\n        public RefitSettings() { }\n        public RefitSettings(Refit.IHttpContentSerializer contentSerializer, Refit.IUrlParameterFormatter? urlParameterFormatter, Refit.IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter) { }\n        public RefitSettings(Refit.IHttpContentSerializer contentSerializer, Refit.IUrlParameterFormatter? urlParameterFormatter = null, Refit.IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter = null, Refit.IUrlParameterKeyFormatter? urlParameterKeyFormatter = null) { }\n        public System.Func<System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken, System.Threading.Tasks.Task<string>>? AuthorizationHeaderValueGetter { get; set; }\n        public bool Buffered { get; set; }\n        public Refit.CollectionFormat CollectionFormat { get; set; }\n        public Refit.IHttpContentSerializer ContentSerializer { get; set; }\n        public System.Func<System.Net.Http.HttpResponseMessage, System.Exception, System.Threading.Tasks.Task<System.Exception?>>? DeserializationExceptionFactory { get; set; }\n        public System.Func<System.Net.Http.HttpResponseMessage, System.Threading.Tasks.Task<System.Exception?>> ExceptionFactory { get; set; }\n        public Refit.IFormUrlEncodedParameterFormatter FormUrlEncodedParameterFormatter { get; set; }\n        public System.Func<System.Net.Http.HttpMessageHandler>? HttpMessageHandlerFactory { get; set; }\n        public System.Collections.Generic.Dictionary<string, object>? HttpRequestMessageOptions { get; set; }\n        public Refit.IUrlParameterFormatter UrlParameterFormatter { get; set; }\n        public Refit.IUrlParameterKeyFormatter UrlParameterKeyFormatter { get; set; }\n        public System.Version Version { get; set; }\n        public System.Net.Http.HttpVersionPolicy VersionPolicy { get; set; }\n    }\n    public static class RequestBuilder\n    {\n        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces \" +\n            \"and DTOs are preserved when trimming.\")]\n        public static Refit.IRequestBuilder ForType(System.Type refitInterfaceType) { }\n        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces \" +\n            \"and DTOs are preserved when trimming.\")]\n        public static Refit.IRequestBuilder ForType([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, Refit.RefitSettings? settings) { }\n        public static Refit.IRequestBuilder<T> ForType<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>() { }\n        public static Refit.IRequestBuilder<T> ForType<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(Refit.RefitSettings? settings) { }\n    }\n    public class RestMethodInfo : System.IEquatable<Refit.RestMethodInfo>\n    {\n        public RestMethodInfo(string Name, System.Type HostingType, System.Reflection.MethodInfo MethodInfo, string RelativePath, System.Type ReturnType) { }\n        public System.Type HostingType { get; init; }\n        public System.Reflection.MethodInfo MethodInfo { get; init; }\n        public string Name { get; init; }\n        public string RelativePath { get; init; }\n        public System.Type ReturnType { get; init; }\n    }\n    public class RestMethodParameterInfo\n    {\n        public RestMethodParameterInfo(bool isObjectPropertyParameter, System.Reflection.ParameterInfo parameterInfo) { }\n        public RestMethodParameterInfo(string name, System.Reflection.ParameterInfo parameterInfo) { }\n        public bool IsObjectPropertyParameter { get; set; }\n        public string? Name { get; set; }\n        public System.Reflection.ParameterInfo ParameterInfo { get; set; }\n        public System.Collections.Generic.List<Refit.RestMethodParameterProperty> ParameterProperties { get; set; }\n        public Refit.ParameterType Type { get; set; }\n    }\n    public class RestMethodParameterProperty\n    {\n        public RestMethodParameterProperty(string name, System.Reflection.PropertyInfo propertyInfo) { }\n        public string Name { get; set; }\n        public System.Reflection.PropertyInfo PropertyInfo { get; set; }\n    }\n    public static class RestService\n    {\n        public static System.Net.Http.HttpClient CreateHttpClient(string hostUrl, Refit.RefitSettings? settings) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, System.Net.Http.HttpClient client) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, string hostUrl) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, System.Net.Http.HttpClient client, Refit.IRequestBuilder builder) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, System.Net.Http.HttpClient client, Refit.RefitSettings? settings) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, string hostUrl, Refit.RefitSettings? settings) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(System.Net.Http.HttpClient client) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(string hostUrl) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(System.Net.Http.HttpClient client, Refit.IRequestBuilder<T> builder) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(System.Net.Http.HttpClient client, Refit.RefitSettings? settings) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(string hostUrl, Refit.RefitSettings? settings) { }\n    }\n    public class StreamPart : Refit.MultipartItem\n    {\n        public StreamPart(System.IO.Stream value, string fileName, string? contentType = null, string? name = null) { }\n        public System.IO.Stream Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    public sealed class SystemTextJsonContentSerializer : Refit.IHttpContentSerializer\n    {\n        public SystemTextJsonContentSerializer() { }\n        public SystemTextJsonContentSerializer(System.Text.Json.JsonSerializerOptions jsonSerializerOptions) { }\n        public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default) { }\n        public string? GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo) { }\n        public System.Net.Http.HttpContent ToHttpContent<T>(T item) { }\n        public static System.Text.Json.JsonSerializerOptions GetDefaultJsonSerializerOptions() { }\n    }\n    [System.Serializable]\n    public class ValidationApiException : Refit.ApiException\n    {\n        public new Refit.ProblemDetails? Content { get; }\n        public static Refit.ValidationApiException Create(Refit.ApiException exception) { }\n    }\n}"
  },
  {
    "path": "Refit.Tests/API/_snapshots/ApiApprovalTests.Refit.DotNet8_0.verified.txt",
    "content": "﻿[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.HttpClientFactory\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Newtonsoft.Json\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Tests\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Xml\")]\n[assembly: System.Runtime.Versioning.TargetFramework(\".NETCoreApp,Version=v8.0\", FrameworkDisplayName=\".NET 8.0\")]\nnamespace Refit\n{\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    public class AliasAsAttribute : System.Attribute\n    {\n        public AliasAsAttribute(string name) { }\n        public string Name { get; protected set; }\n    }\n    [System.Serializable]\n    public class ApiException : System.Exception\n    {\n        protected ApiException(System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        protected ApiException(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        public string? Content { get; }\n        public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        public bool HasContent { get; }\n        public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        public System.Net.Http.HttpMethod HttpMethod { get; }\n        public string? ReasonPhrase { get; }\n        public Refit.RefitSettings RefitSettings { get; }\n        public System.Net.Http.HttpRequestMessage RequestMessage { get; }\n        public System.Net.HttpStatusCode StatusCode { get; }\n        public System.Uri? Uri { get; }\n        public System.Threading.Tasks.Task<T?> GetContentAsAsync<T>() { }\n        public static System.Threading.Tasks.Task<Refit.ApiException> Create(System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, System.Net.Http.HttpResponseMessage response, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        public static System.Threading.Tasks.Task<Refit.ApiException> Create(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, System.Net.Http.HttpResponseMessage response, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n    }\n    public sealed class ApiResponse<T> : Refit.IApiResponse, Refit.IApiResponse<T>, System.IDisposable\n    {\n        public ApiResponse(System.Net.Http.HttpResponseMessage response, T? content, Refit.RefitSettings settings, Refit.ApiException? error = null) { }\n        public T Content { get; }\n        public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        public Refit.ApiException? Error { get; }\n        public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        public bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        public bool IsSuccessful { get; }\n        public string? ReasonPhrase { get; }\n        public System.Net.Http.HttpRequestMessage? RequestMessage { get; }\n        public Refit.RefitSettings Settings { get; }\n        public System.Net.HttpStatusCode StatusCode { get; }\n        public System.Version Version { get; }\n        public void Dispose() { }\n        public System.Threading.Tasks.Task<Refit.ApiResponse<T>> EnsureSuccessStatusCodeAsync() { }\n        public System.Threading.Tasks.Task<Refit.ApiResponse<T>> EnsureSuccessfulAsync() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    [System.Obsolete(\"Use Refit.StreamPart, Refit.ByteArrayPart, Refit.FileInfoPart or if necessary, in\" +\n        \"herit from Refit.MultipartItem\", false)]\n    public class AttachmentNameAttribute : System.Attribute\n    {\n        public AttachmentNameAttribute(string name) { }\n        public string Name { get; protected set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class AuthorizeAttribute : System.Attribute\n    {\n        public AuthorizeAttribute(string scheme = \"Bearer\") { }\n        public string Scheme { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class BodyAttribute : System.Attribute\n    {\n        public BodyAttribute() { }\n        public BodyAttribute(Refit.BodySerializationMethod serializationMethod = 0) { }\n        public BodyAttribute(bool buffered) { }\n        public BodyAttribute(Refit.BodySerializationMethod serializationMethod, bool buffered) { }\n        public bool? Buffered { get; }\n        public Refit.BodySerializationMethod SerializationMethod { get; }\n    }\n    public enum BodySerializationMethod\n    {\n        Default = 0,\n        [System.Obsolete(\"Use BodySerializationMethod.Serialized instead\", false)]\n        Json = 1,\n        UrlEncoded = 2,\n        Serialized = 3,\n    }\n    public class ByteArrayPart : Refit.MultipartItem\n    {\n        public ByteArrayPart(byte[] value, string fileName, string? contentType = null, string? name = null) { }\n        public byte[] Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    public class CamelCaseUrlParameterKeyFormatter : Refit.IUrlParameterKeyFormatter\n    {\n        public CamelCaseUrlParameterKeyFormatter() { }\n        public string Format(string key) { }\n    }\n    public enum CollectionFormat\n    {\n        RefitParameterFormatter = 0,\n        Csv = 1,\n        Ssv = 2,\n        Tsv = 3,\n        Pipes = 4,\n        Multi = 5,\n    }\n    public class DefaultApiExceptionFactory\n    {\n        public DefaultApiExceptionFactory(Refit.RefitSettings refitSettings) { }\n        public System.Threading.Tasks.Task<System.Exception?> CreateAsync(System.Net.Http.HttpResponseMessage responseMessage) { }\n    }\n    public class DefaultFormUrlEncodedParameterFormatter : Refit.IFormUrlEncodedParameterFormatter\n    {\n        public DefaultFormUrlEncodedParameterFormatter() { }\n        public virtual string? Format(object? parameterValue, string? formatString) { }\n    }\n    public class DefaultUrlParameterFormatter : Refit.IUrlParameterFormatter\n    {\n        public DefaultUrlParameterFormatter() { }\n        public void AddFormat<TParameter>(string format) { }\n        public void AddFormat<TContainer, TParameter>(string format) { }\n        public virtual string? Format(object? parameterValue, System.Reflection.ICustomAttributeProvider attributeProvider, System.Type type) { }\n    }\n    public class DefaultUrlParameterKeyFormatter : Refit.IUrlParameterKeyFormatter\n    {\n        public DefaultUrlParameterKeyFormatter() { }\n        public virtual string Format(string key) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class DeleteAttribute : Refit.HttpMethodAttribute\n    {\n        public DeleteAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public class FileInfoPart : Refit.MultipartItem\n    {\n        public FileInfoPart(System.IO.FileInfo value, string fileName, string? contentType = null, string? name = null) { }\n        public System.IO.FileInfo Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class GetAttribute : Refit.HttpMethodAttribute\n    {\n        public GetAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class HeadAttribute : Refit.HttpMethodAttribute\n    {\n        public HeadAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class HeaderAttribute : System.Attribute\n    {\n        public HeaderAttribute(string header) { }\n        public string Header { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class HeaderCollectionAttribute : System.Attribute\n    {\n        public HeaderCollectionAttribute() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Interface)]\n    public class HeadersAttribute : System.Attribute\n    {\n        public HeadersAttribute(params string[] headers) { }\n        public string[] Headers { get; }\n    }\n    public abstract class HttpMethodAttribute : System.Attribute\n    {\n        protected HttpMethodAttribute(string path) { }\n        public abstract System.Net.Http.HttpMethod Method { get; }\n        public virtual string Path { get; protected set; }\n    }\n    public static class HttpRequestMessageOptions\n    {\n        public static string InterfaceType { get; }\n        public static string RestMethodInfo { get; }\n    }\n    public interface IApiResponse : System.IDisposable\n    {\n        System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        Refit.ApiException? Error { get; }\n        System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        bool IsSuccessful { get; }\n        string? ReasonPhrase { get; }\n        System.Net.Http.HttpRequestMessage? RequestMessage { get; }\n        System.Net.HttpStatusCode StatusCode { get; }\n        System.Version Version { get; }\n    }\n    public interface IApiResponse<out T> : Refit.IApiResponse, System.IDisposable\n    {\n        T Content { get; }\n        new System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        new Refit.ApiException? Error { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        new bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        new bool IsSuccessful { get; }\n    }\n    public interface IFormUrlEncodedParameterFormatter\n    {\n        string? Format(object? value, string? formatString);\n    }\n    public interface IHttpContentSerializer\n    {\n        System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default);\n        string? GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo);\n        System.Net.Http.HttpContent ToHttpContent<T>(T item);\n    }\n    public interface IRequestBuilder\n    {\n        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces \" +\n            \"and DTOs are preserved when trimming.\")]\n        System.Func<System.Net.Http.HttpClient, object[], object?> BuildRestResultFuncForMethod(string methodName, System.Type[]? parameterTypes = null, System.Type[]? genericArgumentTypes = null);\n    }\n    public interface IRequestBuilder<T> : Refit.IRequestBuilder { }\n    public interface IUrlParameterFormatter\n    {\n        string? Format(object? value, System.Reflection.ICustomAttributeProvider attributeProvider, System.Type type);\n    }\n    public interface IUrlParameterKeyFormatter\n    {\n        string Format(string key);\n    }\n    [System.Obsolete(\"Use NewtonsoftJsonContentSerializer in the Refit.Newtonsoft.Json package instead\", true)]\n    public class JsonContentSerializer : Refit.IHttpContentSerializer\n    {\n        public JsonContentSerializer() { }\n        public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default) { }\n        public string GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo) { }\n        public System.Net.Http.HttpContent ToHttpContent<T>(T item) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class MultipartAttribute : System.Attribute\n    {\n        public MultipartAttribute(string boundaryText = \"----MyGreatBoundary\") { }\n        public string BoundaryText { get; }\n    }\n    public abstract class MultipartItem\n    {\n        protected MultipartItem(string fileName, string? contentType) { }\n        public MultipartItem(string fileName, string? contentType, string? name) { }\n        public string? ContentType { get; }\n        public string FileName { get; }\n        public string? Name { get; }\n        protected abstract System.Net.Http.HttpContent CreateContent();\n        public System.Net.Http.HttpContent ToContent() { }\n    }\n    public class ObjectToInferredTypesConverter : System.Text.Json.Serialization.JsonConverter<object>\n    {\n        public ObjectToInferredTypesConverter() { }\n        public override object? Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { }\n        public override void Write(System.Text.Json.Utf8JsonWriter writer, object objectToWrite, System.Text.Json.JsonSerializerOptions options) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class OptionsAttribute : Refit.HttpMethodAttribute\n    {\n        public OptionsAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public enum ParameterType\n    {\n        Normal = 0,\n        RoundTripping = 1,\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PatchAttribute : Refit.HttpMethodAttribute\n    {\n        public PatchAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PostAttribute : Refit.HttpMethodAttribute\n    {\n        public PostAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public class ProblemDetails\n    {\n        public ProblemDetails() { }\n        public string? Detail { get; set; }\n        public System.Collections.Generic.Dictionary<string, string[]> Errors { get; set; }\n        [System.Text.Json.Serialization.JsonExtensionData]\n        public System.Collections.Generic.IDictionary<string, object> Extensions { get; set; }\n        public string? Instance { get; set; }\n        public int Status { get; set; }\n        public string? Title { get; set; }\n        public string? Type { get; set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class PropertyAttribute : System.Attribute\n    {\n        public PropertyAttribute() { }\n        public PropertyAttribute(string key) { }\n        public string? Key { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PutAttribute : Refit.HttpMethodAttribute\n    {\n        public PutAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    public class QueryAttribute : System.Attribute\n    {\n        public QueryAttribute() { }\n        public QueryAttribute(Refit.CollectionFormat collectionFormat) { }\n        public QueryAttribute(string delimiter) { }\n        public QueryAttribute(string delimiter, string prefix) { }\n        public QueryAttribute(string delimiter, string prefix, string format) { }\n        public Refit.CollectionFormat CollectionFormat { get; set; }\n        public string Delimiter { get; protected set; }\n        public string? Format { get; set; }\n        public bool IsCollectionFormatSpecified { get; }\n        public string? Prefix { get; protected set; }\n        public bool TreatAsString { get; set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class QueryUriFormatAttribute : System.Attribute\n    {\n        public QueryUriFormatAttribute(System.UriFormat uriFormat) { }\n        public System.UriFormat UriFormat { get; }\n    }\n    public class RefitSettings\n    {\n        public RefitSettings() { }\n        public RefitSettings(Refit.IHttpContentSerializer contentSerializer, Refit.IUrlParameterFormatter? urlParameterFormatter, Refit.IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter) { }\n        public RefitSettings(Refit.IHttpContentSerializer contentSerializer, Refit.IUrlParameterFormatter? urlParameterFormatter = null, Refit.IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter = null, Refit.IUrlParameterKeyFormatter? urlParameterKeyFormatter = null) { }\n        public System.Func<System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken, System.Threading.Tasks.Task<string>>? AuthorizationHeaderValueGetter { get; set; }\n        public bool Buffered { get; set; }\n        public Refit.CollectionFormat CollectionFormat { get; set; }\n        public Refit.IHttpContentSerializer ContentSerializer { get; set; }\n        public System.Func<System.Net.Http.HttpResponseMessage, System.Exception, System.Threading.Tasks.Task<System.Exception?>>? DeserializationExceptionFactory { get; set; }\n        public System.Func<System.Net.Http.HttpResponseMessage, System.Threading.Tasks.Task<System.Exception?>> ExceptionFactory { get; set; }\n        public Refit.IFormUrlEncodedParameterFormatter FormUrlEncodedParameterFormatter { get; set; }\n        public System.Func<System.Net.Http.HttpMessageHandler>? HttpMessageHandlerFactory { get; set; }\n        public System.Collections.Generic.Dictionary<string, object>? HttpRequestMessageOptions { get; set; }\n        public Refit.IUrlParameterFormatter UrlParameterFormatter { get; set; }\n        public Refit.IUrlParameterKeyFormatter UrlParameterKeyFormatter { get; set; }\n        public System.Version Version { get; set; }\n        public System.Net.Http.HttpVersionPolicy VersionPolicy { get; set; }\n    }\n    public static class RequestBuilder\n    {\n        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces \" +\n            \"and DTOs are preserved when trimming.\")]\n        public static Refit.IRequestBuilder ForType(System.Type refitInterfaceType) { }\n        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces \" +\n            \"and DTOs are preserved when trimming.\")]\n        public static Refit.IRequestBuilder ForType([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, Refit.RefitSettings? settings) { }\n        public static Refit.IRequestBuilder<T> ForType<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>() { }\n        public static Refit.IRequestBuilder<T> ForType<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(Refit.RefitSettings? settings) { }\n    }\n    public class RestMethodInfo : System.IEquatable<Refit.RestMethodInfo>\n    {\n        public RestMethodInfo(string Name, System.Type HostingType, System.Reflection.MethodInfo MethodInfo, string RelativePath, System.Type ReturnType) { }\n        public System.Type HostingType { get; init; }\n        public System.Reflection.MethodInfo MethodInfo { get; init; }\n        public string Name { get; init; }\n        public string RelativePath { get; init; }\n        public System.Type ReturnType { get; init; }\n    }\n    public class RestMethodParameterInfo\n    {\n        public RestMethodParameterInfo(bool isObjectPropertyParameter, System.Reflection.ParameterInfo parameterInfo) { }\n        public RestMethodParameterInfo(string name, System.Reflection.ParameterInfo parameterInfo) { }\n        public bool IsObjectPropertyParameter { get; set; }\n        public string? Name { get; set; }\n        public System.Reflection.ParameterInfo ParameterInfo { get; set; }\n        public System.Collections.Generic.List<Refit.RestMethodParameterProperty> ParameterProperties { get; set; }\n        public Refit.ParameterType Type { get; set; }\n    }\n    public class RestMethodParameterProperty\n    {\n        public RestMethodParameterProperty(string name, System.Reflection.PropertyInfo propertyInfo) { }\n        public string Name { get; set; }\n        public System.Reflection.PropertyInfo PropertyInfo { get; set; }\n    }\n    public static class RestService\n    {\n        public static System.Net.Http.HttpClient CreateHttpClient(string hostUrl, Refit.RefitSettings? settings) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, System.Net.Http.HttpClient client) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, string hostUrl) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, System.Net.Http.HttpClient client, Refit.IRequestBuilder builder) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, System.Net.Http.HttpClient client, Refit.RefitSettings? settings) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, string hostUrl, Refit.RefitSettings? settings) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(System.Net.Http.HttpClient client) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(string hostUrl) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(System.Net.Http.HttpClient client, Refit.IRequestBuilder<T> builder) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(System.Net.Http.HttpClient client, Refit.RefitSettings? settings) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(string hostUrl, Refit.RefitSettings? settings) { }\n    }\n    public class StreamPart : Refit.MultipartItem\n    {\n        public StreamPart(System.IO.Stream value, string fileName, string? contentType = null, string? name = null) { }\n        public System.IO.Stream Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    public sealed class SystemTextJsonContentSerializer : Refit.IHttpContentSerializer\n    {\n        public SystemTextJsonContentSerializer() { }\n        public SystemTextJsonContentSerializer(System.Text.Json.JsonSerializerOptions jsonSerializerOptions) { }\n        public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default) { }\n        public string? GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo) { }\n        public System.Net.Http.HttpContent ToHttpContent<T>(T item) { }\n        public static System.Text.Json.JsonSerializerOptions GetDefaultJsonSerializerOptions() { }\n    }\n    [System.Serializable]\n    public class ValidationApiException : Refit.ApiException\n    {\n        public new Refit.ProblemDetails? Content { get; }\n        public static Refit.ValidationApiException Create(Refit.ApiException exception) { }\n    }\n}"
  },
  {
    "path": "Refit.Tests/API/_snapshots/ApiApprovalTests.Refit.DotNet9_0.verified.txt",
    "content": "﻿[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.HttpClientFactory\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Newtonsoft.Json\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Tests\")]\n[assembly: System.Runtime.CompilerServices.InternalsVisibleTo(\"Refit.Xml\")]\n[assembly: System.Runtime.Versioning.TargetFramework(\".NETCoreApp,Version=v9.0\", FrameworkDisplayName=\".NET 9.0\")]\nnamespace Refit\n{\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    public class AliasAsAttribute : System.Attribute\n    {\n        public AliasAsAttribute(string name) { }\n        public string Name { get; protected set; }\n    }\n    [System.Serializable]\n    public class ApiException : System.Exception\n    {\n        protected ApiException(System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        protected ApiException(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, string? content, System.Net.HttpStatusCode statusCode, string? reasonPhrase, System.Net.Http.Headers.HttpResponseHeaders headers, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        public string? Content { get; }\n        public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        public bool HasContent { get; }\n        public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        public System.Net.Http.HttpMethod HttpMethod { get; }\n        public string? ReasonPhrase { get; }\n        public Refit.RefitSettings RefitSettings { get; }\n        public System.Net.Http.HttpRequestMessage RequestMessage { get; }\n        public System.Net.HttpStatusCode StatusCode { get; }\n        public System.Uri? Uri { get; }\n        public System.Threading.Tasks.Task<T?> GetContentAsAsync<T>() { }\n        public static System.Threading.Tasks.Task<Refit.ApiException> Create(System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, System.Net.Http.HttpResponseMessage response, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n        public static System.Threading.Tasks.Task<Refit.ApiException> Create(string exceptionMessage, System.Net.Http.HttpRequestMessage message, System.Net.Http.HttpMethod httpMethod, System.Net.Http.HttpResponseMessage response, Refit.RefitSettings refitSettings, System.Exception? innerException = null) { }\n    }\n    public sealed class ApiResponse<T> : Refit.IApiResponse, Refit.IApiResponse<T>, System.IDisposable\n    {\n        public ApiResponse(System.Net.Http.HttpResponseMessage response, T? content, Refit.RefitSettings settings, Refit.ApiException? error = null) { }\n        public T Content { get; }\n        public System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        public Refit.ApiException? Error { get; }\n        public System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        public bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        public bool IsSuccessful { get; }\n        public string? ReasonPhrase { get; }\n        public System.Net.Http.HttpRequestMessage? RequestMessage { get; }\n        public Refit.RefitSettings Settings { get; }\n        public System.Net.HttpStatusCode StatusCode { get; }\n        public System.Version Version { get; }\n        public void Dispose() { }\n        public System.Threading.Tasks.Task<Refit.ApiResponse<T>> EnsureSuccessStatusCodeAsync() { }\n        public System.Threading.Tasks.Task<Refit.ApiResponse<T>> EnsureSuccessfulAsync() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    [System.Obsolete(\"Use Refit.StreamPart, Refit.ByteArrayPart, Refit.FileInfoPart or if necessary, in\" +\n        \"herit from Refit.MultipartItem\", false)]\n    public class AttachmentNameAttribute : System.Attribute\n    {\n        public AttachmentNameAttribute(string name) { }\n        public string Name { get; protected set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class AuthorizeAttribute : System.Attribute\n    {\n        public AuthorizeAttribute(string scheme = \"Bearer\") { }\n        public string Scheme { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class BodyAttribute : System.Attribute\n    {\n        public BodyAttribute() { }\n        public BodyAttribute(Refit.BodySerializationMethod serializationMethod = 0) { }\n        public BodyAttribute(bool buffered) { }\n        public BodyAttribute(Refit.BodySerializationMethod serializationMethod, bool buffered) { }\n        public bool? Buffered { get; }\n        public Refit.BodySerializationMethod SerializationMethod { get; }\n    }\n    public enum BodySerializationMethod\n    {\n        Default = 0,\n        [System.Obsolete(\"Use BodySerializationMethod.Serialized instead\", false)]\n        Json = 1,\n        UrlEncoded = 2,\n        Serialized = 3,\n    }\n    public class ByteArrayPart : Refit.MultipartItem\n    {\n        public ByteArrayPart(byte[] value, string fileName, string? contentType = null, string? name = null) { }\n        public byte[] Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    public class CamelCaseUrlParameterKeyFormatter : Refit.IUrlParameterKeyFormatter\n    {\n        public CamelCaseUrlParameterKeyFormatter() { }\n        public string Format(string key) { }\n    }\n    public enum CollectionFormat\n    {\n        RefitParameterFormatter = 0,\n        Csv = 1,\n        Ssv = 2,\n        Tsv = 3,\n        Pipes = 4,\n        Multi = 5,\n    }\n    public class DefaultApiExceptionFactory\n    {\n        public DefaultApiExceptionFactory(Refit.RefitSettings refitSettings) { }\n        public System.Threading.Tasks.Task<System.Exception?> CreateAsync(System.Net.Http.HttpResponseMessage responseMessage) { }\n    }\n    public class DefaultFormUrlEncodedParameterFormatter : Refit.IFormUrlEncodedParameterFormatter\n    {\n        public DefaultFormUrlEncodedParameterFormatter() { }\n        public virtual string? Format(object? parameterValue, string? formatString) { }\n    }\n    public class DefaultUrlParameterFormatter : Refit.IUrlParameterFormatter\n    {\n        public DefaultUrlParameterFormatter() { }\n        public void AddFormat<TParameter>(string format) { }\n        public void AddFormat<TContainer, TParameter>(string format) { }\n        public virtual string? Format(object? parameterValue, System.Reflection.ICustomAttributeProvider attributeProvider, System.Type type) { }\n    }\n    public class DefaultUrlParameterKeyFormatter : Refit.IUrlParameterKeyFormatter\n    {\n        public DefaultUrlParameterKeyFormatter() { }\n        public virtual string Format(string key) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class DeleteAttribute : Refit.HttpMethodAttribute\n    {\n        public DeleteAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public class FileInfoPart : Refit.MultipartItem\n    {\n        public FileInfoPart(System.IO.FileInfo value, string fileName, string? contentType = null, string? name = null) { }\n        public System.IO.FileInfo Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class GetAttribute : Refit.HttpMethodAttribute\n    {\n        public GetAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class HeadAttribute : Refit.HttpMethodAttribute\n    {\n        public HeadAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class HeaderAttribute : System.Attribute\n    {\n        public HeaderAttribute(string header) { }\n        public string Header { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class HeaderCollectionAttribute : System.Attribute\n    {\n        public HeaderCollectionAttribute() { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Interface)]\n    public class HeadersAttribute : System.Attribute\n    {\n        public HeadersAttribute(params string[] headers) { }\n        public string[] Headers { get; }\n    }\n    public abstract class HttpMethodAttribute : System.Attribute\n    {\n        protected HttpMethodAttribute(string path) { }\n        public abstract System.Net.Http.HttpMethod Method { get; }\n        public virtual string Path { get; protected set; }\n    }\n    public static class HttpRequestMessageOptions\n    {\n        public static string InterfaceType { get; }\n        public static string RestMethodInfo { get; }\n    }\n    public interface IApiResponse : System.IDisposable\n    {\n        System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        Refit.ApiException? Error { get; }\n        System.Net.Http.Headers.HttpResponseHeaders Headers { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        bool IsSuccessful { get; }\n        string? ReasonPhrase { get; }\n        System.Net.Http.HttpRequestMessage? RequestMessage { get; }\n        System.Net.HttpStatusCode StatusCode { get; }\n        System.Version Version { get; }\n    }\n    public interface IApiResponse<out T> : Refit.IApiResponse, System.IDisposable\n    {\n        T Content { get; }\n        new System.Net.Http.Headers.HttpContentHeaders? ContentHeaders { get; }\n        new Refit.ApiException? Error { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        new bool IsSuccessStatusCode { get; }\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(false, \"Error\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"Content\")]\n        [get: System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, \"ContentHeaders\")]\n        new bool IsSuccessful { get; }\n    }\n    public interface IFormUrlEncodedParameterFormatter\n    {\n        string? Format(object? value, string? formatString);\n    }\n    public interface IHttpContentSerializer\n    {\n        System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default);\n        string? GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo);\n        System.Net.Http.HttpContent ToHttpContent<T>(T item);\n    }\n    public interface IRequestBuilder\n    {\n        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces \" +\n            \"and DTOs are preserved when trimming.\")]\n        System.Func<System.Net.Http.HttpClient, object[], object?> BuildRestResultFuncForMethod(string methodName, System.Type[]? parameterTypes = null, System.Type[]? genericArgumentTypes = null);\n    }\n    public interface IRequestBuilder<T> : Refit.IRequestBuilder { }\n    public interface IUrlParameterFormatter\n    {\n        string? Format(object? value, System.Reflection.ICustomAttributeProvider attributeProvider, System.Type type);\n    }\n    public interface IUrlParameterKeyFormatter\n    {\n        string Format(string key);\n    }\n    [System.Obsolete(\"Use NewtonsoftJsonContentSerializer in the Refit.Newtonsoft.Json package instead\", true)]\n    public class JsonContentSerializer : Refit.IHttpContentSerializer\n    {\n        public JsonContentSerializer() { }\n        public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default) { }\n        public string GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo) { }\n        public System.Net.Http.HttpContent ToHttpContent<T>(T item) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class MultipartAttribute : System.Attribute\n    {\n        public MultipartAttribute(string boundaryText = \"----MyGreatBoundary\") { }\n        public string BoundaryText { get; }\n    }\n    public abstract class MultipartItem\n    {\n        protected MultipartItem(string fileName, string? contentType) { }\n        public MultipartItem(string fileName, string? contentType, string? name) { }\n        public string? ContentType { get; }\n        public string FileName { get; }\n        public string? Name { get; }\n        protected abstract System.Net.Http.HttpContent CreateContent();\n        public System.Net.Http.HttpContent ToContent() { }\n    }\n    public class ObjectToInferredTypesConverter : System.Text.Json.Serialization.JsonConverter<object>\n    {\n        public ObjectToInferredTypesConverter() { }\n        public override object? Read(ref System.Text.Json.Utf8JsonReader reader, System.Type typeToConvert, System.Text.Json.JsonSerializerOptions options) { }\n        public override void Write(System.Text.Json.Utf8JsonWriter writer, object objectToWrite, System.Text.Json.JsonSerializerOptions options) { }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class OptionsAttribute : Refit.HttpMethodAttribute\n    {\n        public OptionsAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public enum ParameterType\n    {\n        Normal = 0,\n        RoundTripping = 1,\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PatchAttribute : Refit.HttpMethodAttribute\n    {\n        public PatchAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PostAttribute : Refit.HttpMethodAttribute\n    {\n        public PostAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    public class ProblemDetails\n    {\n        public ProblemDetails() { }\n        public string? Detail { get; set; }\n        public System.Collections.Generic.Dictionary<string, string[]> Errors { get; set; }\n        [System.Text.Json.Serialization.JsonExtensionData]\n        public System.Collections.Generic.IDictionary<string, object> Extensions { get; set; }\n        public string? Instance { get; set; }\n        public int Status { get; set; }\n        public string? Title { get; set; }\n        public string? Type { get; set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Parameter)]\n    public class PropertyAttribute : System.Attribute\n    {\n        public PropertyAttribute() { }\n        public PropertyAttribute(string key) { }\n        public string? Key { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class PutAttribute : Refit.HttpMethodAttribute\n    {\n        public PutAttribute(string path) { }\n        public override System.Net.Http.HttpMethod Method { get; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]\n    public class QueryAttribute : System.Attribute\n    {\n        public QueryAttribute() { }\n        public QueryAttribute(Refit.CollectionFormat collectionFormat) { }\n        public QueryAttribute(string delimiter) { }\n        public QueryAttribute(string delimiter, string prefix) { }\n        public QueryAttribute(string delimiter, string prefix, string format) { }\n        public Refit.CollectionFormat CollectionFormat { get; set; }\n        public string Delimiter { get; protected set; }\n        public string? Format { get; set; }\n        public bool IsCollectionFormatSpecified { get; }\n        public string? Prefix { get; protected set; }\n        public bool TreatAsString { get; set; }\n    }\n    [System.AttributeUsage(System.AttributeTargets.Method)]\n    public class QueryUriFormatAttribute : System.Attribute\n    {\n        public QueryUriFormatAttribute(System.UriFormat uriFormat) { }\n        public System.UriFormat UriFormat { get; }\n    }\n    public class RefitSettings\n    {\n        public RefitSettings() { }\n        public RefitSettings(Refit.IHttpContentSerializer contentSerializer, Refit.IUrlParameterFormatter? urlParameterFormatter, Refit.IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter) { }\n        public RefitSettings(Refit.IHttpContentSerializer contentSerializer, Refit.IUrlParameterFormatter? urlParameterFormatter = null, Refit.IFormUrlEncodedParameterFormatter? formUrlEncodedParameterFormatter = null, Refit.IUrlParameterKeyFormatter? urlParameterKeyFormatter = null) { }\n        public System.Func<System.Net.Http.HttpRequestMessage, System.Threading.CancellationToken, System.Threading.Tasks.Task<string>>? AuthorizationHeaderValueGetter { get; set; }\n        public bool Buffered { get; set; }\n        public Refit.CollectionFormat CollectionFormat { get; set; }\n        public Refit.IHttpContentSerializer ContentSerializer { get; set; }\n        public System.Func<System.Net.Http.HttpResponseMessage, System.Exception, System.Threading.Tasks.Task<System.Exception?>>? DeserializationExceptionFactory { get; set; }\n        public System.Func<System.Net.Http.HttpResponseMessage, System.Threading.Tasks.Task<System.Exception?>> ExceptionFactory { get; set; }\n        public Refit.IFormUrlEncodedParameterFormatter FormUrlEncodedParameterFormatter { get; set; }\n        public System.Func<System.Net.Http.HttpMessageHandler>? HttpMessageHandlerFactory { get; set; }\n        public System.Collections.Generic.Dictionary<string, object>? HttpRequestMessageOptions { get; set; }\n        public Refit.IUrlParameterFormatter UrlParameterFormatter { get; set; }\n        public Refit.IUrlParameterKeyFormatter UrlParameterKeyFormatter { get; set; }\n        public System.Version Version { get; set; }\n        public System.Net.Http.HttpVersionPolicy VersionPolicy { get; set; }\n    }\n    public static class RequestBuilder\n    {\n        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces \" +\n            \"and DTOs are preserved when trimming.\")]\n        public static Refit.IRequestBuilder ForType(System.Type refitInterfaceType) { }\n        [System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode(\"Refit uses reflection to analyze interface methods. Ensure referenced interfaces \" +\n            \"and DTOs are preserved when trimming.\")]\n        public static Refit.IRequestBuilder ForType([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, Refit.RefitSettings? settings) { }\n        public static Refit.IRequestBuilder<T> ForType<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>() { }\n        public static Refit.IRequestBuilder<T> ForType<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(Refit.RefitSettings? settings) { }\n    }\n    public class RestMethodInfo : System.IEquatable<Refit.RestMethodInfo>\n    {\n        public RestMethodInfo(string Name, System.Type HostingType, System.Reflection.MethodInfo MethodInfo, string RelativePath, System.Type ReturnType) { }\n        public System.Type HostingType { get; init; }\n        public System.Reflection.MethodInfo MethodInfo { get; init; }\n        public string Name { get; init; }\n        public string RelativePath { get; init; }\n        public System.Type ReturnType { get; init; }\n    }\n    public class RestMethodParameterInfo\n    {\n        public RestMethodParameterInfo(bool isObjectPropertyParameter, System.Reflection.ParameterInfo parameterInfo) { }\n        public RestMethodParameterInfo(string name, System.Reflection.ParameterInfo parameterInfo) { }\n        public bool IsObjectPropertyParameter { get; set; }\n        public string? Name { get; set; }\n        public System.Reflection.ParameterInfo ParameterInfo { get; set; }\n        public System.Collections.Generic.List<Refit.RestMethodParameterProperty> ParameterProperties { get; set; }\n        public Refit.ParameterType Type { get; set; }\n    }\n    public class RestMethodParameterProperty\n    {\n        public RestMethodParameterProperty(string name, System.Reflection.PropertyInfo propertyInfo) { }\n        public string Name { get; set; }\n        public System.Reflection.PropertyInfo PropertyInfo { get; set; }\n    }\n    public static class RestService\n    {\n        public static System.Net.Http.HttpClient CreateHttpClient(string hostUrl, Refit.RefitSettings? settings) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, System.Net.Http.HttpClient client) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, string hostUrl) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, System.Net.Http.HttpClient client, Refit.IRequestBuilder builder) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, System.Net.Http.HttpClient client, Refit.RefitSettings? settings) { }\n        public static object For([System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)] System.Type refitInterfaceType, string hostUrl, Refit.RefitSettings? settings) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(System.Net.Http.HttpClient client) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(string hostUrl) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(System.Net.Http.HttpClient client, Refit.IRequestBuilder<T> builder) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(System.Net.Http.HttpClient client, Refit.RefitSettings? settings) { }\n        public static T For<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.None | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicMethods | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.NonPublicMethods)]  T>(string hostUrl, Refit.RefitSettings? settings) { }\n    }\n    public class StreamPart : Refit.MultipartItem\n    {\n        public StreamPart(System.IO.Stream value, string fileName, string? contentType = null, string? name = null) { }\n        public System.IO.Stream Value { get; }\n        protected override System.Net.Http.HttpContent CreateContent() { }\n    }\n    public sealed class SystemTextJsonContentSerializer : Refit.IHttpContentSerializer\n    {\n        public SystemTextJsonContentSerializer() { }\n        public SystemTextJsonContentSerializer(System.Text.Json.JsonSerializerOptions jsonSerializerOptions) { }\n        public System.Threading.Tasks.Task<T?> FromHttpContentAsync<T>(System.Net.Http.HttpContent content, System.Threading.CancellationToken cancellationToken = default) { }\n        public string? GetFieldNameForProperty(System.Reflection.PropertyInfo propertyInfo) { }\n        public System.Net.Http.HttpContent ToHttpContent<T>(T item) { }\n        public static System.Text.Json.JsonSerializerOptions GetDefaultJsonSerializerOptions() { }\n    }\n    [System.Serializable]\n    public class ValidationApiException : Refit.ApiException\n    {\n        public new Refit.ProblemDetails? Content { get; }\n        public static Refit.ValidationApiException Create(Refit.ApiException exception) { }\n    }\n}"
  },
  {
    "path": "Refit.Tests/App.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<configuration>\n  <runtime>\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n      <!--\n        Manually apply binding redirect for Newtonsoft.Json due to NuGet packaging bug.\n        https://github.com/NuGet/Home/issues/10505\n      -->\n      <dependentAssembly>\n        <assemblyIdentity name=\"Newtonsoft.Json\" publicKeyToken=\"30ad4fe6b2a6aeed\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-13.0.0.0\" newVersion=\"13.0.0.0\" />\n      </dependentAssembly>\n    </assemblyBinding>\n  </runtime>\n</configuration>\n"
  },
  {
    "path": "Refit.Tests/AuthenticatedClientHandlerTests.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Net;\nusing System.Net.Http;\nusing System.Text;\nusing System.Threading.Tasks;\n\nusing Refit; // for the code gen\n\nusing RichardSzalay.MockHttp;\n\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic class AuthenticatedClientHandlerTests\n{\n    public interface IMyAuthenticatedService\n    {\n        [Get(\"/unauth\")]\n        Task<string> GetUnauthenticated();\n\n        [Get(\"/auth\")]\n        [Headers(\"Authorization: Bearer\")]\n        Task<string> GetAuthenticated();\n\n        [Get(\"/auth\")]\n        Task<string> GetAuthenticatedWithTokenInMethod([Authorize(\"Bearer\")] string token);\n\n        [Get(\"/auth\")]\n        Task<string> GetAuthenticatedWithAuthorizeAttributeAndHeaderCollection(\n            [Authorize(\"Bearer\")] string token,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Get(\"/auth\")]\n        Task<string> GetAuthenticatedWithTokenInHeaderCollection(\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Post(\"/auth/{id}\")]\n        Task<string> PostAuthenticatedWithTokenInHeaderCollection(\n            int id,\n            SomeRequestData content,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n    }\n\n    public interface IInheritedAuthenticatedServiceWithHeaders : IAuthenticatedServiceWithHeaders\n    {\n        [Get(\"/get-inherited-thing\")]\n        Task<string> GetInheritedThing();\n    }\n\n    public interface IInheritedAuthenticatedServiceWithHeadersCRLF : IAuthenticatedServiceWithHeaders\n    {\n        [Get(\"/get-inherited-thing\\r\\n\\r\\nGET /smuggled\")]\n        Task<string> GetInheritedThing();\n    }\n\n    [Headers(\"Authorization: Bearer\")]\n    public interface IAuthenticatedServiceWithHeaders\n    {\n        [Get(\"/get-base-thing\")]\n        Task<string> GetThingFromBase();\n    }\n\n    [Fact]\n    public void DefaultHandlerIsHttpClientHandler()\n    {\n        var handler = new AuthenticatedHttpClientHandler(((_, _) => Task.FromResult(string.Empty)));\n\n        Assert.IsType<HttpClientHandler>(handler.InnerHandler);\n    }\n\n    [Fact]\n    public void DefaultHandlerIsNull()\n    {\n        var handler = new AuthenticatedHttpClientHandler(null, ((_, _) => Task.FromResult(string.Empty)));\n\n        Assert.Null(handler.InnerHandler);\n    }\n\n    [Fact]\n    public void NullTokenGetterThrows()\n    {\n        Assert.Throws<ArgumentNullException>(() => new AuthenticatedHttpClientHandler(null));\n    }\n\n    [Fact]\n    public async Task AuthenticatedHandlerIgnoresUnAuth()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            AuthorizationHeaderValueGetter = (_, __) => Task.FromResult(\"tokenValue\"),\n            HttpMessageHandlerFactory = () => handler\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/unauth\")\n            .With(msg => msg.Headers.Authorization == null)\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IMyAuthenticatedService>(\"http://api\", settings);\n\n        var result = await fixture.GetUnauthenticated();\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthenticatedHandlerUsesAuth()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            AuthorizationHeaderValueGetter = (_, __) => Task.FromResult(\"tokenValue\"),\n            HttpMessageHandlerFactory = () => handler\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/auth\")\n            .WithHeaders(\"Authorization\", \"Bearer tokenValue\")\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IMyAuthenticatedService>(\"http://api\", settings);\n\n        var result = await fixture.GetAuthenticated();\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthenticatedHandlerWithParamUsesAuth()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            AuthorizationHeaderValueGetter = (request, _) => Task.FromResult(\"tokenValue\"),\n            HttpMessageHandlerFactory = () => handler\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/auth\")\n            .WithHeaders(\"Authorization\", \"Bearer tokenValue\")\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IMyAuthenticatedService>(\"http://api\", settings);\n\n        var result = await fixture.GetAuthenticated();\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthenticatedHandlerWithTokenInParameterUsesAuth()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/auth\")\n            .WithHeaders(\"Authorization\", \"Bearer tokenValue\")\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IMyAuthenticatedService>(\"http://api\", settings);\n\n        var result = await fixture.GetAuthenticatedWithTokenInMethod(\"tokenValue\");\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthenticatedHandlerWithTokenInHeaderCollectionUsesAuth()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        var headers = new Dictionary<string, string>\n        {\n            { \"User-Agent\", \"Refit\" },\n            { \"Authorization\", \"Bearer tokenValue\" }\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/auth\")\n            .WithHeaders(headers)\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IMyAuthenticatedService>(\"http://api\", settings);\n\n        var result = await fixture.GetAuthenticatedWithTokenInHeaderCollection(headers);\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthenticatedHandlerWithAuthorizeAttributeAndHeaderCollectionUsesAuth()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        var expectedHeaders = new Dictionary<string, string>\n        {\n            { \"Authorization\", \"Bearer tokenValue\" },\n            { \"User-Agent\", \"Refit\" },\n            { \"X-Forwarded-For\", \"Refit\" }\n        };\n\n        var headerCollectionHeaders = new Dictionary<string, string>\n        {\n            { \"User-Agent\", \"Refit\" },\n            { \"X-Forwarded-For\", \"Refit\" }\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/auth\")\n            .WithHeaders(expectedHeaders)\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IMyAuthenticatedService>(\"http://api\", settings);\n\n        var result = await fixture.GetAuthenticatedWithAuthorizeAttributeAndHeaderCollection(\n            \"tokenValue\",\n            headerCollectionHeaders\n        );\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthenticatedHandlerWithDuplicatedAuthorizationHeaderUsesAuth()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        var expectedHeaders = new Dictionary<string, string>\n        {\n            { \"Authorization\", \"Bearer tokenValue2\" },\n            { \"User-Agent\", \"Refit\" },\n            { \"X-Forwarded-For\", \"Refit\" }\n        };\n\n        var headerCollectionHeaders = new Dictionary<string, string>\n        {\n            { \"Authorization\", \"Bearer tokenValue2\" },\n            { \"User-Agent\", \"Refit\" },\n            { \"X-Forwarded-For\", \"Refit\" }\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/auth\")\n            .WithHeaders(expectedHeaders)\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IMyAuthenticatedService>(\"http://api\", settings);\n\n        var result = await fixture.GetAuthenticatedWithAuthorizeAttributeAndHeaderCollection(\n            \"tokenValue\",\n            headerCollectionHeaders\n        );\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthenticatedHandlerPostTokenInHeaderCollectionUsesAuth()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        var id = 1;\n        var someRequestData = new SomeRequestData { ReadablePropertyName = 1 };\n\n        var headers = new Dictionary<string, string>\n        {\n            { \"Authorization\", \"Bearer tokenValue2\" },\n            { \"ThingId\", id.ToString() }\n        };\n\n        handler\n            .Expect(HttpMethod.Post, $\"http://api/auth/{id}\")\n            .WithHeaders(headers)\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IMyAuthenticatedService>(\"http://api\", settings);\n\n        var result = await fixture.PostAuthenticatedWithTokenInHeaderCollection(\n            id,\n            someRequestData,\n            headers\n        );\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthentictedMethodFromBaseClassWithHeadersAttributeUsesAuth()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            AuthorizationHeaderValueGetter = (_, __) => Task.FromResult(\"tokenValue\"),\n            HttpMessageHandlerFactory = () => handler\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-base-thing\")\n            .WithHeaders(\"Authorization\", \"Bearer tokenValue\")\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IInheritedAuthenticatedServiceWithHeaders>(\n            \"http://api\",\n            settings\n        );\n\n        var result = await fixture.GetThingFromBase();\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthentictedMethodFromInheritedClassWithHeadersAttributeUsesAuth()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            AuthorizationHeaderValueGetter = (_, __) => Task.FromResult(\"tokenValue\"),\n            HttpMessageHandlerFactory = () => handler\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-inherited-thing\")\n            .WithHeaders(\"Authorization\", \"Bearer tokenValue\")\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IInheritedAuthenticatedServiceWithHeaders>(\n            \"http://api\",\n            settings\n        );\n\n        var result = await fixture.GetInheritedThing();\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthentictedMethodFromInheritedClassWithHeadersAttributeUsesAuth_WithCRLFCheck()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            AuthorizationHeaderValueGetter = (_, __) => Task.FromResult(\"tokenValue\"),\n            HttpMessageHandlerFactory = () => handler,\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-inherited-thing\")\n            .WithHeaders(\"Authorization\", \"Bearer tokenValue\")\n            .Respond(\"text/plain\", \"Ok\");\n\n        await Assert.ThrowsAsync<ArgumentException>(async () =>\n        {\n            var fixture = RestService.For<IInheritedAuthenticatedServiceWithHeadersCRLF>(\n                    \"http://api\",\n                    settings\n                );\n\n            var result = await fixture.GetInheritedThing();\n        });\n    }\n\n    [Fact]\n    public async Task AuthorizationHeaderValueGetterIsUsedWhenSupplyingHttpClient()\n    {\n        var handler = new MockHttpMessageHandler();\n        var httpClient = new HttpClient(handler) { BaseAddress = new Uri(\"http://api\") };\n\n        var settings = new RefitSettings\n        {\n            AuthorizationHeaderValueGetter = (_, __) => Task.FromResult(\"tokenValue\")\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/auth\")\n            .WithHeaders(\"Authorization\", \"Bearer tokenValue\")\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IMyAuthenticatedService>(httpClient, settings);\n\n        var result = await fixture.GetAuthenticated();\n\n        handler.VerifyNoOutstandingExpectation();\n        Assert.Equal(\"Ok\", result);\n    }\n\n    [Fact]\n    public async Task AuthorizationHeaderValueGetterDoesNotOverrideExplicitTokenWhenSupplyingHttpClient()\n    {\n        var handler = new MockHttpMessageHandler();\n        var httpClient = new HttpClient(handler) { BaseAddress = new Uri(\"http://api\") };\n\n        var settings = new RefitSettings\n        {\n            AuthorizationHeaderValueGetter = (_, __) => Task.FromResult(\"token-from-getter\")\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/auth\")\n            .WithHeaders(\"Authorization\", \"Bearer token-from-parameter\")\n            .Respond(\"text/plain\", \"Ok\");\n\n        var fixture = RestService.For<IMyAuthenticatedService>(httpClient, settings);\n\n        var result = await fixture.GetAuthenticatedWithTokenInMethod(\"token-from-parameter\");\n\n        handler.VerifyNoOutstandingExpectation();\n        Assert.Equal(\"Ok\", result);\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/CachedRequestBuilder.cs",
    "content": "﻿using System.Net;\nusing System.Net.Http;\nusing System.Reflection;\n\nusing RichardSzalay.MockHttp;\n\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic interface IGeneralRequests\n{\n    [Post(\"/foo\")]\n    Task Empty();\n\n    [Post(\"/foo\")]\n    Task SingleParameter(string id);\n\n    [Post(\"/foo\")]\n    Task MultiParameter(string id, string name);\n\n    [Post(\"/foo\")]\n    Task SingleGenericMultiParameter<TValue>(string id, string name, TValue generic);\n}\n\npublic interface IDuplicateNames\n{\n    [Post(\"/foo\")]\n    Task SingleParameter(string id);\n\n    [Post(\"/foo\")]\n    Task SingleParameter(int id);\n}\n\npublic class CachedRequestBuilderTests\n{\n    [Fact]\n    public async Task CacheHasCorrectNumberOfElementsTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        var fixture = RestService.For<IGeneralRequests>(\"http://bar\", settings);\n\n        // get internal dictionary to check count\n        var requestBuilderField = fixture.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Single(x => x.Name == \"requestBuilder\");\n        var requestBuilder = requestBuilderField.GetValue(fixture) as CachedRequestBuilderImplementation;\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://bar/foo\")\n            .Respond(HttpStatusCode.OK);\n        await fixture.Empty();\n        Assert.Single(requestBuilder.MethodDictionary);\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://bar/foo\")\n            .WithQueryString(\"id\", \"id\")\n            .Respond(HttpStatusCode.OK);\n        await fixture.SingleParameter(\"id\");\n        Assert.Equal(2, requestBuilder.MethodDictionary.Count);\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://bar/foo\")\n            .WithQueryString(\"id\", \"id\")\n            .WithQueryString(\"name\", \"name\")\n            .Respond(HttpStatusCode.OK);\n        await fixture.MultiParameter(\"id\", \"name\");\n        Assert.Equal(3, requestBuilder.MethodDictionary.Count);\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://bar/foo\")\n            .WithQueryString(\"id\", \"id\")\n            .WithQueryString(\"name\", \"name\")\n            .WithQueryString(\"generic\", \"generic\")\n            .Respond(HttpStatusCode.OK);\n        await fixture.SingleGenericMultiParameter(\"id\", \"name\", \"generic\");\n        Assert.Equal(4, requestBuilder.MethodDictionary.Count);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task NoDuplicateEntriesTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        var fixture = RestService.For<IGeneralRequests>(\"http://bar\", settings);\n\n        // get internal dictionary to check count\n        var requestBuilderField = fixture.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Single(x => x.Name == \"requestBuilder\");\n        var requestBuilder = requestBuilderField.GetValue(fixture) as CachedRequestBuilderImplementation;\n\n        // send the same request repeatedly to ensure that multiple dictionary entries are not created\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://bar/foo\")\n            .WithQueryString(\"id\", \"id\")\n            .Respond(HttpStatusCode.OK);\n        await fixture.SingleParameter(\"id\");\n        Assert.Single(requestBuilder.MethodDictionary);\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://bar/foo\")\n            .WithQueryString(\"id\", \"id\")\n            .Respond(HttpStatusCode.OK);\n        await fixture.SingleParameter(\"id\");\n        Assert.Single(requestBuilder.MethodDictionary);\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://bar/foo\")\n            .WithQueryString(\"id\", \"id\")\n            .Respond(HttpStatusCode.OK);\n        await fixture.SingleParameter(\"id\");\n        Assert.Single(requestBuilder.MethodDictionary);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task SameNameDuplicateEntriesTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        var fixture = RestService.For<IDuplicateNames>(\"http://bar\", settings);\n\n        // get internal dictionary to check count\n        var requestBuilderField = fixture.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).Single(x => x.Name == \"requestBuilder\");\n        var requestBuilder = requestBuilderField.GetValue(fixture) as CachedRequestBuilderImplementation;\n\n        // send the two different requests with the same name\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://bar/foo\")\n            .WithQueryString(\"id\", \"id\")\n            .Respond(HttpStatusCode.OK);\n        await fixture.SingleParameter(\"id\");\n        Assert.Single(requestBuilder.MethodDictionary);\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://bar/foo\")\n            .WithQueryString(\"id\", \"10\")\n            .Respond(HttpStatusCode.OK);\n        await fixture.SingleParameter(10);\n        Assert.Equal(2, requestBuilder.MethodDictionary.Count);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/CamelCaseUrlParameterKeyFormatter.cs",
    "content": "﻿using Xunit;\n\nnamespace Refit.Tests;\n\npublic class CamelCaselTestsRequest\n{\n    public string alreadyCamelCased { get; set; }\n    public string NOTCAMELCased { get; set; }\n}\n\npublic class CamelCaseUrlParameterKeyFormatterTests\n{\n    [Fact]\n    public void Format_EmptyKey_ReturnsEmptyKey()\n    {\n        var urlParameterKeyFormatter = new CamelCaseUrlParameterKeyFormatter();\n\n        var output = urlParameterKeyFormatter.Format(string.Empty);\n        Assert.Equal(string.Empty, output);\n    }\n\n    [Fact]\n    public void FormatKey_Returns_ExpectedValue()\n    {\n        var urlParameterKeyFormatter = new CamelCaseUrlParameterKeyFormatter();\n\n        var refitSettings = new RefitSettings\n        {\n            UrlParameterKeyFormatter = urlParameterKeyFormatter\n        };\n        var fixture = new RequestBuilderImplementation<IDummyHttpApi>(refitSettings);\n        var factory = fixture.BuildRequestFactoryForMethod(\n            nameof(IDummyHttpApi.ComplexQueryObjectWithDictionary)\n        );\n\n        var complexQuery = new CamelCaselTestsRequest\n        {\n            alreadyCamelCased = \"value1\",\n            NOTCAMELCased = \"value2\"\n        };\n\n        var output = factory([complexQuery]);\n        var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n        Assert.Equal(\"/foo?alreadyCamelCased=value1&notcamelCased=value2\", uri.PathAndQuery);\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/DefaultUrlParameterFormatterTest.cs",
    "content": "﻿using System.Globalization;\nusing System.Reflection;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic class DefaultUrlParameterFormatterTests\n{\n    class DefaultUrlParameterFormatterTestRequest\n    {\n        [Query(Format = \"yyyy\")] public DateTime? DateTimeWithAttributeFormatYear { get; set; }\n\n        public DateTime? DateTime { get; set; }\n\n        public IEnumerable<DateTime> DateTimeCollection { get; set; }\n\n        public IDictionary<int, DateTime> DateTimeDictionary { get; set; }\n\n        public IDictionary<DateTime, int> DateTimeKeyedDictionary { get; set; }\n    }\n\n    [Fact]\n    public void NullParameterValue_ReturnsNull()\n    {\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTime = null\n        };\n\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n\n        var output = urlParameterFormatter.Format(\n            parameters.DateTime,\n            parameters.GetType().GetProperty(nameof(parameters.DateTime))!,\n            parameters.GetType());\n\n        Assert.Null(output);\n    }\n\n    [Fact]\n    public void NoFormatters_UseDefaultFormat()\n    {\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTime = new DateTime(2023, 8, 21)\n        };\n\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n\n        var output = urlParameterFormatter.Format(\n            parameters.DateTime,\n            parameters.GetType().GetProperty(nameof(parameters.DateTime))!,\n            parameters.GetType());\n\n        Assert.Equal(\"08/21/2023 00:00:00\", output);\n    }\n\n    [Fact]\n    public void QueryAttributeFormatOnly_UseQueryAttributeFormat()\n    {\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTimeWithAttributeFormatYear = new DateTime(2023, 8, 21)\n        };\n\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n\n        var output = urlParameterFormatter.Format(\n            parameters.DateTimeWithAttributeFormatYear,\n            parameters.GetType().GetProperty(nameof(parameters.DateTimeWithAttributeFormatYear))!,\n            parameters.GetType());\n\n        Assert.Equal(\"2023\", output);\n    }\n\n    [Fact]\n    public void QueryAttributeAndGeneralFormat_UseQueryAttributeFormat()\n    {\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTimeWithAttributeFormatYear = new DateTime(2023, 8, 21)\n        };\n\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        urlParameterFormatter.AddFormat<DateTime>(\"yyyy-MM-dd\");\n\n        var output = urlParameterFormatter.Format(\n            parameters.DateTimeWithAttributeFormatYear,\n            parameters.GetType().GetProperty(nameof(parameters.DateTimeWithAttributeFormatYear))!,\n            parameters.GetType());\n\n        Assert.Equal(\"2023\", output);\n    }\n\n    [Fact]\n    public void QueryAttributeAndSpecificFormat_UseQueryAttributeFormat()\n    {\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTimeWithAttributeFormatYear = new DateTime(2023, 8, 21)\n        };\n\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        urlParameterFormatter.AddFormat<DefaultUrlParameterFormatterTestRequest, DateTime>(\"yyyy-MM-dd\");\n\n        var output = urlParameterFormatter.Format(\n            parameters.DateTimeWithAttributeFormatYear,\n            parameters.GetType().GetProperty(nameof(parameters.DateTimeWithAttributeFormatYear))!,\n            parameters.GetType());\n\n        Assert.Equal(\"2023\", output);\n    }\n\n    [Fact]\n    public void AllFormats_UseQueryAttributeFormat()\n    {\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTimeWithAttributeFormatYear = new DateTime(2023, 8, 21)\n        };\n\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        urlParameterFormatter.AddFormat<DateTime>(\"yyyy-MM-dd\");\n        urlParameterFormatter.AddFormat<DefaultUrlParameterFormatterTestRequest, DateTime>(\"yyyy-MM-dd\");\n\n        var output = urlParameterFormatter.Format(\n            parameters.DateTimeWithAttributeFormatYear,\n            parameters.GetType().GetProperty(nameof(parameters.DateTimeWithAttributeFormatYear))!,\n            parameters.GetType());\n\n        Assert.Equal(\"2023\", output);\n    }\n\n    [Fact]\n    public void GeneralFormatOnly_UseGeneralFormat()\n    {\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTime = new DateTime(2023, 8, 21)\n        };\n\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        urlParameterFormatter.AddFormat<DateTime>(\"yyyy\");\n\n        var output = urlParameterFormatter.Format(\n            parameters.DateTime,\n            parameters.GetType().GetProperty(nameof(parameters.DateTime))!,\n            parameters.GetType());\n\n        Assert.Equal(\"2023\", output);\n    }\n\n    [Fact]\n    public void SpecificFormatOnly_UseSpecificFormat()\n    {\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTime = new DateTime(2023, 8, 21)\n        };\n\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        urlParameterFormatter.AddFormat<DefaultUrlParameterFormatterTestRequest, DateTime>(\"yyyy\");\n\n        var output = urlParameterFormatter.Format(\n            parameters.DateTime,\n            parameters.GetType().GetProperty(nameof(parameters.DateTime))!,\n            parameters.GetType());\n\n        Assert.Equal(\"2023\", output);\n    }\n\n    [Fact]\n    public void GeneralAndSpecificFormats_UseSpecificFormat()\n    {\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTime = new DateTime(2023, 8, 21)\n        };\n\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        urlParameterFormatter.AddFormat<DateTime>(\"yyyy-MM-dd\");\n        urlParameterFormatter.AddFormat<DefaultUrlParameterFormatterTestRequest, DateTime>(\"yyyy\");\n\n        var output = urlParameterFormatter.Format(\n            parameters.DateTime,\n            parameters.GetType().GetProperty(nameof(parameters.DateTime))!,\n            parameters.GetType());\n\n        Assert.Equal(\"2023\", output);\n    }\n\n    [Fact]\n    public void RequestWithPlainDateTimeQueryParameter_ProducesCorrectQueryString()\n    {\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        urlParameterFormatter.AddFormat<DateTime>(\"yyyy\");\n\n        var refitSettings = new RefitSettings { UrlParameterFormatter = urlParameterFormatter };\n        var fixture = new RequestBuilderImplementation<IDummyHttpApi>(refitSettings);\n        var factory = fixture.BuildRequestFactoryForMethod(\n            nameof(IDummyHttpApi.PostWithComplexTypeQuery)\n        );\n\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTime = new DateTime(2023, 8, 21),\n        };\n\n        var output = factory([parameters]);\n        var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n        Assert.Equal(\n            \"?DateTime=2023\",\n            uri.Query\n        );\n    }\n\n    [Fact]\n    public void RequestWithDateTimeCollectionQueryParameter_ProducesCorrectQueryString()\n    {\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        urlParameterFormatter.AddFormat<DateTime>(\"yyyy\");\n\n        var refitSettings = new RefitSettings { UrlParameterFormatter = urlParameterFormatter };\n        var fixture = new RequestBuilderImplementation<IDummyHttpApi>(refitSettings);\n        var factory = fixture.BuildRequestFactoryForMethod(\n            nameof(IDummyHttpApi.PostWithComplexTypeQuery)\n        );\n\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTimeCollection = [new DateTime(2023, 8, 21), new DateTime(2024, 8, 21)],\n        };\n\n        var output = factory([parameters]);\n        var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n        Assert.Equal(\n            \"?DateTimeCollection=2023%2C2024\",\n            uri.Query\n        );\n    }\n\n    [Fact]\n    public void RequestWithDateTimeDictionaryQueryParameter_ProducesCorrectQueryString()\n    {\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        urlParameterFormatter.AddFormat<DateTime>(\"yyyy\");\n\n        var refitSettings = new RefitSettings { UrlParameterFormatter = urlParameterFormatter };\n        var fixture = new RequestBuilderImplementation<IDummyHttpApi>(refitSettings);\n        var factory = fixture.BuildRequestFactoryForMethod(\n            nameof(IDummyHttpApi.PostWithComplexTypeQuery)\n        );\n\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTimeDictionary = new Dictionary<int, DateTime>\n            {\n                { 1, new DateTime(2023, 8, 21) },\n                { 2, new DateTime(2024, 8, 21) },\n            },\n        };\n\n        var output = factory([parameters]);\n        var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n        Assert.Equal(\n            \"?DateTimeDictionary.1=2023&DateTimeDictionary.2=2024\",\n            uri.Query\n        );\n    }\n\n    [Fact]\n    public void RequestWithDateTimeKeyedDictionaryQueryParameter_ProducesCorrectQueryString()\n    {\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        urlParameterFormatter.AddFormat<DateTime>(\"yyyy\");\n\n        var refitSettings = new RefitSettings { UrlParameterFormatter = urlParameterFormatter };\n        var fixture = new RequestBuilderImplementation<IDummyHttpApi>(refitSettings);\n        var factory = fixture.BuildRequestFactoryForMethod(\n            nameof(IDummyHttpApi.PostWithComplexTypeQuery)\n        );\n\n        var parameters = new DefaultUrlParameterFormatterTestRequest\n        {\n            DateTimeKeyedDictionary = new Dictionary<DateTime, int>\n            {\n                { new DateTime(2023, 8, 21), 1 },\n                { new DateTime(2024, 8, 21), 2 },\n            },\n        };\n\n        var output = factory([parameters]);\n        var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n        Assert.Equal(\n            \"?DateTimeKeyedDictionary.2023=1&DateTimeKeyedDictionary.2024=2\",\n            uri.Query\n        );\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/DeliminatorSeparatedPropertyNamesContractResolver.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Text;\nusing Newtonsoft.Json.Serialization;\n\nnamespace Refit.Tests;\n\npublic class DeliminatorSeparatedPropertyNamesContractResolver : DefaultContractResolver\n{\n    readonly string separator;\n\n    protected DeliminatorSeparatedPropertyNamesContractResolver(char separator)\n    {\n        this.separator = separator.ToString(CultureInfo.InvariantCulture);\n    }\n\n    protected override string ResolvePropertyName(string propertyName)\n    {\n        var parts = new List<string>();\n        var currentWord = new StringBuilder();\n\n        foreach (var c in propertyName.ToCharArray())\n        {\n            if (Char.IsUpper(c) && currentWord.Length > 0)\n            {\n                parts.Add(currentWord.ToString());\n                currentWord.Clear();\n            }\n\n            currentWord.Append(char.ToLower(c));\n        }\n\n        if (currentWord.Length > 0)\n        {\n            parts.Add(currentWord.ToString());\n        }\n\n        return String.Join(separator, parts.ToArray());\n    }\n}\n\npublic class SnakeCasePropertyNamesContractResolver\n    : DeliminatorSeparatedPropertyNamesContractResolver\n{\n    public SnakeCasePropertyNamesContractResolver()\n        : base('_') { }\n}\n"
  },
  {
    "path": "Refit.Tests/DeserializationExceptionFactoryTests.cs",
    "content": "﻿using System.Net;\nusing System.Net.Http;\nusing RichardSzalay.MockHttp;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic class DeserializationExceptionFactoryTests\n{\n    public interface IMyService\n    {\n        [Get(\"/get-with-result\")]\n        Task<int> GetWithResult();\n    }\n\n    [Fact]\n    public async Task NoDeserializationExceptionFactory_WithSuccessfulDeserialization()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n        };\n\n        var intContent = 123;\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-with-result\")\n            .Respond(HttpStatusCode.OK, new StringContent($\"{intContent}\"));\n\n        var fixture = RestService.For<IMyService>(\"http://api\", settings);\n\n        var result = await fixture.GetWithResult();\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(intContent, result);\n    }\n\n    [Fact]\n    public async Task NoDeserializationExceptionFactory_WithUnsuccessfulDeserialization()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-with-result\")\n            .Respond(HttpStatusCode.OK, new StringContent(\"non-int-result\"));\n\n        var fixture = RestService.For<IMyService>(\"http://api\", settings);\n\n        var thrownException = await Assert.ThrowsAsync<ApiException>(() => fixture.GetWithResult());\n        Assert.Equal(\"An error occured deserializing the response.\", thrownException.Message);\n\n        handler.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ProvideFactoryWhichReturnsNull_WithSuccessfulDeserialization()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n            DeserializationExceptionFactory = (_, _) => Task.FromResult<Exception>(null)\n        };\n\n        var intContent = 123;\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-with-result\")\n            .Respond(HttpStatusCode.OK, new StringContent($\"{intContent}\"));\n\n        var fixture = RestService.For<IMyService>(\"http://api\", settings);\n\n        var result = await fixture.GetWithResult();\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(intContent, result);\n    }\n\n    [Fact]\n    public async Task ProvideFactoryWhichReturnsNull_WithUnsuccessfulDeserialization()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n            DeserializationExceptionFactory = (_, _) => Task.FromResult<Exception>(null)\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-with-result\")\n            .Respond(HttpStatusCode.OK, new StringContent(\"non-int-result\"));\n\n        var fixture = RestService.For<IMyService>(\"http://api\", settings);\n\n        var result = await fixture.GetWithResult();\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(default, result);\n    }\n\n    [Fact]\n    public async Task ProvideFactoryWhichReturnsException_WithUnsuccessfulDeserialization()\n    {\n        var handler = new MockHttpMessageHandler();\n        var exception = new Exception(\"Unsuccessful Deserialization Exception\");\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n            DeserializationExceptionFactory = (_, _) => Task.FromResult<Exception>(exception)\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-with-result\")\n            .Respond(HttpStatusCode.OK, new StringContent(\"non-int-result\"));\n\n        var fixture = RestService.For<IMyService>(\"http://api\", settings);\n\n        var thrownException = await Assert.ThrowsAsync<Exception>(() => fixture.GetWithResult());\n        Assert.Equal(exception, thrownException);\n\n        handler.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ProvideFactoryWhichReturnsException_WithSuccessfulDeserialization()\n    {\n        var handler = new MockHttpMessageHandler();\n        var exception = new Exception(\"Unsuccessful Deserialization Exception\");\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n            DeserializationExceptionFactory = (_, _) => Task.FromResult<Exception>(exception)\n        };\n\n        var intContent = 123;\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-with-result\")\n            .Respond(HttpStatusCode.OK, new StringContent($\"{intContent}\"));\n\n        var fixture = RestService.For<IMyService>(\"http://api\", settings);\n\n        var result = await fixture.GetWithResult();\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(intContent, result);\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/ExceptionFactoryTests.cs",
    "content": "﻿using System;\nusing System.Net;\nusing System.Net.Http;\nusing System.Threading.Tasks;\nusing Refit; // for the code gen\nusing RichardSzalay.MockHttp;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic class ExceptionFactoryTests\n{\n    public interface IMyService\n    {\n        [Get(\"/get-with-result\")]\n        Task<string> GetWithResult();\n\n        [Put(\"/put-without-result\")]\n        Task PutWithoutResult();\n    }\n\n    [Fact]\n    public async Task ProvideFactoryWhichAlwaysReturnsNull_WithResult()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n            ExceptionFactory = _ => Task.FromResult<Exception>(null)\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-with-result\")\n            .Respond(HttpStatusCode.NotFound, new StringContent(\"error-result\"));\n\n        var fixture = RestService.For<IMyService>(\"http://api\", settings);\n\n        var result = await fixture.GetWithResult();\n\n        handler.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(\"error-result\", result);\n    }\n\n    [Fact]\n    public async Task ProvideFactoryWhichAlwaysReturnsNull_WithoutResult()\n    {\n        var handler = new MockHttpMessageHandler();\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n            ExceptionFactory = _ => Task.FromResult<Exception>(null)\n        };\n\n        handler\n            .Expect(HttpMethod.Put, \"http://api/put-without-result\")\n            .Respond(HttpStatusCode.NotFound);\n\n        var fixture = RestService.For<IMyService>(\"http://api\", settings);\n\n        await fixture.PutWithoutResult();\n\n        handler.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ProvideFactoryWhichAlwaysReturnsException_WithResult()\n    {\n        var handler = new MockHttpMessageHandler();\n        var exception = new Exception(\"I like to fail\");\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n            ExceptionFactory = _ => Task.FromResult<Exception>(exception)\n        };\n\n        handler\n            .Expect(HttpMethod.Get, \"http://api/get-with-result\")\n            .Respond(HttpStatusCode.OK, new StringContent(\"success-result\"));\n\n        var fixture = RestService.For<IMyService>(\"http://api\", settings);\n\n        var thrownException = await Assert.ThrowsAsync<Exception>(() => fixture.GetWithResult());\n        Assert.Equal(exception, thrownException);\n\n        handler.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ProvideFactoryWhichAlwaysReturnsException_WithoutResult()\n    {\n        var handler = new MockHttpMessageHandler();\n        var exception = new Exception(\"I like to fail\");\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n            ExceptionFactory = _ => Task.FromResult<Exception>(exception)\n        };\n\n        handler.Expect(HttpMethod.Put, \"http://api/put-without-result\").Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IMyService>(\"http://api\", settings);\n\n        var thrownException = await Assert.ThrowsAsync<Exception>(() => fixture.PutWithoutResult());\n        Assert.Equal(exception, thrownException);\n\n        handler.VerifyNoOutstandingExpectation();\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/ExplicitInterfaceRefitTests.cs",
    "content": "﻿using System.Net.Http;\nusing System.Threading.Tasks;\nusing Refit;\nusing RichardSzalay.MockHttp;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic class ExplicitInterfaceRefitTests\n{\n    public interface IFoo\n    {\n        int Bar();\n    }\n\n    // Internal interface with a default implementation of IFoo.Bar that calls an internal Refit method\n    internal interface IInternalFoo : IFoo\n    {\n        int IFoo.Bar() => InternalBar() + 1;\n\n        [Get(\"/bar\")]\n        internal int InternalBar();\n    }\n\n    // Derived interface that explicitly implements IFoo.Bar and marks it as a Refit method\n    public interface IRemoteFoo2 : IFoo\n    {\n        [Get(\"/bar\")]\n        abstract int IFoo.Bar();\n    }\n\n    [Fact]\n    public void DefaultInterfaceImplementation_calls_internal_refit_method()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/bar\")\n            .Respond(\"application/json\", \"41\");\n\n        var fixture = RestService.For<IInternalFoo>(\"http://foo\", settings);\n\n        var result = ((IFoo)fixture).Bar();\n        Assert.Equal(42, result);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public void Explicit_interface_member_with_refit_attribute_is_invoked()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/bar\")\n            .Respond(\"application/json\", \"41\");\n\n        var fixture = RestService.For<IRemoteFoo2>(\"http://foo\", settings);\n\n        var result = ((IFoo)fixture).Bar();\n        Assert.Equal(41, result);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/FormValueMultimapTests.cs",
    "content": "﻿using System.Collections.Generic;\nusing System.Linq;\nusing System.Runtime.Serialization;\nusing System.Text.Json.Serialization;\nusing Newtonsoft.Json;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic class FormValueMultimapTests\n{\n    readonly RefitSettings settings = new();\n\n    [Fact]\n    public void EmptyIfNullPassedIn()\n    {\n        var target = new FormValueMultimap(null, settings);\n        Assert.Empty(target);\n    }\n\n    [Fact]\n    public void LoadsFromDictionary()\n    {\n        var source = new Dictionary<string, string> { { \"foo\", \"bar\" }, { \"xyz\", \"123\" } };\n\n        var target = new FormValueMultimap(source, settings);\n\n        Assert.Equal(source, target);\n    }\n\n    [Fact]\n    public void LoadsFromObject()\n    {\n        var source = new ObjectTestClass { A = \"1\", B = \"2\" };\n        var expected = new Dictionary<string, string> { { \"A\", \"1\" }, { \"B\", \"2\" }, };\n\n        var actual = new FormValueMultimap(source, settings);\n\n        Assert.Equal(expected, actual);\n    }\n\n    [Fact]\n    public void LoadFromObjectWithCollections()\n    {\n        var source = new ObjectWithRepeatedFieldsTestClass\n        {\n            A = new List<int> { 1, 2 },\n            B = new HashSet<string> { \"set1\", \"set2\" },\n            C = new HashSet<int> { 1, 2 },\n            D = new List<double> { 0.1, 1.0 },\n            E = new List<bool> { true, false }\n        };\n        var expected = new List<KeyValuePair<string, string>>\n        {\n            new KeyValuePair<string, string>(\"A\", \"01\"),\n            new KeyValuePair<string, string>(\"A\", \"02\"),\n            new KeyValuePair<string, string>(\"B\", \"set1,set2\"),\n            new KeyValuePair<string, string>(\"C\", \"01 02\"),\n            new KeyValuePair<string, string>(\"D\", \"0.10\\t1.00\"),\n            // The default behavior is to capitalize booleans. This is not a requirement.\n            new KeyValuePair<string, string>(\"E\", \"True|False\")\n        };\n\n        var actual = new FormValueMultimap(source, settings);\n\n        Assert.Equal(expected, actual);\n    }\n\n    [Fact]\n    public void DefaultCollectionFormatCanBeSpecifiedInSettings_Multi()\n    {\n        var settingsWithCollectionFormat = new RefitSettings\n        {\n            CollectionFormat = CollectionFormat.Multi\n        };\n        var source = new ObjectWithRepeatedFieldsTestClass\n        {\n            // Members have explicit CollectionFormat\n            A = new List<int> { 1, 2 },\n            B = new HashSet<string> { \"set1\", \"set2\" },\n            C = new HashSet<int> { 1, 2 },\n            D = new List<double> { 0.1, 1.0 },\n            E = new List<bool> { true, false },\n            // Member has no explicit CollectionFormat\n            F = new[] { 1, 2, 3 }\n        };\n        var expected = new List<KeyValuePair<string, string>>\n        {\n            new KeyValuePair<string, string>(\"A\", \"01\"),\n            new KeyValuePair<string, string>(\"A\", \"02\"),\n            new KeyValuePair<string, string>(\"B\", \"set1,set2\"),\n            new KeyValuePair<string, string>(\"C\", \"01 02\"),\n            new KeyValuePair<string, string>(\"D\", \"0.10\\t1.00\"),\n            new KeyValuePair<string, string>(\"E\", \"True|False\"),\n            new KeyValuePair<string, string>(\"F\", \"1\"),\n            new KeyValuePair<string, string>(\"F\", \"2\"),\n            new KeyValuePair<string, string>(\"F\", \"3\"),\n        };\n\n        var actual = new FormValueMultimap(source, settingsWithCollectionFormat);\n\n        Assert.Equal(expected, actual);\n    }\n\n    [Theory]\n    [InlineData(CollectionFormat.Csv, \"1,2,3\")]\n    [InlineData(CollectionFormat.Pipes, \"1|2|3\")]\n    [InlineData(CollectionFormat.Ssv, \"1 2 3\")]\n    [InlineData(CollectionFormat.Tsv, \"1\\t2\\t3\")]\n    public void DefaultCollectionFormatCanBeSpecifiedInSettings(\n        CollectionFormat format,\n        string expectedFormat\n    )\n    {\n        var settingsWithCollectionFormat = new RefitSettings { CollectionFormat = format };\n        var source = new ObjectWithRepeatedFieldsTestClass\n        {\n            // Members have explicit CollectionFormat\n            A = new List<int> { 1, 2 },\n            B = new HashSet<string> { \"set1\", \"set2\" },\n            C = new HashSet<int> { 1, 2 },\n            D = new List<double> { 0.1, 1.0 },\n            E = new List<bool> { true, false },\n            // Member has no explicit CollectionFormat\n            F = new[] { 1, 2, 3 }\n        };\n        var expected = new List<KeyValuePair<string, string>>\n        {\n            new KeyValuePair<string, string>(\"A\", \"01\"),\n            new KeyValuePair<string, string>(\"A\", \"02\"),\n            new KeyValuePair<string, string>(\"B\", \"set1,set2\"),\n            new KeyValuePair<string, string>(\"C\", \"01 02\"),\n            new KeyValuePair<string, string>(\"D\", \"0.10\\t1.00\"),\n            new KeyValuePair<string, string>(\"E\", \"True|False\"),\n            new KeyValuePair<string, string>(\"F\", expectedFormat),\n        };\n\n        var actual = new FormValueMultimap(source, settingsWithCollectionFormat);\n\n        Assert.Equal(expected, actual);\n    }\n\n    public class ObjectTestClass\n    {\n        public string A { get; set; }\n        public string B { get; set; }\n        public string C { get; set; }\n    }\n\n    public class ObjectWithRepeatedFieldsTestClass\n    {\n        [Query(CollectionFormat.Multi, Format = \"00\")]\n        public IList<int> A { get; set; }\n\n        [Query(CollectionFormat.Csv)]\n        public ISet<string> B { get; set; }\n\n        [Query(CollectionFormat.Ssv, Format = \"00\")]\n        public HashSet<int> C { get; set; }\n\n        [Query(CollectionFormat.Tsv, Format = \"0.00\")]\n        public IList<double> D { get; set; }\n\n        [Query(CollectionFormat.Pipes)]\n        public IList<bool> E { get; set; }\n\n        [Query]\n        public int[] F { get; set; }\n    }\n\n    [Fact]\n    public void ExcludesPropertiesWithInaccessibleGetters()\n    {\n        var source = new ClassWithInaccessibleGetters { A = \"Foo\", B = \"Bar\" };\n        var expected = new Dictionary<string, string> { { \"C\", \"FooBar\" } };\n\n        var actual = new FormValueMultimap(source, settings);\n\n        Assert.Equal(expected, actual);\n    }\n\n    public class ClassWithInaccessibleGetters\n    {\n        public string A { internal get; set; }\n        public string B { private get; set; }\n        public string C => A + B;\n    }\n\n    [Fact]\n    public void LoadsFromAnonymousType()\n    {\n        var source = new { foo = \"bar\", xyz = 123 };\n\n        var expected = new Dictionary<string, string> { { \"foo\", \"bar\" }, { \"xyz\", \"123\" } };\n\n        var actual = new FormValueMultimap(source, settings);\n\n        Assert.Equal(expected, actual);\n    }\n\n    [Fact]\n    public void UsesAliasAsAttribute()\n    {\n        var source = new AliasingTestClass { Foo = \"abc\" };\n\n        var target = new FormValueMultimap(source, settings);\n\n        Assert.DoesNotContain(\"Foo\", target.Keys);\n        Assert.Contains(\"f\", target.Keys);\n        Assert.Equal(\"abc\", target.FirstOrDefault(entry => entry.Key == \"f\").Value);\n    }\n\n    [Fact]\n    public void UsesJsonPropertyAttribute()\n    {\n        var source = new AliasingTestClass { Bar = \"xyz\" };\n\n        var target = new FormValueMultimap(source, settings);\n\n        Assert.DoesNotContain(\"Bar\", target.Keys);\n        Assert.Contains(\"b\", target.Keys);\n        Assert.Equal(\"xyz\", target.FirstOrDefault(entry => entry.Key == \"b\").Value);\n    }\n\n    [Fact]\n    public void UsesQueryPropertyAttribute()\n    {\n        var source = new AliasingTestClass { Frob = 4 };\n\n        var target = new FormValueMultimap(source, settings);\n\n        Assert.DoesNotContain(\"Bar\", target.Keys);\n        Assert.Contains(\"prefix-fr\", target.Keys);\n        Assert.Equal(\"4.0\", target.FirstOrDefault(entry => entry.Key == \"prefix-fr\").Value);\n    }\n\n    [Fact]\n    public void GivesPrecedenceToAliasAs()\n    {\n        var source = new AliasingTestClass { Baz = \"123\" };\n\n        var target = new FormValueMultimap(source, settings);\n\n        Assert.DoesNotContain(\"Bar\", target.Keys);\n        Assert.DoesNotContain(\"z\", target.Keys);\n        Assert.Contains(\"a\", target.Keys);\n        Assert.Equal(\"123\", target.FirstOrDefault(entry => entry.Key == \"a\").Value);\n    }\n\n    [Fact]\n    public void SkipsNullValuesFromDictionary()\n    {\n        var source = new Dictionary<string, string> { { \"foo\", \"bar\" }, { \"xyz\", null } };\n\n        var target = new FormValueMultimap(source, settings);\n\n        Assert.Single(target);\n        Assert.Contains(\"foo\", target.Keys);\n    }\n\n    [Fact]\n    public void SerializesEnumWithEnumMemberAttribute()\n    {\n        var source = new Dictionary<string, EnumWithEnumMember>()\n        {\n            { \"A\", EnumWithEnumMember.A },\n            { \"B\", EnumWithEnumMember.B }\n        };\n\n        var expected = new Dictionary<string, string> { { \"A\", \"A\" }, { \"B\", \"b\" } };\n\n        var actual = new FormValueMultimap(source, settings);\n\n        Assert.Equal(expected, actual);\n    }\n\n    public class AliasingTestClass\n    {\n        [AliasAs(\"f\")]\n        public string Foo { get; set; }\n\n        [JsonProperty(PropertyName = \"b\")]\n        [JsonPropertyName(\"b\")]\n        public string Bar { get; set; }\n\n        [AliasAs(\"a\")]\n        [JsonProperty(PropertyName = \"z\")]\n        [JsonPropertyName(\"z\")]\n        public string Baz { get; set; }\n\n        [Query(\"-\", \"prefix\", \"0.0\")]\n        [AliasAs(\"fr\")]\n        public int? Frob { get; set; }\n    }\n\n    public enum EnumWithEnumMember\n    {\n        A,\n\n        [EnumMember(Value = \"b\")]\n        B\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/GitHubApi.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Refit; // InterfaceStubGenerator looks for this\nusing static System.Math; // This is here to verify https://github.com/reactiveui/refit/issues/283\n\nnamespace Refit.Tests;\n\npublic record User\n{\n    public string Login { get; set; }\n    public int Id { get; set; }\n    public string AvatarUrl { get; set; }\n    public string GravatarId { get; set; }\n    public string Url { get; set; }\n    public string HtmlUrl { get; set; }\n    public string FollowersUrl { get; set; }\n    public string FollowingUrl { get; set; }\n    public string GistsUrl { get; set; }\n    public string StarredUrl { get; set; }\n    public string SubscriptionsUrl { get; set; }\n    public string OrganizationsUrl { get; set; }\n    public string ReposUrl { get; set; }\n    public string EventsUrl { get; set; }\n    public string ReceivedEventsUrl { get; set; }\n    public string Type { get; set; }\n    public string Name { get; set; }\n    public string Company { get; set; }\n    public string Blog { get; set; }\n    public string Location { get; set; }\n    public string Email { get; set; }\n    public bool? Hireable { get; set; }\n    public string Bio { get; set; }\n    public int PublicRepos { get; set; }\n    public int Followers { get; set; }\n    public int Following { get; set; }\n    public string CreatedAt { get; set; }\n    public string UpdatedAt { get; set; }\n    public int PublicGists { get; set; }\n}\n\npublic class UserSearchResult\n{\n    public int TotalCount { get; set; }\n    public bool IncompleteResults { get; set; }\n    public IList<User> Items { get; set; }\n}\n\n[Headers(\"User-Agent: Refit Integration Tests\")]\npublic interface IGitHubApi\n{\n    [Get(\"/users/{username}\")]\n    Task<User> GetUser(string userName);\n\n    [Get(\"/users/{username}\")]\n    IObservable<User> GetUserObservable(string userName);\n\n    [Get(\"/users/{userName}\")]\n    IObservable<User> GetUserCamelCase(string userName);\n\n    [Get(\"/orgs/{orgname}/members\")]\n    Task<List<User>> GetOrgMembers(string orgName, CancellationToken cancellationToken = default);\n\n    [Get(\"/search/users\")]\n    Task<UserSearchResult> FindUsers(string q);\n\n    [Get(\"/\")]\n    Task<HttpResponseMessage> GetIndex();\n\n    [Get(\"/\")]\n    IObservable<string> GetIndexObservable();\n\n    [Get(\"/give-me-some-404-action\")]\n    Task<User> NothingToSeeHere();\n\n    [Get(\"/give-me-some-404-action\")]\n    Task<ApiResponse<User>> NothingToSeeHereWithMetadata();\n\n    [Get(\"/users/{username}\")]\n    Task<ApiResponse<User>> GetUserWithMetadata(string userName);\n\n    [Get(\"/users/{username}\")]\n    IObservable<ApiResponse<User>> GetUserObservableWithMetadata(string userName);\n\n    [Get(\"/users/{username}\")]\n    IObservable<IApiResponse<User>> GetUserIApiResponseObservableWithMetadata(string userName);\n\n    [Post(\"/users\")]\n    Task<User> CreateUser(User user);\n\n    [Post(\"/users\")]\n    Task<ApiResponse<User>> CreateUserWithMetadata(User user);\n}\n\npublic interface IGitHubApiDisposable : IDisposable\n{\n    [Get(\"whatever\")]\n    Task RefitMethod();\n}\n\npublic class TestNested\n{\n    [Headers(\"User-Agent: Refit Integration Tests\")]\n    public interface INestedGitHubApi\n    {\n        [Get(\"/users/{username}\")]\n        Task<User> GetUser(string userName);\n\n        [Get(\"/users/{username}\")]\n        IObservable<User> GetUserObservable(string userName);\n\n        [Get(\"/users/{userName}\")]\n        IObservable<User> GetUserCamelCase(string userName);\n\n        [Get(\"/orgs/{orgname}/members\")]\n        Task<List<User>> GetOrgMembers(string orgName);\n\n        [Get(\"/search/users\")]\n        Task<UserSearchResult> FindUsers(string q);\n\n        [Get(\"/\")]\n        Task<HttpResponseMessage> GetIndex();\n\n        [Get(\"/\")]\n        IObservable<string> GetIndexObservable();\n\n        [Get(\"/give-me-some-404-action\")]\n        Task NothingToSeeHere();\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/GlobalSuppressions.cs",
    "content": "﻿// This file is used by Code Analysis to maintain SuppressMessage\n// attributes that are applied to this project.\n// Project-level suppressions either have no target or are given\n// a specific target and scoped to a namespace, type, member, etc.\n\nusing System.Diagnostics.CodeAnalysis;\n\n[assembly: SuppressMessage(\n    \"CodeQuality\",\n    \"IDE0079:Remove unnecessary suppression\",\n    Justification = \"<Pending>\",\n    Scope = \"member\",\n    Target = \"~T:Refit.Tests.RequestBuilderTests\"\n)]\n[assembly: SuppressMessage(\n    \"CodeQuality\",\n    \"IDE0079:Remove unnecessary suppression\",\n    Justification = \"<Pending>\",\n    Scope = \"member\",\n    Target = \"~T:Refit.Tests.MultipartTests\"\n)]\n"
  },
  {
    "path": "Refit.Tests/HttpClientFactoryExtensionsTests.cs",
    "content": "﻿using System.Globalization;\nusing System.Net.Http;\nusing System.Reflection;\nusing System.Text.Json;\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Options;\n\nusing Refit.Implementation;\n\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic class HttpClientFactoryExtensionsTests\n{\n    class User { }\n\n    class Role { }\n\n    [Fact]\n    public void GenericHttpClientsAreAssignedUniqueNames()\n    {\n        var services = new ServiceCollection();\n\n        var userClientName = services.AddRefitClient<IBoringCrudApi<User, string>>().Name;\n        var roleClientName = services.AddRefitClient<IBoringCrudApi<Role, string>>().Name;\n\n        Assert.NotEqual(userClientName, roleClientName);\n    }\n\n    [Fact]\n    public void HttpClientServicesAreDifferentThanKeyedServices()\n    {\n        var serviceCollection = new ServiceCollection();\n        serviceCollection.AddRefitClient<IFooWithOtherAttribute>();\n        serviceCollection.AddKeyedRefitClient<IFooWithOtherAttribute>(\"keyed\");\n\n        var serviceProvider = serviceCollection.BuildServiceProvider();\n        var nonKeyedService = serviceProvider.GetService<IFooWithOtherAttribute>();\n        var keyedService = serviceProvider.GetKeyedService<IFooWithOtherAttribute>(\"keyed\");\n\n        Assert.NotNull(nonKeyedService);\n        Assert.NotNull(keyedService);\n        Assert.NotSame(nonKeyedService, keyedService);\n\n        var nonKeyedSettings = serviceProvider.GetService<SettingsFor<IFooWithOtherAttribute>>();\n        var keyedSettings = serviceProvider.GetKeyedService<SettingsFor<IFooWithOtherAttribute>>(\"keyed\");\n        Assert.NotSame(nonKeyedSettings, keyedSettings);\n\n        var nonKeyedRequestBuilder = serviceProvider.GetService<IRequestBuilder<IFooWithOtherAttribute>>();\n        var keyedRequestBuilder = serviceProvider.GetKeyedService<IRequestBuilder<IFooWithOtherAttribute>>(\"keyed\");\n        Assert.NotSame(nonKeyedRequestBuilder, keyedRequestBuilder);\n    }\n\n    [Fact]\n    public void HttpClientServicesAreAddedCorrectlyGivenGenericArgument()\n    {\n        var serviceCollection = new ServiceCollection();\n        serviceCollection.AddRefitClient<IFooWithOtherAttribute>();\n        Assert.Contains(\n            serviceCollection,\n            z => z.ServiceType == typeof(SettingsFor<IFooWithOtherAttribute>)\n        );\n        Assert.Contains(\n            serviceCollection,\n            z => z.ServiceType == typeof(IRequestBuilder<IFooWithOtherAttribute>)\n        );\n    }\n\n    [Fact]\n    public void HttpClientServicesAreAddedCorrectlyGivenTypeArgument()\n    {\n        var serviceCollection = new ServiceCollection();\n        serviceCollection.AddRefitClient(typeof(IFooWithOtherAttribute));\n        Assert.Contains(\n            serviceCollection,\n            z => z.ServiceType == typeof(SettingsFor<IFooWithOtherAttribute>)\n        );\n        Assert.Contains(\n            serviceCollection,\n            z => z.ServiceType == typeof(IRequestBuilder<IFooWithOtherAttribute>)\n        );\n    }\n\n    [Fact]\n    public void HttpClientReturnsClientGivenGenericArgument()\n    {\n        var serviceCollection = new ServiceCollection();\n        serviceCollection.AddRefitClient<IFooWithOtherAttribute>();\n        var serviceProvider = serviceCollection.BuildServiceProvider();\n        Assert.NotNull(serviceProvider.GetService<IFooWithOtherAttribute>());\n    }\n\n    [Fact]\n    public void HttpClientReturnsClientGivenTypeArgument()\n    {\n        var serviceCollection = new ServiceCollection();\n        serviceCollection.AddRefitClient(typeof(IFooWithOtherAttribute));\n        var serviceProvider = serviceCollection.BuildServiceProvider();\n        Assert.NotNull(serviceProvider.GetService<IFooWithOtherAttribute>());\n    }\n\n    [Fact]\n    public void HttpClientSettingsAreInjectableGivenGenericArgument()\n    {\n        var serviceCollection = new ServiceCollection().Configure<ClientOptions>(\n            o => o.Serializer = new SystemTextJsonContentSerializer(new JsonSerializerOptions())\n        );\n        serviceCollection.AddRefitClient<IFooWithOtherAttribute>(\n            _ =>\n                new RefitSettings()\n                {\n                    ContentSerializer = _.GetRequiredService<\n                        IOptions<ClientOptions>\n                    >().Value.Serializer\n                }\n        );\n        var serviceProvider = serviceCollection.BuildServiceProvider();\n        Assert.Same(\n            serviceProvider.GetRequiredService<IOptions<ClientOptions>>().Value.Serializer,\n            serviceProvider\n                .GetRequiredService<SettingsFor<IFooWithOtherAttribute>>()\n                .Settings!.ContentSerializer\n        );\n    }\n\n    [Fact]\n    public void HttpClientSettingsAreInjectableGivenTypeArgument()\n    {\n        var serviceCollection = new ServiceCollection().Configure<ClientOptions>(\n            o => o.Serializer = new SystemTextJsonContentSerializer(new JsonSerializerOptions())\n        );\n        serviceCollection.AddRefitClient(\n            typeof(IFooWithOtherAttribute),\n            _ =>\n                new RefitSettings()\n                {\n                    ContentSerializer = _.GetRequiredService<\n                        IOptions<ClientOptions>\n                    >().Value.Serializer\n                }\n        );\n        var serviceProvider = serviceCollection.BuildServiceProvider();\n        Assert.Same(\n            serviceProvider.GetRequiredService<IOptions<ClientOptions>>().Value.Serializer,\n            serviceProvider\n                .GetRequiredService<SettingsFor<IFooWithOtherAttribute>>()\n                .Settings!.ContentSerializer\n        );\n    }\n\n    [Fact]\n    public void HttpClientSettingsCanBeProvidedStaticallyGivenGenericArgument()\n    {\n        var contentSerializer = new SystemTextJsonContentSerializer(new JsonSerializerOptions());\n        var serviceCollection = new ServiceCollection();\n        serviceCollection.AddRefitClient<IFooWithOtherAttribute>(\n            new RefitSettings() { ContentSerializer = contentSerializer }\n        );\n        var serviceProvider = serviceCollection.BuildServiceProvider();\n        Assert.Same(\n            contentSerializer,\n            serviceProvider\n                .GetRequiredService<SettingsFor<IFooWithOtherAttribute>>()\n                .Settings!.ContentSerializer\n        );\n    }\n\n    [Fact]\n    public void HttpClientSettingsCanBeProvidedStaticallyGivenTypeArgument()\n    {\n        var contentSerializer = new SystemTextJsonContentSerializer(new JsonSerializerOptions());\n        var serviceCollection = new ServiceCollection();\n        serviceCollection.AddRefitClient<IFooWithOtherAttribute>(\n            new RefitSettings() { ContentSerializer = contentSerializer }\n        );\n        var serviceProvider = serviceCollection.BuildServiceProvider();\n        Assert.Same(\n            contentSerializer,\n            serviceProvider\n                .GetRequiredService<SettingsFor<IFooWithOtherAttribute>>()\n                .Settings!.ContentSerializer\n        );\n    }\n\n    [Fact]\n    public void ProvidedHttpClientIsUsedAsNamedClient()\n    {\n        var baseUri = new Uri(\"https://0:1337\");\n        var services = new ServiceCollection();\n\n        services.AddHttpClient(\"MyHttpClient\", client =>\n        {\n            client.BaseAddress = baseUri;\n            client.DefaultRequestHeaders.Add(\"X-Powered-By\", Environment.OSVersion.VersionString);\n        });\n        services.AddRefitClient<IGitHubApi>(settingsAction: null, \"MyHttpClient\");\n\n        var sp = services.BuildServiceProvider();\n        var httpClientFactory = sp.GetRequiredService<IHttpClientFactory>();\n        var httpClient = httpClientFactory.CreateClient(\"MyHttpClient\");\n\n        var gitHubApi = sp.GetRequiredService<IGitHubApi>();\n\n        var memberInfos = typeof(Generated).GetMember(\"RefitTestsIGitHubApi\", BindingFlags.NonPublic);\n        var genApi = Convert.ChangeType(gitHubApi, (Type)memberInfos[0], CultureInfo.InvariantCulture);\n        var genApiProperty = genApi.GetType().GetProperty(\"Client\")!;\n        var genApiClient = (HttpClient)genApiProperty.GetValue(genApi)!;\n\n        Assert.NotSame(httpClient, genApiClient);\n        Assert.Equal(httpClient.BaseAddress, genApiClient.BaseAddress);\n        Assert.Equal(baseUri, genApiClient.BaseAddress);\n        Assert.Contains(\n            new KeyValuePair<string, IEnumerable<string>>(\"X-Powered-By\",\n                new[] { Environment.OSVersion.VersionString }), genApiClient.DefaultRequestHeaders);\n    }\n\n    class ClientOptions\n    {\n        public SystemTextJsonContentSerializer Serializer { get; set; }\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/IDefaultInterfaceMethodTests.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Text;\nusing System.Threading.Tasks;\nusing RichardSzalay.MockHttp;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic interface IHaveDims\n{\n    [Get(\"\")]\n    internal Task<string> GetInternal();\n\n    // DIMs require C# 8.0 which requires .NET Core 3.x or .NET Standard 2.1\n#if NETCOREAPP3_1_OR_GREATER\n    private Task<string> GetPrivate()\n    {\n        return GetInternal();\n    }\n\n    Task<string> GetDim()\n    {\n        return GetPrivate();\n    }\n\n    static string GetStatic()\n    {\n        return nameof(IHaveDims);\n    }\n#endif\n}\n\n// DIMs require C# 8.0 which requires .NET Core 3.x or .NET Standard 2.1\n#if NETCOREAPP3_1_OR_GREATER\npublic class DefaultInterfaceMethodTests\n{\n    [Fact]\n    public async Task InternalInterfaceMemberTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/\")\n            .Respond(HttpStatusCode.OK, \"text/html\", \"OK\");\n\n        var fixture = RestService.For<IHaveDims>(\"https://httpbin.org/\", settings);\n        var plainText = await fixture.GetInternal();\n\n        Assert.True(!string.IsNullOrWhiteSpace(plainText));\n    }\n\n    [Fact]\n    public async Task DimTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/\")\n            .Respond(HttpStatusCode.OK, \"text/html\", \"OK\");\n\n        var fixture = RestService.For<IHaveDims>(\"https://httpbin.org/\", settings);\n        var plainText = await fixture.GetDim();\n\n        Assert.True(!string.IsNullOrWhiteSpace(plainText));\n    }\n\n    [Fact]\n    public async Task InternalDimTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/\")\n            .Respond(HttpStatusCode.OK, \"text/html\", \"OK\");\n\n        var fixture = RestService.For<IHaveDims>(\"https://httpbin.org/\", settings);\n        var plainText = await fixture.GetInternal();\n\n        Assert.True(!string.IsNullOrWhiteSpace(plainText));\n    }\n\n    [Fact]\n    public void StaticInterfaceMethodTest()\n    {\n        var plainText = IHaveDims.GetStatic();\n\n        Assert.True(!string.IsNullOrWhiteSpace(plainText));\n    }\n}\n#endif\n"
  },
  {
    "path": "Refit.Tests/IFooWithOtherAttribute.cs",
    "content": "﻿using System.ComponentModel;\nusing System.Threading.Tasks;\nusing Refit;\n\ninterface IFooWithOtherAttribute\n{\n    [Get(\"/\")]\n    Task GetRoot();\n\n    [DisplayName(\"/\")]\n    Task PostRoot();\n}\n"
  },
  {
    "path": "Refit.Tests/IInterfaceWithoutRefit.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Refit.Tests;\n\npublic interface IInterfaceWithoutRefit\n{\n    Task DoSomething();\n}\n"
  },
  {
    "path": "Refit.Tests/IServiceWithoutNamespace.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Refit;\n\ninterface IServiceWithoutNamespace\n{\n    [Get(\"/\")]\n    Task GetRoot();\n\n    [Post(\"/\")]\n    Task PostRoot();\n}\n"
  },
  {
    "path": "Refit.Tests/InheritedGenericInterfacesApi.cs",
    "content": "﻿using System.Collections.Generic;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json;\nusing Refit; // InterfaceStubGenerator looks for this\nusing static System.Math; // This is here to verify https://github.com/reactiveui/refit/issues/283\n\nnamespace Refit.Tests;\n\npublic class DataEntity { }\n\npublic interface IDataApiA : IDataCrudApi<DataEntity>\n{\n    [Get(\"\")]\n    Task PingA();\n}\n\npublic interface IDataApiB : IDataCrudApi<DataEntity, int>\n{\n    [Get(\"\")]\n    Task PingB();\n}\n\npublic interface IDataCrudApi<T> : IDataCrudApi<T, long>\n    where T : class\n{\n    [Post(\"\")]\n    Task<T> Copy([Body] T payload);\n}\n\npublic interface IDataCrudApi<T, TKey>\n    where T : class\n{\n    [Post(\"\")]\n    Task<T> Create([Body] T payload);\n\n    [Get(\"\")]\n    Task<List<T>> ReadAll<TFoo>()\n        where TFoo : new();\n\n    [Get(\"\")]\n    Task<List<T>> ReadAll<TFoo, TBar>()\n        where TFoo : new()\n        where TBar : struct;\n\n    [Get(\"/{key}\")]\n    Task<T> ReadOne(TKey key);\n\n    [Put(\"/{key}\")]\n    Task Update(TKey key, [Body] T payload);\n\n    [Delete(\"/{key}\")]\n    Task Delete(TKey key);\n\n    [Get(\"\")]\n    Task ReadAllClasses<TFoo>()\n        where TFoo : class, new();\n}\n\npublic class DatasetQueryItem<TResultRow>\n    where TResultRow : class, new()\n{\n    [JsonProperty(\"global_id\")]\n    public long GlobalId { get; set; }\n\n    public long Number { get; set; }\n\n    [JsonProperty(\"Cells\")]\n    public TResultRow Value { get; set; }\n}\n\npublic interface IDataMosApi\n{\n    [Get(\"/datasets/{dataSet}/rows\")]\n    Task<DatasetQueryItem<TResulRow>[]> GetDataSetItems<TResulRow>()\n        where TResulRow : class, new();\n}\n"
  },
  {
    "path": "Refit.Tests/InheritedInterfacesApi.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Threading.Tasks;\nusing Refit; // InterfaceStubGenerator looks for this\nusing Refit.Tests.SeparateNamespaceWithModel;\nusing static System.Math; // This is here to verify https://github.com/reactiveui/refit/issues/283\n\nnamespace Refit.Tests\n{\n    [Headers(\"User-Agent: Refit Integration Tests\")]\n    public interface IAmInterface : IAmInterfaceB, IAmInterfaceA\n    {\n        [Get(\"/get?result=Pang\")]\n        Task<string> Pang();\n    }\n\n    [Headers(\"User-Agent: Refit Integration Tests\")]\n    public interface IAmInterfaceA\n    {\n        [Get(\"/get?result=Ping\")]\n        Task<string> Ping();\n    }\n\n    [Headers(\"User-Agent: Refit Integration Tests\")]\n    public interface IAmInterfaceB : IAmInterfaceD\n    {\n        [Get(\"/get?result=Pong\")]\n        Task<string> Pong();\n    }\n\n    [Headers(\"User-Agent: Refit Integration Tests\")]\n    public interface IAmInterfaceC : IAmInterfaceB, IAmInterfaceA\n    {\n        [Get(\"/get?result=Pang\")]\n        Task<string> Pang();\n    }\n\n    public interface IAmInterfaceD\n    {\n        [Get(\"/get?result=Test\")]\n        Task<string> Test();\n    }\n\n    public interface IAmInterfaceF_RequireUsing\n    {\n        [Get(\"/get-requiring-using\")]\n        Task<ResponseModel> Get(List<Guid> guids);\n    }\n\n    public interface IContainAandB : IAmInterfaceB, IAmInterfaceA { }\n\n    public interface IAmInterfaceEWithNoRefit<T>\n    {\n        public Task DoSomething(T parameter);\n\n        public Task DoSomethingElse();\n    }\n\n    public interface IImplementTheInterfaceAndUseRefit : IAmInterfaceEWithNoRefit<int>\n    {\n#pragma warning disable CS0108 // Member hides inherited member; missing new keyword\n        [Get(\"/doSomething\")]\n        public Task DoSomething(int parameter);\n#pragma warning restore CS0108 // Member hides inherited member; missing new keyword\n\n        [Get(\"/DoSomethingElse\")]\n        public new Task DoSomethingElse();\n    }\n\n    public interface IImplementTheInterfaceAndDontUseRefit : IAmInterfaceD\n    {\n#pragma warning disable CS0108 // Member hides inherited member; missing new keyword\n        Task<string> Test();\n#pragma warning restore CS0108 // Member hides inherited member; missing new keyword\n    }\n\n    public interface IMyClient\n    {\n        [Get(\"/\")]\n        Task MyMethodAsync(string ex);\n    }\n}\n\nnamespace Refit.Tests.SeparateNamespaceWithModel\n{\n    public class ResponseModel { }\n}\n"
  },
  {
    "path": "Refit.Tests/InheritedInterfacesInSeparateFileApi.cs",
    "content": "﻿using System.Threading.Tasks;\nusing Refit; // InterfaceStubGenerator looks for this\n\nnamespace Refit.Tests.SeparateNamespace;\n\npublic interface InheritedInterfacesInSeparateFileApi : IAmInterfaceF_RequireUsing\n{\n    [Get(\"/get\")]\n    Task Get(int i);\n}\n"
  },
  {
    "path": "Refit.Tests/IntegrationTestHelper.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Refit.Tests;\n\npublic static class IntegrationTestHelper\n{\n    public static string GetPath(params string[] paths)\n    {\n        var ret = GetIntegrationTestRootDirectory();\n        return (new FileInfo(paths.Aggregate(ret, Path.Combine))).FullName;\n    }\n\n    public static string GetIntegrationTestRootDirectory([CallerFilePath] string filePath = default)\n    {\n        // XXX: This is an evil hack, but it's okay for a unit test\n        // We can't use Assembly.Location because unit test runners love\n        // to move stuff to temp directories\n        var di = new DirectoryInfo(Path.Combine(Path.GetDirectoryName(filePath)));\n\n        return di.FullName;\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/InterfaceStubGenerator.cs",
    "content": "﻿using System.Collections.Immutable;\nusing System.Reflection;\n\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.Testing;\n\nusing Refit.Generator;\n\nusing VerifyTests.DiffPlex;\n\nusing Task = System.Threading.Tasks.Task;\n\nnamespace Refit.Tests;\n\npublic class InterfaceStubGeneratorTests\n{\n    static readonly MetadataReference RefitAssembly = MetadataReference.CreateFromFile(\n        typeof(GetAttribute).Assembly.Location,\n        documentation: XmlDocumentationProvider.CreateFromFile(\n            Path.ChangeExtension(typeof(GetAttribute).Assembly.Location, \".xml\")\n        )\n    );\n\n    static readonly ReferenceAssemblies ReferenceAssemblies;\n\n    static InterfaceStubGeneratorTests()\n    {\n#if NET6_0\n        ReferenceAssemblies = ReferenceAssemblies.Net.Net60;\n#elif NET8_0\n        ReferenceAssemblies = ReferenceAssemblies.Net.Net80;\n#elif NET9_0\n        ReferenceAssemblies = ReferenceAssemblies.Net.Net90;\n#else\n        ReferenceAssemblies = ReferenceAssemblies.Default.AddPackages(\n            ImmutableArray.Create(new PackageIdentity(\"System.Text.Json\", \"7.0.2\"))\n        );\n#endif\n\n#if NET48\n        ReferenceAssemblies = ReferenceAssemblies\n            .AddAssemblies(ImmutableArray.Create(\"System.Web\"))\n            .AddPackages(ImmutableArray.Create(new PackageIdentity(\"System.Net.Http\", \"4.3.4\")));\n#endif\n    }\n\n    public static async Task<VerifyResult> VerifyGenerator(string input)\n    {\n        var assemblies = await ReferenceAssemblies.ResolveAsync(null, default);\n\n        string[] inputs = [input];\n        var compilation = CSharpCompilation.Create(\n            \"compilation\",\n            inputs.Select(source => CSharpSyntaxTree.ParseText(File.ReadAllText(source))),\n            assemblies.Add(RefitAssembly),\n            new CSharpCompilationOptions(OutputKind.ConsoleApplication)\n        );\n\n#if NET48\n        var generator = new InterfaceStubGenerator();\n#else\n        var generator = new InterfaceStubGeneratorV2();\n#endif\n        var driver = CSharpGeneratorDriver.Create(generator);\n        var ranDriver = driver.RunGenerators(compilation);\n\n        return await Verify(ranDriver).ToTask();\n    }\n\n    [Fact(Skip = \"Generator in test issue\")]\n    public void GenerateInterfaceStubsSmokeTest()\n    {\n        var fixture = new InterfaceStubGenerator();\n\n        var driver = CSharpGeneratorDriver.Create(fixture);\n\n        var inputCompilation = CreateCompilation(\n            IntegrationTestHelper.GetPath(\"RestService.cs\"),\n            IntegrationTestHelper.GetPath(\"GitHubApi.cs\"),\n            IntegrationTestHelper.GetPath(\"InheritedInterfacesApi.cs\"),\n            IntegrationTestHelper.GetPath(\"InheritedGenericInterfacesApi.cs\")\n        );\n\n        var diags = inputCompilation.GetDiagnostics();\n\n        // Make sure we don't have any errors\n        Assert.Empty(diags.Where(d => d.Severity == DiagnosticSeverity.Error));\n\n        var rundriver = driver.RunGeneratorsAndUpdateCompilation(\n            inputCompilation,\n            out var outputCompiliation,\n            out var diagnostics\n        );\n\n        var runResult = rundriver.GetRunResult();\n\n        var generated = runResult.Results[0];\n\n        var text = generated.GeneratedSources.First().SourceText.ToString();\n\n        Assert.Contains(\"IGitHubApi\", text);\n        Assert.Contains(\"IAmInterfaceC\", text);\n    }\n\n    static CSharpCompilation CreateCompilation(params string[] sourceFiles)\n    {\n        var keyReferences = new[]\n        {\n            typeof(Binder),\n            typeof(GetAttribute),\n            typeof(RichardSzalay.MockHttp.MockHttpMessageHandler),\n            typeof(System.Reactive.Unit),\n            typeof(System.Linq.Enumerable),\n            typeof(Newtonsoft.Json.JsonConvert),\n            typeof(Xunit.FactAttribute),\n            typeof(System.Net.Http.HttpContent),\n            typeof(ModelObject),\n            typeof(Attribute)\n        };\n\n        return CSharpCompilation.Create(\n            \"compilation\",\n            sourceFiles.Select(source => CSharpSyntaxTree.ParseText(File.ReadAllText(source))),\n            keyReferences.Select(t => MetadataReference.CreateFromFile(t.Assembly.Location)),\n            new CSharpCompilationOptions(OutputKind.ConsoleApplication)\n        );\n    }\n\n    [Fact]\n    public async Task NoRefitInterfacesSmokeTest()\n    {\n        var path = IntegrationTestHelper.GetPath(\"IInterfaceWithoutRefit.cs\");\n        await VerifyGenerator(path);\n    }\n\n    [Fact]\n    public async Task FindInterfacesSmokeTest()\n    {\n        var path = IntegrationTestHelper.GetPath(\"GitHubApi.cs\");\n        await VerifyGenerator(path);\n    }\n\n    [Fact]\n    public async Task GenerateInterfaceStubsWithoutNamespaceSmokeTest()\n    {\n        var path = IntegrationTestHelper.GetPath(\"IServiceWithoutNamespace.cs\");\n        await VerifyGenerator(path);\n    }\n}\n\npublic static class ThisIsDumbButMightHappen\n{\n    public const string PeopleDoWeirdStuff = \"But we don't let them\";\n}\n\npublic interface IAmARefitInterfaceButNobodyUsesMe\n{\n    [Get(\"whatever\")]\n    Task RefitMethod();\n\n    [Refit.GetAttribute(\"something-else\")]\n    Task AnotherRefitMethod();\n\n    [Get(ThisIsDumbButMightHappen.PeopleDoWeirdStuff)]\n    Task NoConstantsAllowed();\n\n    [Get(\"spaces-shouldnt-break-me\")]\n    Task SpacesShouldntBreakMe();\n\n    // We don't need an explicit test for this because if it isn't supported we can't compile\n    [Get(\"anything\")]\n    Task ReservedWordsForParameterNames(int @int, string @string, float @long);\n}\n\npublic interface IAmNotARefitInterface\n{\n    Task NotARefitMethod();\n}\n\npublic interface IBoringCrudApi<T, in TKey>\n    where T : class\n{\n    [Post(\"\")]\n    Task<T> Create([Body] T paylod);\n\n    [Get(\"\")]\n    Task<List<T>> ReadAll();\n\n    [Get(\"/{key}\")]\n    Task<T> ReadOne(TKey key);\n\n    [Put(\"/{key}\")]\n    Task Update(TKey key, [Body] T payload);\n\n    [Delete(\"/{key}\")]\n    Task Delete(TKey key);\n}\n\npublic interface INonGenericInterfaceWithGenericMethod\n{\n    [Post(\"\")]\n    Task PostMessage<T>([Body] T message)\n        where T : IMessage;\n\n    [Post(\"\")]\n    Task PostMessage<T, U, V>([Body] T message, U param1, V param2)\n        where T : IMessage\n        where U : T;\n}\n\npublic interface IMessage;\n"
  },
  {
    "path": "Refit.Tests/MethodOverloads.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Net;\nusing System.Net.Http;\nusing System.Threading.Tasks;\nusing Refit;\nusing RichardSzalay.MockHttp;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic interface IUseOverloadedMethods\n{\n    [Get(\"\")]\n    Task<string> Get();\n\n    [Get(\"/status/{httpstatuscode}\")]\n    Task<HttpResponseMessage> Get(int httpstatuscode);\n}\n\npublic interface IUseOverloadedGenericMethods<TResponse, in TParam, in THeader>\n    where TResponse : class\n    where THeader : struct\n{\n    [Get(\"\")]\n    Task<string> Get();\n\n    [Get(\"/get\")]\n    Task<TResponse> Get(TParam param, [Header(\"X-Refit\")] THeader header);\n\n    [Get(\"/get\")]\n    Task<TResponse> Get(THeader param, [Header(\"X-Refit\")] TParam header);\n\n    [Get(\"/status/{httpstatuscode}\")]\n    Task<HttpResponseMessage> Get(int httpstatuscode);\n\n    [Get(\"/get\")]\n    Task<TValue> Get<TValue>(int someVal);\n\n    [Get(\"/get\")]\n    Task<TValue> Get<TValue, TInput>(TInput input);\n\n    [Get(\"/get\")]\n    Task Get<TInput1, TInput2>(TInput1 input1, TInput2 input2);\n}\n\npublic class MethodOverladTests\n{\n    [Fact]\n    public async Task BasicMethodOverloadTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/\")\n            .Respond(HttpStatusCode.OK, \"text/html\", \"OK\");\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/status/403\")\n            .Respond(HttpStatusCode.Forbidden);\n\n        var fixture = RestService.For<IUseOverloadedMethods>(\"https://httpbin.org/\", settings);\n        var plainText = await fixture.Get();\n\n        var resp = await fixture.Get(403);\n\n        Assert.True(!string.IsNullOrWhiteSpace(plainText));\n        Assert.Equal(HttpStatusCode.Forbidden, resp.StatusCode);\n    }\n\n    [Fact]\n    public async Task GenericMethodOverloadTest1()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/\")\n            .Respond(HttpStatusCode.OK, \"text/html\", \"OK\");\n\n        var fixture = RestService.For<IUseOverloadedGenericMethods<HttpBinGet, string, int>>(\n            \"https://httpbin.org/\",\n            settings\n        );\n        var plainText = await fixture.Get();\n\n        Assert.True(!string.IsNullOrWhiteSpace(plainText));\n    }\n\n    [Fact]\n    public async Task GenericMethodOverloadTest2()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/status/403\")\n            .Respond(HttpStatusCode.Forbidden);\n\n        var fixture = RestService.For<IUseOverloadedGenericMethods<HttpBinGet, string, int>>(\n            \"https://httpbin.org/\",\n            settings\n        );\n\n        var resp = await fixture.Get(403);\n\n        Assert.Equal(HttpStatusCode.Forbidden, resp.StatusCode);\n    }\n\n    [Fact]\n    public async Task GenericMethodOverloadTest3()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .WithQueryString(\"someVal\", \"201\")\n            .Respond(\"application/json\", \"some-T-value\");\n\n        var fixture = RestService.For<IUseOverloadedGenericMethods<HttpBinGet, string, int>>(\n            \"https://httpbin.org/\",\n            settings\n        );\n\n        var result = await fixture.Get<string>(201);\n\n        Assert.Equal(\"some-T-value\", result);\n    }\n\n    [Fact]\n    public async Task GenericMethodOverloadTest4()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .WithHeaders(\"X-Refit\", \"99\")\n            .WithQueryString(\"param\", \"foo\")\n            .Respond(\n                \"application/json\",\n                \"{\\\"url\\\": \\\"https://httpbin.org/get\\\", \\\"args\\\": {\\\"param\\\": \\\"foo\\\"}}\"\n            );\n\n        var fixture = RestService.For<IUseOverloadedGenericMethods<HttpBinGet, string, int>>(\n            \"https://httpbin.org/\",\n            settings\n        );\n\n        var result = await fixture.Get(\"foo\", 99);\n\n        Assert.Equal(\"foo\", result.Args[\"param\"]);\n    }\n\n    [Fact]\n    public async Task GenericMethodOverloadTest5()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .WithHeaders(\"X-Refit\", \"foo\")\n            .WithQueryString(\"param\", \"99\")\n            .Respond(\n                \"application/json\",\n                \"{\\\"url\\\": \\\"https://httpbin.org/get\\\", \\\"args\\\": {\\\"param\\\": \\\"99\\\"}}\"\n            );\n\n        var fixture = RestService.For<IUseOverloadedGenericMethods<HttpBinGet, string, int>>(\n            \"https://httpbin.org/\",\n            settings\n        );\n\n        var result = await fixture.Get(99, \"foo\");\n\n        Assert.Equal(\"99\", result.Args[\"param\"]);\n    }\n\n    [Fact]\n    public async Task GenericMethodOverloadTest6()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .WithQueryString(\"input\", \"99\")\n            .Respond(\"application/json\", \"generic-output\");\n\n        var fixture = RestService.For<IUseOverloadedGenericMethods<HttpBinGet, string, int>>(\n            \"https://httpbin.org/\",\n            settings\n        );\n\n        var result = await fixture.Get<string, int>(99);\n\n        Assert.Equal(\"generic-output\", result);\n    }\n\n    [Fact]\n    public async Task GenericMethodOverloadTest7()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .WithQueryString(\n                new Dictionary<string, string>() { { \"input1\", \"str\" }, { \"input2\", \"3\" } }\n            )\n            .Respond(\"application/json\", \"Ok\");\n\n        var fixture = RestService.For<IUseOverloadedGenericMethods<HttpBinGet, string, int>>(\n            \"https://httpbin.org/\",\n            settings\n        );\n\n        await fixture.Get<string, int>(\"str\", 3);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/ModuleInitializer.cs",
    "content": "﻿using System.Runtime.CompilerServices;\nusing VerifyTests.DiffPlex;\n\nnamespace Refit.Tests;\n\nstatic class ModuleInitializer\n{\n    // ModuleInitializer should only be used in apps\n#pragma warning disable CA2255\n    [ModuleInitializer]\n#pragma warning restore CA2255\n    public static void Init()\n    {\n        DerivePathInfo((file, _, type, method) => new(Path.Combine(Path.GetDirectoryName(file), \"_snapshots\"), type.Name, method.Name));\n\n        VerifySourceGenerators.Initialize();\n        VerifyDiffPlex.Initialize(OutputType.Compact);\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/ModuleInitializerAttribute.cs",
    "content": "﻿// ReSharper disable once CheckNamespace\nnamespace System.Runtime.CompilerServices;\n\n[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]\nsealed class ModuleInitializerAttribute : Attribute;\n"
  },
  {
    "path": "Refit.Tests/MultipartTests.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Reflection;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json;\nusing Refit;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic interface IRunscopeApi\n{\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadStream(Stream stream);\n\n    [Multipart(\"-----SomeCustomBoundary\")]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadStreamWithCustomBoundary(Stream stream);\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadStreamPart(StreamPart stream);\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadStreamPart(\n        [Query] ModelObject someQueryParams,\n        StreamPart stream\n    );\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadBytes(byte[] bytes);\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadBytesPart(\n        [AliasAs(\"ByteArrayPartParamAlias\")] ByteArrayPart bytes\n    );\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadString([AliasAs(\"SomeStringAlias\")] string someString);\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadStringWithHeaderAndRequestProperty(\n        [Header(\"Authorization\")] string authorization,\n        [Property(\"SomeProperty\")] string someProperty,\n        [AliasAs(\"SomeStringAlias\")] string someString\n    );\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadFileInfo(IEnumerable<FileInfo> fileInfos, FileInfo anotherFile);\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadFileInfoPart(\n        IEnumerable<FileInfoPart> fileInfos,\n        FileInfoPart anotherFile\n    );\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadJsonObject(ModelObject theObject);\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadJsonObjects(IEnumerable<ModelObject> theObjects);\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadMixedObjects(\n        IEnumerable<ModelObject> theObjects,\n        AnotherModel anotherModel,\n        FileInfo aFile,\n        AnEnum anEnum,\n        string aString,\n        int anInt\n    );\n\n    [Multipart]\n    [Post(\"/\")]\n    Task<HttpResponseMessage> UploadHttpContent(HttpContent content);\n}\n\npublic class ModelObject\n{\n    public string Property1 { get; set; }\n    public string Property2 { get; set; }\n}\n\npublic class AnotherModel\n{\n    public string[] Foos { get; set; }\n}\n\npublic enum AnEnum\n{\n    Val1,\n    Val2\n}\n\npublic class MultipartTests\n{\n    const string BaseAddress = \"https://api/\";\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithStream()\n    {\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"stream\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Equal(\"stream\", parts[0].Headers.ContentDisposition.FileName);\n\n                using var str = await parts[0].ReadAsStreamAsync();\n                using var src = GetTestFileStream(\"Test Files/Test.pdf\");\n                Assert.True(StreamsEqual(src, str));\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadStream(stream);\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithStreamAndCustomBoundary()\n    {\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"stream\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Equal(\"stream\", parts[0].Headers.ContentDisposition.FileName);\n\n                using var str = await parts[0].ReadAsStreamAsync();\n                using var src = GetTestFileStream(\"Test Files/Test.pdf\");\n                Assert.True(StreamsEqual(src, str));\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        using (var stream = GetTestFileStream(\"Test Files/Test.pdf\"))\n        {\n            var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n            var result = await fixture.UploadStreamWithCustomBoundary(stream);\n        }\n\n        var input = typeof(IRunscopeApi);\n        var methodFixture = new RestMethodInfoInternal(\n            input,\n            input.GetMethods().First(x => x.Name == \"UploadStreamWithCustomBoundary\")\n        );\n        Assert.Equal(\"-----SomeCustomBoundary\", methodFixture.MultipartBoundary);\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithByteArray()\n    {\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"bytes\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Equal(\"bytes\", parts[0].Headers.ContentDisposition.FileName);\n                Assert.Null(parts[0].Headers.ContentType);\n                using var str = await parts[0].ReadAsStreamAsync();\n                using var src = GetTestFileStream(\"Test Files/Test.pdf\");\n                Assert.True(StreamsEqual(src, str));\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n        using var reader = new BinaryReader(stream);\n        var bytes = reader.ReadBytes((int)stream.Length);\n\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadBytes(bytes);\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithFileInfo()\n    {\n        var fileName = Path.GetTempFileName();\n        var name = Path.GetFileName(fileName);\n\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Equal(3, parts.Count);\n\n                Assert.Equal(\"fileInfos\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Equal(name, parts[0].Headers.ContentDisposition.FileName);\n                Assert.Null(parts[0].Headers.ContentType);\n                using (var str = await parts[0].ReadAsStreamAsync())\n                using (var src = GetTestFileStream(\"Test Files/Test.pdf\"))\n                {\n                    Assert.True(StreamsEqual(src, str));\n                }\n\n                Assert.Equal(\"fileInfos\", parts[1].Headers.ContentDisposition.Name);\n                Assert.Equal(name, parts[1].Headers.ContentDisposition.FileName);\n                Assert.Null(parts[1].Headers.ContentType);\n                using (var str = await parts[1].ReadAsStreamAsync())\n                using (var src = GetTestFileStream(\"Test Files/Test.pdf\"))\n                {\n                    Assert.True(StreamsEqual(src, str));\n                }\n\n                Assert.Equal(\"anotherFile\", parts[2].Headers.ContentDisposition.Name);\n                Assert.Equal(name, parts[2].Headers.ContentDisposition.FileName);\n                Assert.Null(parts[2].Headers.ContentType);\n                using (var str = await parts[2].ReadAsStreamAsync())\n                using (var src = GetTestFileStream(\"Test Files/Test.pdf\"))\n                {\n                    Assert.True(StreamsEqual(src, str));\n                }\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        try\n        {\n            using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n            using var outStream = File.OpenWrite(fileName);\n            await stream.CopyToAsync(outStream);\n            await outStream.FlushAsync();\n            outStream.Close();\n\n            var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n            var result = await fixture.UploadFileInfo(\n                new[] { new FileInfo(fileName), new FileInfo(fileName) },\n                new FileInfo(fileName)\n            );\n        }\n        finally\n        {\n            File.Delete(fileName);\n        }\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithString()\n    {\n        const string text = \"This is random text\";\n\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"SomeStringAlias\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Null(parts[0].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"text/plain\", parts[0].Headers.ContentType.MediaType);\n                Assert.Equal(\"utf-8\", parts[0].Headers.ContentType.CharSet);\n                var str = await parts[0].ReadAsStringAsync();\n                Assert.Equal(text, str);\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadString(text);\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithHeaderAndRequestProperty()\n    {\n        const string text = \"This is random text\";\n        const string someHeader = \"someHeader\";\n        const string someProperty = \"someProperty\";\n\n        var handler = new MockHttpMessageHandler\n        {\n            RequestAsserts = message =>\n            {\n                Assert.Equal(someHeader, message.Headers.Authorization.ToString());\n\n#if NET6_0_OR_GREATER\n                Assert.Equal(3, message.Options.Count());\n                Assert.Equal(\n                    someProperty,\n                    ((IDictionary<string, object>)message.Options)[\"SomeProperty\"]\n                );\n#endif\n\n#pragma warning disable CS0618 // Type or member is obsolete\n                Assert.Equal(3, message.Properties.Count);\n                Assert.Equal(someProperty, message.Properties[\"SomeProperty\"]);\n#pragma warning restore CS0618 // Type or member is obsolete\n            },\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"SomeStringAlias\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Null(parts[0].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"text/plain\", parts[0].Headers.ContentType.MediaType);\n                Assert.Equal(\"utf-8\", parts[0].Headers.ContentType.CharSet);\n                var str = await parts[0].ReadAsStringAsync();\n                Assert.Equal(text, str);\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadStringWithHeaderAndRequestProperty(\n            someHeader,\n            someProperty,\n            text\n        );\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithStreamPart()\n    {\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"stream\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Equal(\"test-streampart.pdf\", parts[0].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/pdf\", parts[0].Headers.ContentType.MediaType);\n\n                using var str = await parts[0].ReadAsStreamAsync();\n                using var src = GetTestFileStream(\"Test Files/Test.pdf\");\n                Assert.True(StreamsEqual(src, str));\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadStreamPart(\n            new StreamPart(stream, \"test-streampart.pdf\", \"application/pdf\")\n        );\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithStreamPartWithNamedMultipart()\n    {\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"test-stream\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Equal(\"test-streampart.pdf\", parts[0].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/pdf\", parts[0].Headers.ContentType.MediaType);\n\n                using var str = await parts[0].ReadAsStreamAsync();\n                using var src = GetTestFileStream(\"Test Files/Test.pdf\");\n                Assert.True(StreamsEqual(src, str));\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadStreamPart(\n            new StreamPart(stream, \"test-streampart.pdf\", \"application/pdf\", \"test-stream\")\n        );\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithStreamPartAndQuery()\n    {\n        var handler = new MockHttpMessageHandler\n        {\n            RequestAsserts = request =>\n            {\n                Assert.Equal(\"?Property1=test&Property2=test2\", request.RequestUri.Query);\n            },\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"stream\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Equal(\"test-streampart.pdf\", parts[0].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/pdf\", parts[0].Headers.ContentType.MediaType);\n\n                using var str = await parts[0].ReadAsStreamAsync();\n                using var src = GetTestFileStream(\"Test Files/Test.pdf\");\n                Assert.True(StreamsEqual(src, str));\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadStreamPart(\n            new ModelObject() { Property1 = \"test\", Property2 = \"test2\" },\n            new StreamPart(stream, \"test-streampart.pdf\", \"application/pdf\")\n        );\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithByteArrayPart()\n    {\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"ByteArrayPartParamAlias\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Equal(\n                    \"test-bytearraypart.pdf\",\n                    parts[0].Headers.ContentDisposition.FileName\n                );\n                Assert.Equal(\"application/pdf\", parts[0].Headers.ContentType.MediaType);\n\n                using var str = await parts[0].ReadAsStreamAsync();\n                using var src = GetTestFileStream(\"Test Files/Test.pdf\");\n                Assert.True(StreamsEqual(src, str));\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n        using var reader = new BinaryReader(stream);\n        var bytes = reader.ReadBytes((int)stream.Length);\n\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadBytesPart(\n            new ByteArrayPart(bytes, \"test-bytearraypart.pdf\", \"application/pdf\")\n        );\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithFileInfoPart()\n    {\n        var fileName = Path.GetTempFileName();\n\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Equal(3, parts.Count);\n\n                Assert.Equal(\"fileInfos\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Equal(\"test-fileinfopart.pdf\", parts[0].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/pdf\", parts[0].Headers.ContentType.MediaType);\n                using (var str = await parts[0].ReadAsStreamAsync())\n                using (var src = GetTestFileStream(\"Test Files/Test.pdf\"))\n                {\n                    Assert.True(StreamsEqual(src, str));\n                }\n\n                Assert.Equal(\"fileInfos\", parts[1].Headers.ContentDisposition.Name);\n                Assert.Equal(\n                    \"test-fileinfopart2.pdf\",\n                    parts[1].Headers.ContentDisposition.FileName\n                );\n                Assert.Null(parts[1].Headers.ContentType);\n                using (var str = await parts[1].ReadAsStreamAsync())\n                using (var src = GetTestFileStream(\"Test Files/Test.pdf\"))\n                {\n                    Assert.True(StreamsEqual(src, str));\n                }\n\n                Assert.Equal(\"anotherFile\", parts[2].Headers.ContentDisposition.Name);\n                Assert.Equal(\"additionalfile.pdf\", parts[2].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/pdf\", parts[2].Headers.ContentType.MediaType);\n                using (var str = await parts[2].ReadAsStreamAsync())\n                using (var src = GetTestFileStream(\"Test Files/Test.pdf\"))\n                {\n                    Assert.True(StreamsEqual(src, str));\n                }\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        try\n        {\n            using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n            using var outStream = File.OpenWrite(fileName);\n            await stream.CopyToAsync(outStream);\n            await outStream.FlushAsync();\n            outStream.Close();\n\n            var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n            var result = await fixture.UploadFileInfoPart(\n                new[]\n                {\n                    new FileInfoPart(\n                        new FileInfo(fileName),\n                        \"test-fileinfopart.pdf\",\n                        \"application/pdf\"\n                    ),\n                    new FileInfoPart(\n                        new FileInfo(fileName),\n                        \"test-fileinfopart2.pdf\",\n                        contentType: null\n                    )\n                },\n                new FileInfoPart(\n                    new FileInfo(fileName),\n                    fileName: \"additionalfile.pdf\",\n                    contentType: \"application/pdf\"\n                )\n            );\n        }\n        finally\n        {\n            File.Delete(fileName);\n        }\n    }\n\n    [Theory]\n    [InlineData(typeof(NewtonsoftJsonContentSerializer), \"application/json\")]\n    [InlineData(typeof(SystemTextJsonContentSerializer), \"application/json\")]\n    [InlineData(typeof(XmlContentSerializer), \"application/xml\")]\n    public async Task MultipartUploadShouldWorkWithAnObject(\n        Type contentSerializerType,\n        string mediaType\n    )\n    {\n        if (\n            Activator.CreateInstance(contentSerializerType) is not IHttpContentSerializer serializer\n        )\n        {\n            throw new ArgumentException(\n                $\"{contentSerializerType.FullName} does not implement {nameof(IHttpContentSerializer)}\"\n            );\n        }\n\n        var model1 = new ModelObject { Property1 = \"M1.prop1\", Property2 = \"M1.prop2\" };\n\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"theObject\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Null(parts[0].Headers.ContentDisposition.FileName);\n                Assert.Equal(mediaType, parts[0].Headers.ContentType.MediaType);\n                var result0 = await serializer\n                    .FromHttpContentAsync<ModelObject>(parts[0])\n                    .ConfigureAwait(false);\n                Assert.Equal(model1.Property1, result0.Property1);\n                Assert.Equal(model1.Property2, result0.Property2);\n            }\n        };\n\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n            ContentSerializer = serializer\n        };\n\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadJsonObject(model1);\n    }\n\n    [Theory]\n    [InlineData(typeof(NewtonsoftJsonContentSerializer), \"application/json\")]\n    [InlineData(typeof(SystemTextJsonContentSerializer), \"application/json\")]\n    [InlineData(typeof(XmlContentSerializer), \"application/xml\")]\n    public async Task MultipartUploadShouldWorkWithObjects(\n        Type contentSerializerType,\n        string mediaType\n    )\n    {\n        if (\n            Activator.CreateInstance(contentSerializerType) is not IHttpContentSerializer serializer\n        )\n        {\n            throw new ArgumentException(\n                $\"{contentSerializerType.FullName} does not implement {nameof(IHttpContentSerializer)}\"\n            );\n        }\n\n        var model1 = new ModelObject { Property1 = \"M1.prop1\", Property2 = \"M1.prop2\" };\n\n        var model2 = new ModelObject { Property1 = \"M2.prop1\" };\n\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Equal(2, parts.Count);\n\n                Assert.Equal(\"theObjects\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Null(parts[0].Headers.ContentDisposition.FileName);\n                Assert.Equal(mediaType, parts[0].Headers.ContentType.MediaType);\n                var result0 = await serializer\n                    .FromHttpContentAsync<ModelObject>(parts[0])\n                    .ConfigureAwait(false);\n                Assert.Equal(model1.Property1, result0.Property1);\n                Assert.Equal(model1.Property2, result0.Property2);\n\n                Assert.Equal(\"theObjects\", parts[1].Headers.ContentDisposition.Name);\n                Assert.Null(parts[1].Headers.ContentDisposition.FileName);\n                Assert.Equal(mediaType, parts[1].Headers.ContentType.MediaType);\n                var result1 = await serializer\n                    .FromHttpContentAsync<ModelObject>(parts[1])\n                    .ConfigureAwait(false);\n                Assert.Equal(model2.Property1, result1.Property1);\n                Assert.Equal(model2.Property2, result1.Property2);\n            }\n        };\n\n        var settings = new RefitSettings()\n        {\n            HttpMessageHandlerFactory = () => handler,\n            ContentSerializer = serializer\n        };\n\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadJsonObjects(new[] { model1, model2 });\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithMixedTypes()\n    {\n        var fileName = Path.GetTempFileName();\n        var name = Path.GetFileName(fileName);\n\n        var model1 = new ModelObject { Property1 = \"M1.prop1\", Property2 = \"M1.prop2\" };\n\n        var model2 = new ModelObject { Property1 = \"M2.prop1\" };\n\n        var anotherModel = new AnotherModel { Foos = new[] { \"bar1\", \"bar2\" } };\n\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Equal(7, parts.Count);\n\n                Assert.Equal(\"theObjects\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Null(parts[0].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/json\", parts[0].Headers.ContentType.MediaType);\n                var result0 = JsonConvert.DeserializeObject<ModelObject>(\n                    await parts[0].ReadAsStringAsync().ConfigureAwait(false)\n                );\n                Assert.Equal(model1.Property1, result0.Property1);\n                Assert.Equal(model1.Property2, result0.Property2);\n\n                Assert.Equal(\"theObjects\", parts[1].Headers.ContentDisposition.Name);\n                Assert.Null(parts[1].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/json\", parts[1].Headers.ContentType.MediaType);\n                var result1 = JsonConvert.DeserializeObject<ModelObject>(\n                    await parts[1].ReadAsStringAsync().ConfigureAwait(false)\n                );\n                Assert.Equal(model2.Property1, result1.Property1);\n                Assert.Equal(model2.Property2, result1.Property2);\n\n                Assert.Equal(\"anotherModel\", parts[2].Headers.ContentDisposition.Name);\n                Assert.Null(parts[2].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/json\", parts[2].Headers.ContentType.MediaType);\n                var result2 = JsonConvert.DeserializeObject<AnotherModel>(\n                    await parts[2].ReadAsStringAsync().ConfigureAwait(false)\n                );\n                Assert.Equal(2, result2.Foos.Length);\n                Assert.Equal(\"bar1\", result2.Foos[0]);\n                Assert.Equal(\"bar2\", result2.Foos[1]);\n\n                Assert.Equal(\"aFile\", parts[3].Headers.ContentDisposition.Name);\n                Assert.Equal(name, parts[3].Headers.ContentDisposition.FileName);\n                Assert.Null(parts[3].Headers.ContentType);\n                using (var str = await parts[3].ReadAsStreamAsync())\n                using (var src = GetTestFileStream(\"Test Files/Test.pdf\"))\n                {\n                    Assert.True(StreamsEqual(src, str));\n                }\n\n                Assert.Equal(\"anEnum\", parts[4].Headers.ContentDisposition.Name);\n                Assert.Null(parts[4].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/json\", parts[4].Headers.ContentType.MediaType);\n                var result4 = JsonConvert.DeserializeObject<AnEnum>(\n                    await parts[4].ReadAsStringAsync().ConfigureAwait(false)\n                );\n                Assert.Equal(AnEnum.Val2, result4);\n\n                Assert.Equal(\"aString\", parts[5].Headers.ContentDisposition.Name);\n                Assert.Null(parts[5].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"text/plain\", parts[5].Headers.ContentType.MediaType);\n                Assert.Equal(\"utf-8\", parts[5].Headers.ContentType.CharSet);\n                Assert.Equal(\"frob\", await parts[5].ReadAsStringAsync());\n\n                Assert.Equal(\"anInt\", parts[6].Headers.ContentDisposition.Name);\n                Assert.Null(parts[6].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/json\", parts[6].Headers.ContentType.MediaType);\n                var result6 = JsonConvert.DeserializeObject<int>(\n                    await parts[6].ReadAsStringAsync().ConfigureAwait(false)\n                );\n                Assert.Equal(42, result6);\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        try\n        {\n            using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n            using var outStream = File.OpenWrite(fileName);\n            await stream.CopyToAsync(outStream);\n            await outStream.FlushAsync();\n            outStream.Close();\n\n            var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n            var result = await fixture.UploadMixedObjects(\n                new[] { model1, model2 },\n                anotherModel,\n                new FileInfo(fileName),\n                AnEnum.Val2,\n                \"frob\",\n                42\n            );\n        }\n        finally\n        {\n            File.Delete(fileName);\n        }\n    }\n\n    [Fact]\n    public async Task MultipartUploadShouldWorkWithHttpContent()\n    {\n        var httpContent = new StringContent(\"some text\", Encoding.ASCII, \"application/custom\");\n        httpContent.Headers.ContentDisposition = new ContentDispositionHeaderValue(\"attachment\")\n        {\n            Name = \"myName\",\n            FileName = \"myFileName\",\n        };\n\n        var handler = new MockHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var parts = content.ToList();\n\n                Assert.Single(parts);\n\n                Assert.Equal(\"myName\", parts[0].Headers.ContentDisposition.Name);\n                Assert.Equal(\"myFileName\", parts[0].Headers.ContentDisposition.FileName);\n                Assert.Equal(\"application/custom\", parts[0].Headers.ContentType.MediaType);\n                var result0 = await parts[0].ReadAsStringAsync().ConfigureAwait(false);\n                Assert.Equal(\"some text\", result0);\n            }\n        };\n\n        var settings = new RefitSettings() { HttpMessageHandlerFactory = () => handler };\n\n        var fixture = RestService.For<IRunscopeApi>(BaseAddress, settings);\n        var result = await fixture.UploadHttpContent(httpContent);\n    }\n\n    [Fact]\n    public void MultiPartConstructorShouldThrowArgumentNullExceptionWhenNoFileName()\n    {\n        Assert.Throws<ArgumentNullException>(() =>\n        {\n            var byteArrayPart = new ByteArrayPart(Array.Empty<byte>(), null, \"application/pdf\");\n        });\n    }\n\n    [Fact]\n    public void FileInfoPartConstructorShouldThrowArgumentNullExceptionWhenNoFileInfo()\n    {\n        Assert.Throws<ArgumentNullException>(() =>\n        {\n            var fileInfoPart = new FileInfoPart(null, \"file.pdf\", \"application/pdf\");\n        });\n    }\n\n    internal static Stream GetTestFileStream(string relativeFilePath)\n    {\n        const char namespaceSeparator = '.';\n\n        // get calling assembly\n        var assembly = Assembly.GetCallingAssembly();\n\n        // compute resource name suffix\n        var relativeName =\n            \".\"\n            + relativeFilePath\n                .Replace('\\\\', namespaceSeparator)\n                .Replace('/', namespaceSeparator)\n                .Replace(' ', '_');\n\n        // get resource stream\n        var fullName = assembly\n            .GetManifestResourceNames()\n            .FirstOrDefault(name => name.EndsWith(relativeName, StringComparison.InvariantCulture));\n        if (fullName == null)\n        {\n            throw new Exception(\n                $\"Unable to find resource for path \\\"{relativeFilePath}\\\". Resource with name ending on \\\"{relativeName}\\\" was not found in assembly.\"\n            );\n        }\n\n        var stream = assembly.GetManifestResourceStream(fullName);\n        if (stream == null)\n        {\n            throw new Exception(\n                $\"Unable to find resource for path \\\"{relativeFilePath}\\\". Resource named \\\"{fullName}\\\" was not found in assembly.\"\n            );\n        }\n\n        return stream;\n    }\n\n    static bool StreamsEqual(Stream a, Stream b)\n    {\n        if (a == null && b == null)\n            return true;\n        if (a == null || b == null)\n        {\n            throw new ArgumentNullException(a == null ? \"a\" : \"b\");\n        }\n\n        if (a.Length < b.Length)\n            return false;\n        if (a.Length > b.Length)\n            return false;\n\n        for (var i = 0; i < a.Length; i++)\n        {\n            var aByte = a.ReadByte();\n            var bByte = b.ReadByte();\n            if (aByte != bByte)\n                return false;\n        }\n\n        return true;\n    }\n\n    class MockHttpMessageHandler : HttpMessageHandler\n    {\n        public Action<HttpRequestMessage> RequestAsserts { get; set; }\n        public Func<MultipartFormDataContent, Task> Asserts { get; set; }\n\n        protected override async Task<HttpResponseMessage> SendAsync(\n            HttpRequestMessage request,\n            CancellationToken cancellationToken\n        )\n        {\n            RequestAsserts?.Invoke(request);\n            var content = request.Content as MultipartFormDataContent;\n            Assert.IsType<MultipartFormDataContent>(content);\n            Assert.NotNull(Asserts);\n\n            await Asserts(content);\n\n            return new HttpResponseMessage(HttpStatusCode.OK);\n        }\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/MyQueryParams.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Text;\n\nnamespace Refit.Tests;\n\npublic record MySimpleQueryParams\n{\n    public string FirstName { get; set; }\n\n    [AliasAs(\"lName\")]\n    public string LastName { get; set; }\n}\n\npublic class MyComplexQueryParams\n{\n    public string FirstName { get; set; }\n\n    public string LastName { get; set; }\n\n    [AliasAs(\"Addr\")]\n    public Address Address { get; set; } = new Address();\n\n    public Dictionary<string, object> MetaData { get; set; } = new Dictionary<string, object>();\n\n    public List<object> Other { get; set; } = new List<object>();\n}\n\npublic record Address\n{\n    [AliasAs(\"Zip\")]\n    public int Postcode { get; set; }\n    public string Street { get; set; }\n}\n"
  },
  {
    "path": "Refit.Tests/NamespaceCollisionApi.cs",
    "content": "﻿using System.Threading.Tasks;\nusing CollisionB;\nusing Refit; // InterfaceStubGenerator looks for this\nusing SomeType = CollisionA.SomeType;\n\nnamespace Refit.Tests\n{\n    public interface INamespaceCollisionApi\n    {\n        [Get(\"/\")]\n        Task<SomeType> SomeRequest();\n    }\n\n    public static class NamespaceCollisionApi\n    {\n        public static INamespaceCollisionApi Create()\n        {\n            return RestService.For<INamespaceCollisionApi>(\"http://somewhere.com\");\n        }\n    }\n}\n\nnamespace CollisionA\n{\n    public class SomeType { }\n\n    public interface INamespaceCollisionApi\n    {\n        [Get(\"/\")]\n        Task<SomeType> SomeRequest();\n    }\n}\n\nnamespace CollisionB\n{\n    public class SomeType { }\n\n    public interface INamespaceCollisionApi\n    {\n        [Get(\"/\")]\n        Task<SomeType> SomeRequest();\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/NamespaceOverlapApi.cs",
    "content": "﻿using System;\nusing System.Threading.Tasks;\nusing Common.Helper;\n// InterfaceStubGenerator looks for this\nusing Refit;\nusing Refit.Tests.Common;\n\nnamespace Refit.Tests\n{\n    [SomeHelper]\n    public interface INamespaceOverlapApi\n    {\n        [Get(\"/\")]\n        Task<SomeOtherType> SomeRequest();\n    }\n\n    public static class NamespaceOverlapApi\n    {\n        public static INamespaceOverlapApi Create()\n        {\n            return RestService.For<INamespaceOverlapApi>(\"http://somewhere.com\");\n        }\n    }\n}\n\nnamespace Common.Helper\n{\n    public class SomeHelperAttribute : Attribute { }\n}\n\nnamespace Refit.Tests.Common\n{\n    public class SomeOtherType { }\n}\n"
  },
  {
    "path": "Refit.Tests/NamespaceWithGlobalAliasApi.cs",
    "content": "﻿using global::System.Threading.Tasks;\nusing Refit; // InterfaceStubGenerator looks for this\n\nnamespace Refit.Tests\n{\n    using global::Refit.Tests.SomeNamespace;\n\n    public interface NamespaceWithGlobalAliasApi\n    {\n        [Get(\"/\")]\n        Task<SomeType> SomeRequest();\n    }\n}\n\nnamespace Refit.Tests.SomeNamespace\n{\n    public class SomeType { }\n}\n"
  },
  {
    "path": "Refit.Tests/NullableReferenceTypes.cs",
    "content": "﻿#nullable enable\n\nusing System.Threading.Tasks;\nusing Refit; // InterfaceStubGenerator looks for this\n\nnamespace Refit.Tests;\n\ninterface IGenericWithResultService\n{\n    [Get(\"/\")]\n    Task<string?> Get();\n}\n\ninterface IGenericWithNullableValueService\n{\n    [Get(\"/\")]\n    Task<int?> Get();\n}\n\ninterface IGenericNullableReferenceService\n{\n    [Get(\"/\")]\n    Task<string>? Get();\n}\n\ninterface IGenericNullableValueService\n{\n    [Get(\"/\")]\n    ValueTask<int>? Get();\n}\n\ninterface IGenericNullableWithNullableReferenceService\n{\n    [Get(\"/\")]\n    Task<string?>? Get();\n}\n\ninterface IGenericNullableWithNullableValueService\n{\n    [Get(\"/\")]\n    ValueTask<int?>? Get();\n}\n\ninterface INullableReferenceService\n{\n    [Get(\"/\")]\n    string? Get();\n}\n\ninterface INullableValueService\n{\n    [Get(\"/\")]\n    int? Get();\n}\n\ninterface IReferenceAndValueParametersService\n{\n    [Get(\"/\")]\n    Task Get(string? reference, int? value);\n}\n\ninterface IGenericNullableReferenceParameterService\n{\n    [Get(\"/\")]\n    Task Get(System.Collections.Generic.List<string>? reference);\n}\n\ninterface IGenericWithNullableReferenceParameterService\n{\n    [Get(\"/\")]\n    Task Get(System.Collections.Generic.List<string?> reference);\n}\n\ninterface IGenericNullableWithNullableReferenceParameterService\n{\n    [Get(\"/\")]\n    Task Get(System.Collections.Generic.List<string?>? reference);\n}\n\ninterface ICustomNullableReferenceService\n{\n    [Get(\"/\")]\n    CustomReferenceType? Get();\n}\n\ninterface ICustomNullableValueService\n{\n    [Get(\"/\")]\n    CustomValueType? Get();\n}\n\ninterface ICustomReferenceAndValueParametersService\n{\n    [Get(\"/\")]\n    Task Get(CustomReferenceType? reference, CustomValueType? value);\n}\n\nclass CustomReferenceType { }\n\nclass CustomValueType { }\n"
  },
  {
    "path": "Refit.Tests/PartialInterfacesApi.First.cs",
    "content": "﻿using System.Threading.Tasks;\nusing Refit; // InterfaceStubGenerator looks for this\n\nnamespace Refit.Tests;\n\npublic partial interface PartialInterfacesApi\n{\n    [Get(\"/get?result=First\")]\n    Task<string> First();\n}\n"
  },
  {
    "path": "Refit.Tests/PartialInterfacesApi.Second.cs",
    "content": "﻿using System.Threading.Tasks;\nusing Refit; // InterfaceStubGenerator looks for this\n\nnamespace Refit.Tests;\n\npublic partial interface PartialInterfacesApi\n{\n    [Get(\"/get?result=Second\")]\n    Task<string> Second();\n}\n"
  },
  {
    "path": "Refit.Tests/ReducedUsingInsideNamespaceApi.cs",
    "content": "﻿using System.Threading.Tasks;\nusing Refit; // InterfaceStubGenerator looks for this\n\nnamespace Refit.Tests\n{\n    using ModelNamespace;\n\n    public interface IReducedUsingInsideNamespaceApi\n    {\n        [Get(\"/\")]\n        Task<SomeType> SomeRequest();\n    }\n}\n\nnamespace Refit.Tests.ModelNamespace\n{\n    public class SomeType { }\n}\n"
  },
  {
    "path": "Refit.Tests/Refit.Tests.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <Import Project=\"..\\Refit\\targets\\refit.props\" />\n\n  <PropertyGroup>\n    <TargetFrameworks>$(RefitTestTargets)</TargetFrameworks>\n    <Deterministic>false</Deterministic>\n    <!-- Some tests rely on CallerFilePath -->\n    <RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json</RestoreAdditionalProjectSources>\n    <NoWarn>$(NoWarn);CS1591;CA1819;CA2000;CA2007;CA1056;CA1707;CA1861;CA1515;xUnit1031</NoWarn>\n    <MockHttpVersion>6.0.0</MockHttpVersion>\n    <IsPackable>false</IsPackable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <EmbeddedResource Include=\"Test Files\\Test.pdf\" />\n  </ItemGroup>\n\n  <ItemGroup Condition=\"'$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net9.0' or '$(TargetFramework)' == 'net10.0'\">\n    <PackageReference Include=\"PublicApiGenerator\" Version=\"11.5.4\" />\n  </ItemGroup>\n  <ItemGroup Condition=\"$(TargetFramework.StartsWith('net10.0'))\">\n    <PackageReference Include=\"Microsoft.AspNetCore.WebUtilities\" Version=\"10.0.0-*\" />\n  </ItemGroup>\n  \n  <ItemGroup Condition=\"$(TargetFramework.StartsWith('net9.0'))\">\n    <PackageReference Include=\"Microsoft.AspNetCore.WebUtilities\" Version=\"9.0.*\" />\n  </ItemGroup>\n\n  <ItemGroup Condition=\"$(TargetFramework.StartsWith('net8.0'))\">\n    <PackageReference Include=\"Microsoft.AspNetCore.WebUtilities\" Version=\"8.0.*\" />\n  </ItemGroup>\n\n  <ItemGroup Condition=\"$(TargetFramework.StartsWith('net4'))\">\n    <PackageReference Include=\"Microsoft.AspNetCore.WebUtilities\" Version=\"2.3.0\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"coverlet.msbuild\" Version=\"8.0.1\" />\n    <PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"18.3.0\" />\n    <PackageReference Include=\"Moq\" Version=\"4.20.72\" />\n    <PackageReference Include=\"System.Formats.Asn1\" Version=\"9.0.3\" />\n    <PackageReference Include=\"xunit\" Version=\"2.9.3\" />\n    <PackageReference Include=\"xunit.runner.visualstudio\" Version=\"3.1.5\" />\n    <PackageReference Include=\"System.Reactive\" Version=\"6.1.0\" />\n    <PackageReference Include=\"Microsoft.CodeAnalysis.CSharp.Workspaces\" Version=\"4.11.0\" />\n    <PackageReference Include=\"Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing\" Version=\"1.1.3\" />\n    <PackageReference Include=\"RichardSzalay.MockHttp\" Version=\"$(MockHttpVersion)\" />\n    <PackageReference Include=\"Verify.DiffPlex\" Version=\"3.1.2\" />\n    <PackageReference Include=\"Verify.SourceGenerators\" Version=\"2.5.0\" />\n    <PackageReference Include=\"Verify.Xunit\" Version=\"31.12.5\" />\n    <ProjectReference Include=\"..\\Refit.HttpClientFactory\\Refit.HttpClientFactory.csproj\" />\n    <ProjectReference Include=\"..\\Refit.Newtonsoft.Json\\Refit.Newtonsoft.Json.csproj\" />\n    <ProjectReference Include=\"..\\Refit.Xml\\Refit.Xml.csproj\" />\n    <ProjectReference Include=\"..\\InterfaceStubGenerator.Roslyn38\\InterfaceStubGenerator.Roslyn38.csproj\" OutputItemType=\"Analyzer\" ReferenceOutputAssembly=\"true\" />\n    <ProjectReference Include=\"..\\InterfaceStubGenerator.Roslyn41\\InterfaceStubGenerator.Roslyn41.csproj\" />\n    <ProjectReference Include=\"..\\Refit\\Refit.csproj\" />\n  </ItemGroup>\n\n  <Import Project=\"..\\Refit\\targets\\refit.targets\" />\n\n  <ItemGroup>\n    <None Include=\"..\\Refit.Tests\\_snapshots\\**\">\n      <Link>%(RecursiveDir)\\resources\\%(Filename)%(Extension)</Link>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </None>\n    <Using Include=\"Xunit\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <Folder Include=\"_snapshots\\\" />\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "Refit.Tests/RefitSettings.cs",
    "content": "﻿using Xunit;\n\nnamespace Refit.Tests;\n\npublic class RefitSettingsTests\n{\n    [Fact]\n    public void Can_CreateRefitSettings_WithoutException()\n    {\n        var contentSerializer = new NewtonsoftJsonContentSerializer();\n        var urlParameterFormatter = new DefaultUrlParameterFormatter();\n        var urlParameterKeyFormatter = new CamelCaseUrlParameterKeyFormatter();\n        var formUrlEncodedParameterFormatter = new DefaultFormUrlEncodedParameterFormatter();\n\n        var exception = Record.Exception(() => new RefitSettings());\n        Assert.Null(exception);\n\n        exception = Record.Exception(() => new RefitSettings(contentSerializer));\n        Assert.Null(exception);\n\n        exception = Record.Exception(\n            () => new RefitSettings(contentSerializer, urlParameterFormatter)\n        );\n        Assert.Null(exception);\n\n        exception = Record.Exception(\n            () =>\n                new RefitSettings(\n                    contentSerializer,\n                    urlParameterFormatter,\n                    formUrlEncodedParameterFormatter\n                )\n        );\n        Assert.Null(exception);\n\n        exception = Record.Exception(\n            () =>\n                new RefitSettings(\n                    contentSerializer,\n                    urlParameterFormatter,\n                    formUrlEncodedParameterFormatter,\n                    urlParameterKeyFormatter\n                )\n        );\n        Assert.Null(exception);\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/ReflectionTests.cs",
    "content": "﻿using System.Net.Http;\nusing System.Reflection;\nusing RichardSzalay.MockHttp;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic interface IBasicApi\n{\n    [Get(\"/{value}\")]\n    Task<string> GetParam(string value);\n\n    [Get(\"/{value}\")]\n    Task<string> GetDerivedParam(BaseRecord value);\n\n    [Get(\"/{value.PropValue}\")]\n    Task<string> GetPropertyParam(MyParams value);\n\n    [Get(\"/{value}\")]\n    Task<string> GetGenericParam<T>(T value);\n\n    [Get(\"/\")]\n    Task<string> GetQuery(string queryKey);\n\n    [Get(\"/\")]\n    Task<string> GetGenericQuery<T>(T queryKey);\n\n    [Get(\"/\")]\n    Task<string> GetPropertyQuery(BaseRecord queryKey);\n\n    [Get(\"/\")]\n    Task<string> GetEnumerableQuery(IEnumerable<string> enums);\n\n    [Get(\"/\")]\n    Task<string> GetEnumerablePropertyQuery(MyEnumerableParams enums);\n\n    [Get(\"/\")]\n    Task<string> GetDictionaryQuery(IDictionary<string, object> dict);\n}\n\npublic record DerivedRecordWithProperty(string Name) : BaseRecord(\"value\");\n\npublic record DerivedRecord(string Value) : BaseRecord(Value);\n\npublic record BaseRecord(string Value);\n\npublic record MyParams(string PropValue);\n\npublic record MyEnumerableParams(int[] Enumerable);\n\npublic class TestUrlFormatter : IUrlParameterFormatter\n{\n    private readonly ICustomAttributeProvider[] expectedAttributeProviders;\n    private readonly Type[] expectedTypes;\n    private int index;\n\n    public TestUrlFormatter(ICustomAttributeProvider expectedAttributeProvider, Type expectedType)\n    {\n        expectedAttributeProviders = [expectedAttributeProvider];\n        expectedTypes = [expectedType];\n    }\n\n    public TestUrlFormatter(\n        ICustomAttributeProvider[] expectedAttributeProviders,\n        Type[] expectedTypes\n    )\n    {\n        this.expectedAttributeProviders = expectedAttributeProviders;\n        this.expectedTypes = expectedTypes;\n    }\n\n    public string Format(object value, ICustomAttributeProvider attributeProvider, Type type)\n    {\n        Assert.Equal(expectedAttributeProviders[index], attributeProvider);\n        Assert.Equal(expectedTypes[index], type);\n        index++;\n        return value!.ToString();\n    }\n\n    public void AssertNoOutstandingAssertions()\n    {\n        Assert.Equal(expectedAttributeProviders.Length, index);\n        Assert.Equal(expectedTypes.Length, index);\n    }\n}\n\npublic sealed class ReflectionTests : IDisposable\n{\n    readonly MockHttpMessageHandler mockHandler = new();\n\n    [Fact]\n    public async Task UrlParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/bar\")\n            .Respond(\"application/json\", nameof(IBasicApi.GetParam));\n\n        var methodInfo = typeof(IBasicApi).GetMethod(nameof(IBasicApi.GetParam))!;\n        var parameterInfo = methodInfo.GetParameters()[0];\n\n        var formatter = new TestUrlFormatter(parameterInfo, typeof(string));\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        await service.GetParam(\"bar\");\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    [Fact]\n    public async Task DerivedUrlParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/DerivedRecord%20%7B%20Value%20%3D%20Derived%20%7D\")\n            .Respond(\"application/json\", nameof(IBasicApi.GetDerivedParam));\n\n        var methodInfo = typeof(IBasicApi).GetMethod(nameof(IBasicApi.GetDerivedParam))!;\n        var parameterInfo = methodInfo.GetParameters()[0];\n\n        var formatter = new TestUrlFormatter(parameterInfo, typeof(BaseRecord));\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        await service.GetDerivedParam(new DerivedRecord(\"Derived\"));\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    [Fact]\n    public async Task PropertyParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/propVal\")\n            .Respond(\"application/json\", nameof(IBasicApi.GetPropertyParam));\n\n        var propertyInfo = typeof(MyParams).GetProperties()[0];\n\n        var formatter = new TestUrlFormatter(propertyInfo, typeof(string));\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        await service.GetPropertyParam(new MyParams(\"propVal\"));\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    [Fact]\n    public async Task GenericParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/genericVal\")\n            .Respond(\"application/json\", nameof(IBasicApi.GetGenericParam));\n\n        var methodInfo = typeof(IBasicApi).GetMethod(nameof(IBasicApi.GetGenericParam))!;\n        var stringMethod = methodInfo.MakeGenericMethod(typeof(string));\n        var parameterInfo = stringMethod.GetParameters()[0];\n\n        var formatter = new TestUrlFormatter(parameterInfo, typeof(string));\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        await service.GetGenericParam(\"genericVal\");\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    [Fact]\n    public async Task QueryParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/\")\n            .WithExactQueryString(\n                new[] { new KeyValuePair<string, string>(\"queryKey\", \"queryValue\"), }\n            )\n            .Respond(\"application/json\", nameof(IBasicApi.GetQuery));\n\n        var methodInfo = typeof(IBasicApi).GetMethod(nameof(IBasicApi.GetQuery))!;\n        var parameterInfo = methodInfo.GetParameters()[0];\n\n        var formatter = new TestUrlFormatter(parameterInfo, typeof(string));\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        await service.GetQuery(\"queryValue\");\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    [Fact]\n    public async Task QueryPropertyParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/\")\n            .WithExactQueryString(new[] { new KeyValuePair<string, string>(\"Value\", \"queryVal\"), })\n            .Respond(\"application/json\", nameof(IBasicApi.GetPropertyQuery));\n\n        var methodInfo = typeof(IBasicApi).GetMethod(nameof(IBasicApi.GetPropertyQuery))!;\n        var parameterInfo = methodInfo.GetParameters()[0];\n\n        var formatter = new TestUrlFormatter(parameterInfo, typeof(BaseRecord));\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        await service.GetPropertyQuery(new BaseRecord(\"queryVal\"));\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    [Fact]\n    public async Task DerivedQueryPropertyParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/\")\n            .WithExactQueryString(\n                new[]\n                {\n                    new KeyValuePair<string, string>(\"Name\", \"queryName\"),\n                    new KeyValuePair<string, string>(\"Value\", \"value\"),\n                }\n            )\n            .Respond(\"application/json\", nameof(IBasicApi.GetPropertyQuery));\n\n        var methodInfo = typeof(IBasicApi).GetMethod(nameof(IBasicApi.GetPropertyQuery))!;\n        var parameterInfo = methodInfo.GetParameters()[0];\n\n        var formatter = new TestUrlFormatter(\n            [parameterInfo, parameterInfo],\n            [typeof(BaseRecord), typeof(BaseRecord)]\n        );\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        await service.GetPropertyQuery(new DerivedRecordWithProperty(\"queryName\"));\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    [Fact]\n    public async Task GenericQueryParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/\")\n            .WithExactQueryString(\n                new[] { new KeyValuePair<string, string>(\"queryKey\", \"queryValue\"), }\n            )\n            .Respond(\"application/json\", nameof(IBasicApi.GetGenericQuery));\n\n        var methodInfo = typeof(IBasicApi).GetMethod(nameof(IBasicApi.GetGenericQuery))!;\n        var stringMethod = methodInfo.MakeGenericMethod(typeof(string));\n        var parameterInfo = stringMethod.GetParameters()[0];\n\n        var formatter = new TestUrlFormatter(parameterInfo, typeof(string));\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        await service.GetGenericQuery(\"queryValue\");\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    [Fact]\n    public async Task EnumerableQueryParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/\")\n            .WithExactQueryString(new[] { new KeyValuePair<string, string>(\"enums\", \"k0,k1\"), })\n            .Respond(\"application/json\", nameof(IBasicApi.GetEnumerableQuery));\n\n        var methodInfo = typeof(IBasicApi).GetMethod(nameof(IBasicApi.GetEnumerableQuery))!;\n        var parameterInfo = methodInfo.GetParameters()[0];\n\n        var formatter = new TestUrlFormatter(\n            [parameterInfo, parameterInfo],\n            [typeof(IEnumerable<string>), typeof(IEnumerable<string>)]\n        );\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        await service.GetEnumerableQuery([\"k0\", \"k1\"]);\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    [Fact]\n    public async Task EnumerablePropertyQueryParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/\")\n            .WithExactQueryString(new[] { new KeyValuePair<string, string>(\"Enumerable\", \"0,1\"), })\n            .Respond(\"application/json\", nameof(IBasicApi.GetEnumerablePropertyQuery));\n\n        var methodInfo = typeof(IBasicApi).GetMethod(nameof(IBasicApi.GetEnumerablePropertyQuery))!;\n        var parameterInfo = methodInfo.GetParameters()[0];\n        var propertyInfo = typeof(MyEnumerableParams).GetProperties()[0];\n\n        var formatter = new TestUrlFormatter(\n            [propertyInfo, propertyInfo, parameterInfo],\n            [typeof(int[]), typeof(int[]), typeof(MyEnumerableParams)]\n        );\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        await service.GetEnumerablePropertyQuery(new MyEnumerableParams([0, 1]));\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    [Fact]\n    public async Task QueryDictionaryParameterShouldBeExpectedReflection()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"https://foo/\")\n            .WithExactQueryString(\n                new[]\n                {\n                    new KeyValuePair<string, string>(\"key0\", \"1\"),\n                    new KeyValuePair<string, string>(\"key1\", \"2\"),\n                }\n            )\n            .Respond(\"application/json\", nameof(IBasicApi.GetDictionaryQuery));\n\n        var methodInfo = typeof(IBasicApi).GetMethod(nameof(IBasicApi.GetDictionaryQuery))!;\n        var parameterInfo = methodInfo.GetParameters()[0];\n\n        var formatter = new TestUrlFormatter(\n            [typeof(string), typeof(string), parameterInfo, parameterInfo],\n            [\n                typeof(string),\n                typeof(string),\n                typeof(IDictionary<string, object>),\n                typeof(IDictionary<string, object>)\n            ]\n        );\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            UrlParameterFormatter = formatter\n        };\n        var service = RestService.For<IBasicApi>(\"https://foo\", settings);\n\n        var dict = new Dictionary<string, object> { { \"key0\", 1 }, { \"key1\", 2 } };\n        await service.GetDictionaryQuery(dict);\n        formatter.AssertNoOutstandingAssertions();\n    }\n\n    public void Dispose()\n    {\n        mockHandler?.Dispose();\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/RequestBuilder.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Reflection;\nusing System.Runtime.Serialization;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.AspNetCore.WebUtilities;\nusing Xunit;\n\nnamespace Refit.Tests\n{\n    [Headers(\"User-Agent: RefitTestClient\", \"Api-Version: 1\")]\n    public interface IRestMethodInfoTests\n    {\n        [Get(\"@)!@_!($_!@($\\\\\\\\|||::::\")]\n        Task<string> GarbagePath();\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffMissingParameters();\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuff(int id);\n\n        [Get(\"/foo/bar/{id}?param1={id}&param2={id}\")]\n        Task<string> FetchSomeStuffWithTheSameId(int id);\n\n        [Get(\"/foo/bar?param=first {id} and second {id}\")]\n        Task<string> FetchSomeStuffWithTheIdInAParameterMultipleTimes(int id);\n\n        [Get(\"/foo/bar/{**path}/{id}\")]\n        Task<string> FetchSomeStuffWithRoundTrippingParam(string path, int id);\n\n        [Get(\"/foo/bar/{**path}/{id}\")]\n        Task<string> FetchSomeStuffWithNonStringRoundTrippingParam(int path, int id);\n\n        [Get(\"/foo/bar/{id}?baz=bamf\")]\n        Task<string> FetchSomeStuffWithHardcodedQueryParam(int id);\n\n        [Get(\"/foo/bar/{id}?baz=bamf\")]\n        Task<string> FetchSomeStuffWithQueryParam(int id, string search);\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithAlias([AliasAs(\"id\")] int anId);\n\n        [Get(\"/foo/bar/{width}x{height}\")]\n        Task<string> FetchAnImage(int width, int height);\n\n        [Get(\"/foo/bar/{id}\")]\n        IObservable<string> FetchSomeStuffWithBody(\n            [AliasAs(\"id\")] int anId,\n            [Body] Dictionary<int, string> theData\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        IObservable<string> PostSomeUrlEncodedStuff(\n            [AliasAs(\"id\")] int anId,\n            [Body(BodySerializationMethod.UrlEncoded)] Dictionary<string, string> theData\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        IObservable<string> FetchSomeStuffWithAuthorizationSchemeSpecified(\n            [AliasAs(\"id\")] int anId,\n            [Authorize(\"Bearer\")] string token\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        [Headers(\"Api-Version: 2\", \"Accept: application/json\")]\n        Task<string> FetchSomeStuffWithHardcodedHeaders(int id);\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithDynamicHeader(\n            int id,\n            [Header(\"Authorization\")] string authorization\n        );\n\n        [Get(\"/foo\")]\n        Task<string> FetchSomeStuffWithDynamicHeaderQueryParamAndArrayQueryParam(\n            [Header(\"Authorization\")] string authorization,\n            int id,\n            [Query(CollectionFormat.Multi)] string[] someArray,\n            [Property(\"SomeProperty\")] object someValue\n        );\n\n        #region [HeaderCollection] interface methods\n\n        [Get(\"/foo/bar/{id}\")]\n        [Headers(\n            \"Authorization: SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\",\n            \"Accept: application/json\"\n        )]\n        Task<string> FetchSomeStuffWithDynamicHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Put(\"/foo/bar/{id}\")]\n        Task<string> PutSomeStuffWithCustomHeaderCollection(\n            int id,\n            [Body] object body,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithCustomHeaderCollection(\n            int id,\n            [Body] object body,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Patch(\"/foo/bar/{id}\")]\n        Task<string> PatchSomeStuffWithCustomHeaderCollection(\n            int id,\n            [Body] object body,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Put(\"/foo/bar/{id}\")]\n        Task<string> PutSomeStuffWithoutBodyAndCustomHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithoutBodyAndCustomHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Patch(\"/foo/bar/{id}\")]\n        Task<string> PatchSomeStuffWithoutBodyAndCustomHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Put(\"/foo/bar/{id}\")]\n        Task<string> PutSomeStuffWithInferredBodyAndWithDynamicHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers,\n            object inferredBody\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithInferredBodyAndWithDynamicHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers,\n            object inferredBody\n        );\n\n        [Patch(\"/foo/bar/{id}\")]\n        Task<string> PatchSomeStuffWithInferredBodyAndWithDynamicHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers,\n            object inferredBody\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithDynamicHeaderCollectionAndAuthorize(\n            int id,\n            [Authorize] string value,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithDynamicHeaderCollectionAndAuthorize(\n            int id,\n            [Authorize] string value,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithDynamicHeaderCollectionAndDynamicHeader(\n            int id,\n            [Header(\"Authorization\")] string value,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithDynamicHeaderCollectionAndDynamicHeader(\n            int id,\n            [Header(\"Authorization\")] string value,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithDynamicHeaderCollectionAndDynamicHeaderOrderFlipped(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers,\n            [Header(\"Authorization\")] string value\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithPathMemberInCustomHeaderAndDynamicHeaderCollection(\n            [Header(\"X-PathMember\")] int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithPathMemberInCustomHeaderAndDynamicHeaderCollection(\n            [Header(\"X-PathMember\")] int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers,\n            int baz\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers,\n            int baz\n        );\n\n        [Get(\"/foo/bar\")]\n        Task<string> FetchSomeStuffWithDuplicateHeaderCollection(\n            [HeaderCollection] IDictionary<string, string> headers,\n            [HeaderCollection] IDictionary<string, string> headers2\n        );\n\n        [Post(\"/foo/bar\")]\n        Task<string> PostSomeStuffWithDuplicateHeaderCollection(\n            [HeaderCollection] IDictionary<string, string> headers,\n            [HeaderCollection] IDictionary<string, string> headers2\n        );\n\n        [Get(\"/foo\")]\n        Task<string> FetchSomeStuffWithHeaderCollectionQueryParamAndArrayQueryParam(\n            [HeaderCollection] IDictionary<string, string> headers,\n            int id,\n            [Query(CollectionFormat.Multi)] string[] someArray,\n            [Property(\"SomeProperty\")] object someValue\n        );\n\n        [Post(\"/foo\")]\n        Task<string> PostSomeStuffWithHeaderCollectionQueryParamAndArrayQueryParam(\n            [HeaderCollection] IDictionary<string, string> headers,\n            int id,\n            [Query(CollectionFormat.Multi)] string[] someArray,\n            [Property(\"SomeProperty\")] object someValue\n        );\n\n        [Get(\"/foo\")]\n        Task<string> FetchSomeStuffWithHeaderCollectionOfUnsupportedType(\n            [HeaderCollection] string headers\n        );\n\n        [Post(\"/foo\")]\n        Task<string> PostSomeStuffWithHeaderCollectionOfUnsupportedType(\n            [HeaderCollection] string headers\n        );\n\n        #endregion\n\n        #region [Property] interface methods\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someValue\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithDynamicRequestProperty(\n            int id,\n            [Body] object body,\n            [Property(\"SomeProperty\")] object someValue\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithDynamicRequestProperties(\n            int id,\n            [Body] object body,\n            [Property(\"SomeProperty\")] object someValue,\n            [Property(\"SomeOtherProperty\")] object someOtherValue\n        );\n\n        [Put(\"/foo/bar/{id}\")]\n        Task<string> PutSomeStuffWithoutBodyAndWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someValue\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithoutBodyAndWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someValue\n        );\n\n        [Patch(\"/foo/bar/{id}\")]\n        Task<string> PatchSomeStuffWithoutBodyAndWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someValue\n        );\n\n        [Put(\"/foo/bar/{id}\")]\n        Task<string> PutSomeStuffWithInferredBodyAndWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someValue,\n            object inferredBody\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithInferredBodyAndWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someValue,\n            object inferredBody\n        );\n\n        [Patch(\"/foo/bar/{id}\")]\n        Task<string> PatchSomeStuffWithInferredBodyAndWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someValue,\n            object inferredBody\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithDynamicRequestPropertyWithDuplicateKey(\n            int id,\n            [Property(\"SomeProperty\")] object someValue1,\n            [Property(\"SomeProperty\")] object someValue2\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithDynamicRequestPropertyWithoutKey(\n            int id,\n            [Property] object someValue,\n            [Property(\"\")] object someOtherValue\n        );\n\n        #endregion\n\n        [Post(\"/foo/{id}\")]\n        Task<bool> OhYeahValueTypes(int id, [Body(buffered: true)] int whatever);\n\n        [Post(\"/foo/{id}\")]\n        Task<bool> OhYeahValueTypesUnbuffered(int id, [Body(buffered: false)] int whatever);\n\n        [Post(\"/foo/{id}\")]\n        Task<bool> PullStreamMethod(int id, [Body(buffered: true)] Dictionary<int, string> theData);\n\n        [Post(\"/foo/{id}\")]\n        Task VoidPost(int id);\n\n        [Post(\"/foo/{id}\")]\n        string AsyncOnlyBuddy(int id);\n\n        [Patch(\"/foo/{id}\")]\n        IObservable<string> PatchSomething(int id, [Body] string someAttribute);\n\n        [Options(\"/foo/{id}\")]\n        Task<string> SendOptions(int id, [Body] string someAttribute);\n\n        [Post(\"/foo/{id}\")]\n        Task<ApiResponse<bool>> PostReturnsApiResponse(int id);\n\n        [Post(\"/foo/{id}\")]\n        Task<bool> PostReturnsNonApiResponse(int id);\n\n        [Post(\"/foo\")]\n        Task PostWithBodyDetected(Dictionary<int, string> theData);\n\n        [Get(\"/foo\")]\n        Task GetWithBodyDetected(Dictionary<int, string> theData);\n\n        [Put(\"/foo\")]\n        Task PutWithBodyDetected(Dictionary<int, string> theData);\n\n        [Patch(\"/foo\")]\n        Task PatchWithBodyDetected(Dictionary<int, string> theData);\n\n        [Post(\"/foo\")]\n        Task TooManyComplexTypes(Dictionary<int, string> theData, Dictionary<int, string> theData1);\n\n        [Post(\"/foo\")]\n        Task ManyComplexTypes(\n            Dictionary<int, string> theData,\n            [Body] Dictionary<int, string> theData1\n        );\n\n        [Post(\"/foo\")]\n        Task PostWithDictionaryQuery([Query] Dictionary<int, string> theData);\n\n        [Post(\"/foo\")]\n        Task PostWithComplexTypeQuery([Query] ComplexQueryObject queryParams);\n\n        [Post(\"/foo\")]\n        Task ImpliedComplexQueryType(\n            ComplexQueryObject queryParams,\n            [Body] Dictionary<int, string> theData1\n        );\n\n        [Get(\"/api/{id}\")]\n        Task MultipleQueryAttributes(\n            int id,\n            [Query] string text = null,\n            [Query] int? optionalId = null,\n            [Query(CollectionFormat = CollectionFormat.Multi)] string[] filters = null\n        );\n\n        [Get(\"/api/{id}\")]\n        Task NullableValues(\n            int id,\n            string text = null,\n            int? optionalId = null,\n            [Query(CollectionFormat = CollectionFormat.Multi)] string[] filters = null\n        );\n\n        [Get(\"/api/{id}\")]\n        Task IEnumerableThrowingError([Query(CollectionFormat.Multi)] IEnumerable<string> values);\n\n        [Get(\"/foo\")]\n        List<string> InvalidGenericReturnType();\n    }\n\n    public enum TestEnum\n    {\n        A,\n        B,\n        C\n    }\n\n    public class ComplexQueryObject\n    {\n        [AliasAs(\"test-query-alias\")]\n        public string TestAlias1 { get; set; }\n\n        public string TestAlias2 { get; set; }\n\n        public IEnumerable<int> TestCollection { get; set; }\n\n        [AliasAs(\"test-dictionary-alias\")]\n        public Dictionary<TestEnum, string> TestAliasedDictionary { get; set; }\n\n        public Dictionary<TestEnum, string> TestDictionary { get; set; }\n\n        [AliasAs(\"listOfEnumMulti\")]\n        [Query(CollectionFormat.Multi)]\n        public List<TestEnum> EnumCollectionMulti { get; set; }\n\n        [Query(CollectionFormat.Multi)]\n        public List<object> ObjectCollectionMulti { get; set; }\n\n        [Query(CollectionFormat.Csv)]\n        public List<TestEnum> EnumCollectionCsv { get; set; }\n\n        [AliasAs(\"listOfObjectsCsv\")]\n        [Query(CollectionFormat.Csv)]\n        public List<object> ObjectCollectionCcv { get; set; }\n\n        [IgnoreDataMember]\n        public string InternalUseOnlyIgnoredByDataMember { get; set; }\n\n        [System.Text.Json.Serialization.JsonIgnore]\n        public string InternalUseOnlyIgnoredBySystemTextJson { get; set; }\n    }\n\n    public class RestMethodInfoTests\n    {\n        [Fact]\n        public void TooManyComplexTypesThrows()\n        {\n            var input = typeof(IRestMethodInfoTests);\n\n            Assert.Throws<ArgumentException>(() =>\n            {\n                var fixture = new RestMethodInfoInternal(\n                    input,\n                    input\n                        .GetMethods()\n                        .First(x => x.Name == nameof(IRestMethodInfoTests.TooManyComplexTypes))\n                );\n            });\n        }\n\n        [Fact]\n        public void ManyComplexTypes()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.ManyComplexTypes))\n            );\n\n            Assert.Single(fixture.QueryParameterMap);\n            Assert.NotNull(fixture.BodyParameterInfo);\n            Assert.Equal(1, fixture.BodyParameterInfo.Item3);\n        }\n\n        [Theory]\n        [InlineData(nameof(IRestMethodInfoTests.PutWithBodyDetected))]\n        [InlineData(nameof(IRestMethodInfoTests.PostWithBodyDetected))]\n        [InlineData(nameof(IRestMethodInfoTests.PatchWithBodyDetected))]\n        public void DefaultBodyParameterDetected(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.NotNull(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void DefaultBodyParameterNotDetectedForGet()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.GetWithBodyDetected))\n            );\n\n            Assert.Single(fixture.QueryParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void PostWithDictionaryQueryParameter()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.PostWithDictionaryQuery))\n            );\n\n            Assert.Single(fixture.QueryParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void PostWithObjectQueryParameterHasSingleQueryParameterValue()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixtureParams = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.PostWithComplexTypeQuery))\n            );\n\n            Assert.Single(fixtureParams.QueryParameterMap);\n            Assert.Equal(\"queryParams\", fixtureParams.QueryParameterMap[0]);\n            Assert.Null(fixtureParams.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void PostWithObjectQueryParameterHasCorrectQuerystring()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.PostWithComplexTypeQuery)\n            );\n\n            var param = new ComplexQueryObject { TestAlias1 = \"one\", TestAlias2 = \"two\" };\n\n            var output = factory(new object[] { param });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/foo?test-query-alias=one&TestAlias2=two\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void PostWithObjectQueryParameterSkipsIgnoredProperties()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.PostWithComplexTypeQuery)\n            );\n\n            var param = new ComplexQueryObject\n            {\n                TestAlias1 = \"one\",\n                InternalUseOnlyIgnoredByDataMember = \"nope\",\n                InternalUseOnlyIgnoredBySystemTextJson = \"nope\"\n            };\n\n            var output = factory(new object[] { param });\n\n            Assert.Equal(\"/foo?test-query-alias=one\", output.RequestUri.PathAndQuery);\n        }\n\n        [Fact]\n        public void PostWithObjectQueryParameterWithEnumList_Multi()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.PostWithComplexTypeQuery)\n            );\n\n            var param = new ComplexQueryObject\n            {\n                EnumCollectionMulti = new List<TestEnum> { TestEnum.A, TestEnum.B }\n            };\n\n            var output = factory(new object[] { param });\n\n            Assert.Equal(\n                \"/foo?listOfEnumMulti=A&listOfEnumMulti=B\",\n                output.RequestUri.PathAndQuery\n            );\n        }\n\n        [Fact]\n        public void PostWithObjectQueryParameterWithObjectListWithProvidedEnumValues_Multi()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.PostWithComplexTypeQuery)\n            );\n\n            var param = new ComplexQueryObject\n            {\n                ObjectCollectionMulti = new List<object> { TestEnum.A, TestEnum.B }\n            };\n\n            var output = factory(new object[] { param });\n\n            Assert.Equal(\n                \"/foo?ObjectCollectionMulti=A&ObjectCollectionMulti=B\",\n                output.RequestUri.PathAndQuery\n            );\n        }\n\n        [Fact]\n        public void PostWithObjectQueryParameterWithEnumList_Csv()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.PostWithComplexTypeQuery)\n            );\n\n            var param = new ComplexQueryObject\n            {\n                EnumCollectionCsv = new List<TestEnum> { TestEnum.A, TestEnum.B }\n            };\n\n            var output = factory(new object[] { param });\n\n            Assert.Equal(\"/foo?EnumCollectionCsv=A%2CB\", output.RequestUri.PathAndQuery);\n        }\n\n        [Fact]\n        public void PostWithObjectQueryParameterWithObjectListWithProvidedEnumValues_Csv()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.PostWithComplexTypeQuery)\n            );\n\n            var param = new ComplexQueryObject\n            {\n                ObjectCollectionCcv = new List<object> { TestEnum.A, TestEnum.B }\n            };\n\n            var output = factory(new object[] { param });\n\n            Assert.Equal(\"/foo?listOfObjectsCsv=A%2CB\", output.RequestUri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ObjectQueryParameterWithInnerCollectionHasCorrectQuerystring()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.ComplexTypeQueryWithInnerCollection)\n            );\n\n            var param = new ComplexQueryObject { TestCollection = new[] { 1, 2, 3 } };\n            var output = factory(new object[] { param });\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/foo?TestCollection=1%2C2%2C3\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void MultipleQueryAttributesWithNulls()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixtureParams = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.MultipleQueryAttributes))\n            );\n\n            Assert.Equal(3, fixtureParams.QueryParameterMap.Count);\n        }\n\n        [Fact]\n        public void GarbagePathsShouldThrow()\n        {\n            var shouldDie = true;\n\n            try\n            {\n                var input = typeof(IRestMethodInfoTests);\n                var fixture = new RestMethodInfoInternal(\n                    input,\n                    input\n                        .GetMethods()\n                        .First(x => x.Name == nameof(IRestMethodInfoTests.GarbagePath))\n                );\n            }\n            catch (ArgumentException)\n            {\n                shouldDie = false;\n            }\n\n            Assert.False(shouldDie);\n        }\n\n        [Fact]\n        public void MissingParametersShouldBlowUp()\n        {\n            var shouldDie = true;\n\n            try\n            {\n                var input = typeof(IRestMethodInfoTests);\n                var fixture = new RestMethodInfoInternal(\n                    input,\n                    input\n                        .GetMethods()\n                        .First(\n                            x =>\n                                x.Name\n                                == nameof(IRestMethodInfoTests.FetchSomeStuffMissingParameters)\n                        )\n                );\n            }\n            catch (ArgumentException)\n            {\n                shouldDie = false;\n            }\n\n            Assert.False(shouldDie);\n        }\n\n        [Fact]\n        public void ParameterMappingSmokeTest()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == nameof(IRestMethodInfoTests.FetchSomeStuff))\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void ParameterMappingWithTheSameIdInAFewPlaces()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.FetchSomeStuffWithTheSameId))\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void ParameterMappingWithTheSameIdInTheQueryParameter()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(\n                                IRestMethodInfoTests.FetchSomeStuffWithTheIdInAParameterMultipleTimes\n                            )\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void ParameterMappingWithRoundTrippingSmokeTest()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(IRestMethodInfoTests.FetchSomeStuffWithRoundTrippingParam)\n                    )\n            );\n            Assert.Equal(\"path\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.RoundTripping, fixture.ParameterMap[0].Type);\n            Assert.Equal(\"id\", fixture.ParameterMap[1].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[1].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void ParameterMappingWithNonStringRoundTrippingShouldThrow()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            Assert.Throws<ArgumentException>(() =>\n            {\n                var fixture = new RestMethodInfoInternal(\n                    input,\n                    input\n                        .GetMethods()\n                        .First(\n                            x =>\n                                x.Name\n                                == nameof(\n                                    IRestMethodInfoTests.FetchSomeStuffWithNonStringRoundTrippingParam\n                                )\n                        )\n                );\n            });\n        }\n\n        [Fact]\n        public void ParameterMappingWithQuerySmokeTest()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.FetchSomeStuffWithQueryParam))\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Equal(\"search\", fixture.QueryParameterMap[1]);\n            Assert.Null(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void ParameterMappingWithHardcodedQuerySmokeTest()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(IRestMethodInfoTests.FetchSomeStuffWithHardcodedQueryParam)\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void AliasMappingShouldWork()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.FetchSomeStuffWithAlias))\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void MultipleParametersPerSegmentShouldWork()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == nameof(IRestMethodInfoTests.FetchAnImage))\n            );\n            Assert.Equal(\"width\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Equal(\"height\", fixture.ParameterMap[1].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[1].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n        }\n\n        [Fact]\n        public void FindTheBodyParameter()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.FetchSomeStuffWithBody))\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n\n            Assert.NotNull(fixture.BodyParameterInfo);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Equal(1, fixture.BodyParameterInfo.Item3);\n        }\n\n        [Fact]\n        public void FindTheAuthorizeParameter()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(\n                                IRestMethodInfoTests.FetchSomeStuffWithAuthorizationSchemeSpecified\n                            )\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n\n            Assert.NotNull(fixture.AuthorizeParameterInfo);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Equal(1, fixture.AuthorizeParameterInfo.Item2);\n        }\n\n        [Fact]\n        public void AllowUrlEncodedContent()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.PostSomeUrlEncodedStuff))\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n\n            Assert.NotNull(fixture.BodyParameterInfo);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Equal(BodySerializationMethod.UrlEncoded, fixture.BodyParameterInfo.Item1);\n        }\n\n        [Fact]\n        public void HardcodedHeadersShouldWork()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(IRestMethodInfoTests.FetchSomeStuffWithHardcodedHeaders)\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.True(\n                fixture.Headers.ContainsKey(\"Api-Version\"),\n                \"Headers include Api-Version header\"\n            );\n            Assert.Equal(\"2\", fixture.Headers[\"Api-Version\"]);\n            Assert.True(\n                fixture.Headers.ContainsKey(\"User-Agent\"),\n                \"Headers include User-Agent header\"\n            );\n            Assert.Equal(\"RefitTestClient\", fixture.Headers[\"User-Agent\"]);\n            Assert.True(fixture.Headers.ContainsKey(\"Accept\"), \"Headers include Accept header\");\n            Assert.Equal(\"application/json\", fixture.Headers[\"Accept\"]);\n            Assert.Equal(3, fixture.Headers.Count);\n        }\n\n        [Fact]\n        public void DynamicHeadersShouldWork()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x => x.Name == nameof(IRestMethodInfoTests.FetchSomeStuffWithDynamicHeader)\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.PropertyParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.Equal(\"Authorization\", fixture.HeaderParameterMap[1]);\n            Assert.True(\n                fixture.Headers.ContainsKey(\"User-Agent\"),\n                \"Headers include User-Agent header\"\n            );\n            Assert.Equal(\"RefitTestClient\", fixture.Headers[\"User-Agent\"]);\n            Assert.Equal(2, fixture.Headers.Count);\n        }\n\n        #region [HeaderCollection] Tests\n\n        [Fact]\n        public void DynamicHeaderCollectionShouldWork()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(\n                                IRestMethodInfoTests.FetchSomeStuffWithDynamicHeaderCollection\n                            )\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.Empty(fixture.PropertyParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.True(\n                fixture.Headers.ContainsKey(\"Authorization\"),\n                \"Headers include Authorization header\"\n            );\n            Assert.Equal(\n                \"SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\",\n                fixture.Headers[\"Authorization\"]\n            );\n            Assert.True(fixture.Headers.ContainsKey(\"Accept\"), \"Headers include Accept header\");\n            Assert.Equal(\"application/json\", fixture.Headers[\"Accept\"]);\n            Assert.True(\n                fixture.Headers.ContainsKey(\"User-Agent\"),\n                \"Headers include User-Agent header\"\n            );\n            Assert.Equal(\"RefitTestClient\", fixture.Headers[\"User-Agent\"]);\n            Assert.True(\n                fixture.Headers.ContainsKey(\"Api-Version\"),\n                \"Headers include Api-Version header\"\n            );\n            Assert.Equal(\"1\", fixture.Headers[\"Api-Version\"]);\n\n            Assert.Equal(4, fixture.Headers.Count);\n            Assert.True(fixture.HasHeaderCollection);\n            Assert.True(fixture.HeaderCollectionAt(1));\n        }\n\n        [Theory]\n        [InlineData(nameof(IRestMethodInfoTests.PutSomeStuffWithCustomHeaderCollection))]\n        [InlineData(nameof(IRestMethodInfoTests.PostSomeStuffWithCustomHeaderCollection))]\n        [InlineData(nameof(IRestMethodInfoTests.PatchSomeStuffWithCustomHeaderCollection))]\n        public void DynamicHeaderCollectionShouldWorkWithBody(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.Empty(fixture.PropertyParameterMap);\n            Assert.NotNull(fixture.BodyParameterInfo);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n\n            Assert.True(fixture.HasHeaderCollection);\n            Assert.True(fixture.HeaderCollectionAt(2));\n        }\n\n        [Theory]\n        [InlineData(nameof(IRestMethodInfoTests.PutSomeStuffWithoutBodyAndCustomHeaderCollection))]\n        [InlineData(nameof(IRestMethodInfoTests.PostSomeStuffWithoutBodyAndCustomHeaderCollection))]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PatchSomeStuffWithoutBodyAndCustomHeaderCollection)\n        )]\n        public void DynamicHeaderCollectionShouldWorkWithoutBody(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.Empty(fixture.PropertyParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n\n            Assert.True(fixture.HasHeaderCollection);\n            Assert.True(fixture.HeaderCollectionAt(1));\n        }\n\n        [Theory]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PutSomeStuffWithInferredBodyAndWithDynamicHeaderCollection)\n        )]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PostSomeStuffWithInferredBodyAndWithDynamicHeaderCollection)\n        )]\n        [InlineData(\n            nameof(\n                IRestMethodInfoTests.PatchSomeStuffWithInferredBodyAndWithDynamicHeaderCollection\n            )\n        )]\n        public void DynamicHeaderCollectionShouldWorkWithInferredBody(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.Empty(fixture.PropertyParameterMap);\n            Assert.NotNull(fixture.BodyParameterInfo);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n\n            Assert.True(fixture.HasHeaderCollection);\n            Assert.True(fixture.HeaderCollectionAt(1));\n            Assert.Equal(2, fixture.BodyParameterInfo.Item3);\n        }\n\n        [Theory]\n        [InlineData(\n            nameof(IRestMethodInfoTests.FetchSomeStuffWithDynamicHeaderCollectionAndAuthorize)\n        )]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PostSomeStuffWithDynamicHeaderCollectionAndAuthorize)\n        )]\n        public void DynamicHeaderCollectionShouldWorkWithAuthorize(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.Empty(fixture.PropertyParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.NotNull(fixture.AuthorizeParameterInfo);\n            Assert.True(fixture.HasHeaderCollection);\n            Assert.True(fixture.HeaderCollectionAt(2));\n        }\n\n        [Theory]\n        [InlineData(\n            nameof(IRestMethodInfoTests.FetchSomeStuffWithDynamicHeaderCollectionAndDynamicHeader)\n        )]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PostSomeStuffWithDynamicHeaderCollectionAndDynamicHeader)\n        )]\n        public void DynamicHeaderCollectionShouldWorkWithDynamicHeader(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n            Assert.Empty(fixture.PropertyParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.Single(fixture.HeaderParameterMap);\n            Assert.Equal(\"Authorization\", fixture.HeaderParameterMap[1]);\n            Assert.True(fixture.HasHeaderCollection);\n            Assert.True(fixture.HeaderCollectionAt(2));\n\n            input = typeof(IRestMethodInfoTests);\n            fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(\n                                IRestMethodInfoTests.FetchSomeStuffWithDynamicHeaderCollectionAndDynamicHeaderOrderFlipped\n                            )\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n            Assert.Empty(fixture.PropertyParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.Single(fixture.HeaderParameterMap);\n            Assert.Equal(\"Authorization\", fixture.HeaderParameterMap[2]);\n            Assert.True(fixture.HasHeaderCollection);\n            Assert.True(fixture.HeaderCollectionAt(1));\n        }\n\n        [Theory]\n        [InlineData(\n            nameof(\n                IRestMethodInfoTests.FetchSomeStuffWithPathMemberInCustomHeaderAndDynamicHeaderCollection\n            )\n        )]\n        [InlineData(\n            nameof(\n                IRestMethodInfoTests.PostSomeStuffWithPathMemberInCustomHeaderAndDynamicHeaderCollection\n            )\n        )]\n        public void DynamicHeaderCollectionShouldWorkWithPathMemberDynamicHeader(\n            string interfaceMethodName\n        )\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n            Assert.Empty(fixture.PropertyParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.Single(fixture.HeaderParameterMap);\n            Assert.Equal(\"X-PathMember\", fixture.HeaderParameterMap[0]);\n            Assert.True(fixture.HasHeaderCollection);\n            Assert.True(fixture.HeaderCollectionAt(1));\n        }\n\n        [Theory]\n        [InlineData(nameof(IRestMethodInfoTests.FetchSomeStuffWithHeaderCollection))]\n        [InlineData(nameof(IRestMethodInfoTests.PostSomeStuffWithHeaderCollection))]\n        public void DynamicHeaderCollectionInMiddleOfParamsShouldWork(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n            Assert.Empty(fixture.PropertyParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.Equal(\"baz\", fixture.QueryParameterMap[2]);\n            Assert.True(fixture.HasHeaderCollection);\n            Assert.True(fixture.HeaderCollectionAt(1));\n        }\n\n        [Theory]\n        [InlineData(nameof(IRestMethodInfoTests.FetchSomeStuffWithDuplicateHeaderCollection))]\n        [InlineData(nameof(IRestMethodInfoTests.PostSomeStuffWithDuplicateHeaderCollection))]\n        public void DynamicHeaderCollectionShouldOnlyAllowOne(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n\n            Assert.Throws<ArgumentException>(\n                () =>\n                    new RestMethodInfoInternal(\n                        input,\n                        input.GetMethods().First(x => x.Name == interfaceMethodName)\n                    )\n            );\n        }\n\n        [Theory]\n        [InlineData(\n            nameof(\n                IRestMethodInfoTests.FetchSomeStuffWithHeaderCollectionQueryParamAndArrayQueryParam\n            )\n        )]\n        [InlineData(\n            nameof(\n                IRestMethodInfoTests.PostSomeStuffWithHeaderCollectionQueryParamAndArrayQueryParam\n            )\n        )]\n        public void DynamicHeaderCollectionShouldWorkWithProperty(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n            Assert.Null(fixture.BodyParameterInfo);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n\n            Assert.Equal(2, fixture.QueryParameterMap.Count);\n            Assert.Equal(\"id\", fixture.QueryParameterMap[1]);\n            Assert.Equal(\"someArray\", fixture.QueryParameterMap[2]);\n\n            Assert.Single(fixture.PropertyParameterMap);\n\n            Assert.True(fixture.HasHeaderCollection);\n            Assert.True(fixture.HeaderCollectionAt(0));\n        }\n\n        [Theory]\n        [InlineData(\n            nameof(IRestMethodInfoTests.FetchSomeStuffWithHeaderCollectionOfUnsupportedType)\n        )]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PostSomeStuffWithHeaderCollectionOfUnsupportedType)\n        )]\n        public void DynamicHeaderCollectionShouldOnlyWorkWithSupportedSemantics(\n            string interfaceMethodName\n        )\n        {\n            var input = typeof(IRestMethodInfoTests);\n            Assert.Throws<ArgumentException>(\n                () =>\n                    new RestMethodInfoInternal(\n                        input,\n                        input.GetMethods().First(x => x.Name == interfaceMethodName)\n                    )\n            );\n        }\n\n        #endregion\n\n        #region [Property] Tests\n\n        [Fact]\n        public void DynamicRequestPropertiesShouldWork()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(IRestMethodInfoTests.FetchSomeStuffWithDynamicRequestProperty)\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.Equal(\"SomeProperty\", fixture.PropertyParameterMap[1]);\n        }\n\n        [Fact]\n        public void DynamicRequestPropertyShouldWorkWithBody()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(IRestMethodInfoTests.PostSomeStuffWithDynamicRequestProperty)\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.NotNull(fixture.BodyParameterInfo);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n            Assert.False(fixture.HasHeaderCollection);\n\n            Assert.Equal(\"SomeProperty\", fixture.PropertyParameterMap[2]);\n        }\n\n        [Fact]\n        public void DynamicRequestPropertiesShouldWorkWithBody()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(\n                                IRestMethodInfoTests.PostSomeStuffWithDynamicRequestProperties\n                            )\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.NotNull(fixture.BodyParameterInfo);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n            Assert.False(fixture.HasHeaderCollection);\n\n            Assert.Equal(\"SomeProperty\", fixture.PropertyParameterMap[2]);\n            Assert.Equal(\"SomeOtherProperty\", fixture.PropertyParameterMap[3]);\n        }\n\n        [Theory]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PutSomeStuffWithoutBodyAndWithDynamicRequestProperty)\n        )]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PostSomeStuffWithoutBodyAndWithDynamicRequestProperty)\n        )]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PatchSomeStuffWithoutBodyAndWithDynamicRequestProperty)\n        )]\n        public void DynamicRequestPropertyShouldWorkWithoutBody(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n            Assert.False(fixture.HasHeaderCollection);\n\n            Assert.Equal(\"SomeProperty\", fixture.PropertyParameterMap[1]);\n        }\n\n        [Theory]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PutSomeStuffWithInferredBodyAndWithDynamicRequestProperty)\n        )]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PostSomeStuffWithInferredBodyAndWithDynamicRequestProperty)\n        )]\n        [InlineData(\n            nameof(IRestMethodInfoTests.PatchSomeStuffWithInferredBodyAndWithDynamicRequestProperty)\n        )]\n        public void DynamicRequestPropertyShouldWorkWithInferredBody(string interfaceMethodName)\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == interfaceMethodName)\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.NotNull(fixture.BodyParameterInfo);\n            Assert.Null(fixture.AuthorizeParameterInfo);\n            Assert.False(fixture.HasHeaderCollection);\n\n            Assert.Equal(\"SomeProperty\", fixture.PropertyParameterMap[1]);\n            Assert.Equal(2, fixture.BodyParameterInfo.Item3);\n        }\n\n        [Fact]\n        public void DynamicRequestPropertiesWithoutKeysShouldDefaultKeyToParameterName()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(\n                                IRestMethodInfoTests.FetchSomeStuffWithDynamicRequestPropertyWithoutKey\n                            )\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.Equal(\"someValue\", fixture.PropertyParameterMap[1]);\n            Assert.Equal(\"someOtherValue\", fixture.PropertyParameterMap[2]);\n        }\n\n        [Fact]\n        public void DynamicRequestPropertiesWithDuplicateKeysDontBlowUp()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(\n                                IRestMethodInfoTests.FetchSomeStuffWithDynamicRequestPropertyWithDuplicateKey\n                            )\n                    )\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Empty(fixture.HeaderParameterMap);\n            Assert.Null(fixture.BodyParameterInfo);\n\n            Assert.Equal(\"SomeProperty\", fixture.PropertyParameterMap[1]);\n            Assert.Equal(\"SomeProperty\", fixture.PropertyParameterMap[2]);\n        }\n\n        #endregion\n\n        [Fact]\n        public void ValueTypesDontBlowUpBuffered()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.OhYeahValueTypes))\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Equal(BodySerializationMethod.Default, fixture.BodyParameterInfo.Item1);\n            Assert.True(fixture.BodyParameterInfo.Item2); // buffered default\n            Assert.Equal(1, fixture.BodyParameterInfo.Item3);\n\n            Assert.Equal(typeof(bool), fixture.ReturnResultType);\n        }\n\n        [Fact]\n        public void ValueTypesDontBlowUpUnBuffered()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.OhYeahValueTypesUnbuffered))\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Equal(BodySerializationMethod.Default, fixture.BodyParameterInfo.Item1);\n            Assert.False(fixture.BodyParameterInfo.Item2); // unbuffered specified\n            Assert.Equal(1, fixture.BodyParameterInfo.Item3);\n\n            Assert.Equal(typeof(bool), fixture.ReturnResultType);\n        }\n\n        [Fact]\n        public void StreamMethodPullWorks()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.PullStreamMethod))\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n            Assert.Empty(fixture.QueryParameterMap);\n            Assert.Equal(BodySerializationMethod.Default, fixture.BodyParameterInfo.Item1);\n            Assert.True(fixture.BodyParameterInfo.Item2);\n            Assert.Equal(1, fixture.BodyParameterInfo.Item3);\n\n            Assert.Equal(typeof(bool), fixture.ReturnResultType);\n        }\n\n        [Fact]\n        public void ReturningTaskShouldWork()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == nameof(IRestMethodInfoTests.VoidPost))\n            );\n            Assert.Equal(\"id\", fixture.ParameterMap[0].Name);\n            Assert.Equal(ParameterType.Normal, fixture.ParameterMap[0].Type);\n\n            Assert.Equal(typeof(Task), fixture.ReturnType);\n            Assert.Equal(typeof(void), fixture.ReturnResultType);\n        }\n\n        [Fact]\n        public void SyncMethodsShouldThrow()\n        {\n            var shouldDie = true;\n\n            try\n            {\n                var input = typeof(IRestMethodInfoTests);\n                var fixture = new RestMethodInfoInternal(\n                    input,\n                    input\n                        .GetMethods()\n                        .First(x => x.Name == nameof(IRestMethodInfoTests.AsyncOnlyBuddy))\n                );\n            }\n            catch (ArgumentException)\n            {\n                shouldDie = false;\n            }\n\n            Assert.False(shouldDie);\n        }\n\n        [Fact]\n        public void UsingThePatchAttributeSetsTheCorrectMethod()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == nameof(IRestMethodInfoTests.PatchSomething))\n            );\n\n            Assert.Equal(\"PATCH\", fixture.HttpMethod.Method);\n        }\n\n        [Fact]\n        public void UsingOptionsAttribute()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input.GetMethods().First(x => x.Name == nameof(IDummyHttpApi.SendOptions))\n            );\n\n            Assert.Equal(\"OPTIONS\", fixture.HttpMethod.Method);\n        }\n\n        [Fact]\n        public void ApiResponseShouldBeSet()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.PostReturnsApiResponse))\n            );\n\n            Assert.True(fixture.IsApiResponse);\n        }\n\n        [Fact]\n        public void ApiResponseShouldNotBeSet()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(x => x.Name == nameof(IRestMethodInfoTests.PostReturnsNonApiResponse))\n            );\n\n            Assert.False(fixture.IsApiResponse);\n        }\n\n        [Fact]\n        public void ParameterMappingWithHeaderQueryParamAndQueryArrayParam()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            var fixture = new RestMethodInfoInternal(\n                input,\n                input\n                    .GetMethods()\n                    .First(\n                        x =>\n                            x.Name\n                            == nameof(\n                                IRestMethodInfoTests.FetchSomeStuffWithDynamicHeaderQueryParamAndArrayQueryParam\n                            )\n                    )\n            );\n\n            Assert.Equal(\"GET\", fixture.HttpMethod.Method);\n            Assert.Equal(2, fixture.QueryParameterMap.Count);\n            Assert.Single(fixture.HeaderParameterMap);\n            Assert.Single(fixture.PropertyParameterMap);\n        }\n\n        [Fact]\n        public void GenericReturnTypeIsNotTaskOrObservableShouldThrow()\n        {\n            var input = typeof(IRestMethodInfoTests);\n            Assert.Throws<ArgumentException>(\n                () =>\n                    new RestMethodInfoInternal(\n                        input,\n                        input\n                            .GetMethods()\n                            .First(\n                                x => x.Name == nameof(IRestMethodInfoTests.InvalidGenericReturnType)\n                            )\n                    )\n            );\n        }\n    }\n\n    [Headers(\"User-Agent: RefitTestClient\", \"Api-Version: 1\")]\n    public interface IDummyHttpApi\n    {\n        [Get(\"/foo/bar/{id}\")]\n        Task<ApiResponse<string>> FetchSomeStringWithMetadata(int id);\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuff(int id);\n\n        [Get(\"/foo/bar/{**path}/{id}\")]\n        Task<string> FetchSomeStuffWithRoundTrippingParam(string path, int id);\n\n        [Get(\"/foo/bar/{id}?baz=bamf\")]\n        Task<string> FetchSomeStuffWithHardcodedQueryParameter(int id);\n\n        [Get(\"/foo/bar/{id}?baz=bamf\")]\n        Task<string> FetchSomeStuffWithHardcodedAndOtherQueryParameters(\n            int id,\n            [AliasAs(\"search_for\")] string searchQuery\n        );\n\n        [Get(\"/{id}/{width}x{height}/foo\")]\n        Task<string> FetchSomethingWithMultipleParametersPerSegment(int id, int width, int height);\n\n        [Get(\"/foo/bar/{id}\")]\n        [Headers(\"Api-Version: 2\", \"Accept: application/json\")]\n        Task<string> FetchSomeStuffWithHardcodedHeaders(int id);\n\n        [Get(\"/foo/bar/{id}\")]\n        [Headers(\"Api-Version\")]\n        Task<string> FetchSomeStuffWithNullHardcodedHeader(int id);\n\n        [Get(\"/foo/bar/{id}\")]\n        [Headers(\"Api-Version: \")]\n        Task<string> FetchSomeStuffWithEmptyHardcodedHeader(int id);\n\n        [Get(\"/foo/bar/{id}?param1={id}&param2={id}\")]\n        Task<string> FetchSomeStuffWithTheSameId(int id);\n\n        [Get(\"/foo/bar?param=first {id} and second {id}\")]\n        Task<string> FetchSomeStuffWithTheIdInAParameterMultipleTimes(int id);\n\n        [Get(\"/foo?q=app_metadata.id:\\\"{id}\\\"\")]\n        Task<string> FetchSomeStuffWithDoubleQuotesInUrl(int id);\n\n        [Get(\"/foo/bar/({id})\")]\n        Task<string> GetWithTrainingParenthesis(int id);\n\n        [Get(\"/foo/bar/{id}/\")]\n        Task<string> GetWithTrailingSlash(int id);\n\n        [Post(\"/foo/bar/{id}\")]\n        [Headers(\"Content-Type: literally/anything\")]\n        Task<string> PostSomeStuffWithHardCodedContentTypeHeader(int id, [Body] string content);\n\n        [Get(\"/foo/bar/{id}\")]\n        [Headers(\"Authorization: SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\")]\n        Task<string> FetchSomeStuffWithDynamicHeader(\n            int id,\n            [Header(\"Authorization\")] string authorization\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithCustomHeader(int id, [Header(\"X-Emoji\")] string custom);\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithPathMemberInCustomHeader(\n            [Header(\"X-PathMember\")] int id,\n            [Header(\"X-Emoji\")] string custom\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithCustomHeader(\n            int id,\n            [Body] object body,\n            [Header(\"X-Emoji\")] string emoji\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        [Headers(\n            \"Authorization: SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\",\n            \"Accept: application/json\"\n        )]\n        Task<string> FetchSomeStuffWithDynamicHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Delete(\"/foo/bar/{id}\")]\n        [Headers(\n            \"Authorization: SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\",\n            \"Accept: application/json\"\n        )]\n        Task<string> DeleteSomeStuffWithDynamicHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Put(\"/foo/bar/{id}\")]\n        [Headers(\n            \"Authorization: SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\",\n            \"Accept: application/json\"\n        )]\n        Task<string> PutSomeStuffWithDynamicHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        [Headers(\n            \"Authorization: SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\",\n            \"Accept: application/json\"\n        )]\n        Task<string> PostSomeStuffWithDynamicHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Patch(\"/foo/bar/{id}\")]\n        [Headers(\n            \"Authorization: SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\",\n            \"Accept: application/json\"\n        )]\n        Task<string> PatchSomeStuffWithDynamicHeaderCollection(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        [Headers(\"Authorization: SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\")]\n        Task<string> FetchSomeStuffWithDynamicHeaderCollectionAndDynamicHeader(\n            int id,\n            [Header(\"Authorization\")] string value,\n            [HeaderCollection] IDictionary<string, string> headers\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        [Headers(\"Authorization: SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\")]\n        Task<string> FetchSomeStuffWithDynamicHeaderCollectionAndDynamicHeaderOrderFlipped(\n            int id,\n            [HeaderCollection] IDictionary<string, string> headers,\n            [Header(\"Authorization\")] string value\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someProperty\n        );\n\n        [Delete(\"/foo/bar/{id}\")]\n        Task<string> DeleteSomeStuffWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someProperty\n        );\n\n        [Put(\"/foo/bar/{id}\")]\n        Task<string> PutSomeStuffWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someProperty\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeStuffWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someProperty\n        );\n\n        [Patch(\"/foo/bar/{id}\")]\n        Task<string> PatchSomeStuffWithDynamicRequestProperty(\n            int id,\n            [Property(\"SomeProperty\")] object someProperty\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithDynamicRequestPropertyWithDuplicateKey(\n            int id,\n            [Property(\"SomeProperty\")] object someValue1,\n            [Property(\"SomeProperty\")] object someValue2\n        );\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithDynamicRequestPropertyWithoutKey(\n            int id,\n            [Property] object someValue,\n            [Property(\"\")] object someOtherValue\n        );\n\n        [Get(\"/string\")]\n        Task<string> FetchSomeStuffWithoutFullPath();\n\n        [Get(\"/void\")]\n        Task FetchSomeStuffWithVoid();\n\n        [Get(\"/void/{id}/path\")]\n        Task FetchSomeStuffWithVoidAndQueryAlias(\n            string id,\n            [AliasAs(\"a\")] string valueA,\n            [AliasAs(\"b\")] string valueB\n        );\n\n        [Get(\"/foo\")]\n        Task FetchSomeStuffWithNonFormattableQueryParams(bool b, char c);\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeUrlEncodedStuff(\n            int id,\n            [Body(BodySerializationMethod.UrlEncoded)] object content\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<string> PostSomeAliasedUrlEncodedStuff(\n            int id,\n            [Body(BodySerializationMethod.UrlEncoded)] SomeRequestData content\n        );\n\n        string SomeOtherMethod();\n\n        [Put(\"/foo/bar/{id}\")]\n        Task PutSomeContentWithAuthorization(\n            int id,\n            [Body] object content,\n            [Header(\"Authorization\")] string authorization\n        );\n\n        [Put(\"/foo/bar/{id}\")]\n        Task<string> PutSomeStuffWithDynamicContentType(\n            int id,\n            [Body] string content,\n            [Header(\"Content-Type\")] string contentType\n        );\n\n        [Post(\"/foo/bar/{id}\")]\n        Task<bool> PostAValueType(int id, [Body] Guid? content);\n\n        [Patch(\"/foo/bar/{id}\")]\n        IObservable<string> PatchSomething(int id, [Body] string someAttribute);\n\n        [Options(\"/foo/bar/{id}\")]\n        Task<string> SendOptions(int id, [Body] string someAttribute);\n\n        [Get(\"/foo/bar/{id}\")]\n        Task<string> FetchSomeStuffWithQueryFormat([Query(Format = \"0.0\")] int id);\n\n        [Get(\"/query\")]\n        Task QueryWithEnumerable(IEnumerable<int> numbers);\n\n        [Get(\"/query\")]\n        Task QueryWithArray(int[] numbers);\n\n        [Get(\"/query?q1={param1}&q2={param2}\")]\n        Task QueryWithExplicitParameters(string param1, string param2);\n\n        [Get(\"/query\")]\n        Task QueryWithArrayFormattedAsMulti([Query(CollectionFormat.Multi)] int[] numbers);\n\n        [Get(\"/query\")]\n        Task QueryWithArrayFormattedAsCsv([Query(CollectionFormat.Csv)] int[] numbers);\n\n        [Get(\"/query\")]\n        Task QueryWithArrayFormattedAsSsv([Query(CollectionFormat.Ssv)] int[] numbers);\n\n        [Get(\"/query\")]\n        Task QueryWithArrayFormattedAsTsv([Query(CollectionFormat.Tsv)] int[] numbers);\n\n        [Get(\"/query\")]\n        Task QueryWithArrayFormattedAsPipes([Query(CollectionFormat.Pipes)] int[] numbers);\n\n        [Get(\"/foo\")]\n        Task ComplexQueryObjectWithDictionary([Query] ComplexQueryObject query);\n\n        [Get(\"/foo\")]\n        Task QueryWithDictionaryWithEnumKey([Query] IDictionary<TestEnum, string> query);\n\n        [Get(\"/foo\")]\n        Task QueryWithDictionaryWithPrefix(\n            [Query(\".\", \"dictionary\")] IDictionary<TestEnum, string> query\n        );\n\n        [Get(\"/foo\")]\n        Task QueryWithDictionaryWithNumericKey([Query] IDictionary<int, string> query);\n\n        [Get(\"/query\")]\n        Task QueryWithEnumerableFormattedAsMulti(\n            [Query(CollectionFormat.Multi)] IEnumerable<string> lines\n        );\n\n        [Get(\"/query\")]\n        Task QueryWithEnumerableFormattedAsCsv(\n            [Query(CollectionFormat.Csv)] IEnumerable<string> lines\n        );\n\n        [Get(\"/query\")]\n        Task QueryWithEnumerableFormattedAsSsv(\n            [Query(CollectionFormat.Ssv)] IEnumerable<string> lines\n        );\n\n        [Get(\"/query\")]\n        Task QueryWithEnumerableFormattedAsTsv(\n            [Query(CollectionFormat.Tsv)] IEnumerable<string> lines\n        );\n\n        [Get(\"/query\")]\n        Task QueryWithEnumerableFormattedAsPipes(\n            [Query(CollectionFormat.Pipes)] IEnumerable<string> lines\n        );\n\n        [Get(\"/query\")]\n        Task QueryWithObjectWithPrivateGetters(Person person);\n\n        [Multipart]\n        [Post(\"/foo?&name={name}\")]\n        Task<HttpResponseMessage> PostWithQueryStringParameters(FileInfo source, string name);\n\n        [Get(\"/query\")]\n        Task QueryWithEnum(FooWithEnumMember foo);\n\n        [Get(\"/query\")]\n        Task QueryWithTypeWithEnum(TypeFooWithEnumMember foo);\n\n        [Get(\"/api/{id}\")]\n        Task QueryWithOptionalParameters(\n            int id,\n            [Query] string text = null,\n            [Query] int? optionalId = null,\n            [Query(TreatAsString = true)] Foo foo = null,\n            [Query(CollectionFormat = CollectionFormat.Multi)] string[] filters = null\n        );\n\n        [Delete(\"/api/bar\")]\n        Task ClearWithEnumMember([Query] FooWithEnumMember foo);\n\n        [Delete(\"/api/v1/video\")]\n        Task Clear([Query] int playerIndex);\n\n        [Multipart]\n        [Post(\"/blobstorage/{**filepath}\")]\n        Task Blob_Post_Byte(string filepath, [AliasAs(\"attachment\")] ByteArrayPart byteArray);\n\n        [Multipart]\n        [Post(\"/companies/{companyId}/{path}\")]\n        Task<ApiResponse<object>> UploadFile(\n            int companyId,\n            string path,\n            [AliasAs(\"file\")] StreamPart stream,\n            [Header(\"Authorization\")] string authorization,\n            bool overwrite = false,\n            [AliasAs(\"fileMetadata\")] string metadata = null\n        );\n\n        [Post(\"/foo\")]\n        Task PostWithComplexTypeQuery([Query] ComplexQueryObject queryParams);\n\n        [Get(\"/foo\")]\n        Task ComplexTypeQueryWithInnerCollection([Query] ComplexQueryObject queryParams);\n\n        [Get(\"/api/{obj.someProperty}\")]\n        Task QueryWithOptionalParametersPathBoundObject(\n            PathBoundObject obj,\n            [Query] string text = null,\n            [Query] int? optionalId = null,\n            [Query(CollectionFormat = CollectionFormat.Multi)] string[] filters = null\n        );\n\n        [Headers(\"Accept:application/json\", \"X-API-V: 125\")]\n        [Get(\"/api/someModule/deviceList?controlId={control_id}\")]\n        Task QueryWithHeadersBeforeData(\n            [Header(\"Authorization\")] string authorization,\n            [Header(\"X-Lng\")] string twoLetterLang,\n            string search,\n            [AliasAs(\"control_id\")] string controlId,\n            string secret\n        );\n\n        [Get(\"/query\")]\n        [QueryUriFormat(UriFormat.Unescaped)]\n        Task UnescapedQueryParams(string q);\n\n        [Get(\"/query\")]\n        [QueryUriFormat(UriFormat.Unescaped)]\n        Task UnescapedQueryParamsWithFilter(string q, string filter);\n\n        [Get(\"/api/foo/{id}/file_{id}?query={id}\")]\n        Task SomeApiThatUsesParameterMoreThanOnceInTheUrl(string id);\n    }\n\n    interface ICancellableMethods\n    {\n        [Get(\"/foo\")]\n        Task GetWithCancellation(CancellationToken token = default);\n\n        [Get(\"/foo\")]\n        Task<string> GetWithCancellationAndReturn(CancellationToken token = default);\n    }\n\n    interface IAuthenticatedCancellableMethods\n    {\n        [Headers(\"Authorization: Bearer\")]\n        [Get(\"/foo\")]\n        Task GetWithAuthorizationAndCancellation(CancellationToken token = default);\n    }\n\n    public enum FooWithEnumMember\n    {\n        A,\n\n        [EnumMember(Value = \"b\")]\n        B\n    }\n\n    public class TypeFooWithEnumMember\n    {\n        [AliasAs(\"foo\")]\n        public FooWithEnumMember Foo { get; set; }\n    }\n\n    public class SomeRequestData\n    {\n        [AliasAs(\"rpn\")]\n        public int ReadablePropertyName { get; set; }\n    }\n\n    public class Person\n    {\n        public string FirstName { private get; set; }\n        public string LastName { private get; set; }\n        public string FullName => $\"{FirstName} {LastName}\";\n    }\n\n    public class TestHttpMessageHandler : HttpMessageHandler\n    {\n        public HttpRequestMessage RequestMessage { get; private set; }\n        public int MessagesSent { get; set; }\n        public HttpContent Content { get; set; }\n        public Func<HttpContent> ContentFactory { get; set; }\n        public CancellationToken CancellationToken { get; set; }\n        public string SendContent { get; set; }\n\n        public TestHttpMessageHandler(string content = \"test\")\n        {\n            Content = new StringContent(content);\n            ContentFactory = () => Content;\n        }\n\n        protected override async Task<HttpResponseMessage> SendAsync(\n            HttpRequestMessage request,\n            CancellationToken cancellationToken\n        )\n        {\n            RequestMessage = request;\n            if (request.Content != null)\n            {\n                SendContent = await request\n                    .Content.ReadAsStringAsync(cancellationToken)\n                    .ConfigureAwait(false);\n            }\n\n            CancellationToken = cancellationToken;\n            MessagesSent++;\n\n            return new HttpResponseMessage(HttpStatusCode.OK) { Content = ContentFactory() };\n        }\n    }\n\n    public class TestUrlParameterFormatter : IUrlParameterFormatter\n    {\n        readonly string constantParameterOutput;\n\n        public TestUrlParameterFormatter(string constantOutput)\n        {\n            constantParameterOutput = constantOutput;\n        }\n\n        public string Format(object value, ICustomAttributeProvider attributeProvider, Type type)\n        {\n            return constantParameterOutput;\n        }\n    }\n\n    // Converts enums to ints and adds a suffix to strings to test that both dictionary keys and values are formatted.\n    public class TestEnumUrlParameterFormatter : DefaultUrlParameterFormatter\n    {\n        public override string Format(\n            object parameterValue,\n            ICustomAttributeProvider attributeProvider,\n            Type type\n        )\n        {\n            if (parameterValue is TestEnum enumValue)\n            {\n                var enumBackingValue = (int)enumValue;\n                return enumBackingValue.ToString();\n            }\n\n            if (parameterValue is string stringValue)\n            {\n                return $\"{stringValue}{StringParameterSuffix}\";\n            }\n\n            return base.Format(parameterValue, attributeProvider, type);\n        }\n\n        public static string StringParameterSuffix => \"suffix\";\n    }\n\n    public class TestEnumerableUrlParameterFormatter : DefaultUrlParameterFormatter\n    {\n        public override string Format(\n            object parameterValue,\n            ICustomAttributeProvider attributeProvider,\n            Type type\n        )\n        {\n            if (parameterValue is IEnumerable<object> enu)\n            {\n                return string.Join(\",\", enu.Select(o => base.Format(o, attributeProvider, type)));\n            }\n            if (parameterValue is IEnumerable en)\n            {\n                return string.Join(\n                    \",\",\n                    en.Cast<object>().Select(o => base.Format(o, attributeProvider, type))\n                );\n            }\n\n            return base.Format(parameterValue, attributeProvider, type);\n        }\n    }\n\n    public class RequestBuilderTests\n    {\n        [Fact]\n        public void MethodsShouldBeCancellableDefault()\n        {\n            var fixture = new RequestBuilderImplementation<ICancellableMethods>();\n            var factory = fixture.RunRequest(\"GetWithCancellation\");\n            var output = factory(Array.Empty<object>());\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestMessage.RequestUri);\n            Assert.Equal(\"/foo\", uri.PathAndQuery);\n            Assert.False(output.CancellationToken.IsCancellationRequested);\n        }\n\n        [Fact]\n        public void MethodsShouldBeCancellableWithToken()\n        {\n            var fixture = new RequestBuilderImplementation<ICancellableMethods>();\n            var factory = fixture.RunRequest(\"GetWithCancellation\");\n\n            var cts = new CancellationTokenSource();\n\n            var output = factory(new object[] { cts.Token });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestMessage.RequestUri);\n            Assert.Equal(\"/foo\", uri.PathAndQuery);\n            Assert.False(output.CancellationToken.IsCancellationRequested);\n        }\n\n        [Fact]\n        public void MethodsShouldBeCancellableWithTokenDoesCancel()\n        {\n            var fixture = new RequestBuilderImplementation<ICancellableMethods>();\n            var factory = fixture.RunRequest(\"GetWithCancellation\");\n\n            var cts = new CancellationTokenSource();\n            cts.Cancel();\n\n            var output = factory(new object[] { cts.Token });\n            Assert.True(output.CancellationToken.IsCancellationRequested);\n        }\n\n        [Fact]\n        public void AuthorizationHeaderValueGetterReceivesMethodCancellationToken()\n        {\n            var observedCancellationToken = CancellationToken.None;\n            var settings = new RefitSettings\n            {\n                AuthorizationHeaderValueGetter = (_, cancellationToken) =>\n                {\n                    observedCancellationToken = cancellationToken;\n                    return Task.FromResult(\"tokenValue\");\n                }\n            };\n\n            var fixture = new RequestBuilderImplementation<IAuthenticatedCancellableMethods>(settings);\n            var factory = fixture.RunRequest(\"GetWithAuthorizationAndCancellation\");\n            var cts = new CancellationTokenSource();\n\n            var output = factory(new object[] { cts.Token });\n\n            Assert.Equal(cts.Token, observedCancellationToken);\n            Assert.Equal(\"Bearer tokenValue\", output.RequestMessage.Headers.Authorization?.ToString());\n        }\n\n        [Fact]\n        public void HttpContentAsApiResponseTest()\n        {\n            var fixture = new RequestBuilderImplementation<IHttpContentApi>();\n            var factory = fixture.BuildRestResultFuncForMethod(\"PostFileUploadWithMetadata\");\n            var testHttpMessageHandler = new TestHttpMessageHandler();\n            var retContent = new StreamContent(new MemoryStream());\n            testHttpMessageHandler.Content = retContent;\n\n            var mpc = new MultipartContent(\"foosubtype\");\n\n            var task =\n                (Task<ApiResponse<HttpContent>>)\n                    factory(\n                        new HttpClient(testHttpMessageHandler)\n                        {\n                            BaseAddress = new Uri(\"http://api/\")\n                        },\n                        new object[] { mpc }\n                    );\n            task.Wait();\n\n            Assert.NotNull(task.Result.Headers);\n            Assert.True(task.Result.IsSuccessStatusCode);\n            Assert.NotNull(task.Result.ReasonPhrase);\n            Assert.False(task.Result.StatusCode == default);\n            Assert.NotNull(task.Result.Version);\n\n            Assert.Equal(testHttpMessageHandler.RequestMessage.Content, mpc);\n            Assert.Equal(retContent, task.Result.Content);\n        }\n\n        [Fact]\n        public void HttpContentTest()\n        {\n            var fixture = new RequestBuilderImplementation<IHttpContentApi>();\n            var factory = fixture.BuildRestResultFuncForMethod(\"PostFileUpload\");\n            var testHttpMessageHandler = new TestHttpMessageHandler();\n            var retContent = new StreamContent(new MemoryStream());\n            testHttpMessageHandler.Content = retContent;\n\n            var mpc = new MultipartContent(\"foosubtype\");\n\n            var task =\n                (Task<HttpContent>)\n                    factory(\n                        new HttpClient(testHttpMessageHandler)\n                        {\n                            BaseAddress = new Uri(\"http://api/\")\n                        },\n                        new object[] { mpc }\n                    );\n            task.Wait();\n\n            Assert.Equal(testHttpMessageHandler.RequestMessage.Content, mpc);\n            Assert.Equal(retContent, task.Result);\n        }\n\n        [Fact]\n        public void StreamResponseAsApiResponseTest()\n        {\n            var fixture = new RequestBuilderImplementation<IStreamApi>();\n            var factory = fixture.BuildRestResultFuncForMethod(\"GetRemoteFileWithMetadata\");\n            var testHttpMessageHandler = new TestHttpMessageHandler();\n            var streamResponse = new MemoryStream();\n            var reponseContent = \"A remote file\";\n            testHttpMessageHandler.Content = new StreamContent(streamResponse);\n\n            var writer = new StreamWriter(streamResponse);\n            writer.Write(reponseContent);\n            writer.Flush();\n            streamResponse.Seek(0L, SeekOrigin.Begin);\n\n            var task =\n                (Task<ApiResponse<Stream>>)\n                    factory(\n                        new HttpClient(testHttpMessageHandler)\n                        {\n                            BaseAddress = new Uri(\"http://api/\")\n                        },\n                        new object[] { \"test-file\" }\n                    );\n            task.Wait();\n\n            Assert.NotNull(task.Result.Headers);\n            Assert.True(task.Result.IsSuccessStatusCode);\n            Assert.NotNull(task.Result.ReasonPhrase);\n            Assert.False(task.Result.StatusCode == default);\n            Assert.NotNull(task.Result.Version);\n\n            using var reader = new StreamReader(task.Result.Content);\n            Assert.Equal(reponseContent, reader.ReadToEnd());\n        }\n\n        [Fact]\n        public void StreamResponseTest()\n        {\n            var fixture = new RequestBuilderImplementation<IStreamApi>();\n            var factory = fixture.BuildRestResultFuncForMethod(\"GetRemoteFile\");\n            var testHttpMessageHandler = new TestHttpMessageHandler();\n            var streamResponse = new MemoryStream();\n            var reponseContent = \"A remote file\";\n            testHttpMessageHandler.Content = new StreamContent(streamResponse);\n\n            var writer = new StreamWriter(streamResponse);\n            writer.Write(reponseContent);\n            writer.Flush();\n            streamResponse.Seek(0L, SeekOrigin.Begin);\n\n            var task =\n                (Task<Stream>)\n                    factory(\n                        new HttpClient(testHttpMessageHandler)\n                        {\n                            BaseAddress = new Uri(\"http://api/\")\n                        },\n                        new object[] { \"test-file\" }\n                    );\n            task.Wait();\n\n            using var reader = new StreamReader(task.Result);\n            Assert.Equal(reponseContent, reader.ReadToEnd());\n        }\n\n        [Fact]\n        public void MethodsThatDontHaveAnHttpMethodShouldFail()\n        {\n            var failureMethods = new[] { \"SomeOtherMethod\", \"weofjwoeijfwe\", null, };\n\n            var successMethods = new[] { \"FetchSomeStuff\", };\n\n            foreach (var v in failureMethods)\n            {\n                var shouldDie = true;\n\n                try\n                {\n                    var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n                    fixture.BuildRequestFactoryForMethod(v);\n                }\n                catch (Exception)\n                {\n                    shouldDie = false;\n                }\n                Assert.False(shouldDie);\n            }\n\n            foreach (var v in successMethods)\n            {\n                var shouldDie = false;\n\n                try\n                {\n                    var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n                    fixture.BuildRequestFactoryForMethod(v);\n                }\n                catch (Exception)\n                {\n                    shouldDie = true;\n                }\n\n                Assert.False(shouldDie);\n            }\n        }\n\n        [Fact]\n        public void HardcodedQueryParamShouldBeInUrl()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithHardcodedQueryParameter\"\n            );\n            var output = factory(new object[] { 6 });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/foo/bar/6?baz=bamf\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ParameterizedQueryParamsShouldBeInUrl()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithHardcodedAndOtherQueryParameters\"\n            );\n            var output = factory(new object[] { 6, \"foo\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/foo/bar/6?baz=bamf&search_for=foo\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ParameterizedValuesShouldBeInUrlMoreThanOnce()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.SomeApiThatUsesParameterMoreThanOnceInTheUrl)\n            );\n            var output = factory(new object[] { 6 });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/api/foo/6/file_6?query=6\", uri.PathAndQuery);\n        }\n\n        [Theory]\n        [InlineData(\"aaa/bbb\", \"/foo/bar/aaa/bbb/1\")]\n        [InlineData(\"aaa/bbb/ccc\", \"/foo/bar/aaa/bbb/ccc/1\")]\n        [InlineData(\"aaa\", \"/foo/bar/aaa/1\")]\n        [InlineData(\"aa a/bb-b\", \"/foo/bar/aa%20a/bb-b/1\")]\n        public void RoundTrippingParameterizedQueryParamsShouldBeInUrl(\n            string path,\n            string expectedQuery\n        )\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithRoundTrippingParam\"\n            );\n            var output = factory(new object[] { path, 1 });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(expectedQuery, uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ParameterizedNullQueryParamsShouldBeBlankInUrl()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"PostWithQueryStringParameters\");\n            var output = factory(\n                new object[] { new FileInfo(typeof(RequestBuilderTests).Assembly.Location), null }\n            );\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/foo?name=\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ParametersShouldBePutAsExplicitQueryString()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.QueryWithExplicitParameters)\n            );\n            var output = factory(new object[] { \"value1\", \"value2\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/query?q1=value1&q2=value2\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void QueryParamShouldFormat()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"FetchSomeStuffWithQueryFormat\");\n            var output = factory(new object[] { 6 });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/foo/bar/6.0\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ParameterizedQueryParamsShouldBeInUrlAndValuesEncoded()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithHardcodedAndOtherQueryParameters\"\n            );\n            var output = factory(new object[] { 6, \"push!=pull&push\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/foo/bar/6?baz=bamf&search_for=push%21%3Dpull%26push\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ParameterizedQueryParamsShouldBeInUrlAndValuesEncodedWhenMixedReplacementAndQuery()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithVoidAndQueryAlias\"\n            );\n            var output = factory(new object[] { \"6 & 7/8\", \"test@example.com\", \"push!=pull\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\n                \"/void/6%20%26%207%2F8/path?a=test%40example.com&b=push%21%3Dpull\",\n                uri.PathAndQuery\n            );\n        }\n\n        [Fact]\n        public void QueryParamWithPathDelimiterShouldBeEncoded()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithVoidAndQueryAlias\"\n            );\n            var output = factory(new object[] { \"6/6\", \"test@example.com\", \"push!=pull\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\n                \"/void/6%2F6/path?a=test%40example.com&b=push%21%3Dpull\",\n                uri.PathAndQuery\n            );\n        }\n\n        [Fact]\n        public void QueryParamWhichEndsInDoubleQuotesShouldNotBeTruncated()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithDoubleQuotesInUrl\"\n            );\n            var output = factory([42]);\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri!);\n\n            Assert.Equal(\"/foo?q=app_metadata.id%3A%2242%22\", uri.PathAndQuery);\n        }\n\n        [Theory]\n        [InlineData(\"GetWithTrainingParenthesis\", \")\", \"/foo/bar/(1)\")]\n        [InlineData(\"GetWithTrailingSlash\", \"/\", \"/foo/bar/1/\")]\n        public void ShouldCaptureLastCharacterWhenRouteEndsWithConstant(string methodToTest, string constantChar, string contains)\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                methodToTest\n            );\n            var output = factory([\"1\"]);\n\n            var uri = new Uri(new Uri(\"http://api/\"), output.RequestUri!);\n\n            Assert.EndsWith(constantChar, uri.PathAndQuery, StringComparison.Ordinal);\n            Assert.Contains(contains, uri.PathAndQuery, StringComparison.Ordinal);\n        }\n\n        [Fact]\n        public void ParameterizedQueryParamsShouldBeInUrlAndValuesEncodedWhenMixedReplacementAndQueryBadId()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithVoidAndQueryAlias\"\n            );\n            var output = factory(new object[] { \"6\", \"test@example.com\", \"push!=pull\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/void/6/path?a=test%40example.com&b=push%21%3Dpull\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void NonFormattableQueryParamsShouldBeIncluded()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithNonFormattableQueryParams\"\n            );\n            var output = factory(new object[] { true, 'x' });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/foo?b=True&c=x\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void MultipleParametersInTheSameSegmentAreGeneratedProperly()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomethingWithMultipleParametersPerSegment\"\n            );\n            var output = factory(new object[] { 6, 1024, 768 });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/6/1024x768/foo\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void HardcodedHeadersShouldBeInHeaders()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.FetchSomeStuffWithHardcodedHeaders)\n            );\n            var output = factory(new object[] { 6 });\n\n            Assert.True(output.Headers.Contains(\"User-Agent\"), \"Headers include User-Agent header\");\n            Assert.Equal(\"RefitTestClient\", output.Headers.UserAgent.ToString());\n            Assert.True(\n                output.Headers.Contains(\"Api-Version\"),\n                \"Headers include Api-Version header\"\n            );\n            Assert.Equal(\"2\", output.Headers.GetValues(\"Api-Version\").Single());\n            Assert.True(output.Headers.Contains(\"Accept\"), \"Headers include Accept header\");\n            Assert.Equal(\"application/json\", output.Headers.Accept.ToString());\n        }\n\n        [Fact]\n        public void EmptyHardcodedHeadersShouldBeInHeaders()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithEmptyHardcodedHeader\"\n            );\n            var output = factory(new object[] { 6 });\n\n            Assert.True(output.Headers.Contains(\"User-Agent\"), \"Headers include User-Agent header\");\n            Assert.Equal(\"RefitTestClient\", output.Headers.UserAgent.ToString());\n            Assert.True(\n                output.Headers.Contains(\"Api-Version\"),\n                \"Headers include Api-Version header\"\n            );\n            Assert.Equal(\"\", output.Headers.GetValues(\"Api-Version\").Single());\n        }\n\n        [Fact]\n        public void NullHardcodedHeadersShouldNotBeInHeaders()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithNullHardcodedHeader\"\n            );\n            var output = factory(new object[] { 6 });\n\n            Assert.True(output.Headers.Contains(\"User-Agent\"), \"Headers include User-Agent header\");\n            Assert.Equal(\"RefitTestClient\", output.Headers.UserAgent.ToString());\n            Assert.False(\n                output.Headers.Contains(\"Api-Version\"),\n                \"Headers include Api-Version header\"\n            );\n        }\n\n        [Fact]\n        public void ReadStringContentWithMetadata()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRestResultFuncForMethod(\"FetchSomeStringWithMetadata\");\n            var testHttpMessageHandler = new TestHttpMessageHandler();\n\n            var task =\n                (Task<ApiResponse<string>>)\n                    factory(\n                        new HttpClient(testHttpMessageHandler)\n                        {\n                            BaseAddress = new Uri(\"http://api/\")\n                        },\n                        new object[] { 42 }\n                    );\n            task.Wait();\n\n            Assert.NotNull(task.Result.Headers);\n            Assert.True(task.Result.IsSuccessStatusCode);\n            Assert.NotNull(task.Result.ReasonPhrase);\n            Assert.False(task.Result.StatusCode == default);\n            Assert.NotNull(task.Result.Version);\n\n            Assert.Equal(\"test\", task.Result.Content);\n        }\n\n        [Fact]\n        public void ContentHeadersCanBeHardcoded()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"PostSomeStuffWithHardCodedContentTypeHeader\"\n            );\n            var output = factory(new object[] { 6, \"stuff\" });\n\n            Assert.True(\n                output.Content.Headers.Contains(\"Content-Type\"),\n                \"Content headers include Content-Type header\"\n            );\n            Assert.Equal(\"literally/anything\", output.Content.Headers.ContentType.ToString());\n        }\n\n        [Fact]\n        public void DynamicHeaderShouldBeInHeaders()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"FetchSomeStuffWithDynamicHeader\");\n            var output = factory(new object[] { 6, \"Basic RnVjayB5ZWFoOmhlYWRlcnMh\" });\n\n            Assert.NotNull(output.Headers.Authorization); //, \"Headers include Authorization header\");\n            Assert.Equal(\"RnVjayB5ZWFoOmhlYWRlcnMh\", output.Headers.Authorization.Parameter);\n        }\n\n        [Fact]\n        public void CustomDynamicHeaderShouldBeInHeaders()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"FetchSomeStuffWithCustomHeader\");\n            var output = factory(new object[] { 6, \":joy_cat:\" });\n\n            Assert.True(output.Headers.Contains(\"X-Emoji\"), \"Headers include X-Emoji header\");\n            Assert.Equal(\":joy_cat:\", output.Headers.GetValues(\"X-Emoji\").First());\n        }\n\n        [Fact]\n        public void EmptyDynamicHeaderShouldBeInHeaders()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"FetchSomeStuffWithCustomHeader\");\n            var output = factory(new object[] { 6, \"\" });\n\n            Assert.True(output.Headers.Contains(\"X-Emoji\"), \"Headers include X-Emoji header\");\n            Assert.Equal(\"\", output.Headers.GetValues(\"X-Emoji\").First());\n        }\n\n        [Fact]\n        public void NullDynamicHeaderShouldNotBeInHeaders()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"FetchSomeStuffWithDynamicHeader\");\n            var output = factory(new object[] { 6, null });\n\n            Assert.Null(output.Headers.Authorization); //, \"Headers include Authorization header\");\n        }\n\n        [Fact]\n        public void PathMemberAsCustomDynamicHeaderShouldBeInHeaders()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"FetchSomeStuffWithPathMemberInCustomHeader\"\n            );\n            var output = factory(new object[] { 6, \":joy_cat:\" });\n\n            Assert.True(\n                output.Headers.Contains(\"X-PathMember\"),\n                \"Headers include X-PathMember header\"\n            );\n            Assert.Equal(\"6\", output.Headers.GetValues(\"X-PathMember\").First());\n        }\n\n        [Fact]\n        public void AddCustomHeadersToRequestHeadersOnly()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"PostSomeStuffWithCustomHeader\");\n            var output = factory(new object[] { 6, new { Foo = \"bar\" }, \":smile_cat:\" });\n\n            Assert.True(\n                output.Headers.Contains(\"Api-Version\"),\n                \"Headers include Api-Version header\"\n            );\n            Assert.True(output.Headers.Contains(\"X-Emoji\"), \"Headers include X-Emoji header\");\n            Assert.False(\n                output.Content.Headers.Contains(\"Api-Version\"),\n                \"Content headers include Api-Version header\"\n            );\n            Assert.False(\n                output.Content.Headers.Contains(\"X-Emoji\"),\n                \"Content headers include X-Emoji header\"\n            );\n        }\n\n        [Theory]\n        [InlineData(nameof(IDummyHttpApi.FetchSomeStuffWithDynamicHeaderCollection))]\n        [InlineData(nameof(IDummyHttpApi.DeleteSomeStuffWithDynamicHeaderCollection))]\n        [InlineData(nameof(IDummyHttpApi.PutSomeStuffWithDynamicHeaderCollection))]\n        [InlineData(nameof(IDummyHttpApi.PostSomeStuffWithDynamicHeaderCollection))]\n        [InlineData(nameof(IDummyHttpApi.PatchSomeStuffWithDynamicHeaderCollection))]\n        public void HeaderCollectionShouldBeInHeaders(string interfaceMethodName)\n        {\n            var headerCollection = new Dictionary<string, string>\n            {\n                { \"key1\", \"val1\" },\n                { \"key2\", \"val2\" }\n            };\n\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(interfaceMethodName);\n            var output = factory(new object[] { 6, headerCollection });\n\n            Assert.True(output.Headers.Contains(\"User-Agent\"), \"Headers include User-Agent header\");\n            Assert.Equal(\"RefitTestClient\", output.Headers.GetValues(\"User-Agent\").First());\n            Assert.True(\n                output.Headers.Contains(\"Api-Version\"),\n                \"Headers include Api-Version header\"\n            );\n            Assert.Equal(\"1\", output.Headers.GetValues(\"Api-Version\").First());\n\n            Assert.True(\n                output.Headers.Contains(\"Authorization\"),\n                \"Headers include Authorization header\"\n            );\n            Assert.Equal(\n                \"SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\",\n                output.Headers.GetValues(\"Authorization\").First()\n            );\n            Assert.True(output.Headers.Contains(\"Accept\"), \"Headers include Accept header\");\n            Assert.Equal(\"application/json\", output.Headers.GetValues(\"Accept\").First());\n\n            Assert.True(output.Headers.Contains(\"key1\"), \"Headers include key1 header\");\n            Assert.Equal(\"val1\", output.Headers.GetValues(\"key1\").First());\n            Assert.True(output.Headers.Contains(\"key2\"), \"Headers include key2 header\");\n            Assert.Equal(\"val2\", output.Headers.GetValues(\"key2\").First());\n        }\n\n        [Fact]\n        public void LastWriteWinsWhenHeaderCollectionAndDynamicHeader()\n        {\n            var authHeader = \"LetMeIn\";\n            var headerCollection = new Dictionary<string, string>\n            {\n                { \"Authorization\", \"OpenSesame\" }\n            };\n\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.FetchSomeStuffWithDynamicHeaderCollectionAndDynamicHeader)\n            );\n            var output = factory(new object[] { 6, authHeader, headerCollection });\n\n            Assert.True(\n                output.Headers.Contains(\"Authorization\"),\n                \"Headers include Authorization header\"\n            );\n            Assert.Equal(\"OpenSesame\", output.Headers.GetValues(\"Authorization\").First());\n\n            fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            factory = fixture.BuildRequestFactoryForMethod(\n                nameof(\n                    IDummyHttpApi.FetchSomeStuffWithDynamicHeaderCollectionAndDynamicHeaderOrderFlipped\n                )\n            );\n            output = factory(new object[] { 6, headerCollection, authHeader });\n\n            Assert.True(\n                output.Headers.Contains(\"Authorization\"),\n                \"Headers include Authorization header\"\n            );\n            Assert.Equal(authHeader, output.Headers.GetValues(\"Authorization\").First());\n        }\n\n        [Theory]\n        [InlineData(nameof(IDummyHttpApi.FetchSomeStuffWithDynamicHeaderCollection))]\n        [InlineData(nameof(IDummyHttpApi.DeleteSomeStuffWithDynamicHeaderCollection))]\n        [InlineData(nameof(IDummyHttpApi.PutSomeStuffWithDynamicHeaderCollection))]\n        [InlineData(nameof(IDummyHttpApi.PostSomeStuffWithDynamicHeaderCollection))]\n        [InlineData(nameof(IDummyHttpApi.PatchSomeStuffWithDynamicHeaderCollection))]\n        public void NullHeaderCollectionDoesntBlowUp(string interfaceMethodName)\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(interfaceMethodName);\n            var output = factory(new object[] { 6, null });\n\n            Assert.True(output.Headers.Contains(\"User-Agent\"), \"Headers include User-Agent header\");\n            Assert.Equal(\"RefitTestClient\", output.Headers.GetValues(\"User-Agent\").First());\n            Assert.True(\n                output.Headers.Contains(\"Api-Version\"),\n                \"Headers include Api-Version header\"\n            );\n            Assert.Equal(\"1\", output.Headers.GetValues(\"Api-Version\").First());\n\n            Assert.True(\n                output.Headers.Contains(\"Authorization\"),\n                \"Headers include Authorization header\"\n            );\n            Assert.Equal(\n                \"SRSLY aHR0cDovL2kuaW1ndXIuY29tL0NGRzJaLmdpZg==\",\n                output.Headers.GetValues(\"Authorization\").First()\n            );\n            Assert.True(output.Headers.Contains(\"Accept\"), \"Headers include Accept header\");\n            Assert.Equal(\"application/json\", output.Headers.GetValues(\"Accept\").First());\n        }\n\n        [Fact]\n        public void HeaderCollectionCanUnsetHeaders()\n        {\n            var headerCollection = new Dictionary<string, string>\n            {\n                { \"Authorization\", \"\" },\n                { \"Api-Version\", null }\n            };\n\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.FetchSomeStuffWithDynamicHeaderCollection)\n            );\n            var output = factory(new object[] { 6, headerCollection });\n\n            Assert.True(\n                !output.Headers.Contains(\"Api-Version\"),\n                \"Headers does not include Api-Version header\"\n            );\n\n            Assert.True(\n                output.Headers.Contains(\"Authorization\"),\n                \"Headers include Authorization header\"\n            );\n            Assert.Equal(\"\", output.Headers.GetValues(\"Authorization\").First());\n        }\n\n        [Theory]\n        [InlineData(nameof(IDummyHttpApi.FetchSomeStuffWithDynamicRequestProperty))]\n        [InlineData(nameof(IDummyHttpApi.DeleteSomeStuffWithDynamicRequestProperty))]\n        [InlineData(nameof(IDummyHttpApi.PutSomeStuffWithDynamicRequestProperty))]\n        [InlineData(nameof(IDummyHttpApi.PostSomeStuffWithDynamicRequestProperty))]\n        [InlineData(nameof(IDummyHttpApi.PatchSomeStuffWithDynamicRequestProperty))]\n        public void DynamicRequestPropertiesShouldBeInProperties(string interfaceMethodName)\n        {\n            var someProperty = new object();\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(interfaceMethodName);\n            var output = factory(new object[] { 6, someProperty });\n\n#if NET6_0_OR_GREATER\n            Assert.NotEmpty(output.Options);\n            Assert.Equal(\n                someProperty,\n                ((IDictionary<string, object>)output.Options)[\"SomeProperty\"]\n            );\n#endif\n\n#pragma warning disable CS0618 // Type or member is obsolete\n            Assert.NotEmpty(output.Properties);\n            Assert.Equal(someProperty, output.Properties[\"SomeProperty\"]);\n#pragma warning restore CS0618 // Type or member is obsolete\n        }\n\n        [Fact]\n        public void OptionsFromSettingsShouldBeInProperties()\n        {\n            const string nameProp1 = \"UnitTest.Property1\";\n            string valueProp1 = \"TestValue\";\n            const string nameProp2 = \"UnitTest.Property2\";\n            object valueProp2 = new List<string>() { \"123\", \"345\" };\n            var fixture = new RequestBuilderImplementation<IContainAandB>(\n                new RefitSettings()\n                {\n                    HttpRequestMessageOptions = new Dictionary<string, object>()\n                    {\n                        [nameProp1] = valueProp1,\n                        [nameProp2] = valueProp2,\n                    },\n                }\n            );\n            var factory = fixture.BuildRequestFactoryForMethod(nameof(IContainAandB.Ping));\n            var output = factory(Array.Empty<object>());\n\n#if NET6_0_OR_GREATER\n            Assert.NotEmpty(output.Options);\n            Assert.True(\n                output.Options.TryGetValue(\n                    new HttpRequestOptionsKey<string>(nameProp1),\n                    out var resultValueProp1\n                )\n            );\n            Assert.Equal(valueProp1, resultValueProp1);\n\n            Assert.True(\n                output.Options.TryGetValue(\n                    new HttpRequestOptionsKey<List<string>>(nameProp2),\n                    out var resultValueProp2\n                )\n            );\n            Assert.Equal(valueProp2, resultValueProp2);\n#else\n            Assert.NotEmpty(output.Properties);\n            Assert.True(output.Properties.TryGetValue(nameProp1, out var resultValueProp1));\n            Assert.IsType<string>(resultValueProp1);\n            Assert.Equal(valueProp1, (string)resultValueProp1);\n\n            Assert.True(output.Properties.TryGetValue(nameProp2, out var resultValueProp2));\n            Assert.IsType<List<string>>(resultValueProp2);\n            Assert.Equal(valueProp2, (List<string>)resultValueProp2);\n#endif\n        }\n\n        [Fact]\n        public void InterfaceTypeShouldBeInProperties()\n        {\n            var fixture = new RequestBuilderImplementation<IContainAandB>();\n            var factory = fixture.BuildRequestFactoryForMethod(nameof(IContainAandB.Ping));\n            var output = factory(Array.Empty<object>());\n\n#pragma warning disable CS0618 // Type or member is obsolete\n            Assert.NotEmpty(output.Properties);\n            Assert.Equal(\n                typeof(IContainAandB),\n                output.Properties[HttpRequestMessageOptions.InterfaceType]\n            );\n#pragma warning restore CS0618 // Type or member is obsolete\n        }\n\n        [Fact]\n        public void RestMethodInfoShouldBeInProperties()\n        {\n            var someProperty = new object();\n            var fixture = new RequestBuilderImplementation<IContainAandB>();\n            var factory = fixture.BuildRequestFactoryForMethod(nameof(IContainAandB.Ping));\n            var output = factory(new object[] { });\n\n#if NET6_0_OR_GREATER\n            Assert.NotEmpty(output.Options);\n            Assert.True(\n                output.Options.TryGetValue(\n                    new HttpRequestOptionsKey<RestMethodInfo>(\n                        HttpRequestMessageOptions.RestMethodInfo\n                    ),\n                    out var restMethodInfo\n                )\n            );\n#else\n            Assert.NotEmpty(output.Properties);\n            Assert.True(\n                output.Properties.TryGetValue(\n                    HttpRequestMessageOptions.RestMethodInfo,\n                    out var restMethodInfoObj\n                )\n            );\n            Assert.IsType<RestMethodInfo>(restMethodInfoObj);\n            var restMethodInfo = restMethodInfoObj as RestMethodInfo;\n#endif\n            Assert.Equal(nameof(IContainAandB.Ping), restMethodInfo.Name);\n        }\n\n        [Fact]\n        public void DynamicRequestPropertiesWithDefaultKeysShouldBeInProperties()\n        {\n            var someProperty = new object();\n            var someOtherProperty = new object();\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.FetchSomeStuffWithDynamicRequestPropertyWithoutKey)\n            );\n            var output = factory(new object[] { 6, someProperty, someOtherProperty });\n\n#if NET6_0_OR_GREATER\n            Assert.NotEmpty(output.Options);\n            Assert.Equal(someProperty, ((IDictionary<string, object>)output.Options)[\"someValue\"]);\n            Assert.Equal(\n                someOtherProperty,\n                ((IDictionary<string, object>)output.Options)[\"someOtherValue\"]\n            );\n#endif\n\n#pragma warning disable CS0618 // Type or member is obsolete\n            Assert.NotEmpty(output.Properties);\n            Assert.Equal(someProperty, output.Properties[\"someValue\"]);\n            Assert.Equal(someOtherProperty, output.Properties[\"someOtherValue\"]);\n#pragma warning restore CS0618 // Type or member is obsolete\n        }\n\n        [Fact]\n        public void DynamicRequestPropertiesWithDuplicateKeyShouldOverwritePreviousProperty()\n        {\n            var someProperty = new object();\n            var someOtherProperty = new object();\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.FetchSomeStuffWithDynamicRequestPropertyWithDuplicateKey)\n            );\n            var output = factory(new object[] { 6, someProperty, someOtherProperty });\n\n#if NET6_0_OR_GREATER\n            Assert.Equal(3, output.Options.Count());\n            Assert.Equal(\n                someOtherProperty,\n                ((IDictionary<string, object>)output.Options)[\"SomeProperty\"]\n            );\n#endif\n\n#pragma warning disable CS0618 // Type or member is obsolete\n            Assert.Equal(3, output.Properties.Count);\n            Assert.Equal(someOtherProperty, output.Properties[\"SomeProperty\"]);\n#pragma warning restore CS0618 // Type or member is obsolete\n        }\n\n        [Fact]\n        public void HttpClientShouldPrefixedAbsolutePathToTheRequestUri()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRestResultFuncForMethod(\"FetchSomeStuffWithoutFullPath\");\n            var testHttpMessageHandler = new TestHttpMessageHandler();\n\n            var task = (Task)factory(\n                new HttpClient(testHttpMessageHandler)\n                {\n                    BaseAddress = new Uri(\"http://api/foo/bar\")\n                },\n                Array.Empty<object>()\n            );\n            task.Wait();\n\n            Assert.Equal(\n                \"http://api/foo/bar/string\",\n                testHttpMessageHandler.RequestMessage.RequestUri.ToString()\n            );\n        }\n\n        [Fact]\n        public void HttpClientForVoidMethodShouldPrefixedAbsolutePathToTheRequestUri()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRestResultFuncForMethod(\"FetchSomeStuffWithVoid\");\n            var testHttpMessageHandler = new TestHttpMessageHandler();\n\n            var task = (Task)factory(\n                new HttpClient(testHttpMessageHandler)\n                {\n                    BaseAddress = new Uri(\"http://api/foo/bar\")\n                },\n                Array.Empty<object>()\n            );\n            task.Wait();\n\n            Assert.Equal(\n                \"http://api/foo/bar/void\",\n                testHttpMessageHandler.RequestMessage.RequestUri.ToString()\n            );\n        }\n\n        [Fact]\n        public void HttpClientShouldNotPrefixEmptyAbsolutePathToTheRequestUri()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRestResultFuncForMethod(\"FetchSomeStuff\");\n            var testHttpMessageHandler = new TestHttpMessageHandler();\n\n            var task = (Task)factory(\n                new HttpClient(testHttpMessageHandler) { BaseAddress = new Uri(\"http://api/\") },\n                new object[] { 42 }\n            );\n            task.Wait();\n\n            Assert.Equal(\n                \"http://api/foo/bar/42\",\n                testHttpMessageHandler.RequestMessage.RequestUri.ToString()\n            );\n        }\n\n        [Fact]\n        public void DontBlowUpWithDynamicAuthorizationHeaderAndContent()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"PutSomeContentWithAuthorization\");\n            var output = factory(\n                new object[] { 7, new { Octocat = \"Dunetocat\" }, \"Basic RnVjayB5ZWFoOmhlYWRlcnMh\" }\n            );\n\n            Assert.NotNull(output.Headers.Authorization); //, \"Headers include Authorization header\");\n            Assert.Equal(\"RnVjayB5ZWFoOmhlYWRlcnMh\", output.Headers.Authorization.Parameter);\n        }\n\n        [Fact]\n        public void SuchFlexibleContentTypeWow()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"PutSomeStuffWithDynamicContentType\"\n            );\n            var output = factory(\n                new object[] { 7, \"such \\\"refit\\\" is \\\"amaze\\\" wow\", \"text/dson\" }\n            );\n\n            Assert.NotNull(output.Content); //, \"Request has content\");\n            Assert.NotNull(output.Content.Headers.ContentType); //, \"Headers include Content-Type header\");\n            Assert.Equal(\"text/dson\", output.Content.Headers.ContentType.MediaType); //, \"Content-Type header has the expected value\");\n        }\n\n        [Fact]\n        public void BodyContentGetsUrlEncoded()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.RunRequest(\"PostSomeUrlEncodedStuff\");\n            var output = factory(\n                new object[]\n                {\n                    6,\n                    new\n                    {\n                        Foo = \"Something\",\n                        Bar = 100,\n                        Baz = \"\" // explicitly use blank to preserve value that would be stripped if null\n                    }\n                }\n            );\n\n            Assert.Equal(\"Foo=Something&Bar=100&Baz=\", output.SendContent);\n        }\n\n        [Fact]\n        public void BodyContentGetsUrlEncodedWithCollectionFormat()\n        {\n            var settings = new RefitSettings() { CollectionFormat = CollectionFormat.Csv };\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(settings);\n            var factory = fixture.RunRequest(\"PostSomeUrlEncodedStuff\");\n            var output = factory(\n                new object[]\n                {\n                    6,\n                    new\n                    {\n                        Foo = \"Something\",\n                        Bar = 100,\n                        FooBar = new [] {5,7},\n                        Baz = \"\" // explicitly use blank to preserve value that would be stripped if null\n                    }\n                }\n            );\n\n            Assert.Equal(\"Foo=Something&Bar=100&FooBar=5%2C7&Baz=\", output.SendContent);\n        }\n\n        [Fact]\n        public void FormFieldGetsAliased()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.RunRequest(\"PostSomeAliasedUrlEncodedStuff\");\n            var output = factory(\n                new object[]\n                {\n                    6,\n                    new SomeRequestData { ReadablePropertyName = 99 }\n                }\n            );\n\n            Assert.Equal(\"rpn=99\", output.SendContent);\n        }\n\n        [Fact]\n        public void CustomParmeterFormatter()\n        {\n            var settings = new RefitSettings\n            {\n                UrlParameterFormatter = new TestUrlParameterFormatter(\"custom-parameter\")\n            };\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(settings);\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"FetchSomeStuff\");\n            var output = factory(new object[] { 5 });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/foo/bar/custom-parameter\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void QueryStringWithEnumerablesCanBeFormatted()\n        {\n            var settings = new RefitSettings\n            {\n                UrlParameterFormatter = new TestEnumerableUrlParameterFormatter()\n            };\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(settings);\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithEnumerable\");\n            var output = factory(new object[] { new int[] { 1, 2, 3 } });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/query?numbers=1%2C2%2C3\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void QueryStringWithArrayCanBeFormatted()\n        {\n            var settings = new RefitSettings\n            {\n                UrlParameterFormatter = new TestEnumerableUrlParameterFormatter()\n            };\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(settings);\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithArray\");\n            var output = factory(new object[] { new int[] { 1, 2, 3 } });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/query?numbers=1%2C2%2C3\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void QueryStringWithArrayCanBeFormattedByAttribute()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"UnescapedQueryParams\");\n            var output = factory(new object[] { \"Select+Id,Name+From+Account\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/query?q=Select+Id,Name+From+Account\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void QueryStringWithArrayCanBeFormattedByAttributeWithMultiple()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"UnescapedQueryParamsWithFilter\");\n            var output = factory(new object[] { \"Select+Id+From+Account\", \"*\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/query?q=Select+Id+From+Account&filter=*\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void QueryStringWithArrayCanBeFormattedByDefaultSetting()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(\n                new RefitSettings { CollectionFormat = CollectionFormat.Multi }\n            );\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithArray\");\n            var output = factory(new object[] { new[] { 1, 2, 3 } });\n\n            Assert.Equal(\"/query?numbers=1&numbers=2&numbers=3\", output.RequestUri.PathAndQuery);\n        }\n\n        [Fact]\n        public void DefaultCollectionFormatCanBeOverridenByQueryAttribute()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(\n                new RefitSettings { CollectionFormat = CollectionFormat.Multi }\n            );\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithArrayFormattedAsCsv\");\n            var output = factory(new object[] { new[] { 1, 2, 3 } });\n\n            Assert.Equal(\"/query?numbers=1%2C2%2C3\", output.RequestUri.PathAndQuery);\n        }\n\n        [Fact]\n        public void RequestWithParameterInMultiplePlaces()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.FetchSomeStuffWithTheSameId)\n            );\n            var output = factory(new object[] { \"theId\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            var builder = new UriBuilder(uri);\n            var qs = QueryHelpers.ParseQuery(uri.Query);\n            Assert.Equal(\"/foo/bar/theId\", builder.Path);\n            Assert.Equal(\"theId\", qs[\"param1\"]);\n            Assert.Equal(\"theId\", qs[\"param2\"]);\n        }\n\n        [Fact]\n        public void RequestWithParameterInAQueryParameterMultipleTimes()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.FetchSomeStuffWithTheIdInAParameterMultipleTimes)\n            );\n            var output = factory(new object[] { \"theId\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/foo/bar?param=first%20theId%20and%20second%20theId\", uri.PathAndQuery);\n        }\n\n        [Theory]\n        [InlineData(\"QueryWithArrayFormattedAsMulti\", \"/query?numbers=1&numbers=2&numbers=3\")]\n        [InlineData(\"QueryWithArrayFormattedAsCsv\", \"/query?numbers=1%2C2%2C3\")]\n        [InlineData(\"QueryWithArrayFormattedAsSsv\", \"/query?numbers=1%202%203\")]\n        [InlineData(\"QueryWithArrayFormattedAsTsv\", \"/query?numbers=1%092%093\")]\n        [InlineData(\"QueryWithArrayFormattedAsPipes\", \"/query?numbers=1%7C2%7C3\")]\n        public void QueryStringWithArrayFormatted(string apiMethodName, string expectedQuery)\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(apiMethodName);\n            var output = factory(new object[] { new[] { 1, 2, 3 } });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(expectedQuery, uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void QueryStringWithArrayFormattedAsSsvAndItemsFormattedIndividually()\n        {\n            var settings = new RefitSettings\n            {\n                UrlParameterFormatter = new TestUrlParameterFormatter(\"custom-parameter\")\n            };\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(settings);\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithArrayFormattedAsSsv\");\n            var output = factory(new object[] { new int[] { 1, 2, 3 } });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\n                \"/query?numbers=custom-parameter%20custom-parameter%20custom-parameter\",\n                uri.PathAndQuery\n            );\n        }\n\n        [Fact]\n        public void QueryStringWithEnumerablesCanBeFormattedEnumerable()\n        {\n            var settings = new RefitSettings\n            {\n                UrlParameterFormatter = new TestEnumerableUrlParameterFormatter()\n            };\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(settings);\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithEnumerable\");\n\n            var list = new List<int> { 1, 2, 3 };\n\n            var output = factory(new object[] { list });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/query?numbers=1%2C2%2C3\", uri.PathAndQuery);\n        }\n\n        [Theory]\n        [InlineData(\n            \"QueryWithEnumerableFormattedAsMulti\",\n            \"/query?lines=first&lines=second&lines=third\"\n        )]\n        [InlineData(\"QueryWithEnumerableFormattedAsCsv\", \"/query?lines=first%2Csecond%2Cthird\")]\n        [InlineData(\"QueryWithEnumerableFormattedAsSsv\", \"/query?lines=first%20second%20third\")]\n        [InlineData(\"QueryWithEnumerableFormattedAsTsv\", \"/query?lines=first%09second%09third\")]\n        [InlineData(\"QueryWithEnumerableFormattedAsPipes\", \"/query?lines=first%7Csecond%7Cthird\")]\n        public void QueryStringWithEnumerableFormatted(string apiMethodName, string expectedQuery)\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(apiMethodName);\n\n            var lines = new List<string> { \"first\", \"second\", \"third\" };\n\n            var output = factory(new object[] { lines });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(expectedQuery, uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void QueryStringExcludesPropertiesWithPrivateGetters()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithObjectWithPrivateGetters\");\n\n            var person = new Person { FirstName = \"Mickey\", LastName = \"Mouse\" };\n\n            var output = factory(new object[] { person });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/query?FullName=Mickey%20Mouse\", uri.PathAndQuery);\n        }\n\n        [Theory]\n        [InlineData(FooWithEnumMember.A, \"/query?foo=A\")]\n        [InlineData(FooWithEnumMember.B, \"/query?foo=b\")]\n        public void QueryStringUsesEnumMemberAttribute(\n            FooWithEnumMember queryParameter,\n            string expectedQuery\n        )\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithEnum\");\n\n            var output = factory(new object[] { queryParameter });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(expectedQuery, uri.PathAndQuery);\n        }\n\n        [Theory]\n        [InlineData(FooWithEnumMember.A, \"/query?foo=A\")]\n        [InlineData(FooWithEnumMember.B, \"/query?foo=b\")]\n        public void QueryStringUsesEnumMemberAttributeInTypeWithEnum(\n            FooWithEnumMember queryParameter,\n            string expectedQuery\n        )\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithTypeWithEnum\");\n\n            var output = factory(\n                new object[] { new TypeFooWithEnumMember { Foo = queryParameter } }\n            );\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(expectedQuery, uri.PathAndQuery);\n        }\n\n        [Theory]\n        [InlineData(\"/api/123?text=title&optionalId=999&foo=foo&filters=A&filters=B\")]\n        public void TestNullableQueryStringParams(string expectedQuery)\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithOptionalParameters\");\n            var output = factory(new object[] { 123, \"title\", 999, new Foo(), new string[] { \"A\", \"B\" } });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(expectedQuery, uri.PathAndQuery);\n        }\n\n        [Theory]\n        [InlineData(\"/api/123?text=title&filters=A&filters=B\")]\n        public void TestNullableQueryStringParamsWithANull(string expectedQuery)\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"QueryWithOptionalParameters\");\n            var output = factory(new object[] { 123, \"title\", null, null, new string[] { \"A\", \"B\" } });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(expectedQuery, uri.PathAndQuery);\n        }\n\n        [Theory]\n        [InlineData(\"/api/123?SomeProperty2=test&text=title&filters=A&filters=B\")]\n        public void TestNullableQueryStringParamsWithANullAndPathBoundObject(string expectedQuery)\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                \"QueryWithOptionalParametersPathBoundObject\"\n            );\n            var output = factory(\n                new object[]\n                {\n                    new PathBoundObject() { SomeProperty = 123, SomeProperty2 = \"test\" },\n                    \"title\",\n                    null,\n                    new string[] { \"A\", \"B\" }\n                }\n            );\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(expectedQuery, uri.PathAndQuery);\n        }\n\n        [Fact]\n        [UseCulture(\"es-ES\")] // Spain uses a , instead of a .\n        public void DefaultParameterFormatterIsInvariant()\n        {\n            var settings = new RefitSettings();\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(settings);\n\n            var factory = fixture.BuildRequestFactoryForMethod(\"FetchSomeStuff\");\n            var output = factory(new object[] { 5.4 });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n            Assert.Equal(\"/foo/bar/5.4\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ICanPostAValueTypeIfIWantYoureNotTheBossOfMe()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.RunRequest(\"PostAValueType\", \"true\");\n            var guid = Guid.NewGuid();\n            var expected = string.Format(\"\\\"{0}\\\"\", guid);\n            var output = factory(new object[] { 7, guid });\n\n            Assert.Equal(expected, output.SendContent);\n        }\n\n        [Fact]\n        public void DeleteWithQuery()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"Clear\");\n\n            var output = factory(new object[] { 1 });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/api/v1/video?playerIndex=1\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ClearWithQuery()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\"ClearWithEnumMember\");\n\n            var output = factory(new object[] { FooWithEnumMember.B });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/api/bar?foo=b\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void MultipartPostWithAliasAndHeader()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.RunRequest(\"UploadFile\", \"true\");\n\n            using var file = MultipartTests.GetTestFileStream(\"Test Files/Test.pdf\");\n\n            var sp = new StreamPart(file, \"aFile\");\n\n            var output = factory(new object[] { 42, \"aPath\", sp, \"theAuth\", false, \"theMeta\" });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestMessage.RequestUri);\n\n            Assert.Equal(\"/companies/42/aPath\", uri.PathAndQuery);\n            Assert.Equal(\"theAuth\", output.RequestMessage.Headers.Authorization.ToString());\n        }\n\n        [Fact]\n        public void PostBlobByteWithAlias()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.Blob_Post_Byte)\n            );\n\n            var bytes = new byte[10] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };\n\n            var bap = new ByteArrayPart(bytes, \"theBytes\");\n\n            var output = factory(new object[] { \"the/path\", bap });\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/blobstorage/the/path\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void QueryWithAliasAndHeadersWorks()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.QueryWithHeadersBeforeData)\n            );\n\n            var authHeader = \"theAuth\";\n            var langHeader = \"LnG\";\n            var searchParam = \"theSearchParam\";\n            var controlIdParam = \"theControlId\";\n            var secretValue = \"theSecret\";\n\n            var output = factory(\n                new object[] { authHeader, langHeader, searchParam, controlIdParam, secretValue }\n            );\n\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\n                $\"/api/someModule/deviceList?controlId={controlIdParam}&search={searchParam}&secret={secretValue}\",\n                uri.PathAndQuery\n            );\n            Assert.Equal(langHeader, output.Headers.GetValues(\"X-LnG\").FirstOrDefault());\n            Assert.Equal(authHeader, output.Headers.Authorization?.Scheme);\n        }\n\n        class RequestBuilderMock : IRequestBuilder\n        {\n            public int CallCount { get; private set; }\n\n            public Func<HttpClient, object[], object> BuildRestResultFuncForMethod(\n                string methodName,\n                Type[] parameterTypes = null,\n                Type[] genericArgumentTypes = null\n            )\n            {\n                CallCount++;\n                return null;\n            }\n        }\n\n        [Fact]\n        public void CachedRequestBuilderCallInternalBuilderForParametersWithSameNamesButDifferentNamespaces()\n        {\n            var internalBuilder = new RequestBuilderMock();\n            var cachedBuilder = new CachedRequestBuilderImplementation(internalBuilder);\n\n            cachedBuilder.BuildRestResultFuncForMethod(\n                \"TestMethodName\",\n                new[] { typeof(CollisionA.SomeType) }\n            );\n            cachedBuilder.BuildRestResultFuncForMethod(\n                \"TestMethodName\",\n                new[] { typeof(CollisionB.SomeType) }\n            );\n            cachedBuilder.BuildRestResultFuncForMethod(\n                \"TestMethodName\",\n                null,\n                new[] { typeof(CollisionA.SomeType) }\n            );\n            cachedBuilder.BuildRestResultFuncForMethod(\n                \"TestMethodName\",\n                null,\n                new[] { typeof(CollisionB.SomeType) }\n            );\n\n            Assert.Equal(4, internalBuilder.CallCount);\n        }\n\n        [Fact]\n        public void DictionaryQueryWithEnumKeyProducesCorrectQueryString()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.QueryWithDictionaryWithEnumKey)\n            );\n\n            var dict = new Dictionary<TestEnum, string>\n            {\n                { TestEnum.A, \"value1\" },\n                { TestEnum.B, \"value2\" },\n            };\n\n            var output = factory(new object[] { dict });\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/foo?A=value1&B=value2\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void DictionaryQueryWithPrefix()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.QueryWithDictionaryWithPrefix)\n            );\n\n            var dict = new Dictionary<TestEnum, string>\n            {\n                { TestEnum.A, \"value1\" },\n                { TestEnum.B, \"value2\" },\n            };\n\n            var output = factory(new object[] { dict });\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/foo?dictionary.A=value1&dictionary.B=value2\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void DictionaryQueryWithNumericKeyProducesCorrectQueryString()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.QueryWithDictionaryWithNumericKey)\n            );\n\n            var dict = new Dictionary<int, string> { { 1, \"value1\" }, { 2, \"value2\" }, };\n\n            var output = factory(new object[] { dict });\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/foo?1=value1&2=value2\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void DictionaryQueryWithCustomFormatterProducesCorrectQueryString()\n        {\n            var urlParameterFormatter = new TestEnumUrlParameterFormatter();\n\n            var refitSettings = new RefitSettings { UrlParameterFormatter = urlParameterFormatter };\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(refitSettings);\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.QueryWithDictionaryWithEnumKey)\n            );\n\n            var dict = new Dictionary<TestEnum, string>\n            {\n                { TestEnum.A, \"value1\" },\n                { TestEnum.B, \"value2\" },\n            };\n\n            var output = factory(new object[] { dict });\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\n                $\"/foo?{(int)TestEnum.A}=value1{TestEnumUrlParameterFormatter.StringParameterSuffix}&{(int)TestEnum.B}=value2{TestEnumUrlParameterFormatter.StringParameterSuffix}\",\n                uri.PathAndQuery\n            );\n        }\n\n        [Fact]\n        public void ComplexQueryObjectWithDefaultKeyFormatterProducesCorrectQueryString()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.ComplexQueryObjectWithDictionary)\n            );\n\n            var complexQuery = new ComplexQueryObject { TestAlias2 = \"value1\" };\n\n            var output = factory(new object[] { complexQuery });\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/foo?TestAlias2=value1\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ComplexQueryObjectWithCustomKeyFormatterProducesCorrectQueryString()\n        {\n            var urlParameterKeyFormatter = new CamelCaseUrlParameterKeyFormatter();\n\n            var refitSettings = new RefitSettings\n            {\n                UrlParameterKeyFormatter = urlParameterKeyFormatter\n            };\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(refitSettings);\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.ComplexQueryObjectWithDictionary)\n            );\n\n            var complexQuery = new ComplexQueryObject { TestAlias2 = \"value1\" };\n\n            var output = factory(new object[] { complexQuery });\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/foo?testAlias2=value1\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ComplexQueryObjectWithAliasedDictionaryProducesCorrectQueryString()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.ComplexQueryObjectWithDictionary)\n            );\n\n            var complexQuery = new ComplexQueryObject\n            {\n                TestAliasedDictionary = new Dictionary<TestEnum, string>\n                {\n                    { TestEnum.A, \"value1\" },\n                    { TestEnum.B, \"value2\" },\n                },\n            };\n\n            var output = factory(new object[] { complexQuery });\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\n                \"/foo?test-dictionary-alias.A=value1&test-dictionary-alias.B=value2\",\n                uri.PathAndQuery\n            );\n        }\n\n        [Fact]\n        public void ComplexQueryObjectWithDictionaryProducesCorrectQueryString()\n        {\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>();\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.ComplexQueryObjectWithDictionary)\n            );\n\n            var complexQuery = new ComplexQueryObject\n            {\n                TestDictionary = new Dictionary<TestEnum, string>\n                {\n                    { TestEnum.A, \"value1\" },\n                    { TestEnum.B, \"value2\" },\n                },\n            };\n\n            var output = factory(new object[] { complexQuery });\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\"/foo?TestDictionary.A=value1&TestDictionary.B=value2\", uri.PathAndQuery);\n        }\n\n        [Fact]\n        public void ComplexQueryObjectWithDictionaryAndCustomFormatterProducesCorrectQueryString()\n        {\n            var urlParameterFormatter = new TestEnumUrlParameterFormatter();\n            var refitSettings = new RefitSettings { UrlParameterFormatter = urlParameterFormatter };\n            var fixture = new RequestBuilderImplementation<IDummyHttpApi>(refitSettings);\n            var factory = fixture.BuildRequestFactoryForMethod(\n                nameof(IDummyHttpApi.ComplexQueryObjectWithDictionary)\n            );\n\n            var complexQuery = new ComplexQueryObject\n            {\n                TestDictionary = new Dictionary<TestEnum, string>\n                {\n                    { TestEnum.A, \"value1\" },\n                    { TestEnum.B, \"value2\" },\n                },\n            };\n\n            var output = factory(new object[] { complexQuery });\n            var uri = new Uri(new Uri(\"http://api\"), output.RequestUri);\n\n            Assert.Equal(\n                $\"/foo?TestDictionary.{(int)TestEnum.A}=value1{TestEnumUrlParameterFormatter.StringParameterSuffix}&TestDictionary.{(int)TestEnum.B}=value2{TestEnumUrlParameterFormatter.StringParameterSuffix}\",\n                uri.PathAndQuery\n            );\n        }\n    }\n\n    public record Foo\n    {\n        public override string ToString()\n        {\n            return \"foo\";\n        }\n    }\n\n    static class RequestBuilderTestExtensions\n    {\n        public static Func<object[], HttpRequestMessage> BuildRequestFactoryForMethod(\n            this IRequestBuilder builder,\n            string methodName,\n            string baseAddress = \"http://api/\"\n        )\n        {\n            var factory = builder.BuildRestResultFuncForMethod(methodName);\n            var testHttpMessageHandler = new TestHttpMessageHandler();\n\n            return paramList =>\n            {\n                var task = (Task)factory(\n                    new HttpClient(testHttpMessageHandler) { BaseAddress = new Uri(baseAddress) },\n                    paramList\n                );\n                task.Wait();\n                return testHttpMessageHandler.RequestMessage;\n            };\n        }\n\n        public static Func<object[], TestHttpMessageHandler> RunRequest(\n            this IRequestBuilder builder,\n            string methodName,\n            string returnContent = null,\n            string baseAddress = \"http://api/\"\n        )\n        {\n            var factory = builder.BuildRestResultFuncForMethod(methodName);\n            var testHttpMessageHandler = new TestHttpMessageHandler();\n            if (returnContent != null)\n            {\n                testHttpMessageHandler.Content = new StringContent(returnContent);\n            }\n\n            return paramList =>\n            {\n                var task = (Task)factory(\n                    new HttpClient(testHttpMessageHandler) { BaseAddress = new Uri(baseAddress) },\n                    paramList\n                );\n                try\n                {\n                    task.Wait();\n                }\n                catch (AggregateException e) when (e.InnerException is TaskCanceledException) { }\n\n                return testHttpMessageHandler;\n            };\n        }\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/ResponseTests.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Net;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing System.Text;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json;\nusing Refit;\nusing Refit.Buffers;\nusing RichardSzalay.MockHttp;\n// for the code gen\nusing Xunit;\nusing JsonSerializer = Newtonsoft.Json.JsonSerializer;\n\nnamespace Refit.Tests;\n\npublic class TestAliasObject\n{\n    [AliasAs(\"FIELD_WE_SHOULD_SHORTEN_WITH_ALIAS_AS\")]\n    public string ShortNameForAlias { get; set; }\n\n    [JsonProperty(PropertyName = \"FIELD_WE_SHOULD_SHORTEN_WITH_JSON_PROPERTY\")]\n    [JsonPropertyName(\"FIELD_WE_SHOULD_SHORTEN_WITH_JSON_PROPERTY\")]\n    public string ShortNameForJsonProperty { get; set; }\n}\n\npublic class ResponseTests\n{\n    readonly MockHttpMessageHandler mockHandler;\n    readonly IMyAliasService fixture;\n\n    public ResponseTests()\n    {\n        mockHandler = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHandler };\n\n        fixture = RestService.For<IMyAliasService>(\"http://api\", settings);\n    }\n\n    public interface IMyAliasService\n    {\n        [Get(\"/aliasTest\")]\n        Task<TestAliasObject> GetTestObject();\n\n        [Get(\"/GetApiResponseTestObject\")]\n        Task<ApiResponse<TestAliasObject>> GetApiResponseTestObject();\n\n        [Get(\"/GetIApiResponse\")]\n        Task<IApiResponse> GetIApiResponse();\n    }\n\n    [Fact]\n    public async Task JsonPropertyCanBeUsedToAliasFieldNamesInResponses()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"http://api/aliasTest\")\n            .Respond(\n                \"application/json\",\n                \"{\\\"FIELD_WE_SHOULD_SHORTEN_WITH_ALIAS_AS\\\": \\\"Hello\\\", \\\"FIELD_WE_SHOULD_SHORTEN_WITH_JSON_PROPERTY\\\": \\\"World\\\"}\"\n            );\n\n        var result = await fixture.GetTestObject();\n\n        Assert.Equal(\"World\", result.ShortNameForJsonProperty);\n    }\n\n    /// <summary>\n    /// Even though it may seem like AliasAs and JsonProperty are used interchangeably in some places,\n    /// when serializing responses, AliasAs will not work -- only JsonProperty will.\n    /// </summary>\n    [Fact]\n    public async Task AliasAsCannotBeUsedToAliasFieldNamesInResponses()\n    {\n        mockHandler\n            .Expect(HttpMethod.Get, \"http://api/aliasTest\")\n            .Respond(\n                \"application/json\",\n                \"{\\\"FIELD_WE_SHOULD_SHORTEN_WITH_ALIAS_AS\\\": \\\"Hello\\\", \\\"FIELD_WE_SHOULD_SHORTEN_WITH_JSON_PROPERTY\\\": \\\"World\\\"}\"\n            );\n\n        var result = await fixture.GetTestObject();\n\n        Assert.Null(result.ShortNameForAlias);\n    }\n\n    /// <summary>\n    /// Test to verify if a ValidationException is thrown for a Bad Request in terms of RFC 7807\n    /// </summary>\n    [Fact]\n    public async Task ThrowsValidationException()\n    {\n        var expectedContent = new ProblemDetails\n        {\n            Detail = \"detail\",\n            Errors =\n            {\n                { \"Field1\", new string[] { \"Problem1\" } },\n                { \"Field2\", new string[] { \"Problem2\" } }\n            },\n            Instance = \"instance\",\n            Status = 1,\n            Title = \"title\",\n            Type = \"type\"\n        };\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.BadRequest)\n        {\n            Content = new StringContent(JsonConvert.SerializeObject(expectedContent))\n        };\n        expectedResponse.Content.Headers.ContentType =\n            new System.Net.Http.Headers.MediaTypeHeaderValue(\"application/problem+json\");\n        mockHandler.Expect(HttpMethod.Get, \"http://api/aliasTest\").Respond(req => expectedResponse);\n\n        var actualException = await Assert.ThrowsAsync<ValidationApiException>(\n            () => fixture.GetTestObject()\n        );\n        Assert.NotNull(actualException.Content);\n        Assert.Equal(\"detail\", actualException.Content.Detail);\n        Assert.Equal(\"Problem1\", actualException.Content.Errors[\"Field1\"][0]);\n        Assert.Equal(\"Problem2\", actualException.Content.Errors[\"Field2\"][0]);\n        Assert.Equal(\"instance\", actualException.Content.Instance);\n        Assert.Equal(1, actualException.Content.Status);\n        Assert.Equal(\"title\", actualException.Content.Title);\n        Assert.Equal(\"type\", actualException.Content.Type);\n    }\n\n    /// <summary>\n    /// Test to verify if EnsureSuccessStatusCodeAsync throws a ValidationApiException for a Bad Request in terms of RFC 7807\n    /// </summary>\n    [Fact]\n    public async Task When_BadRequest_EnsureSuccessStatusCodeAsync_ThrowsValidationException()\n    {\n        var expectedContent = new ProblemDetails\n        {\n            Detail = \"detail\",\n            Errors =\n            {\n                { \"Field1\", new string[] { \"Problem1\" } },\n                { \"Field2\", new string[] { \"Problem2\" } }\n            },\n            Instance = \"instance\",\n            Status = 1,\n            Title = \"title\",\n            Type = \"type\"\n        };\n\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.BadRequest)\n        {\n            Content = new StringContent(JsonConvert.SerializeObject(expectedContent))\n        };\n\n        expectedResponse.Content.Headers.ContentType =\n            new System.Net.Http.Headers.MediaTypeHeaderValue(\"application/problem+json\");\n        mockHandler\n            .Expect(HttpMethod.Get, \"http://api/GetApiResponseTestObject\")\n            .Respond(req => expectedResponse);\n\n        using var response = await fixture.GetApiResponseTestObject();\n        var actualException = await Assert.ThrowsAsync<ValidationApiException>(\n            () => response.EnsureSuccessStatusCodeAsync()\n        );\n\n        Assert.NotNull(actualException.Content);\n        Assert.Equal(\"detail\", actualException.Content.Detail);\n        Assert.Equal(\"Problem1\", actualException.Content.Errors[\"Field1\"][0]);\n        Assert.Equal(\"Problem2\", actualException.Content.Errors[\"Field2\"][0]);\n        Assert.Equal(\"instance\", actualException.Content.Instance);\n        Assert.Equal(1, actualException.Content.Status);\n        Assert.Equal(\"title\", actualException.Content.Title);\n        Assert.Equal(\"type\", actualException.Content.Type);\n    }\n\n    /// <summary>\n    /// Test to verify if IsSuccessful returns false if we have a success status code, but there is a deserialization error\n    /// </summary>\n    [Fact]\n    public async Task When_SerializationErrorOnSuccessStatusCode_IsSuccessful_ShouldReturnFalse()\n    {\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK)\n        {\n            Content = new StringContent(\"Invalid JSON\")\n        };\n\n        mockHandler\n            .Expect(HttpMethod.Get, \"http://api/GetApiResponseTestObject\")\n            .Respond(req => expectedResponse);\n\n        using var response = await fixture.GetApiResponseTestObject();\n\n        Assert.True(response.IsSuccessStatusCode);\n        Assert.False(response.IsSuccessful);\n        Assert.NotNull(response.Error);\n    }\n\n    /// <summary>\n    /// Test to verify if EnsureSuccessStatusCodeAsync do not throw an ApiException if we have a success status code, but there is a deserialization error\n    /// </summary>\n    [Fact]\n    public async Task When_SerializationErrorOnSuccessStatusCode_EnsureSuccesStatusCodeAsync_DoNotThrowApiException()\n    {\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK)\n        {\n            Content = new StringContent(\"Invalid JSON\")\n        };\n\n        mockHandler\n            .Expect(HttpMethod.Get, \"http://api/GetApiResponseTestObject\")\n            .Respond(req => expectedResponse);\n\n        using var response = await fixture.GetApiResponseTestObject();\n        await response.EnsureSuccessStatusCodeAsync();        \n\n        Assert.True(response.IsSuccessStatusCode);\n        Assert.False(response.IsSuccessful);\n        Assert.NotNull(response.Error);\n    }\n\n    /// <summary>\n    /// Test to verify if EnsureSuccessfulAsync throws an ApiException if we have a success status code, but there is a deserialization error\n    /// </summary>\n    [Fact]\n    public async Task When_SerializationErrorOnSuccessStatusCode_EnsureSuccessfulAsync_ThrowsApiException()\n    {\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK)\n        {           \n            Content = new StringContent(\"Invalid JSON\")\n        };\n\n        mockHandler\n            .Expect(HttpMethod.Get, \"http://api/GetApiResponseTestObject\")\n            .Respond(req => expectedResponse);\n\n        using var response = await fixture.GetApiResponseTestObject();\n        var actualException = await Assert.ThrowsAsync<ApiException>(\n            () => response.EnsureSuccessfulAsync()\n        );\n\n        Assert.True(response.IsSuccessStatusCode);\n        Assert.False(response.IsSuccessful);\n        Assert.NotNull(actualException);\n        Assert.IsType<System.Text.Json.JsonException>(actualException.InnerException);\n    }\n\n    [Fact]\n    public async Task WhenProblemDetailsResponseContainsExtensions_ShouldHydrateExtensions()\n    {\n        var expectedContent = new\n        {\n            Detail = \"detail\",\n            Instance = \"instance\",\n            Status = 1,\n            Title = \"title\",\n            Type = \"type\",\n            Foo = \"bar\",\n            Baz = 123d,\n        };\n\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.BadRequest)\n        {\n            Content = new StringContent(JsonConvert.SerializeObject(expectedContent))\n        };\n\n        expectedResponse.Content.Headers.ContentType =\n            new System.Net.Http.Headers.MediaTypeHeaderValue(\"application/problem+json\");\n        mockHandler.Expect(HttpMethod.Get, \"http://api/aliasTest\").Respond(req => expectedResponse);\n\n        mockHandler.Expect(HttpMethod.Get, \"http://api/soloyolo\").Respond(req => expectedResponse);\n\n        var actualException = await Assert.ThrowsAsync<ValidationApiException>(\n            () => fixture.GetTestObject()\n        );\n        Assert.NotNull(actualException.Content);\n        Assert.Equal(\"detail\", actualException.Content.Detail);\n        Assert.Equal(\"instance\", actualException.Content.Instance);\n        Assert.Equal(1, actualException.Content.Status);\n        Assert.Equal(\"title\", actualException.Content.Title);\n        Assert.Equal(\"type\", actualException.Content.Type);\n\n        Assert.Collection(\n            actualException.Content.Extensions,\n            kvp =>\n                Assert.Equal(\n                    new KeyValuePair<string, object>(\n                        nameof(expectedContent.Foo),\n                        expectedContent.Foo\n                    ),\n                    kvp\n                ),\n            kvp =>\n                Assert.Equal(\n                    new KeyValuePair<string, object>(\n                        nameof(expectedContent.Baz),\n                        expectedContent.Baz\n                    ),\n                    kvp\n                )\n        );\n    }\n\n    [Fact]\n    public async Task WithNonSeekableStream_UsingSystemTextJsonContentSerializer()\n    {\n        var model = new TestAliasObject\n        {\n            ShortNameForAlias = nameof(WithNonSeekableStream_UsingSystemTextJsonContentSerializer),\n            ShortNameForJsonProperty = nameof(TestAliasObject)\n        };\n\n        var localHandler = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings(new SystemTextJsonContentSerializer())\n        {\n            HttpMessageHandlerFactory = () => localHandler\n        };\n\n        using var utf8BufferWriter = new PooledBufferWriter();\n\n        var utf8JsonWriter = new Utf8JsonWriter(utf8BufferWriter);\n\n        System.Text.Json.JsonSerializer.Serialize(utf8JsonWriter, model);\n\n        using var sourceStream = utf8BufferWriter.DetachStream();\n\n        using var contentStream = new ThrowOnGetLengthMemoryStream { CanGetLength = true };\n\n        sourceStream.CopyTo(contentStream);\n\n        contentStream.Position = 0;\n\n        contentStream.CanGetLength = false;\n\n        var httpContent = new StreamContent(contentStream)\n        {\n            Headers =\n            {\n                ContentType = new MediaTypeHeaderValue(\"application/json\")\n                {\n                    CharSet = Encoding.UTF8.WebName\n                }\n            }\n        };\n\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = httpContent };\n\n        expectedResponse.Content.Headers.ContentType = new MediaTypeHeaderValue(\"application/json\");\n        expectedResponse.StatusCode = HttpStatusCode.OK;\n\n        localHandler\n            .Expect(HttpMethod.Get, \"http://api/aliasTest\")\n            .Respond(req => expectedResponse);\n\n        var localFixture = RestService.For<IMyAliasService>(\"http://api\", settings);\n\n        var result = await localFixture.GetTestObject();\n\n        Assert.NotNull(result);\n        Assert.Equal(\n            nameof(WithNonSeekableStream_UsingSystemTextJsonContentSerializer),\n            result.ShortNameForAlias\n        );\n        Assert.Equal(nameof(TestAliasObject), result.ShortNameForJsonProperty);\n    }\n\n    [Fact]\n    public async Task BadRequestWithEmptyContent_ShouldReturnApiException()\n    {\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.BadRequest)\n        {\n            Content = new StringContent(\"Hello world\")\n        };\n        expectedResponse.Content.Headers.Clear();\n\n        mockHandler.Expect(HttpMethod.Get, \"http://api/aliasTest\").Respond(req => expectedResponse);\n\n        var actualException = await Assert.ThrowsAsync<ApiException>(() => fixture.GetTestObject());\n\n        Assert.NotNull(actualException.Content);\n        Assert.Equal(\"Hello world\", actualException.Content);\n    }\n\n    [Fact]\n    public async Task BadRequestWithEmptyContent_ShouldReturnApiResponse()\n    {\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.BadRequest)\n        {\n            Content = new StringContent(\"Hello world\")\n        };\n        expectedResponse.Content.Headers.Clear();\n\n        mockHandler\n            .Expect(HttpMethod.Get, $\"http://api/{nameof(fixture.GetApiResponseTestObject)}\")\n            .Respond(req => expectedResponse);\n\n        var apiResponse = await fixture.GetApiResponseTestObject();\n\n        Assert.NotNull(apiResponse);\n        Assert.NotNull(apiResponse.Error);\n        Assert.NotNull(apiResponse.Error.Content);\n        Assert.Equal(\"Hello world\", apiResponse.Error.Content);\n    }\n\n    [Fact]\n    public async Task BadRequestWithStringContent_ShouldReturnIApiResponse()\n    {\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.BadRequest)\n        {\n            Content = new StringContent(\"Hello world\")\n        };\n        expectedResponse.Content.Headers.Clear();\n\n        mockHandler\n            .Expect(HttpMethod.Get, $\"http://api/{nameof(fixture.GetIApiResponse)}\")\n            .Respond(req => expectedResponse);\n\n        var apiResponse = await fixture.GetIApiResponse();\n\n        Assert.NotNull(apiResponse);\n        Assert.NotNull(apiResponse.Error);\n        Assert.NotNull(apiResponse.Error.Content);\n        Assert.Equal(\"Hello world\", apiResponse.Error.Content);\n    }\n\n    [Fact]\n    public async Task ValidationApiException_HydratesBaseContent()\n    {\n        var expectedProblemDetails = new ProblemDetails\n        {\n            Detail = \"detail\",\n            Instance = \"instance\",\n            Status = 1,\n            Title = \"title\",\n            Type = \"type\"\n        };\n        var expectedContent = JsonConvert.SerializeObject(expectedProblemDetails);\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.BadRequest)\n        {\n            Content = new StringContent(expectedContent)\n        };\n        expectedResponse.Content.Headers.ContentType = new MediaTypeHeaderValue(\n            \"application/problem+json\"\n        );\n        mockHandler.Expect(HttpMethod.Get, \"http://api/aliasTest\").Respond(req => expectedResponse);\n\n        var actualException = await Assert.ThrowsAsync<ValidationApiException>(\n            () => fixture.GetTestObject()\n        );\n        var actualBaseException = actualException as ApiException;\n        Assert.Equal(expectedContent, actualBaseException.Content);\n    }\n\n    [Fact]\n    public async Task WithHtmlResponse_ShouldReturnApiException()\n    {\n        const string htmlResponse = \"<html><body>Hello world</body></html>\";\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK)\n        {\n            Content = new StringContent(htmlResponse)\n        };\n        expectedResponse.Content.Headers.Clear();\n\n        mockHandler.Expect(HttpMethod.Get, \"http://api/aliasTest\").Respond(req => expectedResponse);\n\n        var actualException = await Assert.ThrowsAsync<ApiException>(() => fixture.GetTestObject());\n\n        Assert.IsType<System.Text.Json.JsonException>(actualException.InnerException);\n        Assert.NotNull(actualException.Content);\n        Assert.Equal(htmlResponse, actualException.Content);\n    }\n\n    [Fact]\n    public async Task WithHtmlResponse_ShouldReturnApiResponse()\n    {\n        const string htmlResponse = \"<html><body>Hello world</body></html>\";\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK)\n        {\n            Content = new StringContent(htmlResponse)\n        };\n        expectedResponse.Content.Headers.Clear();\n\n        mockHandler\n            .Expect(HttpMethod.Get, $\"http://api/{nameof(fixture.GetApiResponseTestObject)}\")\n            .Respond(req => expectedResponse);\n\n        var apiResponse = await fixture.GetApiResponseTestObject();\n\n        Assert.NotNull(apiResponse.Error);\n        Assert.IsType<System.Text.Json.JsonException>(apiResponse.Error.InnerException);\n        Assert.NotNull(apiResponse.Error.Content);\n        Assert.Equal(htmlResponse, apiResponse.Error.Content);\n    }\n\n    [Fact]\n    public async Task WithNonJsonResponseUsingNewtonsoftJsonContentSerializer_ShouldReturnApiException()\n    {\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            ContentSerializer = new NewtonsoftJsonContentSerializer()\n        };\n\n        var newtonSoftFixture = RestService.For<IMyAliasService>(\"http://api\", settings);\n\n        const string nonJsonResponse = \"bad response\";\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK)\n        {\n            Content = new StringContent(nonJsonResponse)\n        };\n        expectedResponse.Content.Headers.Clear();\n\n        mockHandler.Expect(HttpMethod.Get, \"http://api/aliasTest\").Respond(req => expectedResponse);\n\n        var actualException = await Assert.ThrowsAsync<ApiException>(\n            () => newtonSoftFixture.GetTestObject()\n        );\n\n        Assert.IsType<JsonReaderException>(actualException.InnerException);\n        Assert.NotNull(actualException.Content);\n        Assert.Equal(nonJsonResponse, actualException.Content);\n    }\n\n    [Fact]\n    public async Task WithNonJsonResponseUsingNewtonsoftJsonContentSerializer_ShouldReturnApiResponse()\n    {\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHandler,\n            ContentSerializer = new NewtonsoftJsonContentSerializer()\n        };\n\n        var newtonSoftFixture = RestService.For<IMyAliasService>(\"http://api\", settings);\n\n        const string nonJsonResponse = \"bad response\";\n        var expectedResponse = new HttpResponseMessage(HttpStatusCode.OK)\n        {\n            Content = new StringContent(nonJsonResponse)\n        };\n        expectedResponse.Content.Headers.Clear();\n\n        mockHandler\n            .Expect(HttpMethod.Get, $\"http://api/{nameof(fixture.GetApiResponseTestObject)}\")\n            .Respond(req => expectedResponse);\n\n        var apiResponse = await newtonSoftFixture.GetApiResponseTestObject();\n\n        Assert.NotNull(apiResponse.Error);\n        Assert.IsType<JsonReaderException>(apiResponse.Error.InnerException);\n        Assert.NotNull(apiResponse.Error.Content);\n        Assert.Equal(nonJsonResponse, apiResponse.Error.Content);\n    }\n}\n\npublic sealed class ThrowOnGetLengthMemoryStream : MemoryStream\n{\n    public bool CanGetLength { get; set; }\n\n    public override bool CanSeek\n    {\n        get => CanGetLength;\n    }\n    public override long Length => CanGetLength ? base.Length : throw new NotSupportedException();\n}\n"
  },
  {
    "path": "Refit.Tests/RestService.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net;\nusing System.Net.Http;\nusing System.Reactive.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json;\nusing Refit; // InterfaceStubGenerator looks for this\nusing RichardSzalay.MockHttp;\nusing Xunit;\n\nnamespace Refit.Tests;\n\n#pragma warning disable IDE1006 // Naming Styles\npublic class RootObject\n{\n    public string _id { get; set; }\n    public string _rev { get; set; }\n    public string name { get; set; }\n}\n#pragma warning restore IDE1006 // Naming Styles\n\npublic class BigObject\n{\n    public byte[] BigData { get; set; }\n}\n\n[Headers(\"User-Agent: Refit Integration Tests\")]\npublic interface INpmJs\n{\n    [Get(\"/congruence\")]\n    Task<RootObject> GetCongruence();\n}\n\npublic interface IRequestBin\n{\n    [Post(\"/1h3a5jm1\")]\n    Task Post();\n\n    [Post(\"/foo\")]\n    Task PostRawStringDefault([Body] string str);\n\n    [Post(\"/foo\")]\n    Task PostRawStringJson([Body(BodySerializationMethod.Serialized)] string str);\n\n    [Post(\"/foo\")]\n    Task PostRawStringUrlEncoded([Body(BodySerializationMethod.UrlEncoded)] string str);\n\n    [Post(\"/1h3a5jm1\")]\n    Task PostGeneric<T>(T param);\n\n    [Post(\"/foo\")]\n    Task PostVoidReturnBodyBuffered<T>([Body(buffered: true)] T param);\n\n    [Post(\"/foo\")]\n    Task<string> PostNonVoidReturnBodyBuffered<T>([Body(buffered: true)] T param);\n\n    [Post(\"/big\")]\n    Task PostBig(BigObject big);\n\n    [Get(\"/foo/{arguments}\")]\n    Task SomeApiThatUsesVariableNameFromCodeGen(string arguments);\n}\n\npublic interface IApiBindPathToObject\n{\n    [Get(\"/foos/{request.someProperty}/bar/{request.someProperty2}\")]\n    Task GetFooBars(PathBoundObject request);\n\n    [Get(\"/foos/{Requestparams.SomeProperty}/bar/{requestParams.SoMeProPerty2}\")]\n    Task GetFooBarsWithDifferentCasing(PathBoundObject requestParams);\n\n    [Get(\"/foos/{id}/{request.someProperty}/bar/{request.someProperty2}\")]\n    Task GetBarsByFoo(string id, PathBoundObject request);\n\n    [Get(\"/foos/{someProperty}/bar/{request.someProperty2}\")]\n    Task GetFooBars(PathBoundObject request, string someProperty);\n\n    [Get(\"/foos/{request.someProperty}/bar\")]\n    Task GetBarsByFoo(PathBoundObject request);\n\n    [Get(\"/foo\")]\n    Task GetBarsWithCustomQueryFormat(PathBoundObjectWithQueryFormat request);\n\n    [Get(\"/foos/{request.someProperty}/bar/{request.someProperty3}\")]\n    Task GetFooBarsDerived(PathBoundDerivedObject request);\n\n    [Get(\"/foos/{request.values}\")]\n    Task GetFoos(PathBoundList request);\n\n    [Get(\"/foos2/{values}\")]\n    Task GetFoos2(List<int> values);\n\n    [Post(\"/foos/{request.someProperty}/bar/{request.someProperty2}\")]\n    Task PostFooBar(PathBoundObject request, [Body] object someObject);\n\n    [Get(\"/foos/{request.someProperty}/bar/{request.someProperty2}\")]\n    Task GetFooBars(PathBoundObjectWithQuery request);\n\n    [Post(\"/foos/{request.someProperty}/bar/{request.someProperty2}\")]\n    Task<HttpResponseMessage> PostFooBar(\n        PathBoundObject request,\n        [Query] ModelObject someQueryParams\n    );\n\n    [Multipart]\n    [Post(\"/foos/{request.someProperty}/bar/{request.someProperty2}\")]\n    Task<HttpResponseMessage> PostFooBarStreamPart(\n        PathBoundObject request,\n        [Query] ModelObject someQueryParams,\n        StreamPart stream\n    );\n\n    [Multipart]\n    [Post(\"/foos/{request.someProperty}/bar/{request.someProperty2}\")]\n    Task<HttpResponseMessage> PostFooBarStreamPart(PathBoundObject request, StreamPart stream);\n\n    [Multipart]\n    [Post(\"/foos/{request.someProperty}/bar/{request.someProperty2}\")]\n    Task<HttpResponseMessage> PostFooBarStreamPart(\n        PathBoundObjectWithQuery request,\n        StreamPart stream\n    );\n}\n\npublic class PathBoundList\n{\n    public List<int> Values { get; set; }\n}\n\npublic class PathBoundDerivedObject : PathBoundObject\n{\n    public string SomeProperty3 { get; set; }\n}\n\npublic class PathBoundObject\n{\n    public int SomeProperty { get; set; }\n\n    public string SomeProperty2 { get; set; }\n}\n\npublic class PathBoundObjectWithQuery\n{\n    public int SomeProperty { get; set; }\n\n    public string SomeProperty2 { get; set; }\n\n    [Query]\n    public string SomeQuery { get; set; }\n}\n\npublic class PathBoundObjectWithQueryFormat\n{\n    [Query(Format = \"yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'\")]\n    public DateTime SomeQueryWithFormat { get; set; }\n}\n\npublic interface INoRefitHereBuddy\n{\n    Task Post();\n}\n\npublic interface IAmHalfRefit\n{\n    [Post(\"/anything\")]\n    Task Post();\n\n    Task Get();\n}\n\npublic interface IRefitInterfaceWithStaticMethod\n{\n    [Get(\"\")]\n    Task Get();\n\n#if NETCOREAPP3_1_OR_GREATER\n    public static IRefitInterfaceWithStaticMethod Create()\n    {\n        // This is a C# 8 factory method\n\n        return RestService.For<IRefitInterfaceWithStaticMethod>(\"http://foo/\");\n    }\n#endif\n}\n\npublic class ErrorResponse\n{\n    public string[] Errors { get; set; }\n}\n\npublic interface IHttpBinApi<TResponse, in TParam, in THeader>\n    where TResponse : class\n    where THeader : struct\n{\n    [Get(\"\")]\n    Task<TResponse> Get(TParam param, [Header(\"X-Refit\")] THeader header);\n\n    [Get(\"/get?hardcoded=true\")]\n    Task<TResponse> GetQuery([Query(\"_\")] TParam param);\n\n    [Post(\"/post?hardcoded=true\")]\n    Task<TResponse> PostQuery([Query(\"_\")] TParam param);\n\n    [Get(\"\")]\n    Task<TResponse> GetQueryWithIncludeParameterName([Query(\".\", \"search\")] TParam param);\n\n    [Get(\"/get?hardcoded=true\")]\n    Task<TValue> GetQuery1<TValue>([Query(\"_\")] TParam param);\n}\n\npublic interface IBrokenWebApi\n{\n    [Post(\"/what-spec\")]\n    Task<bool> PostAValue([Body] string derp);\n}\n\npublic interface IHttpContentApi\n{\n    [Post(\"/blah\")]\n    Task<HttpContent> PostFileUpload([Body] HttpContent content);\n\n    [Post(\"/blah\")]\n    Task<ApiResponse<HttpContent>> PostFileUploadWithMetadata([Body] HttpContent content);\n}\n\npublic interface IStreamApi\n{\n    [Post(\"/{filename}\")]\n    Task<Stream> GetRemoteFile(string filename);\n\n    [Post(\"/{filename}\")]\n    Task<ApiResponse<Stream>> GetRemoteFileWithMetadata(string filename);\n}\n\npublic interface IApiWithDecimal\n{\n    [Get(\"/withDecimal\")]\n    Task<string> GetWithDecimal(decimal value);\n}\n\npublic interface IBodylessApi\n{\n    [Post(\"/nobody\")]\n    [Headers(\"Content-Type: application/x-www-form-urlencoded; charset=UTF-8\")]\n    Task Post();\n\n    [Get(\"/nobody\")]\n    [Headers(\"Content-Type: application/x-www-form-urlencoded; charset=UTF-8\")]\n    Task Get();\n\n    [Head(\"/nobody\")]\n    [Headers(\"Content-Type: application/x-www-form-urlencoded; charset=UTF-8\")]\n    Task Head();\n}\n\npublic interface ITrimTrailingForwardSlashApi\n{\n    HttpClient Client { get; }\n\n    [Get(\"/someendpoint\")]\n    Task Get();\n}\n\npublic interface IValidApi\n{\n    [Get(\"/someendpoint\")]\n    Task Get();\n}\n\npublic interface IQueryApi\n{\n    [Get(\"/foo?\")]\n    Task EmptyQuery();\n\n    [Get(\"/foo?     \")]\n    Task WhiteSpaceQuery();\n\n    [Get(\"/foo?=value\")]\n    Task EmptyQueryKey();\n\n    [Get(\"/foo?key=\")]\n    Task EmptyQueryValue();\n\n    [Get(\"/foo?=\")]\n    Task EmptyQueryKeyAndValue();\n\n    [Get(\"/foo?key,=value,&key1(=value1(\")]\n    Task UnescapedQuery();\n\n    [Get(\"/foo?key%2C=value%2C&key1%28=value1%28\")]\n    Task EscapedQuery();\n\n    [Get(\"/foo?{key}={value}\")]\n    Task ParameterMappedQuery(string key, string value);\n\n    [Get(\"/foo\")]\n    Task NullableIntCollectionQuery([Query] int?[] values);\n}\n\npublic interface IFragmentApi\n{\n    [Get(\"/foo#name\")]\n    Task Fragment();\n\n    [Get(\"/foo#\")]\n    Task EmptyFragment();\n\n    [Get(\"/foo#first#second\")]\n    Task ManyFragments();\n\n    [Get(\"/foo#{frag}\")]\n    Task ParameterFragment(string frag);\n\n    [Get(\"/foo?key=value#name\")]\n    Task FragmentAfterQuery();\n\n    [Get(\"/foo#?key=value\")]\n    Task QueryAfterFragment();\n}\n\npublic interface ICancellableApi\n{\n    [Get(\"/foo\")]\n    Task GetWithCancellation(CancellationToken token = default);\n\n    [Get(\"/foo\")]\n    Task<string> GetWithCancellationAndReturn(CancellationToken token = default);\n\n    [Get(\"/foo\")]\n    Task GetWithNullableCancellation(CancellationToken? token);\n}\n\npublic class HttpBinGet\n{\n    public Dictionary<string, object> Args { get; set; }\n    public Dictionary<string, string> Headers { get; set; }\n    public string Origin { get; set; }\n    public string Url { get; set; }\n}\n\npublic class RestServiceIntegrationTests\n{\n#if NETCOREAPP3_1_OR_GREATER\n    [Fact]\n    public void CanCreateInstanceUsingStaticMethod()\n    {\n        var instance = IRefitInterfaceWithStaticMethod.Create();\n\n        Assert.NotNull(instance);\n    }\n#endif\n\n    [Fact]\n    public async Task CanAddContentHeadersToPostWithoutBody()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://foo/nobody\")\n            // The content length header is set automatically by the HttpContent instance,\n            // so checking the header as a string doesn't work\n            .With(r => r.Content?.Headers.ContentLength == 0)\n            // But we added content type ourselves, so this should work\n            .WithHeaders(\"Content-Type\", \"application/x-www-form-urlencoded; charset=UTF-8\")\n            .WithContent(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var fixture = RestService.For<IBodylessApi>(\"http://foo\", settings);\n\n        await fixture.Post();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithNoParametersTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/someendpoint\")\n            .WithExactQueryString(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<ITrimTrailingForwardSlashApi>(\"http://foo\", settings);\n\n        await fixture.Get();\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task BaseAddressFromHttpClientMatchesTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/someendpoint\")\n            .WithExactQueryString(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var client = new HttpClient(mockHttp) { BaseAddress = new Uri(\"http://foo\") };\n\n        var fixture = RestService.For<ITrimTrailingForwardSlashApi>(client);\n\n        await fixture.Get();\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task BaseAddressWithTrailingSlashFromHttpClientMatchesTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/someendpoint\")\n            .WithExactQueryString(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var client = new HttpClient(mockHttp) { BaseAddress = new Uri(\"http://foo/\") };\n\n        var fixture = RestService.For<ITrimTrailingForwardSlashApi>(client);\n\n        await fixture.Get();\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task BaseAddressWithTrailingSlashCalledBeforeFromHttpClientMatchesTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/someendpoint\")\n            .WithExactQueryString(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var client = new HttpClient(mockHttp) { BaseAddress = new Uri(\"http://foo/\") };\n\n        _ = await client.GetAsync(new Uri(\"/firstRequest\", UriKind.RelativeOrAbsolute));\n\n        var fixture = RestService.For<ITrimTrailingForwardSlashApi>(client);\n\n        await fixture.Get();\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithNoParametersTestTrailingSlashInBase()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/someendpoint\")\n            .WithExactQueryString(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<ITrimTrailingForwardSlashApi>(\"http://foo/\", settings);\n\n        await fixture.Get();\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithPathBoundObject()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/foos/1/bar/barNone\")\n            .WithExactQueryString(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetFooBars(\n            new PathBoundObject() { SomeProperty = 1, SomeProperty2 = \"barNone\" }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithLongPathBoundObject()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var longPathString = string.Concat(Enumerable.Repeat(\"barNone\", 1000));\n        mockHttp\n            .Expect(HttpMethod.Get, $\"http://foo/foos/12345/bar/{longPathString}\")\n            .WithExactQueryString(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetFooBars(\n            new PathBoundObject() { SomeProperty = 12345, SomeProperty2 = longPathString }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithPathBoundObjectDifferentCasing()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/foos/1/bar/barNone\")\n            .WithExactQueryString(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetFooBarsWithDifferentCasing(\n            new PathBoundObject() { SomeProperty = 1, SomeProperty2 = \"barNone\" }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithPathBoundObjectAndParameter()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/foos/myId/22/bar/bart\")\n            .WithExactQueryString(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetBarsByFoo(\n            \"myId\",\n            new PathBoundObject() { SomeProperty = 22, SomeProperty2 = \"bart\" }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithPathBoundObjectAndParameterParameterPrecedence()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/foos/chooseMe/bar/barNone\")\n            .WithExactQueryString(new[] { new KeyValuePair<string, string>(\"SomeProperty\", \"1\") })\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetFooBars(\n            new PathBoundObject() { SomeProperty = 1, SomeProperty2 = \"barNone\" },\n            \"chooseMe\"\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithPathBoundDerivedObject()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/foos/1/bar/test\")\n            .WithExactQueryString(\n                new[] { new KeyValuePair<string, string>(\"SomeProperty2\", \"barNone\") }\n            )\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetFooBarsDerived(\n            new PathBoundDerivedObject()\n            {\n                SomeProperty = 1,\n                SomeProperty2 = \"barNone\",\n                SomeProperty3 = \"test\"\n            }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithDerivedObjectAsBaseType()\n    {\n        // possibly a bug see https://github.com/reactiveui/refit/issues/1882\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/foos/1/bar\")\n            .WithExactQueryString(\n                new[]\n                {\n                    new KeyValuePair<string, string>(\"SomeProperty3\", \"test\"),\n                    new KeyValuePair<string, string>(\"SomeProperty2\", \"barNone\"),\n                    new KeyValuePair<string, string>(\"SomeProperty\", \"1\")\n                }\n            )\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetBarsByFoo(\n            new PathBoundDerivedObject()\n            {\n                SomeProperty = 1,\n                SomeProperty2 = \"barNone\",\n                SomeProperty3 = \"test\"\n            }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithPathBoundObjectAndQueryParameter()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/foos/22/bar\")\n            .WithExactQueryString(\n                new[] { new KeyValuePair<string, string>(\"SomeProperty2\", \"bart\") }\n            )\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetBarsByFoo(\n            new PathBoundObject() { SomeProperty = 22, SomeProperty2 = \"bart\" }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostFooBarPathBoundObject()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://foo/foos/22/bar/bart\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.PostFooBar(\n            new PathBoundObject() { SomeProperty = 22, SomeProperty2 = \"bart\" },\n            new { }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PathBoundObjectsRespectFormatter()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/foos/22%2C23\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            UrlParameterFormatter = new TestEnumerableUrlParameterFormatter()\n        };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetFoos(\n            new PathBoundList()\n            {\n                Values = new List<int>() { 22, 23 }\n            }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithPathBoundObjectAndQuery()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/foos/1/bar/barNone\")\n            .WithExactQueryString(\"SomeQuery=test\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetFooBars(\n            new PathBoundObjectWithQuery()\n            {\n                SomeProperty = 1,\n                SomeProperty2 = \"barNone\",\n                SomeQuery = \"test\"\n            }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithPathBoundObjectAndQueryWithFormat()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/foo\")\n            .WithExactQueryString(\"SomeQueryWithFormat=2020-03-05T13:55:00Z\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.GetBarsWithCustomQueryFormat(\n            new PathBoundObjectWithQueryFormat\n            {\n                SomeQueryWithFormat = new DateTime(2020, 03, 05, 13, 55, 00)\n            }\n        );\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithPathBoundObjectAndQueryObject()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://foo/foos/1/bar/barNone\")\n            .WithExactQueryString(\"Property1=test&Property2=test2\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        await fixture.PostFooBar(\n            new PathBoundObject() { SomeProperty = 1, SomeProperty2 = \"barNone\" },\n            new ModelObject() { Property1 = \"test\", Property2 = \"test2\" }\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostFooBarPathMultipart()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://foo/foos/22/bar/bar\")\n            .WithExactQueryString(\"\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n        await fixture.PostFooBarStreamPart(\n            new PathBoundObject() { SomeProperty = 22, SomeProperty2 = \"bar\" },\n            new StreamPart(stream, \"Test.pdf\", \"application/pdf\")\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostFooBarPathQueryMultipart()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://foo/foos/22/bar/bar\")\n            .WithExactQueryString(\"SomeQuery=test\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n        await fixture.PostFooBarStreamPart(\n            new PathBoundObjectWithQuery()\n            {\n                SomeProperty = 22,\n                SomeProperty2 = \"bar\",\n                SomeQuery = \"test\"\n            },\n            new StreamPart(stream, \"Test.pdf\", \"application/pdf\")\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostFooBarPathQueryObjectMultipart()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://foo/foos/22/bar/bar\")\n            .WithExactQueryString(\"Property1=test&Property2=test2\")\n            .Respond(\"application/json\", \"Ok\");\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n        var fixture = RestService.For<IApiBindPathToObject>(\"http://foo\", settings);\n\n        using var stream = GetTestFileStream(\"Test Files/Test.pdf\");\n        await fixture.PostFooBarStreamPart(\n            new PathBoundObject { SomeProperty = 22, SomeProperty2 = \"bar\" },\n            new ModelObject() { Property1 = \"test\", Property2 = \"test2\" },\n            new StreamPart(stream, \"Test.pdf\", \"application/pdf\")\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task DoesntAddAutoAddContentToGetRequest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/nobody\")\n            // We can't add HttpContent to a GET request,\n            // because HttpClient doesn't allow it and it will\n            // blow up at runtime\n            .With(r => r.Content == null)\n            .Respond(\"application/json\", \"Ok\");\n\n        var fixture = RestService.For<IBodylessApi>(\"http://foo\", settings);\n\n        await fixture.Get();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task DoesntAddAutoAddContentToHeadRequest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Head, \"http://foo/nobody\")\n            // We can't add HttpContent to a HEAD request,\n            // because HttpClient doesn't allow it and it will\n            // blow up at runtime\n            .With(r => r.Content == null)\n            .Respond(\"application/json\", \"Ok\");\n\n        var fixture = RestService.For<IBodylessApi>(\"http://foo\", settings);\n\n        await fixture.Head();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task GetWithDecimal()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/withDecimal\")\n            .WithExactQueryString(new[] { new KeyValuePair<string, string>(\"value\", \"3.456\") })\n            .Respond(\"application/json\", \"Ok\");\n\n        var fixture = RestService.For<IApiWithDecimal>(\"http://foo\", settings);\n\n        const decimal val = 3.456M;\n\n        var result = await fixture.GetWithDecimal(val);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitTheGitHubUserApiAsApiResponse()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        var responseMessage = new HttpResponseMessage()\n        {\n            StatusCode = HttpStatusCode.OK,\n            Content = new StringContent(\n                \"{ 'login':'octocat', 'avatar_url':'http://foo/bar' }\",\n                System.Text.Encoding.UTF8,\n                \"application/json\"\n            ),\n        };\n        responseMessage.Headers.Add(\"Cookie\", \"Value\");\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/users/octocat\")\n            .Respond(req => responseMessage);\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await fixture.GetUserWithMetadata(\"octocat\");\n\n        Assert.True(result.Headers.Any());\n        Assert.True(result.IsSuccessStatusCode);\n        Assert.NotNull(result.ReasonPhrase);\n        Assert.NotNull(result.RequestMessage);\n        Assert.False(result.StatusCode == default);\n        Assert.NotNull(result.Version);\n        Assert.Equal(\"octocat\", result.Content.Login);\n        Assert.False(string.IsNullOrEmpty(result.Content.AvatarUrl));\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitTheNonExistentApiAsApiResponse()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/give-me-some-404-action\")\n            .Respond(HttpStatusCode.NotFound);\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        using var result = await fixture.NothingToSeeHereWithMetadata();\n        Assert.False(result.IsSuccessStatusCode);\n        Assert.NotNull(result.ReasonPhrase);\n        Assert.NotNull(result.RequestMessage);\n        Assert.True(result.StatusCode == HttpStatusCode.NotFound);\n        Assert.NotNull(result.Version);\n        Assert.Null(result.Content);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitTheNonExistentApi()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/give-me-some-404-action\")\n            .Respond(HttpStatusCode.NotFound);\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        try\n        {\n            var result = await fixture.NothingToSeeHere();\n        }\n        catch (Exception ex)\n        {\n            Assert.IsType<ApiException>(ex);\n        }\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitTheGitHubUserApiAsObservableApiResponse()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        var responseMessage = new HttpResponseMessage()\n        {\n            StatusCode = HttpStatusCode.OK,\n            Content = new StringContent(\n                \"{ 'login':'octocat', 'avatar_url':'http://foo/bar' }\",\n                System.Text.Encoding.UTF8,\n                \"application/json\"\n            ),\n        };\n        responseMessage.Headers.Add(\"Cookie\", \"Value\");\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/users/octocat\")\n            .Respond(req => responseMessage);\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await fixture\n            .GetUserObservableWithMetadata(\"octocat\")\n            .Timeout(TimeSpan.FromSeconds(10));\n\n        Assert.True(result.Headers.Any());\n        Assert.True(result.IsSuccessStatusCode);\n        Assert.NotNull(result.ReasonPhrase);\n        Assert.NotNull(result.RequestMessage);\n        Assert.False(result.StatusCode == default);\n        Assert.NotNull(result.Version);\n        Assert.Equal(\"octocat\", result.Content.Login);\n        Assert.False(string.IsNullOrEmpty(result.Content.AvatarUrl));\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitTheGitHubUserApiAsObservableIApiResponse()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        var responseMessage = new HttpResponseMessage()\n        {\n            StatusCode = HttpStatusCode.OK,\n            Content = new StringContent(\n                \"{ 'login':'octocat', 'avatar_url':'http://foo/bar' }\",\n                System.Text.Encoding.UTF8,\n                \"application/json\"\n            ),\n        };\n        responseMessage.Headers.Add(\"Cookie\", \"Value\");\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/users/octocat\")\n            .Respond(req => responseMessage);\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await fixture\n            .GetUserIApiResponseObservableWithMetadata(\"octocat\")\n            .Timeout(TimeSpan.FromSeconds(10));\n\n        Assert.True(result.Headers.Any());\n        Assert.True(result.IsSuccessStatusCode);\n        Assert.NotNull(result.ReasonPhrase);\n        Assert.NotNull(result.RequestMessage);\n        Assert.False(result.StatusCode == default);\n        Assert.NotNull(result.Version);\n        Assert.Equal(\"octocat\", result.Content.Login);\n        Assert.False(string.IsNullOrEmpty(result.Content.AvatarUrl));\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitTheGitHubUserApi()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/users/octocat\")\n            .Respond(\"application/json\", \"{ 'login':'octocat', 'avatar_url':'http://foo/bar' }\");\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await fixture.GetUser(\"octocat\");\n\n        Assert.Equal(\"octocat\", result.Login);\n        Assert.False(string.IsNullOrEmpty(result.AvatarUrl));\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitWithCamelCaseParameter()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/users/octocat\")\n            .Respond(\"application/json\", \"{ 'login':'octocat', 'avatar_url':'http://foo/bar' }\");\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await fixture.GetUserCamelCase(\"octocat\");\n\n        Assert.Equal(\"octocat\", result.Login);\n        Assert.False(string.IsNullOrEmpty(result.AvatarUrl));\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitTheGitHubOrgMembersApi()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/orgs/github/members\")\n            .Respond(\n                \"application/json\",\n                \"[{ 'login':'octocat', 'avatar_url':'http://foo/bar', 'type':'User'}]\"\n            );\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await fixture.GetOrgMembers(\"github\");\n\n        Assert.True(result.Count > 0);\n        Assert.Contains(result, member => member.Type == \"User\");\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitTheGitHubOrgMembersApiInParallel()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/orgs/github/members\")\n            .Respond(\n                \"application/json\",\n                \"[{ 'login':'octocat', 'avatar_url':'http://foo/bar', 'type':'User'}]\"\n            );\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/orgs/github/members\")\n            .Respond(\n                \"application/json\",\n                \"[{ 'login':'octocat', 'avatar_url':'http://foo/bar', 'type':'User'}]\"\n            );\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var task1 = fixture.GetOrgMembers(\"github\");\n        var task2 = fixture.GetOrgMembers(\"github\");\n\n        await Task.WhenAll(task1, task2);\n\n        Assert.True(task1.Result.Count > 0);\n        Assert.Contains(task1.Result, member => member.Type == \"User\");\n\n        Assert.True(task2.Result.Count > 0);\n        Assert.Contains(task2.Result, member => member.Type == \"User\");\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task RequestCanceledBeforeResponseRead()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        var cts = new CancellationTokenSource();\n\n        mockHttp\n            .When(HttpMethod.Get, \"https://api.github.com/orgs/github/members\")\n            .Respond(req =>\n            {\n                // Cancel the request\n                cts.Cancel();\n\n                return new HttpResponseMessage(HttpStatusCode.OK)\n                {\n                    Content = new StringContent(\n                        \"[{ 'login':'octocat', 'avatar_url':'http://foo/bar', 'type':'User'}]\",\n                        Encoding.UTF8,\n                        \"application/json\"\n                    )\n                };\n            });\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await Assert.ThrowsAsync<TaskCanceledException>(\n            async () => await fixture.GetOrgMembers(\"github\", cts.Token)\n        );\n\n        AssertStackTraceContains(nameof(IGitHubApi.GetOrgMembers), result.StackTrace);\n    }\n\n    [Fact]\n    public async Task HitTheGitHubUserSearchApi()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/search/users\")\n            .WithQueryString(\"q\", \"tom repos:>42 followers:>1000\")\n            .Respond(\n                \"application/json\",\n                \"{ 'total_count': 1, 'items': [{ 'login':'octocat', 'avatar_url':'http://foo/bar', 'type':'User'}]}\"\n            );\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await fixture.FindUsers(\"tom repos:>42 followers:>1000\");\n\n        Assert.True(result.TotalCount > 0);\n        Assert.Contains(result.Items, member => member.Type == \"User\");\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitTheGitHubUserApiAsObservable()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://api.github.com/users/octocat\")\n            .Respond(\"application/json\", \"{ 'login':'octocat', 'avatar_url':'http://foo/bar' }\");\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await fixture.GetUserObservable(\"octocat\").Timeout(TimeSpan.FromSeconds(10));\n\n        Assert.Equal(\"octocat\", result.Login);\n        Assert.False(string.IsNullOrEmpty(result.AvatarUrl));\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task HitTheGitHubUserApiAsObservableAndSubscribeAfterTheFact()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .When(HttpMethod.Get, \"https://api.github.com/users/octocat\")\n            .Respond(\"application/json\", \"{ 'login':'octocat', 'avatar_url':'http://foo/bar' }\");\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var obs = fixture.GetUserObservable(\"octocat\").Timeout(TimeSpan.FromSeconds(10));\n\n        // NB: We're gonna await twice, so that the 2nd await is definitely\n        // after the result has completed.\n        await obs;\n        var result2 = await obs;\n        Assert.Equal(\"octocat\", result2.Login);\n        Assert.False(string.IsNullOrEmpty(result2.AvatarUrl));\n    }\n\n    [Fact]\n    public async Task TwoSubscriptionsResultInTwoRequests()\n    {\n        var input = new TestHttpMessageHandler\n        {\n            // we need to use a factory here to ensure each request gets its own httpcontent instance\n            ContentFactory = () => new StringContent(\"test\")\n        };\n\n        var client = new HttpClient(input) { BaseAddress = new Uri(\"http://foo\") };\n        var fixture = RestService.For<IGitHubApi>(client);\n\n        Assert.Equal(0, input.MessagesSent);\n\n        var obs = fixture.GetIndexObservable().Timeout(TimeSpan.FromSeconds(10));\n\n        var result1 = await obs;\n        Assert.Equal(1, input.MessagesSent);\n\n        var result2 = await obs;\n        Assert.Equal(2, input.MessagesSent);\n\n        // NB: TestHttpMessageHandler returns what we tell it to ('test' by default)\n        Assert.Contains(\"test\", result1);\n        Assert.Contains(\"test\", result2);\n    }\n\n    [Fact]\n    public async Task ShouldRetHttpResponseMessage()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp.When(HttpMethod.Get, \"https://api.github.com/\").Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n        var result = await fixture.GetIndex();\n\n        Assert.NotNull(result);\n        Assert.True(result.IsSuccessStatusCode);\n    }\n\n    [Fact]\n    public async Task ShouldRetHttpResponseMessageWithNestedInterface()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp.When(HttpMethod.Get, \"https://api.github.com/\").Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<TestNested.INestedGitHubApi>(\n            \"https://api.github.com\",\n            settings\n        );\n        var result = await fixture.GetIndex();\n\n        Assert.NotNull(result);\n        Assert.True(result.IsSuccessStatusCode);\n    }\n\n    [Fact]\n    public async Task HitTheNpmJs()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://registry.npmjs.org/congruence\")\n            .Respond(\n                \"application/json\",\n                \"{ \\\"_id\\\":\\\"congruence\\\", \\\"_rev\\\":\\\"rev\\\" , \\\"name\\\":\\\"name\\\"}\"\n            );\n\n        var fixture = RestService.For<INpmJs>(\"https://registry.npmjs.org\", settings);\n        var result = await fixture.GetCongruence();\n\n        Assert.Equal(\"congruence\", result._id);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostToRequestBin()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp.Expect(HttpMethod.Post, \"http://httpbin.org/1h3a5jm1\").Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IRequestBin>(\"http://httpbin.org/\", settings);\n\n        await fixture.Post();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostStringDefaultToRequestBin()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://httpbin.org/foo\")\n            .WithContent(\"raw string\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IRequestBin>(\"http://httpbin.org/\", settings);\n\n        await fixture.PostRawStringDefault(\"raw string\");\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostStringJsonToRequestBin()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://httpbin.org/foo\")\n            .WithContent(\"\\\"json string\\\"\")\n            .WithHeaders(\"Content-Type\", \"application/json; charset=utf-8\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IRequestBin>(\"http://httpbin.org/\", settings);\n\n        await fixture.PostRawStringJson(\"json string\");\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostStringUrlToRequestBin()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://httpbin.org/foo\")\n            .WithContent(\"url%26string\")\n            .WithHeaders(\"Content-Type\", \"application/x-www-form-urlencoded; charset=utf-8\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IRequestBin>(\"http://httpbin.org/\", settings);\n\n        await fixture.PostRawStringUrlEncoded(\"url&string\");\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostToRequestBinWithGenerics()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp.Expect(HttpMethod.Post, \"http://httpbin.org/1h3a5jm1\").Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IRequestBin>(\"http://httpbin.org/\", settings);\n\n        await fixture.PostGeneric(5);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n\n        mockHttp.ResetExpectations();\n\n        mockHttp.Expect(HttpMethod.Post, \"http://httpbin.org/1h3a5jm1\").Respond(HttpStatusCode.OK);\n\n        await fixture.PostGeneric(\"4\");\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostWithVoidReturnBufferedBodyExpectContentLengthHeader()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        var postBody = new Dictionary<string, string> { { \"some\", \"body\" }, { \"once\", \"told me\" } };\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://httpbin.org/foo\")\n            .With(request => request.Content?.Headers.ContentLength > 0)\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IRequestBin>(\"http://httpbin.org/\", settings);\n\n        await fixture.PostVoidReturnBodyBuffered(postBody);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task PostWithNonVoidReturnBufferedBodyExpectContentLengthHeader()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        var postBody = new Dictionary<string, string> { { \"some\", \"body\" }, { \"once\", \"told me\" } };\n        const string expectedResponse = \"some response\";\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://httpbin.org/foo\")\n            .With(request => request.Content?.Headers.ContentLength > 0)\n            .Respond(\"text/plain\", expectedResponse);\n\n        var fixture = RestService.For<IRequestBin>(\"http://httpbin.org/\", settings);\n\n        var result = await fixture.PostNonVoidReturnBodyBuffered(postBody);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n\n        Assert.Equal(expectedResponse, result);\n    }\n\n    [Fact]\n    public async Task UseMethodWithArgumentsParameter()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        var fixture = RestService.For<IRequestBin>(\"http://httpbin.org/\", settings);\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://httpbin.org/foo/something\")\n            .Respond(HttpStatusCode.OK);\n\n        await fixture.SomeApiThatUsesVariableNameFromCodeGen(\"something\");\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task CanGetDataOutOfErrorResponses()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .When(HttpMethod.Get, \"https://api.github.com/give-me-some-404-action\")\n            .Respond(\n                HttpStatusCode.NotFound,\n                \"application/json\",\n                \"{'message': 'Not Found', 'documentation_url': 'http://foo/bar'}\"\n            );\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n        try\n        {\n            await fixture.NothingToSeeHere();\n            Assert.True(false);\n        }\n        catch (ApiException exception)\n        {\n            Assert.Equal(HttpStatusCode.NotFound, exception.StatusCode);\n            var content = await exception.GetContentAsAsync<Dictionary<string, string>>();\n\n            Assert.Equal(\"Not Found\", content[\"message\"]);\n            Assert.NotNull(content[\"documentation_url\"]);\n        }\n    }\n\n    [Fact]\n    public async Task CanSerializeBigData()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new SystemTextJsonContentSerializer()\n        };\n\n        var bigObject = new BigObject\n        {\n            BigData = Enumerable.Range(0, 800000).Select(x => (byte)(x % 256)).ToArray()\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"http://httpbin.org/big\")\n            .With(m =>\n            {\n                async Task<bool> T()\n                {\n                    using var s = await m.Content.ReadAsStreamAsync();\n                    var it = await System.Text.Json.JsonSerializer.DeserializeAsync<BigObject>(\n                        s,\n                        new System.Text.Json.JsonSerializerOptions\n                        {\n                            PropertyNamingPolicy = System.Text.Json.JsonNamingPolicy.CamelCase\n                        }\n                    );\n                    return it.BigData.SequenceEqual(bigObject.BigData);\n                }\n\n                return T().Result;\n            })\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IRequestBin>(\"http://httpbin.org/\", settings);\n\n        await fixture.PostBig(bigObject);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ErrorsFromApiReturnErrorContent()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"https://api.github.com/users\")\n            .Respond(\n                HttpStatusCode.BadRequest,\n                \"application/json\",\n                \"{ 'errors': [ 'error1', 'message' ]}\"\n            );\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await Assert.ThrowsAsync<ApiException>(\n            async () => await fixture.CreateUser(new User { Name = \"foo\" })\n        );\n\n        AssertStackTraceContains(nameof(IGitHubApi.CreateUser), result.StackTrace);\n\n        var errors = await result.GetContentAsAsync<ErrorResponse>();\n\n        Assert.Contains(\"error1\", errors.Errors);\n        Assert.Contains(\"message\", errors.Errors);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ErrorsFromApiReturnErrorContentWhenApiResponse()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = new NewtonsoftJsonContentSerializer(\n                new JsonSerializerSettings()\n                {\n                    ContractResolver = new SnakeCasePropertyNamesContractResolver()\n                }\n            )\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"https://api.github.com/users\")\n            .Respond(\n                HttpStatusCode.BadRequest,\n                \"application/json\",\n                \"{ 'errors': [ 'error1', 'message' ]}\"\n            );\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        using var response = await fixture.CreateUserWithMetadata(new User { Name = \"foo\" });\n        Assert.False(response.IsSuccessStatusCode);\n        Assert.NotNull(response.Error);\n\n        var errors = await response.Error.GetContentAsAsync<ErrorResponse>();\n\n        Assert.Contains(\"error1\", errors.Errors);\n        Assert.Contains(\"message\", errors.Errors);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public void NonRefitInterfacesThrowMeaningfulExceptions()\n    {\n        try\n        {\n            RestService.For<INoRefitHereBuddy>(\"http://example.com\");\n        }\n        catch (InvalidOperationException exception)\n        {\n            Assert.StartsWith(\"INoRefitHereBuddy\", exception.Message, StringComparison.Ordinal);\n            Assert.Contains(\"Refit source generator\", exception.Message, StringComparison.Ordinal);\n            Assert.Contains(\"Native AOT\", exception.Message, StringComparison.Ordinal);\n        }\n    }\n\n    [Fact]\n    public async Task NonRefitMethodsThrowMeaningfulExceptions()\n    {\n        try\n        {\n            var fixture = RestService.For<IAmHalfRefit>(\"http://example.com\");\n            await fixture.Get();\n        }\n        catch (NotImplementedException exception)\n        {\n            Assert.Contains(\"no Refit HTTP method attribute\", exception.Message);\n        }\n    }\n\n    [Fact]\n    public async Task GenericsWork()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://httpbin.org/get\")\n            .WithHeaders(\"X-Refit\", \"99\")\n            .WithQueryString(\"param\", \"foo\")\n            .Respond(\n                \"application/json\",\n                \"{\\\"url\\\": \\\"http://httpbin.org/get?param=foo\\\", \\\"args\\\": {\\\"param\\\": \\\"foo\\\"}, \\\"headers\\\":{\\\"X-Refit\\\":\\\"99\\\"}}\"\n            );\n\n        var fixture = RestService.For<IHttpBinApi<HttpBinGet, string, int>>(\n            \"http://httpbin.org/get\",\n            settings\n        );\n\n        var result = await fixture.Get(\"foo\", 99);\n\n        Assert.Equal(\"http://httpbin.org/get?param=foo\", result.Url);\n        Assert.Equal(\"foo\", result.Args[\"param\"]);\n        Assert.Equal(\"99\", result.Headers[\"X-Refit\"]);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ValueTypesArentValidButTheyWorkAnyway()\n    {\n        var handler = new TestHttpMessageHandler(\"true\");\n\n        var fixture = RestService.For<IBrokenWebApi>(\n            new HttpClient(handler) { BaseAddress = new Uri(\"http://nowhere.com\") }\n        );\n\n        var result = await fixture.PostAValue(\"Does this work?\");\n\n        Assert.True(result);\n    }\n\n    [Fact]\n    public async Task MissingBaseUrlThrowsArgumentException()\n    {\n        var client = new HttpClient(); // No BaseUrl specified\n\n        var fixture = RestService.For<IGitHubApi>(client);\n\n        // We should get an InvalidOperationException if we call a method without a base address set\n        var result = await Assert.ThrowsAsync<InvalidOperationException>(\n            async () => await fixture.GetUser(null)\n        );\n\n        AssertStackTraceContains(nameof(IGitHubApi.GetUser), result.StackTrace);\n    }\n\n    [Fact]\n    public async Task SimpleDynamicQueryparametersTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .WithHeaders(\"X-Refit\", \"99\")\n            .Respond(\n                \"application/json\",\n                \"{\\\"url\\\": \\\"https://httpbin.org/get?FirstName=John&LastName=Rambo\\\", \\\"args\\\": {\\\"FirstName\\\": \\\"John\\\", \\\"lName\\\": \\\"Rambo\\\"}}\"\n            );\n\n        var myParams = new MySimpleQueryParams { FirstName = \"John\", LastName = \"Rambo\" };\n\n        var fixture = RestService.For<IHttpBinApi<HttpBinGet, MySimpleQueryParams, int>>(\n            \"https://httpbin.org/get\",\n            settings\n        );\n\n        var resp = await fixture.Get(myParams, 99);\n\n        Assert.Equal(\"John\", resp.Args[\"FirstName\"]);\n        Assert.Equal(\"Rambo\", resp.Args[\"lName\"]);\n    }\n\n    [Fact]\n    public async Task ComplexDynamicQueryparametersTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\n                \"application/json\",\n                \"{\\\"url\\\": \\\"https://httpbin.org/get?hardcoded=true&FirstName=John&LastName=Rambo&Addr_Zip=9999&Addr_Street=HomeStreet 99&MetaData_Age=99&MetaData_Initials=JR&MetaData_Birthday=10%2F31%2F1918 4%3A21%3A16 PM&Other=12345&Other=10%2F31%2F2017 4%3A21%3A17 PM&Other=696e8653-6671-4484-a65f-9485af95fd3a\\\", \\\"args\\\": { \\\"Addr_Street\\\": \\\"HomeStreet 99\\\", \\\"Addr_Zip\\\": \\\"9999\\\", \\\"FirstName\\\": \\\"John\\\", \\\"LastName\\\": \\\"Rambo\\\", \\\"MetaData_Age\\\": \\\"99\\\", \\\"MetaData_Birthday\\\": \\\"10/31/1981 4:32:59 PM\\\", \\\"MetaData_Initials\\\": \\\"JR\\\", \\\"Other\\\": [\\\"12345\\\",\\\"10/31/2017 4:32:59 PM\\\",\\\"60282dd2-f79a-4400-be01-bcb0e86e7bc6\\\"], \\\"hardcoded\\\": \\\"true\\\"}}\"\n            );\n\n        var myParams = new MyComplexQueryParams { FirstName = \"John\", LastName = \"Rambo\" };\n        myParams.Address.Postcode = 9999;\n        myParams.Address.Street = \"HomeStreet 99\";\n\n        myParams.MetaData.Add(\"Age\", 99);\n        myParams.MetaData.Add(\"Initials\", \"JR\");\n        myParams.MetaData.Add(\"Birthday\", new DateTime(1981, 10, 31, 16, 24, 59));\n\n        myParams.Other.Add(12345);\n        myParams.Other.Add(new DateTime(2017, 10, 31, 16, 24, 59));\n        myParams.Other.Add(new Guid(\"60282dd2-f79a-4400-be01-bcb0e86e7bc6\"));\n\n        var fixture = RestService.For<IHttpBinApi<HttpBinGet, MyComplexQueryParams, int>>(\n            \"https://httpbin.org\",\n            settings\n        );\n\n        var resp = await fixture.GetQuery(myParams);\n\n        Assert.Equal(\"John\", resp.Args[\"FirstName\"]);\n        Assert.Equal(\"Rambo\", resp.Args[\"LastName\"]);\n        Assert.Equal(\"9999\", resp.Args[\"Addr_Zip\"]);\n    }\n\n    [Fact]\n    public async Task ComplexPostDynamicQueryparametersTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"https://httpbin.org/post\")\n            .Respond(\n                \"application/json\",\n                \"{\\\"url\\\": \\\"https://httpbin.org/post?hardcoded=true&FirstName=John&LastName=Rambo&Addr_Zip=9999&Addr_Street=HomeStreet 99&MetaData_Age=99&MetaData_Initials=JR&MetaData_Birthday=10%2F31%2F1918 4%3A21%3A16 PM&Other=12345&Other=10%2F31%2F2017 4%3A21%3A17 PM&Other=696e8653-6671-4484-a65f-9485af95fd3a\\\", \\\"args\\\": { \\\"Addr_Street\\\": \\\"HomeStreet 99\\\", \\\"Addr_Zip\\\": \\\"9999\\\", \\\"FirstName\\\": \\\"John\\\", \\\"LastName\\\": \\\"Rambo\\\", \\\"MetaData_Age\\\": \\\"99\\\", \\\"MetaData_Birthday\\\": \\\"10/31/1981 4:32:59 PM\\\", \\\"MetaData_Initials\\\": \\\"JR\\\", \\\"Other\\\": [\\\"12345\\\",\\\"10/31/2017 4:32:59 PM\\\",\\\"60282dd2-f79a-4400-be01-bcb0e86e7bc6\\\"], \\\"hardcoded\\\": \\\"true\\\"}}\"\n            );\n\n        var myParams = new MyComplexQueryParams { FirstName = \"John\", LastName = \"Rambo\" };\n        myParams.Address.Postcode = 9999;\n        myParams.Address.Street = \"HomeStreet 99\";\n\n        myParams.MetaData.Add(\"Age\", 99);\n        myParams.MetaData.Add(\"Initials\", \"JR\");\n        myParams.MetaData.Add(\"Birthday\", new DateTime(1981, 10, 31, 16, 24, 59));\n\n        myParams.Other.Add(12345);\n        myParams.Other.Add(new DateTime(2017, 10, 31, 16, 24, 59));\n        myParams.Other.Add(new Guid(\"60282dd2-f79a-4400-be01-bcb0e86e7bc6\"));\n\n        var fixture = RestService.For<IHttpBinApi<HttpBinGet, MyComplexQueryParams, int>>(\n            \"https://httpbin.org\",\n            settings\n        );\n\n        var resp = await fixture.PostQuery(myParams);\n\n        Assert.Equal(\"John\", resp.Args[\"FirstName\"]);\n        Assert.Equal(\"Rambo\", resp.Args[\"LastName\"]);\n        Assert.Equal(\"9999\", resp.Args[\"Addr_Zip\"]);\n    }\n\n    [Fact]\n    public async Task GenericMethodTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        const string response = \"4\";\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\"application/json\", response);\n\n        var myParams = new Dictionary<string, object>\n        {\n            [\"FirstName\"] = \"John\",\n            [\"LastName\"] = \"Rambo\",\n            [\"Address\"] = new { Zip = 9999, Street = \"HomeStreet 99\" }\n        };\n\n        var fixture = RestService.For<IHttpBinApi<HttpBinGet, Dictionary<string, object>, int>>(\n            \"https://httpbin.org\",\n            settings\n        );\n\n        // Use the generic to get it as an ApiResponse of string\n        var resp = await fixture.GetQuery1<ApiResponse<string>>(myParams);\n        Assert.Equal(response, resp.Content);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\"application/json\", response);\n\n        // Get as string\n        var resp1 = await fixture.GetQuery1<string>(myParams);\n\n        Assert.Equal(response, resp1);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\"application/json\", response);\n\n        var resp2 = await fixture.GetQuery1<int>(myParams);\n        Assert.Equal(4, resp2);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task InheritedMethodTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        var fixture = RestService.For<IAmInterfaceC>(\"https://httpbin.org\", settings);\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\"application/json\", nameof(IAmInterfaceA.Ping));\n        var resp = await fixture.Ping();\n        Assert.Equal(nameof(IAmInterfaceA.Ping), resp);\n        mockHttp.VerifyNoOutstandingExpectation();\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\"application/json\", nameof(IAmInterfaceB.Pong));\n        resp = await fixture.Pong();\n        Assert.Equal(nameof(IAmInterfaceB.Pong), resp);\n        mockHttp.VerifyNoOutstandingExpectation();\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\"application/json\", nameof(IAmInterfaceC.Pang));\n        resp = await fixture.Pang();\n        Assert.Equal(nameof(IAmInterfaceC.Pang), resp);\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task InheritedInterfaceWithOnlyBaseMethodsTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        var fixture = RestService.For<IContainAandB>(\"https://httpbin.org\", settings);\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\"application/json\", nameof(IAmInterfaceA.Ping));\n        var resp = await fixture.Ping();\n        Assert.Equal(nameof(IAmInterfaceA.Ping), resp);\n        mockHttp.VerifyNoOutstandingExpectation();\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\"application/json\", nameof(IAmInterfaceB.Pong));\n        resp = await fixture.Pong();\n        Assert.Equal(nameof(IAmInterfaceB.Pong), resp);\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task InheritedInterfaceWithoutRefitInBaseMethodsTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        var fixture = RestService.For<IImplementTheInterfaceAndUseRefit>(\n            \"https://httpbin.org\",\n            settings\n        );\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/doSomething\")\n            .WithQueryString(\"parameter\", \"4\")\n            .Respond(\"application/json\", nameof(IImplementTheInterfaceAndUseRefit.DoSomething));\n\n        await fixture.DoSomething(4);\n        mockHttp.VerifyNoOutstandingExpectation();\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/DoSomethingElse\")\n            .Respond(\"application/json\", nameof(IImplementTheInterfaceAndUseRefit.DoSomethingElse));\n        await fixture.DoSomethingElse();\n        mockHttp.VerifyNoOutstandingExpectation();\n\n        // base non refit method should throw NotImplementedException\n        await Assert.ThrowsAsync<NotImplementedException>(\n            () => ((IAmInterfaceEWithNoRefit<int>)fixture).DoSomethingElse()\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task InheritedInterfaceWithoutRefitMethodsOverrideBaseTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        var fixture = RestService.For<IImplementTheInterfaceAndDontUseRefit>(\n            \"https://httpbin.org\",\n            settings\n        );\n\n        // inherited non refit method should throw NotImplementedException\n        await Assert.ThrowsAsync<NotImplementedException>(\n            () => fixture.Test()\n        );\n        mockHttp.VerifyNoOutstandingExpectation();\n\n        // base Refit method should respond\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .WithQueryString(\"result\", \"Test\")\n            .Respond(\"application/json\", nameof(IAmInterfaceD.Test));\n\n        await ((IAmInterfaceD)fixture).Test();\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task DictionaryDynamicQueryParametersTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\n                \"application/json\",\n                \"{\\\"url\\\": \\\"https://httpbin.org/get?hardcoded=true&FirstName=John&LastName=Rambo&Address_Zip=9999&Address_Street=HomeStreet 99\\\", \\\"args\\\": {\\\"Address_Street\\\": \\\"HomeStreet 99\\\",\\\"Address_Zip\\\": \\\"9999\\\",\\\"FirstName\\\": \\\"John\\\",\\\"LastName\\\": \\\"Rambo\\\",\\\"hardcoded\\\": \\\"true\\\"}}\"\n            );\n\n        var myParams = new Dictionary<string, object>\n        {\n            [\"FirstName\"] = \"John\",\n            [\"LastName\"] = \"Rambo\",\n            [\"Address\"] = new { Zip = 9999, Street = \"HomeStreet 99\" }\n        };\n\n        var fixture = RestService.For<IHttpBinApi<HttpBinGet, Dictionary<string, object>, int>>(\n            \"https://httpbin.org\",\n            settings\n        );\n\n        var resp = await fixture.GetQuery(myParams);\n\n        Assert.Equal(\"John\", resp.Args[\"FirstName\"]);\n        Assert.Equal(\"Rambo\", resp.Args[\"LastName\"]);\n        Assert.Equal(\"9999\", resp.Args[\"Address_Zip\"]);\n    }\n\n    [Fact]\n    public async Task ComplexDynamicQueryparametersTestWithIncludeParameterName()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://httpbin.org/get\")\n            .Respond(\n                \"application/json\",\n                \"{\\\"url\\\": \\\"https://httpbin.org/get?search.FirstName=John&search.LastName=Rambo&search.Addr.Zip=9999&search.Addr.Street=HomeStreet 99\\\", \\\"args\\\": {\\\"search.Addr.Street\\\": \\\"HomeStreet 99\\\",\\\"search.Addr.Zip\\\": \\\"9999\\\",\\\"search.FirstName\\\": \\\"John\\\",\\\"search.LastName\\\": \\\"Rambo\\\"}}\"\n            );\n\n        var myParams = new MyComplexQueryParams { FirstName = \"John\", LastName = \"Rambo\" };\n        myParams.Address.Postcode = 9999;\n        myParams.Address.Street = \"HomeStreet 99\";\n\n        var fixture = RestService.For<IHttpBinApi<HttpBinGet, MyComplexQueryParams, int>>(\n            \"https://httpbin.org/get\",\n            settings\n        );\n\n        var resp = await fixture.GetQueryWithIncludeParameterName(myParams);\n\n        Assert.Equal(\"John\", resp.Args[\"search.FirstName\"]);\n        Assert.Equal(\"Rambo\", resp.Args[\"search.LastName\"]);\n        Assert.Equal(\"9999\", resp.Args[\"search.Addr.Zip\"]);\n    }\n\n    [Fact]\n    public async Task ServiceOutsideNamespaceGetRequest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"http://foo/\")\n            // We can't add HttpContent to a GET request,\n            // because HttpClient doesn't allow it and it will\n            // blow up at runtime\n            .With(r => r.Content == null)\n            .Respond(\"application/json\", \"Ok\");\n\n        var fixture = RestService.For<IServiceWithoutNamespace>(\"http://foo\", settings);\n\n        await fixture.GetRoot();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ServiceOutsideNamespacePostRequest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp };\n\n        mockHttp.Expect(HttpMethod.Post, \"http://foo/\").Respond(\"application/json\", \"Ok\");\n\n        var fixture = RestService.For<IServiceWithoutNamespace>(\"http://foo\", settings);\n\n        await fixture.PostRoot();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task CanSerializeContentAsXml()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var contentSerializer = new XmlContentSerializer();\n        var settings = new RefitSettings\n        {\n            HttpMessageHandlerFactory = () => mockHttp,\n            ContentSerializer = contentSerializer\n        };\n\n        mockHttp\n            .Expect(HttpMethod.Post, \"/users\")\n            .WithHeaders(\"Content-Type:application/xml; charset=utf-8\")\n            .Respond(\n                req =>\n                    new HttpResponseMessage(HttpStatusCode.OK)\n                    {\n                        Content = new StringContent(\n                            \"<User><Name>Created</Name></User>\",\n                            Encoding.UTF8,\n                            \"application/xml\"\n                        )\n                    }\n            );\n\n        var fixture = RestService.For<IGitHubApi>(\"https://api.github.com\", settings);\n\n        var result = await fixture.CreateUser(new User()).ConfigureAwait(false);\n\n        Assert.Equal(\"Created\", result.Name);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public void ShouldTrimTrailingForwardSlashFromBaseUrl()\n    {\n        var expectedBaseAddress = \"http://example.com/api\";\n        var inputBaseAddress = \"http://example.com/api/\";\n\n        var fixture = RestService.For<ITrimTrailingForwardSlashApi>(inputBaseAddress);\n\n        Assert.Equal(fixture.Client.BaseAddress.AbsoluteUri, expectedBaseAddress);\n    }\n\n    [Fact]\n    public void ShouldThrowArgumentExceptionIfHostUrlIsNull()\n    {\n        try\n        {\n            RestService.For<IValidApi>(hostUrl: null);\n        }\n        catch (ArgumentException ex)\n        {\n            Assert.Equal(\"hostUrl\", ex.ParamName);\n            return;\n        }\n\n        Assert.Fail(\"Exception not thrown.\");\n    }\n\n    [Fact]\n    public void ShouldThrowArgumentExceptionIfHostUrlIsEmpty()\n    {\n        try\n        {\n            RestService.For<IValidApi>(hostUrl: \"\");\n        }\n        catch (ArgumentException ex)\n        {\n            Assert.Equal(\"hostUrl\", ex.ParamName);\n            return;\n        }\n\n        Assert.Fail(\"Exception not thrown.\");\n    }\n\n    [Fact]\n    public void ShouldThrowArgumentExceptionIfHostUrlIsWhitespace()\n    {\n        try\n        {\n            RestService.For<IValidApi>(hostUrl: \" \");\n        }\n        catch (ArgumentException ex)\n        {\n            Assert.Equal(\"hostUrl\", ex.ParamName);\n            return;\n        }\n\n        Assert.Fail(\"Exception not thrown.\");\n    }\n\n    [Fact]\n    public void NonGenericCreate()\n    {\n        var expectedBaseAddress = \"http://example.com/api\";\n        var inputBaseAddress = \"http://example.com/api/\";\n\n        var fixture =\n            RestService.For(typeof(ITrimTrailingForwardSlashApi), inputBaseAddress)\n            as ITrimTrailingForwardSlashApi;\n\n        Assert.Equal(fixture.Client.BaseAddress.AbsoluteUri, expectedBaseAddress);\n    }\n\n    [Fact]\n    public async Task EmptyQueryShouldBeEmpty()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo?\")\n            .WithExactQueryString(\"\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IQueryApi>(\"https://github.com\", settings);\n\n        await fixture.EmptyQuery();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task WhiteSpaceQueryShouldBeEmpty()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo?\")\n            .WithExactQueryString(\"\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IQueryApi>(\"https://github.com\", settings);\n\n        await fixture.WhiteSpaceQuery();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task EmptyQueryKeyShouldBeEmpty()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo?\")\n            .WithExactQueryString(\"\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IQueryApi>(\"https://github.com\", settings);\n\n        await fixture.EmptyQueryKey();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task EmptyQueryValueShouldNotBeEmpty()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo?key=\")\n            .WithExactQueryString(\"key=\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IQueryApi>(\"https://github.com\", settings);\n\n        await fixture.EmptyQueryValue();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task EmptyQueryKeyAndValueShouldBeEmpty()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo?\")\n            .WithExactQueryString(\"\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IQueryApi>(\"https://github.com\", settings);\n\n        await fixture.EmptyQueryKeyAndValue();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task UnescapedQueryShouldBeEscaped()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .WithExactQueryString(\"key%2C=value%2C&key1%28=value1%28\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IQueryApi>(\"https://github.com\", settings);\n\n        await fixture.UnescapedQuery();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task EscapedQueryShouldStillBeEscaped()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .WithExactQueryString(\"key%2C=value%2C&key1%28=value1%28\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IQueryApi>(\"https://github.com\", settings);\n\n        await fixture.EscapedQuery();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ParameterMappedQueryShouldWork()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .WithExactQueryString(\"key1=value1\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IQueryApi>(\"https://github.com\", settings);\n\n        await fixture.ParameterMappedQuery(\"key1\", \"value1\");\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ParameterMappedQueryShouldEscape()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .WithExactQueryString(\"key1%2C=value1%2C\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IQueryApi>(\"https://github.com\", settings);\n\n        await fixture.ParameterMappedQuery(\"key1,\", \"value1,\");\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task NullableIntCollectionQuery()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .WithExactQueryString(\"values=3%2C4%2C\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IQueryApi>(\"https://github.com\", settings);\n\n        await fixture.NullableIntCollectionQuery([3, 4, null]);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ShouldStripFragment()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IFragmentApi>(\"https://github.com\", settings);\n\n        await fixture.Fragment();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ShouldStripEmptyFragment()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IFragmentApi>(\"https://github.com\", settings);\n\n        await fixture.EmptyFragment();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ShouldStripManyFragments()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IFragmentApi>(\"https://github.com\", settings);\n\n        await fixture.ManyFragments();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ShouldStripParameterFragment()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IFragmentApi>(\"https://github.com\", settings);\n\n        await fixture.ParameterFragment(\"ignore\");\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ShouldStripFragmentAfterQuery()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .WithExactQueryString(\"key=value\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IFragmentApi>(\"https://github.com\", settings);\n\n        await fixture.FragmentAfterQuery();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task ShouldStripQueryAfterFragment()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<IFragmentApi>(\"https://github.com\", settings);\n\n        await fixture.QueryAfterFragment();\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task TaskShouldCancelWhenRequested()\n    {\n        var ctSource = new CancellationTokenSource();\n        var token = ctSource.Token;\n\n        var fixture = RestService.For<ICancellableApi>(\"https://github.com\");\n\n        ctSource.Cancel();\n        var task = fixture.GetWithCancellation(token);\n        await Assert.ThrowsAsync<TaskCanceledException>(async () => await task);\n    }\n\n    [Fact]\n    public async Task TaskResultShouldCancelWhenRequested()\n    {\n        var ctSource = new CancellationTokenSource();\n        var token = ctSource.Token;\n\n        var fixture = RestService.For<ICancellableApi>(\"https://github.com\");\n\n        ctSource.Cancel();\n        var task = fixture.GetWithCancellationAndReturn(token);\n        await Assert.ThrowsAsync<TaskCanceledException>(async () => await task);\n    }\n\n\n    [Fact]\n    public async Task NullableCancellationTokenShouldBeIgnored()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        mockHttp\n            .Expect(HttpMethod.Get, \"https://github.com/foo\")\n            .Respond(HttpStatusCode.OK);\n\n        var fixture = RestService.For<ICancellableApi>(\"https://github.com\", settings);\n\n        await fixture.GetWithNullableCancellation(null);\n\n        mockHttp.VerifyNoOutstandingExpectation();\n    }\n\n    [Fact]\n    public async Task TypeCollisionTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        const string Url = \"https://httpbin.org/get\";\n\n        mockHttp.Expect(HttpMethod.Get, Url).Respond(\"application/json\", \"{ }\");\n\n        var fixtureA = RestService.For<ITypeCollisionApiA>(Url, settings);\n\n        var respA = await fixtureA.SomeARequest();\n\n        mockHttp.Expect(HttpMethod.Get, Url).Respond(\"application/json\", \"{ }\");\n\n        var fixtureB = RestService.For<ITypeCollisionApiB>(Url, settings);\n\n        var respB = await fixtureB.SomeBRequest();\n\n        Assert.IsType<CollisionA.SomeType>(respA);\n        Assert.IsType<CollisionB.SomeType>(respB);\n    }\n\n    internal static Stream GetTestFileStream(string relativeFilePath)\n    {\n        const char namespaceSeparator = '.';\n\n        // get calling assembly\n        var assembly = Assembly.GetCallingAssembly();\n\n        // compute resource name suffix\n        var relativeName =\n            \".\"\n            + relativeFilePath\n                .Replace('\\\\', namespaceSeparator)\n                .Replace('/', namespaceSeparator)\n                .Replace(' ', '_');\n\n        // get resource stream\n        var fullName = assembly\n            .GetManifestResourceNames()\n            .FirstOrDefault(name => name.EndsWith(relativeName, StringComparison.InvariantCulture));\n        if (fullName == null)\n        {\n            throw new Exception(\n                $\"Unable to find resource for path \\\"{relativeFilePath}\\\". Resource with name ending on \\\"{relativeName}\\\" was not found in assembly.\"\n            );\n        }\n\n        var stream = assembly.GetManifestResourceStream(fullName);\n        if (stream == null)\n        {\n            throw new Exception(\n                $\"Unable to find resource for path \\\"{relativeFilePath}\\\". Resource named \\\"{fullName}\\\" was not found in assembly.\"\n            );\n        }\n\n        return stream;\n    }\n\n    [Fact]\n    public async Task SameTypeNameInMultipleNamespacesTest()\n    {\n        var mockHttp = new MockHttpMessageHandler();\n\n        var settings = new RefitSettings { HttpMessageHandlerFactory = () => mockHttp, };\n\n        const string Url = \"https://httpbin.org/get\";\n\n        mockHttp.Expect(HttpMethod.Get, Url + \"/\").Respond(\"application/json\", \"{ }\");\n\n        var fixtureA = RestService.For<INamespaceCollisionApi>(Url, settings);\n\n        var respA = await fixtureA.SomeRequest();\n\n        mockHttp.Expect(HttpMethod.Get, Url + \"/\").Respond(\"application/json\", \"{ }\");\n\n        var fixtureB = RestService.For<CollisionA.INamespaceCollisionApi>(Url, settings);\n\n        var respB = await fixtureB.SomeRequest();\n\n        mockHttp.Expect(HttpMethod.Get, Url + \"/\").Respond(\"application/json\", \"{ }\");\n\n        var fixtureC = RestService.For<CollisionB.INamespaceCollisionApi>(Url, settings);\n\n        var respC = await fixtureC.SomeRequest();\n\n        Assert.IsType<CollisionA.SomeType>(respA);\n        Assert.IsType<CollisionA.SomeType>(respB);\n        Assert.IsType<CollisionB.SomeType>(respC);\n    }\n\n    private static void AssertStackTraceContains(string expectedSubstring, string actualString)\n    {\n        Assert.Contains(expectedSubstring, actualString);\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/RestServiceExceptions.cs",
    "content": "﻿using Xunit;\n// ReSharper disable InconsistentNaming\n\nnamespace Refit.Tests;\n\npublic interface IManyCancellationTokens\n{\n    [Get(\"/\")]\n    Task<string> GetValue(CancellationToken token0, CancellationToken token1);\n}\n\npublic interface IManyHeaderCollections\n{\n    [Get(\"/\")]\n    Task<string> GetValue([HeaderCollection] IDictionary<string, string> collection0, [HeaderCollection] IDictionary<string, string> collection1);\n}\n\npublic interface IHeaderCollectionWrongType\n{\n    [Get(\"/\")]\n    Task<string> GetValue([HeaderCollection] IDictionary<string, object> collection);\n}\n\npublic interface IDoesNotStartSlash\n{\n    [Get(\"users\")]\n    Task<string> GetValue();\n}\n\npublic interface IUrlContainsCRLF\n{\n    [Get(\"/\\r\")]\n    Task<string> GetValue();\n}\n\npublic interface IRoundTripNotString\n{\n    [Get(\"/{**value}\")]\n    Task<string> GetValue(int value);\n}\n\npublic interface IRoundTrippingLeadingWhitespace\n{\n    [Get(\"/{ **path}\")]\n    Task<string> GetValue(string path);\n}\n\npublic interface IRoundTrippingTrailingWhitespace\n{\n    [Get(\"/{** path}\")]\n    Task<string> GetValue(string path);\n}\n\npublic interface IInvalidParamSubstitution\n{\n    [Get(\"/{/path}\")]\n    Task<string> GetValue(string path);\n}\n\npublic interface IInvalidFragmentParamSubstitution\n{\n    [Get(\"/{#path}\")]\n    Task<string> GetValue(string path);\n}\n\npublic interface IUrlNoMatchingParameters\n{\n    [Get(\"/{value}\")]\n    Task<string> GetValue();\n}\n\npublic interface IMultipartAndBody\n{\n    [Get(\"/}\")]\n    [Multipart]\n    Task<string> GetValue([Body] string body);\n}\n\npublic interface IManyBody\n{\n    [Get(\"/\")]\n    Task<string> GetValue([Body] string body0, [Body] string body1);\n}\n\npublic class UserBody\n{\n    public string Value { get; set; }\n}\n\npublic interface IManyComplexTypes\n{\n    [Post(\"/\")]\n    Task<string> PostValue(UserBody body0, UserBody body1);\n}\n\npublic interface IManyAuthorize\n{\n    [Get(\"/\")]\n    Task<string> GetValue([Authorize(\"Bearer\")] string token0, [Authorize(\"Bearer\")] string token1);\n}\n\npublic interface IInvalidReturnType\n{\n    [Get(\"/\")]\n    string GetValue();\n}\n\npublic class RestServiceExceptionTests\n{\n    [Fact]\n    public void ManyCancellationTokensShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IManyCancellationTokens>(\"https://api.github.com\"));\n        AssertExceptionContains(\"only contain a single CancellationToken\", exception);\n    }\n\n    [Fact]\n    public void ManyHeaderCollectionShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IManyHeaderCollections>(\"https://api.github.com\"));\n        AssertExceptionContains(\"Only one parameter can be a HeaderCollection parameter\", exception);\n    }\n\n    [Fact]\n    public void InvalidHeaderCollectionTypeShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IHeaderCollectionWrongType>(\"https://api.github.com\"));\n        AssertExceptionContains(\"HeaderCollection parameter of type\", exception);\n    }\n\n    [Fact]\n    public void UrlDoesntStartWithSlashShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IDoesNotStartSlash>(\"https://api.github.com\"));\n        AssertExceptionContains(\"must start with '/' and be of the form\", exception);\n    }\n\n    [Fact]\n    public void UrlContainsCRLFShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IUrlContainsCRLF>(\"https://api.github.com\"));\n        AssertExceptionContains(\"must not contain CR or LF characters\", exception);\n    }\n\n    [Fact]\n    public void RoundTripParameterNotStringShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IRoundTripNotString>(\"https://api.github.com\"));\n        AssertExceptionContains(\"has round-tripping parameter\", exception);\n    }\n\n    [Fact]\n    public void RoundTripWithLeadingWhitespaceShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IRoundTrippingLeadingWhitespace>(\"https://api.github.com\"));\n        AssertExceptionContains(\"has parameter  **path, but no method parameter matches\", exception);\n    }\n\n    [Fact]\n    public void RoundTripWithTrailingWhitespaceShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IRoundTrippingTrailingWhitespace>(\"https://api.github.com\"));\n        AssertExceptionContains(\"has parameter ** path, but no method parameter matches\", exception);\n    }\n\n    [Fact]\n    public async Task InvalidParamSubstitutionShouldThrow()\n    {\n        var service = RestService.For<IInvalidParamSubstitution>(\"https://api.github.com\");\n        Assert.NotNull(service);\n\n        await Assert.ThrowsAsync<ApiException>(() => service.GetValue(\"throws\"));\n    }\n\n    [Fact]\n    public void InvalidFragmentParamSubstitutionShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IInvalidFragmentParamSubstitution>(\"https://api.github.com\"));\n        AssertExceptionContains(\"but no method parameter matches\", exception);\n    }\n\n    [Fact]\n    public void UrlNoMatchingParameterShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IUrlNoMatchingParameters>(\"https://api.github.com\"));\n        AssertExceptionContains(\"but no method parameter matches\", exception);\n    }\n\n    [Fact]\n    public void MultipartAndBodyShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IMultipartAndBody>(\"https://api.github.com\"));\n        AssertExceptionContains(\"Multipart requests may not contain a Body parameter\", exception);\n    }\n\n    [Fact]\n    public void ManyBodyShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IManyBody>(\"https://api.github.com\"));\n        AssertExceptionContains(\"Only one parameter can be a Body parameter\", exception);\n    }\n\n    [Fact]\n    public void ManyComplexTypesShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IManyComplexTypes>(\"https://api.github.com\"));\n        AssertExceptionContains(\"Multiple complex types found. Specify one parameter as the body using BodyAttribute\", exception);\n    }\n\n    [Fact]\n    public void ManyAuthorizeAttributesShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IManyAuthorize>(\"https://api.github.com\"));\n        AssertExceptionContains(\"Only one parameter can be an Authorize parameter\", exception);\n    }\n\n    [Fact]\n    public void InvalidReturnTypeShouldThrow()\n    {\n        var exception = Assert.Throws<ArgumentException>(() => RestService.For<IInvalidReturnType>(\"https://api.github.com\"));\n        AssertExceptionContains(\"is invalid. All REST Methods must return either Task<T> or ValueTask<T> or IObservable<T>\", exception);\n    }\n\n    private static void AssertExceptionContains(string expectedSubstring, Exception exception)\n    {\n        Assert.Contains(expectedSubstring, exception.Message!, StringComparison.Ordinal);\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/SerializedContentTests.cs",
    "content": "﻿using System;\nusing System.IO;\nusing System.Net;\nusing System.Net.Http;\nusing System.Reflection;\nusing System.Text;\nusing System.Text.Json;\nusing System.Text.Json.Serialization;\nusing System.Text.Json.Serialization.Metadata;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Newtonsoft.Json;\nusing SystemTextJsonSerializer = System.Text.Json.JsonSerializer;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic partial class SerializedContentTests\n{\n    const string BaseAddress = \"https://api/\";\n\n    [Theory]\n    [InlineData(typeof(NewtonsoftJsonContentSerializer))]\n    [InlineData(typeof(SystemTextJsonContentSerializer))]\n    [InlineData(typeof(XmlContentSerializer))]\n    public async Task WhenARequestRequiresABodyThenItDoesNotDeadlock(Type contentSerializerType)\n    {\n        if (\n            Activator.CreateInstance(contentSerializerType) is not IHttpContentSerializer serializer\n        )\n        {\n            throw new ArgumentException(\n                $\"{contentSerializerType.FullName} does not implement {nameof(IHttpContentSerializer)}\"\n            );\n        }\n\n        var handler = new MockPushStreamContentHttpMessageHandler\n        {\n            Asserts = async content =>\n                new StringContent(await content.ReadAsStringAsync().ConfigureAwait(false))\n        };\n\n        var settings = new RefitSettings(serializer) { HttpMessageHandlerFactory = () => handler };\n\n        var fixture = RestService.For<IGitHubApi>(BaseAddress, settings);\n\n        var fixtureTask = await RunTaskWithATimeLimit(fixture.CreateUser(new User()))\n            .ConfigureAwait(false);\n        Assert.True(fixtureTask.IsCompleted);\n        Assert.Equal(TaskStatus.RanToCompletion, fixtureTask.Status);\n    }\n\n    [Theory]\n    [InlineData(typeof(NewtonsoftJsonContentSerializer))]\n    [InlineData(typeof(SystemTextJsonContentSerializer))]\n    [InlineData(typeof(XmlContentSerializer))]\n    public async Task WhenARequestRequiresABodyThenItIsSerialized(Type contentSerializerType)\n    {\n        if (\n            Activator.CreateInstance(contentSerializerType) is not IHttpContentSerializer serializer\n        )\n        {\n            throw new ArgumentException(\n                $\"{contentSerializerType.FullName} does not implement {nameof(IHttpContentSerializer)}\"\n            );\n        }\n\n        var model = new User\n        {\n            Name = \"Wile E. Coyote\",\n            CreatedAt = new DateTime(1949, 9, 16).ToString(),\n            Company = \"ACME\",\n        };\n\n        var handler = new MockPushStreamContentHttpMessageHandler\n        {\n            Asserts = async content =>\n            {\n                var stringContent = new StringContent(\n                    await content.ReadAsStringAsync().ConfigureAwait(false)\n                );\n                var user = await serializer\n                    .FromHttpContentAsync<User>(content)\n                    .ConfigureAwait(false);\n                Assert.NotSame(model, user);\n                Assert.Equal(model.Name, user.Name);\n                Assert.Equal(model.CreatedAt, user.CreatedAt);\n                Assert.Equal(model.Company, user.Company);\n\n                //  return some content so that the serializer doesn't complain\n                return stringContent;\n            }\n        };\n\n        var settings = new RefitSettings(serializer) { HttpMessageHandlerFactory = () => handler };\n\n        var fixture = RestService.For<IGitHubApi>(BaseAddress, settings);\n\n        var fixtureTask = await RunTaskWithATimeLimit(fixture.CreateUser(model))\n            .ConfigureAwait(false);\n\n        Assert.True(fixtureTask.IsCompleted);\n    }\n\n    [Fact]\n    public void VerityDefaultSerializer()\n    {\n        var settings = new RefitSettings();\n\n        Assert.NotNull(settings.ContentSerializer);\n        Assert.IsType<SystemTextJsonContentSerializer>(settings.ContentSerializer);\n\n        settings = new RefitSettings(new NewtonsoftJsonContentSerializer());\n\n        Assert.NotNull(settings.ContentSerializer);\n        Assert.IsType<NewtonsoftJsonContentSerializer>(settings.ContentSerializer);\n    }\n\n    /// <summary>\n    /// Runs the task to completion or until the timeout occurs\n    /// </summary>\n    static async Task<Task<User>> RunTaskWithATimeLimit(Task<User> fixtureTask)\n    {\n        var circuitBreakerTask = Task.Delay(TimeSpan.FromSeconds(30));\n        await Task.WhenAny(fixtureTask, circuitBreakerTask);\n        return fixtureTask;\n    }\n\n    class MockPushStreamContentHttpMessageHandler : HttpMessageHandler\n    {\n        public Func<PushStreamContent, Task<HttpContent>> Asserts { get; set; }\n\n        protected override async Task<HttpResponseMessage> SendAsync(\n            HttpRequestMessage request,\n            CancellationToken cancellationToken\n        )\n        {\n            var content = request.Content as PushStreamContent;\n            Assert.IsType<PushStreamContent>(content);\n            Assert.NotNull(Asserts);\n\n            var responseContent = await Asserts(content).ConfigureAwait(false);\n\n            return new HttpResponseMessage(HttpStatusCode.OK) { Content = responseContent };\n        }\n    }\n\n    [Fact]\n    public async Task StreamDeserialization_UsingSystemTextJsonContentSerializer()\n    {\n        var model = new TestAliasObject\n        {\n            ShortNameForAlias = nameof(StreamDeserialization_UsingSystemTextJsonContentSerializer),\n            ShortNameForJsonProperty = nameof(TestAliasObject)\n        };\n\n        var serializer = new SystemTextJsonContentSerializer();\n\n        var json = serializer.ToHttpContent(model);\n\n        var result = await serializer.FromHttpContentAsync<TestAliasObject>(json);\n\n        Assert.NotNull(result);\n        Assert.Equal(model.ShortNameForAlias, result.ShortNameForAlias);\n        Assert.Equal(model.ShortNameForJsonProperty, result.ShortNameForJsonProperty);\n    }\n\n    [Fact]\n    public void StreamDeserialization_UsingSystemTextJsonContentSerializer_SetsCorrectHeaders()\n    {\n        var model = new TestAliasObject\n        {\n            ShortNameForAlias = nameof(StreamDeserialization_UsingSystemTextJsonContentSerializer),\n            ShortNameForJsonProperty = nameof(TestAliasObject)\n        };\n\n        var serializer = new SystemTextJsonContentSerializer();\n\n        var json = serializer.ToHttpContent(model);\n\n        Assert.NotNull(json.Headers.ContentType);\n        Assert.Equal(\"utf-8\", json.Headers.ContentType.CharSet);\n        Assert.Equal(\"application/json\", json.Headers.ContentType.MediaType);\n    }\n\n    [Fact]\n    public async Task StreamDeserialization_UsingNewtonsoftJsonContentSerializer_DoesNotUseSynchronousReads()\n    {\n        var serializer = new NewtonsoftJsonContentSerializer();\n        var content = new AsyncOnlyJsonContent(\"{\\\"name\\\":\\\"Road Runner\\\"}\");\n\n        var result = await serializer.FromHttpContentAsync<User>(content);\n\n        Assert.NotNull(result);\n        Assert.Equal(\"Road Runner\", result.Name);\n    }\n\n    [Fact]\n    public async Task StreamDeserialization_UsingNewtonsoftJsonContentSerializer_ReturnsDefaultForNullContent()\n    {\n        var serializer = new NewtonsoftJsonContentSerializer();\n\n        var result = await serializer.FromHttpContentAsync<User>(null!);\n\n        Assert.Null(result);\n    }\n\n    [Fact]\n    public void NewtonsoftJsonContentSerializer_GetFieldNameForProperty_ReturnsJsonPropertyName()\n    {\n        var serializer = new NewtonsoftJsonContentSerializer();\n        var property = typeof(NewtonsoftFieldNameModel).GetProperty(\n            nameof(NewtonsoftFieldNameModel.Name)\n        );\n\n        var fieldName = serializer.GetFieldNameForProperty(property!);\n\n        Assert.Equal(\"json_name\", fieldName);\n    }\n\n    [Fact]\n    public void NewtonsoftJsonContentSerializer_GetFieldNameForProperty_ReturnsNullWithoutJsonPropertyAttribute()\n    {\n        var serializer = new NewtonsoftJsonContentSerializer();\n        var property = typeof(NewtonsoftFieldNameModel).GetProperty(\n            nameof(NewtonsoftFieldNameModel.Unaliased)\n        );\n\n        var fieldName = serializer.GetFieldNameForProperty(property!);\n\n        Assert.Null(fieldName);\n    }\n\n    [Fact]\n    public void NewtonsoftJsonContentSerializer_GetFieldNameForProperty_ThrowsForNullProperty()\n    {\n        var serializer = new NewtonsoftJsonContentSerializer();\n\n        var exception = Assert.Throws<ArgumentNullException>(() => serializer.GetFieldNameForProperty(null!));\n\n        Assert.Equal(\"propertyInfo\", exception.ParamName);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_GetFieldNameForProperty_ReturnsJsonPropertyName()\n    {\n        var serializer = new SystemTextJsonContentSerializer();\n        var property = typeof(SystemTextFieldNameModel).GetProperty(\n            nameof(SystemTextFieldNameModel.Name)\n        );\n\n        var fieldName = serializer.GetFieldNameForProperty(property!);\n\n        Assert.Equal(\"json_name\", fieldName);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_GetFieldNameForProperty_ReturnsNullWithoutJsonPropertyNameAttribute()\n    {\n        var serializer = new SystemTextJsonContentSerializer();\n        var property = typeof(SystemTextFieldNameModel).GetProperty(\n            nameof(SystemTextFieldNameModel.Unaliased)\n        );\n\n        var fieldName = serializer.GetFieldNameForProperty(property!);\n\n        Assert.Null(fieldName);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_GetFieldNameForProperty_ThrowsForNullProperty()\n    {\n        var serializer = new SystemTextJsonContentSerializer();\n\n        var exception = Assert.Throws<ArgumentNullException>(() => serializer.GetFieldNameForProperty(null!));\n\n        Assert.Equal(\"propertyInfo\", exception.ParamName);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_InferBooleanObjectValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<ObjectValueContainer>(\n            \"\"\"{\"value\":true}\"\"\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.True(Assert.IsType<bool>(result!.Value));\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_InferIntegralObjectValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<ObjectValueContainer>(\n            \"\"\"{\"value\":42}\"\"\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(42L, Assert.IsType<long>(result!.Value));\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_InferFloatingPointObjectValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<ObjectValueContainer>(\n            \"\"\"{\"value\":42.5}\"\"\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(42.5, Assert.IsType<double>(result!.Value));\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_InferDateObjectValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<ObjectValueContainer>(\n            \"\"\"{\"value\":\"2024-01-02T03:04:05Z\"}\"\"\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(\n            new DateTime(2024, 1, 2, 3, 4, 5, DateTimeKind.Utc),\n            Assert.IsType<DateTime>(result!.Value)\n        );\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_InferStringObjectValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<ObjectValueContainer>(\n            \"\"\"{\"value\":\"Road Runner\"}\"\"\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(\"Road Runner\", Assert.IsType<string>(result!.Value));\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_DeserializeObjectValuesAsJsonElements()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<ObjectValueContainer>(\n            \"\"\"{\"value\":{\"company\":\"ACME\"}}\"\"\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(JsonValueKind.Object, Assert.IsType<JsonElement>(result!.Value).ValueKind);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_SerializeObjectEnumValuesAsCamelCase()\n    {\n        var json = SystemTextJsonSerializer.Serialize(\n            new ObjectValueContainer { Value = CamelCaseEnum.ValueOne },\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(\"\"\"{\"value\":\"valueOne\"}\"\"\", json);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_SerializeNullObjectValuesAsJsonNull()\n    {\n        var json = SystemTextJsonSerializer.Serialize(\n            new ObjectValueContainer { Value = null },\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(\"\"\"{\"value\":null}\"\"\", json);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_UseResolverWhenSerializingObjectValues()\n    {\n        var resolver = new TrackingTypeInfoResolver(ObjectValueContainerJsonSerializerContext.Default);\n        var options = new JsonSerializerOptions(\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        )\n        {\n            TypeInfoResolver = resolver\n        };\n\n        var json = SystemTextJsonSerializer.Serialize(\n            new ObjectValueContainer { Value = \"Road Runner\" },\n            options\n        );\n\n        Assert.Equal(\"\"\"{\"value\":\"Road Runner\"}\"\"\", json);\n        Assert.Contains(typeof(string), resolver.RequestedTypes);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_DeserializeCamelCaseEnumValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<CamelCaseEnum>(\n            \"\\\"valueOne\\\"\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(CamelCaseEnum.ValueOne, result);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_DeserializeCaseInsensitiveEnumValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<CamelCaseEnum>(\n            \"\\\"VALUEONE\\\"\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(CamelCaseEnum.ValueOne, result);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_DeserializeLowercaseEnumValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<CamelCaseEnum>(\n            \"\\\"alreadyLowercase\\\"\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(CamelCaseEnum.alreadyLowercase, result);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_DeserializeNumericEnumValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<CamelCaseEnum>(\n            \"2\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(CamelCaseEnum.alreadyLowercase, result);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_DeserializeNullNullableEnumValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<CamelCaseEnum?>(\n            \"null\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Null(result);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_DeserializeEmptyNullableEnumValues()\n    {\n        var result = SystemTextJsonSerializer.Deserialize<CamelCaseEnum?>(\n            \"\\\"\\\"\",\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Null(result);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_ThrowForNullNonNullableEnumValues()\n    {\n        Assert.Throws<System.Text.Json.JsonException>(\n            () => SystemTextJsonSerializer.Deserialize<CamelCaseEnum>(\n                \"null\",\n                SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n            )\n        );\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_ThrowForEmptyNonNullableEnumValues()\n    {\n        Assert.Throws<System.Text.Json.JsonException>(\n            () => SystemTextJsonSerializer.Deserialize<CamelCaseEnum>(\n                \"\\\"\\\"\",\n                SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n            )\n        );\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_ThrowForInvalidEnumValues()\n    {\n        Assert.Throws<System.Text.Json.JsonException>(\n            () => SystemTextJsonSerializer.Deserialize<CamelCaseEnum>(\n                \"\\\"notAValue\\\"\",\n                SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n            )\n        );\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_ThrowForUnexpectedTokensWhenParsingEnums()\n    {\n        Assert.Throws<System.Text.Json.JsonException>(\n            () => SystemTextJsonSerializer.Deserialize<CamelCaseEnum>(\n                \"true\",\n                SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n            )\n        );\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_SerializeUndefinedEnumValuesAsNumbers()\n    {\n        var json = SystemTextJsonSerializer.Serialize(\n            (CamelCaseEnum)999,\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(\"999\", json);\n    }\n\n    [Fact]\n    public void SystemTextJsonContentSerializer_DefaultOptions_SerializeLowercaseEnumNamesUnchanged()\n    {\n        var json = SystemTextJsonSerializer.Serialize(\n            CamelCaseEnum.alreadyLowercase,\n            SystemTextJsonContentSerializer.GetDefaultJsonSerializerOptions()\n        );\n\n        Assert.Equal(\"\\\"alreadyLowercase\\\"\", json);\n    }\n\n    [Fact]\n    public async Task SystemTextJsonContentSerializer_UsesSourceGeneratedMetadataWhenProvided()\n    {\n        var resolver = new TrackingTypeInfoResolver(SerializedContentJsonSerializerContext.Default);\n        var options = new JsonSerializerOptions(JsonSerializerDefaults.Web)\n        {\n            TypeInfoResolver = resolver\n        };\n        var serializer = new SystemTextJsonContentSerializer(options);\n        var model = new User\n        {\n            Name = \"Road Runner\",\n            Company = \"ACME\",\n            CreatedAt = \"1949-09-17\"\n        };\n\n        var content = serializer.ToHttpContent(model);\n        var roundTrip = await serializer.FromHttpContentAsync<User>(content);\n\n        Assert.NotNull(roundTrip);\n        Assert.Equal(model.Name, roundTrip.Name);\n        Assert.Equal(model.Company, roundTrip.Company);\n        Assert.Equal(model.CreatedAt, roundTrip.CreatedAt);\n        Assert.Contains(typeof(User), resolver.RequestedTypes);\n    }\n\n    [Fact]\n    public async Task RestService_CanUseSourceGeneratedSystemTextJsonMetadata()\n    {\n        var resolver = new TrackingTypeInfoResolver(SerializedContentJsonSerializerContext.Default);\n        var settings = new RefitSettings(\n            new SystemTextJsonContentSerializer(\n                new JsonSerializerOptions(JsonSerializerDefaults.Web)\n                {\n                    TypeInfoResolver = resolver\n                }\n            )\n        )\n        {\n            HttpMessageHandlerFactory = () => new StubHttpMessageHandler(\n                _ => new HttpResponseMessage(HttpStatusCode.OK)\n                {\n                    Content = new StringContent(\n                        \"{\\\"name\\\":\\\"Road Runner\\\",\\\"company\\\":\\\"ACME\\\",\\\"createdAt\\\":\\\"1949-09-17\\\"}\",\n                        Encoding.UTF8,\n                        \"application/json\"\n                    )\n                }\n            )\n        };\n\n        var api = RestService.For<IGitHubApi>(BaseAddress, settings);\n        var user = await api.GetUser(\"roadrunner\");\n\n        Assert.NotNull(user);\n        Assert.Equal(\"Road Runner\", user.Name);\n        Assert.Equal(\"ACME\", user.Company);\n        Assert.Equal(\"1949-09-17\", user.CreatedAt);\n        Assert.Contains(typeof(User), resolver.RequestedTypes);\n    }\n\n    [JsonSerializable(typeof(User))]\n    internal sealed partial class SerializedContentJsonSerializerContext : JsonSerializerContext { }\n\n    [JsonSerializable(typeof(ObjectValueContainer))]\n    [JsonSerializable(typeof(string))]\n    internal sealed partial class ObjectValueContainerJsonSerializerContext : JsonSerializerContext { }\n\n    sealed class TrackingTypeInfoResolver(IJsonTypeInfoResolver innerResolver) : IJsonTypeInfoResolver\n    {\n        public HashSet<Type> RequestedTypes { get; } = [];\n\n        public JsonTypeInfo? GetTypeInfo(Type type, JsonSerializerOptions options)\n        {\n            RequestedTypes.Add(type);\n            return innerResolver.GetTypeInfo(type, options);\n        }\n    }\n\n    sealed class StubHttpMessageHandler(Func<HttpRequestMessage, HttpResponseMessage> responder)\n        : HttpMessageHandler\n    {\n        protected override Task<HttpResponseMessage> SendAsync(\n            HttpRequestMessage request,\n            CancellationToken cancellationToken\n        ) => Task.FromResult(responder(request));\n    }\n\n    sealed class NewtonsoftFieldNameModel\n    {\n        [JsonProperty(PropertyName = \"json_name\")]\n        public string Name { get; set; }\n\n        public string Unaliased { get; set; }\n    }\n\n    sealed class SystemTextFieldNameModel\n    {\n        [JsonPropertyName(\"json_name\")]\n        public string Name { get; set; }\n\n        public string Unaliased { get; set; }\n    }\n\n    public sealed class ObjectValueContainer\n    {\n        public object Value { get; set; }\n    }\n\n    enum CamelCaseEnum\n    {\n        ValueOne = 1,\n        alreadyLowercase = 2\n    }\n\n    sealed class AsyncOnlyJsonContent(string json) : HttpContent\n    {\n        readonly byte[] _bytes = Encoding.UTF8.GetBytes(json);\n\n        protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context) =>\n            stream.WriteAsync(_bytes, 0, _bytes.Length);\n\n        protected override bool TryComputeLength(out long length)\n        {\n            length = _bytes.Length;\n            return true;\n        }\n\n        protected override Task<Stream> CreateContentReadStreamAsync() =>\n            Task.FromResult<Stream>(new AsyncOnlyReadStream(_bytes));\n    }\n\n    sealed class AsyncOnlyReadStream(byte[] bytes) : Stream\n    {\n        readonly MemoryStream _inner = new(bytes, writable: false);\n\n        public override bool CanRead => true;\n        public override bool CanSeek => _inner.CanSeek;\n        public override bool CanWrite => false;\n        public override long Length => _inner.Length;\n\n        public override long Position\n        {\n            get => _inner.Position;\n            set => _inner.Position = value;\n        }\n\n        public override void Flush() => _inner.Flush();\n\n        public override int Read(byte[] buffer, int offset, int count) =>\n            throw new NotSupportedException(\"Synchronous reads are intentionally not supported.\");\n\n        public override ValueTask<int> ReadAsync(\n            Memory<byte> buffer,\n            CancellationToken cancellationToken = default\n        ) => _inner.ReadAsync(buffer, cancellationToken);\n\n        public override Task<int> ReadAsync(\n            byte[] buffer,\n            int offset,\n            int count,\n            CancellationToken cancellationToken\n        ) => _inner.ReadAsync(buffer, offset, count, cancellationToken);\n\n        public override long Seek(long offset, SeekOrigin origin) => _inner.Seek(offset, origin);\n\n        public override void SetLength(long value) => throw new NotSupportedException();\n\n        public override void Write(byte[] buffer, int offset, int count) =>\n            throw new NotSupportedException();\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/TypeCollisionApiA.cs",
    "content": "﻿using System.Threading.Tasks;\nusing CollisionA;\nusing Refit; // InterfaceStubGenerator looks for this\n\nnamespace Refit.Tests;\n\npublic interface ITypeCollisionApiA\n{\n    [Get(\"\")]\n    Task<SomeType> SomeARequest();\n}\n\npublic static class TypeCollisionApiA\n{\n    public static ITypeCollisionApiA Create()\n    {\n        return RestService.For<ITypeCollisionApiA>(\"http://somewhere.com\");\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/TypeCollisionApiB.cs",
    "content": "﻿using System.Threading.Tasks;\nusing CollisionB;\nusing Refit; // InterfaceStubGenerator looks for this\n\nnamespace Refit.Tests;\n\npublic interface ITypeCollisionApiB\n{\n    [Get(\"\")]\n    Task<SomeType> SomeBRequest();\n}\n\npublic static class TypeCollisionApiB\n{\n    public static ITypeCollisionApiB Create()\n    {\n        return RestService.For<ITypeCollisionApiB>(\"http://somewhere.com\");\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/UniqueNameTests.cs",
    "content": "﻿using System.Collections.Generic;\nusing Xunit;\n\nnamespace Refit.Tests\n{\n    namespace Http\n    {\n        class Client\n        {\n            public class Request { }\n\n            public class Response { }\n        }\n    }\n\n    namespace Tcp\n    {\n        class Client { }\n    }\n\n    public class UniqueNameTests\n    {\n        [Fact]\n        public void SystemTypeAndLanguageTypeHaveSameNames()\n        {\n            var name1 = UniqueName.ForType<System.Int32>();\n            var name2 = UniqueName.ForType<int>();\n\n            Assert.Equal(name1, name2);\n        }\n\n        [Fact]\n        public void GenericClassWithDifferentTypesHaveUniqueNames()\n        {\n            var name1 = UniqueName.ForType<List<long>>();\n            var name2 = UniqueName.ForType<List<int>>();\n\n            Assert.NotEqual(name1, name2);\n        }\n\n        [Fact]\n        public void SameClassNameInDifferentNamespacesHaveUniqueNames()\n        {\n            var name1 = UniqueName.ForType<Http.Client>();\n            var name2 = UniqueName.ForType<Tcp.Client>();\n\n            Assert.NotEqual(name1, name2);\n        }\n\n        [Fact]\n        public void ClassesWithNestedClassesHaveUniqueNames()\n        {\n            var name1 = UniqueName.ForType<Http.Client>();\n            var name2 = UniqueName.ForType<Http.Client.Request>();\n\n            Assert.NotEqual(name1, name2);\n        }\n\n        [Fact]\n        public void NestedClassesHaveUniqueNames()\n        {\n            var name1 = UniqueName.ForType<Http.Client.Request>();\n            var name2 = UniqueName.ForType<Http.Client.Response>();\n\n            Assert.NotEqual(name1, name2);\n        }\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/UseCultureAttribute.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Reflection;\nusing System.Text;\nusing System.Threading;\nusing Xunit.Sdk;\n\nnamespace Refit.Tests;\n\n/// <summary>\n/// Apply this attribute to your test method to replace the\n/// <see cref=\"Thread.CurrentThread\" /> <see cref=\"CultureInfo.CurrentCulture\" /> and\n/// <see cref=\"CultureInfo.CurrentUICulture\" /> with another culture.\n/// </summary>\n[AttributeUsage(\n    AttributeTargets.Class | AttributeTargets.Method,\n    AllowMultiple = false,\n    Inherited = true\n)]\npublic class UseCultureAttribute : BeforeAfterTestAttribute\n{\n    readonly Lazy<CultureInfo> culture;\n    readonly Lazy<CultureInfo> uiCulture;\n\n    CultureInfo originalCulture;\n    CultureInfo originalUICulture;\n\n    /// <summary>\n    /// Replaces the culture and UI culture of the current thread with\n    /// <paramref name=\"culture\" />\n    /// </summary>\n    /// <param name=\"culture\">The name of the culture.</param>\n    /// <remarks>\n    /// <para>\n    /// This constructor overload uses <paramref name=\"culture\" /> for both\n    /// <see cref=\"Culture\" /> and <see cref=\"UICulture\" />.\n    /// </para>\n    /// </remarks>\n    public UseCultureAttribute(string culture)\n        : this(culture, culture) { }\n\n    /// <summary>\n    /// Replaces the culture and UI culture of the current thread with\n    /// <paramref name=\"culture\" /> and <paramref name=\"uiCulture\" />\n    /// </summary>\n    /// <param name=\"culture\">The name of the culture.</param>\n    /// <param name=\"uiCulture\">The name of the UI culture.</param>\n    public UseCultureAttribute(string culture, string uiCulture)\n    {\n        this.culture = new Lazy<CultureInfo>(() => new CultureInfo(culture));\n        this.uiCulture = new Lazy<CultureInfo>(() => new CultureInfo(uiCulture));\n    }\n\n    /// <summary>\n    /// Gets the culture.\n    /// </summary>\n    public CultureInfo Culture\n    {\n        get { return culture.Value; }\n    }\n\n    /// <summary>\n    /// Gets the UI culture.\n    /// </summary>\n    public CultureInfo UICulture\n    {\n        get { return uiCulture.Value; }\n    }\n\n    /// <summary>\n    /// Stores the current <see cref=\"CultureInfo.CurrentCulture\" />\n    /// <see cref=\"CultureInfo.CurrentCulture\" /> and <see cref=\"CultureInfo.CurrentUICulture\" />\n    /// and replaces them with the new cultures defined in the constructor.\n    /// </summary>\n    /// <param name=\"methodUnderTest\">The method under test</param>\n    public override void Before(MethodInfo methodUnderTest)\n    {\n        originalCulture = CultureInfo.CurrentCulture;\n        originalUICulture = CultureInfo.CurrentUICulture;\n\n        CultureInfo.CurrentCulture = Culture;\n        CultureInfo.CurrentUICulture = UICulture;\n    }\n\n    /// <summary>\n    /// Restores the original <see cref=\"CultureInfo.CurrentCulture\" /> and\n    /// <see cref=\"CultureInfo.CurrentUICulture\" /> to <see cref=\"CultureInfo.CurrentCulture\" />\n    /// </summary>\n    /// <param name=\"methodUnderTest\">The method under test</param>\n    public override void After(MethodInfo methodUnderTest)\n    {\n        CultureInfo.CurrentCulture = originalCulture;\n        CultureInfo.CurrentUICulture = originalUICulture;\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/Verifiers/CSharpIncrementalSourceGeneratorVerifier`1+Test.cs",
    "content": "﻿using System.Collections.Generic;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp;\nusing Microsoft.CodeAnalysis.CSharp.Testing;\nusing Microsoft.CodeAnalysis.Testing;\n\nnamespace Refit.Tests;\n\npublic static partial class CSharpIncrementalSourceGeneratorVerifier<TIncrementalGenerator>\n    where TIncrementalGenerator : IIncrementalGenerator, new()\n{\n    public class Test : CSharpSourceGeneratorTest<EmptySourceGeneratorProvider, DefaultVerifier>\n    {\n        public Test()\n        {\n            SolutionTransforms.Add(\n                (solution, projectId) =>\n                {\n                    var compilationOptions = solution.GetProject(projectId).CompilationOptions;\n                    compilationOptions = compilationOptions.WithSpecificDiagnosticOptions(\n                        compilationOptions.SpecificDiagnosticOptions.SetItems(\n                            CSharpVerifierHelper.NullableWarnings\n                        )\n                    );\n                    solution = solution.WithProjectCompilationOptions(\n                        projectId,\n                        compilationOptions\n                    );\n\n                    return solution;\n                }\n            );\n        }\n\n        /// <summary>\n        /// Gets the source generators.\n        /// </summary>\n        /// <returns></returns>\n        protected override IEnumerable<Type> GetSourceGenerators()\n        {\n            yield return new TIncrementalGenerator().AsSourceGenerator().GetGeneratorType();\n        }\n\n        /// <summary>\n        /// Creates the parse options.\n        /// </summary>\n        /// <returns></returns>\n        protected override ParseOptions CreateParseOptions()\n        {\n            var parseOptions = (CSharpParseOptions)base.CreateParseOptions();\n            return parseOptions.WithLanguageVersion(LanguageVersion.Preview);\n        }\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/Verifiers/CSharpIncrementalSourceGeneratorVerifier`1.cs",
    "content": "﻿using Microsoft.CodeAnalysis;\n\nnamespace Refit.Tests;\n\npublic static partial class CSharpIncrementalSourceGeneratorVerifier<TIncrementalGenerator>\n    where TIncrementalGenerator : IIncrementalGenerator, new();\n"
  },
  {
    "path": "Refit.Tests/Verifiers/CSharpSourceGeneratorVerifier`1+Test.cs",
    "content": "﻿using System;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp.Testing;\nusing Microsoft.CodeAnalysis.Testing;\n\nnamespace Refit.Tests;\n\npublic static partial class CSharpSourceGeneratorVerifier<TSourceGenerator>\n    where TSourceGenerator : ISourceGenerator, new()\n{\n    public class Test : CSharpSourceGeneratorTest<TSourceGenerator, DefaultVerifier>\n    {\n        public Test()\n        {\n            SolutionTransforms.Add(\n                (solution, projectId) =>\n                {\n                    var compilationOptions = solution.GetProject(projectId).CompilationOptions;\n                    compilationOptions = compilationOptions.WithSpecificDiagnosticOptions(\n                        compilationOptions.SpecificDiagnosticOptions.SetItems(\n                            CSharpVerifierHelper.NullableWarnings\n                        )\n                    );\n                    solution = solution.WithProjectCompilationOptions(\n                        projectId,\n                        compilationOptions\n                    );\n\n                    return solution;\n                }\n            );\n        }\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/Verifiers/CSharpSourceGeneratorVerifier`1.cs",
    "content": "﻿using Microsoft.CodeAnalysis;\n\nnamespace Refit.Tests;\n\npublic static partial class CSharpSourceGeneratorVerifier<TSourceGenerator>\n    where TSourceGenerator : ISourceGenerator, new();\n"
  },
  {
    "path": "Refit.Tests/Verifiers/CSharpVerifierHelper.cs",
    "content": "﻿using System;\nusing System.Collections.Immutable;\nusing Microsoft.CodeAnalysis;\nusing Microsoft.CodeAnalysis.CSharp;\n\nnamespace Refit.Tests;\n\nstatic class CSharpVerifierHelper\n{\n    /// <summary>\n    /// By default, the compiler reports diagnostics for nullable reference types at\n    /// <see cref=\"DiagnosticSeverity.Warning\"/>, and the analyzer test framework defaults to only validating\n    /// diagnostics at <see cref=\"DiagnosticSeverity.Error\"/>. This map contains all compiler diagnostic IDs\n    /// related to nullability mapped to <see cref=\"ReportDiagnostic.Error\"/>, which is then used to enable all\n    /// of these warnings for default validation during analyzer and code fix tests.\n    /// </summary>\n    internal static ImmutableDictionary<string, ReportDiagnostic> NullableWarnings { get; } =\n        GetNullableWarningsFromCompiler();\n\n    static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarningsFromCompiler()\n    {\n        string[] args = { \"/warnaserror:nullable\" };\n        var commandLineArguments = CSharpCommandLineParser.Default.Parse(\n            args,\n            baseDirectory: Environment.CurrentDirectory,\n            sdkDirectory: Environment.CurrentDirectory\n        );\n        return commandLineArguments.CompilationOptions.SpecificDiagnosticOptions;\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/XmlContentSerializerTests.cs",
    "content": "﻿using System;\nusing System.Net.Http;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Xml.Linq;\nusing System.Xml.Serialization;\nusing Xunit;\n\nnamespace Refit.Tests;\n\npublic class XmlContentSerializerTests\n{\n    public class Dto\n    {\n        public DateTime CreatedOn { get; set; }\n\n        public string Identifier { get; set; }\n\n        [XmlElement(Namespace = \"https://google.com\")]\n        public string Name { get; set; }\n    }\n\n    [Fact]\n    public void MediaTypeShouldBeApplicationXmlAsync()\n    {\n        var dto = BuildDto();\n        var sut = new XmlContentSerializer();\n\n        var content = sut.ToHttpContent(dto);\n\n        Assert.Equal(\"application/xml\", content.Headers.ContentType.MediaType);\n    }\n\n    [Fact]\n    public async Task ShouldSerializeToXml()\n    {\n        var dto = BuildDto();\n        var sut = new XmlContentSerializer();\n\n        var content = sut.ToHttpContent(dto);\n        var document = new XmlDocument();\n        document.LoadXml(await content.ReadAsStringAsync());\n\n        var root =\n            document[nameof(Dto)] ?? throw new NullReferenceException(\"Root element was not found\");\n        Assert.Equal(\n            dto.CreatedOn,\n            XmlConvert.ToDateTime(\n                root[nameof(Dto.CreatedOn)].InnerText,\n                XmlDateTimeSerializationMode.Utc\n            )\n        );\n        Assert.Equal(dto.Identifier, root[nameof(Dto.Identifier)].InnerText);\n        Assert.Equal(dto.Name, root[nameof(Dto.Name)].InnerText);\n    }\n\n    [Fact]\n    public async Task ShouldSerializeToXmlUsingAttributeOverrides()\n    {\n        const string overridenRootElementName = \"dto-ex\";\n\n        var dto = BuildDto();\n        var serializerSettings = new XmlContentSerializerSettings();\n        var attributes = new XmlAttributes\n        {\n            XmlRoot = new XmlRootAttribute(overridenRootElementName)\n        };\n        serializerSettings.XmlAttributeOverrides.Add(dto.GetType(), attributes);\n        var sut = new XmlContentSerializer(serializerSettings);\n\n        var content = sut.ToHttpContent(dto);\n        var document = new XmlDocument();\n        document.LoadXml(await content.ReadAsStringAsync());\n\n        Assert.Equal(overridenRootElementName, document.DocumentElement?.Name);\n    }\n\n    [Fact]\n    public async Task ShouldSerializeToXmlUsingNamespaceOverrides()\n    {\n        const string prefix = \"google\";\n\n        var dto = BuildDto();\n        var serializerSettings = new XmlContentSerializerSettings\n        {\n            XmlNamespaces = new XmlSerializerNamespaces()\n        };\n        serializerSettings.XmlNamespaces.Add(prefix, \"https://google.com\");\n        var sut = new XmlContentSerializer(serializerSettings);\n\n        var content = sut.ToHttpContent(dto);\n        var document = new XmlDocument();\n        document.LoadXml(await content.ReadAsStringAsync());\n\n        Assert.Equal(prefix, document[\"Dto\"]?[\"Name\", \"https://google.com\"]?.Prefix);\n    }\n\n    [Fact]\n    public async Task ShouldDeserializeFromXmlAsync()\n    {\n        var serializerSettings = new XmlContentSerializerSettings\n        {\n            XmlNamespaces = new XmlSerializerNamespaces()\n        };\n        var sut = new XmlContentSerializer(serializerSettings);\n\n        var dto = await sut.FromHttpContentAsync<Dto>(\n            new StringContent(\"<Dto><Identifier>123</Identifier></Dto>\")\n        );\n\n        Assert.Equal(\"123\", dto.Identifier);\n    }\n\n    [Fact]\n    public async Task XmlEncodingShouldMatchWriterSettingAsync()\n    {\n        var encoding = Encoding.UTF32;\n        var serializerSettings = new XmlContentSerializerSettings\n        {\n            XmlReaderWriterSettings = new XmlReaderWriterSettings()\n            {\n                WriterSettings = new XmlWriterSettings() { Encoding = encoding }\n            }\n        };\n        var sut = new XmlContentSerializer(serializerSettings);\n\n        var dto = BuildDto();\n        var content = sut.ToHttpContent(dto);\n        var xml = XDocument.Parse(await content.ReadAsStringAsync());\n        var documentEncoding = xml.Declaration.Encoding;\n        Assert.Equal(encoding.WebName, documentEncoding);\n    }\n\n    static Dto BuildDto()\n    {\n        var dto = new Dto\n        {\n            CreatedOn = DateTime.UtcNow,\n            Identifier = Guid.NewGuid().ToString(),\n            Name = \"Test Dto Object\"\n        };\n        return dto;\n    }\n}\n"
  },
  {
    "path": "Refit.Tests/_snapshots/InterfaceStubGeneratorTests.FindInterfacesSmokeTest#Generated.g.verified.cs",
    "content": "﻿//HintName: Generated.g.cs\n\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    internal static partial class Generated\n    {\n#if NET5_0_OR_GREATER\n        [System.Runtime.CompilerServices.ModuleInitializer]\n        [System.Diagnostics.CodeAnalysis.DynamicDependency(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All, typeof(global::Refit.Implementation.Generated))]\n        public static void Initialize()\n        {\n        }\n#endif\n    }\n}\n#pragma warning restore\n"
  },
  {
    "path": "Refit.Tests/_snapshots/InterfaceStubGeneratorTests.FindInterfacesSmokeTest#IGitHubApi.g.verified.cs",
    "content": "﻿//HintName: IGitHubApi.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitTestsIGitHubApi\n        : global::Refit.Tests.IGitHubApi\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitTestsIGitHubApi(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        private static readonly global::System.Type[] ______typeParameters = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::Refit.Tests.User> GetUser(string @userName)\n        {\n            var ______arguments = new object[] { @userName };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUser\", ______typeParameters );\n\n            return await ((global::System.Threading.Tasks.Task<global::Refit.Tests.User>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters0 = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public global::System.IObservable<global::Refit.Tests.User> GetUserObservable(string @userName)\n        {\n            var ______arguments = new object[] { @userName };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUserObservable\", ______typeParameters0 );\n\n            return (global::System.IObservable<global::Refit.Tests.User>)______func(this.Client, ______arguments);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters1 = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public global::System.IObservable<global::Refit.Tests.User> GetUserCamelCase(string @userName)\n        {\n            var ______arguments = new object[] { @userName };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUserCamelCase\", ______typeParameters1 );\n\n            return (global::System.IObservable<global::Refit.Tests.User>)______func(this.Client, ______arguments);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters2 = new global::System.Type[] {typeof(string), typeof(global::System.Threading.CancellationToken) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::System.Collections.Generic.List<global::Refit.Tests.User>> GetOrgMembers(string @orgName, global::System.Threading.CancellationToken @cancellationToken)\n        {\n            var ______arguments = new object[] { @orgName, @cancellationToken };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetOrgMembers\", ______typeParameters2 );\n\n            return await ((global::System.Threading.Tasks.Task<global::System.Collections.Generic.List<global::Refit.Tests.User>>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters3 = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::Refit.Tests.UserSearchResult> FindUsers(string @q)\n        {\n            var ______arguments = new object[] { @q };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"FindUsers\", ______typeParameters3 );\n\n            return await ((global::System.Threading.Tasks.Task<global::Refit.Tests.UserSearchResult>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::System.Net.Http.HttpResponseMessage> GetIndex()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetIndex\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<global::System.Net.Http.HttpResponseMessage>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        public global::System.IObservable<string> GetIndexObservable()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetIndexObservable\", global::System.Array.Empty<global::System.Type>() );\n\n            return (global::System.IObservable<string>)______func(this.Client, ______arguments);\n        }\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::Refit.Tests.User> NothingToSeeHere()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"NothingToSeeHere\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<global::Refit.Tests.User>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::Refit.ApiResponse<global::Refit.Tests.User>> NothingToSeeHereWithMetadata()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"NothingToSeeHereWithMetadata\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<global::Refit.ApiResponse<global::Refit.Tests.User>>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters4 = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::Refit.ApiResponse<global::Refit.Tests.User>> GetUserWithMetadata(string @userName)\n        {\n            var ______arguments = new object[] { @userName };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUserWithMetadata\", ______typeParameters4 );\n\n            return await ((global::System.Threading.Tasks.Task<global::Refit.ApiResponse<global::Refit.Tests.User>>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters5 = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public global::System.IObservable<global::Refit.ApiResponse<global::Refit.Tests.User>> GetUserObservableWithMetadata(string @userName)\n        {\n            var ______arguments = new object[] { @userName };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUserObservableWithMetadata\", ______typeParameters5 );\n\n            return (global::System.IObservable<global::Refit.ApiResponse<global::Refit.Tests.User>>)______func(this.Client, ______arguments);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters6 = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public global::System.IObservable<global::Refit.IApiResponse<global::Refit.Tests.User>> GetUserIApiResponseObservableWithMetadata(string @userName)\n        {\n            var ______arguments = new object[] { @userName };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUserIApiResponseObservableWithMetadata\", ______typeParameters6 );\n\n            return (global::System.IObservable<global::Refit.IApiResponse<global::Refit.Tests.User>>)______func(this.Client, ______arguments);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters7 = new global::System.Type[] {typeof(global::Refit.Tests.User) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::Refit.Tests.User> CreateUser(global::Refit.Tests.User @user)\n        {\n            var ______arguments = new object[] { @user };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"CreateUser\", ______typeParameters7 );\n\n            return await ((global::System.Threading.Tasks.Task<global::Refit.Tests.User>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters8 = new global::System.Type[] {typeof(global::Refit.Tests.User) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::Refit.ApiResponse<global::Refit.Tests.User>> CreateUserWithMetadata(global::Refit.Tests.User @user)\n        {\n            var ______arguments = new object[] { @user };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"CreateUserWithMetadata\", ______typeParameters8 );\n\n            return await ((global::System.Threading.Tasks.Task<global::Refit.ApiResponse<global::Refit.Tests.User>>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.Tests/_snapshots/InterfaceStubGeneratorTests.FindInterfacesSmokeTest#IGitHubApiDisposable.g.verified.cs",
    "content": "﻿//HintName: IGitHubApiDisposable.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitTestsIGitHubApiDisposable\n        : global::Refit.Tests.IGitHubApiDisposable\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitTestsIGitHubApiDisposable(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task RefitMethod()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"RefitMethod\", global::System.Array.Empty<global::System.Type>() );\n\n            await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        void global::System.IDisposable.Dispose()\n        {\n                Client?.Dispose();\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.Tests/_snapshots/InterfaceStubGeneratorTests.FindInterfacesSmokeTest#INestedGitHubApi.g.verified.cs",
    "content": "﻿//HintName: INestedGitHubApi.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class RefitTestsTestNestedINestedGitHubApi\n        : global::Refit.Tests.TestNested.INestedGitHubApi\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public RefitTestsTestNestedINestedGitHubApi(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        private static readonly global::System.Type[] ______typeParameters = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::Refit.Tests.User> GetUser(string @userName)\n        {\n            var ______arguments = new object[] { @userName };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUser\", ______typeParameters );\n\n            return await ((global::System.Threading.Tasks.Task<global::Refit.Tests.User>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters0 = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public global::System.IObservable<global::Refit.Tests.User> GetUserObservable(string @userName)\n        {\n            var ______arguments = new object[] { @userName };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUserObservable\", ______typeParameters0 );\n\n            return (global::System.IObservable<global::Refit.Tests.User>)______func(this.Client, ______arguments);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters1 = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public global::System.IObservable<global::Refit.Tests.User> GetUserCamelCase(string @userName)\n        {\n            var ______arguments = new object[] { @userName };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetUserCamelCase\", ______typeParameters1 );\n\n            return (global::System.IObservable<global::Refit.Tests.User>)______func(this.Client, ______arguments);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters2 = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::System.Collections.Generic.List<global::Refit.Tests.User>> GetOrgMembers(string @orgName)\n        {\n            var ______arguments = new object[] { @orgName };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetOrgMembers\", ______typeParameters2 );\n\n            return await ((global::System.Threading.Tasks.Task<global::System.Collections.Generic.List<global::Refit.Tests.User>>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        private static readonly global::System.Type[] ______typeParameters3 = new global::System.Type[] {typeof(string) };\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::Refit.Tests.UserSearchResult> FindUsers(string @q)\n        {\n            var ______arguments = new object[] { @q };\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"FindUsers\", ______typeParameters3 );\n\n            return await ((global::System.Threading.Tasks.Task<global::Refit.Tests.UserSearchResult>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task<global::System.Net.Http.HttpResponseMessage> GetIndex()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetIndex\", global::System.Array.Empty<global::System.Type>() );\n\n            return await ((global::System.Threading.Tasks.Task<global::System.Net.Http.HttpResponseMessage>)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        public global::System.IObservable<string> GetIndexObservable()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetIndexObservable\", global::System.Array.Empty<global::System.Type>() );\n\n            return (global::System.IObservable<string>)______func(this.Client, ______arguments);\n        }\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task NothingToSeeHere()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"NothingToSeeHere\", global::System.Array.Empty<global::System.Type>() );\n\n            await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.Tests/_snapshots/InterfaceStubGeneratorTests.FindInterfacesSmokeTest#PreserveAttribute.g.verified.cs",
    "content": "﻿//HintName: PreserveAttribute.g.cs\n\n#pragma warning disable\nnamespace RefitInternalGenerated\n{\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    [global::System.AttributeUsage (global::System.AttributeTargets.Class | global::System.AttributeTargets.Struct | global::System.AttributeTargets.Enum | global::System.AttributeTargets.Constructor | global::System.AttributeTargets.Method | global::System.AttributeTargets.Property | global::System.AttributeTargets.Field | global::System.AttributeTargets.Event | global::System.AttributeTargets.Interface | global::System.AttributeTargets.Delegate)]\n    sealed class PreserveAttribute : global::System.Attribute\n    {\n        //\n        // Fields\n        //\n        public bool AllMembers;\n\n        public bool Conditional;\n    }\n}\n#pragma warning restore\n"
  },
  {
    "path": "Refit.Tests/_snapshots/InterfaceStubGeneratorTests.GenerateInterfaceStubsWithoutNamespaceSmokeTest#Generated.g.verified.cs",
    "content": "﻿//HintName: Generated.g.cs\n\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    internal static partial class Generated\n    {\n#if NET5_0_OR_GREATER\n        [System.Runtime.CompilerServices.ModuleInitializer]\n        [System.Diagnostics.CodeAnalysis.DynamicDependency(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.All, typeof(global::Refit.Implementation.Generated))]\n        public static void Initialize()\n        {\n        }\n#endif\n    }\n}\n#pragma warning restore\n"
  },
  {
    "path": "Refit.Tests/_snapshots/InterfaceStubGeneratorTests.GenerateInterfaceStubsWithoutNamespaceSmokeTest#IServiceWithoutNamespace.g.verified.cs",
    "content": "﻿//HintName: IServiceWithoutNamespace.g.cs\n#nullable disable\n#pragma warning disable\nnamespace Refit.Implementation\n{\n\n    partial class Generated\n    {\n\n    /// <inheritdoc />\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.Diagnostics.DebuggerNonUserCode]\n    [global::RefitInternalGenerated.PreserveAttribute]\n    [global::System.Reflection.Obfuscation(Exclude=true)]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    partial class IServiceWithoutNamespace\n        : global::IServiceWithoutNamespace\n    {\n        /// <inheritdoc />\n        public global::System.Net.Http.HttpClient Client { get; }\n        readonly global::Refit.IRequestBuilder requestBuilder;\n\n        /// <inheritdoc />\n        public IServiceWithoutNamespace(global::System.Net.Http.HttpClient client, global::Refit.IRequestBuilder requestBuilder)\n        {\n            Client = client;\n            this.requestBuilder = requestBuilder;\n        }\n\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task GetRoot()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"GetRoot\", global::System.Array.Empty<global::System.Type>() );\n\n            await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n\n        /// <inheritdoc />\n        public async global::System.Threading.Tasks.Task PostRoot()\n        {\n            var ______arguments = global::System.Array.Empty<object>();\n            var ______func = requestBuilder.BuildRestResultFuncForMethod(\"PostRoot\", global::System.Array.Empty<global::System.Type>() );\n\n            await ((global::System.Threading.Tasks.Task)______func(this.Client, ______arguments)).ConfigureAwait(false);\n        }\n    }\n    }\n}\n\n#pragma warning restore\n"
  },
  {
    "path": "Refit.Tests/_snapshots/InterfaceStubGeneratorTests.GenerateInterfaceStubsWithoutNamespaceSmokeTest#PreserveAttribute.g.verified.cs",
    "content": "﻿//HintName: PreserveAttribute.g.cs\n\n#pragma warning disable\nnamespace RefitInternalGenerated\n{\n    [global::System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]\n    [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]\n    [global::System.AttributeUsage (global::System.AttributeTargets.Class | global::System.AttributeTargets.Struct | global::System.AttributeTargets.Enum | global::System.AttributeTargets.Constructor | global::System.AttributeTargets.Method | global::System.AttributeTargets.Property | global::System.AttributeTargets.Field | global::System.AttributeTargets.Event | global::System.AttributeTargets.Interface | global::System.AttributeTargets.Delegate)]\n    sealed class PreserveAttribute : global::System.Attribute\n    {\n        //\n        // Fields\n        //\n        public bool AllMembers;\n\n        public bool Conditional;\n    }\n}\n#pragma warning restore\n"
  },
  {
    "path": "Refit.Xml/Refit.Xml.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <Product>Refit Xml Serializer ($(TargetFramework))</Product>\n    <Description>Refit Serializers for Xml</Description>\n    <TargetFrameworks>$(RefitTargets)</TargetFrameworks>\n    <GenerateDocumentationFile Condition=\" '$(Configuration)' == 'Release' \">true</GenerateDocumentationFile>\n    <RootNamespace>Refit</RootNamespace>\n    <Nullable>enable</Nullable>\n    <IsTrimmable>true</IsTrimmable>\n  </PropertyGroup>  \n\n  <ItemGroup Condition=\"'$(TargetFramework)' == 'net462'\">\n    <PackageReference Include=\"Microsoft.NETFramework.ReferenceAssemblies\"\n                      Version=\"1.0.3\"\n                      PrivateAssets=\"All\" />\n    <Reference Include=\"System.Web\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\Refit\\Refit.csproj\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "Refit.Xml/XmlContentSerializer.cs",
    "content": "﻿using System;\nusing System.Collections.Concurrent;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Reflection;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Xml;\nusing System.Xml.Serialization;\n\nnamespace Refit\n{\n    /// <summary>\n    /// A <see langword=\"class\"/> implementing <see cref=\"IHttpContentSerializer\"/> which provides Xml content serialization.\n    /// </summary>\n    /// <remarks>\n    /// Initializes a new instance of the <see cref=\"XmlContentSerializer\"/> class.\n    /// </remarks>\n    /// <param name=\"settings\">The settings.</param>\n    /// <exception cref=\"System.ArgumentNullException\">settings</exception>\n    public class XmlContentSerializer(XmlContentSerializerSettings settings) : IHttpContentSerializer\n    {\n        readonly XmlContentSerializerSettings settings = settings ?? throw new ArgumentNullException(nameof(settings));\n        readonly ConcurrentDictionary<Type, XmlSerializer> serializerCache = new();\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"XmlContentSerializer\"/> class.\n        /// </summary>\n        public XmlContentSerializer()\n            : this(new XmlContentSerializerSettings()) { }\n\n        /// <summary>\n        /// Serialize object of type <typeparamref name=\"T\"/> to a <see cref=\"HttpContent\"/> with Xml.\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the object to serialize from.</typeparam>\n        /// <param name=\"item\">Object to serialize.</param>\n        /// <returns><see cref=\"HttpContent\"/> that contains the serialized <typeparamref name=\"T\"/> object in Xml.</returns>\n        /// <exception cref=\"ArgumentNullException\"></exception>\n        public HttpContent ToHttpContent<T>(T item)\n        {\n            if (item is null)\n                throw new ArgumentNullException(nameof(item));\n\n            var xmlSerializer = serializerCache.GetOrAdd(\n                item.GetType(),\n                t => new XmlSerializer(t, settings.XmlAttributeOverrides)\n            );\n\n            using var stream = new MemoryStream();\n            using var writer = XmlWriter.Create(\n                stream,\n                settings.XmlReaderWriterSettings.WriterSettings\n            );\n            var encoding =\n                settings.XmlReaderWriterSettings.WriterSettings?.Encoding ?? Encoding.Unicode;\n            xmlSerializer.Serialize(writer, item, settings.XmlNamespaces);\n            var str = encoding.GetString(stream.ToArray());\n            var content = new StringContent(str, encoding, \"application/xml\");\n            return content;\n        }\n\n        /// <summary>\n        /// Deserializes an object of type <typeparamref name=\"T\"/> from a <see cref=\"HttpContent\"/> object that contains Xml content.\n        /// </summary>\n        /// <typeparam name=\"T\">Type of the object to deserialize to.</typeparam>\n        /// <param name=\"content\">HttpContent object with Xml content to deserialize.</param>\n        /// <param name=\"cancellationToken\">CancellationToken to abort the deserialization.</param>\n        /// <returns>The deserialized object of type <typeparamref name=\"T\"/>.</returns>\n        public async Task<T?> FromHttpContentAsync<T>(\n            HttpContent content,\n            CancellationToken cancellationToken = default\n        )\n        {\n            var xmlSerializer = serializerCache.GetOrAdd(\n                typeof(T),\n                t =>\n                    new XmlSerializer(\n                        t,\n                        settings.XmlAttributeOverrides,\n                        [],\n                        null,\n                        settings.XmlDefaultNamespace\n                    )\n            );\n\n            using var input = new StringReader(\n                await content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false)\n            );\n\n            using var reader = XmlReader.Create(\n                input,\n                settings.XmlReaderWriterSettings.ReaderSettings\n            );\n            return (T?)xmlSerializer.Deserialize(reader);\n        }\n\n        /// <inheritdoc/>\n        public string? GetFieldNameForProperty(PropertyInfo propertyInfo)\n        {\n            if (propertyInfo is null)\n                throw new ArgumentNullException(nameof(propertyInfo));\n\n            return propertyInfo\n                    .GetCustomAttributes<XmlElementAttribute>(true)\n                    .Select(a => a.ElementName)\n                    .FirstOrDefault()\n                ?? propertyInfo\n                    .GetCustomAttributes<XmlAttributeAttribute>(true)\n                    .Select(a => a.AttributeName)\n                    .FirstOrDefault();\n        }\n    }\n\n    /// <summary>\n    /// XmlReaderWriterSettings.\n    /// </summary>\n    public class XmlReaderWriterSettings\n    {\n        XmlReaderSettings readerSettings;\n        XmlWriterSettings writerSettings;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"XmlReaderWriterSettings\"/> class.\n        /// </summary>\n        public XmlReaderWriterSettings()\n            : this(new XmlReaderSettings(), new XmlWriterSettings()) { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"XmlReaderWriterSettings\"/> class.\n        /// </summary>\n        /// <param name=\"readerSettings\">The reader settings.</param>\n        public XmlReaderWriterSettings(XmlReaderSettings readerSettings)\n            : this(readerSettings, new XmlWriterSettings()) { }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"XmlReaderWriterSettings\"/> class.\n        /// </summary>\n        /// <param name=\"writerSettings\">The writer settings.</param>\n        public XmlReaderWriterSettings(XmlWriterSettings writerSettings)\n            : this(new XmlReaderSettings(), writerSettings) { }\n\n#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"XmlReaderWriterSettings\"/> class.\n        /// </summary>\n        /// <param name=\"readerSettings\">The reader settings.</param>\n        /// <param name=\"writerSettings\">The writer settings.</param>\n        public XmlReaderWriterSettings(\n            XmlReaderSettings readerSettings,\n            XmlWriterSettings writerSettings\n        )\n#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.\n        {\n            ReaderSettings = readerSettings;\n            WriterSettings = writerSettings;\n        }\n\n        /// <summary>\n        /// Gets or sets the reader settings.\n        /// </summary>\n        /// <value>\n        /// The reader settings.\n        /// </value>\n        /// <exception cref=\"System.ArgumentNullException\">value</exception>\n        public XmlReaderSettings ReaderSettings\n        {\n            get\n            {\n                ApplyOverrideSettings();\n                return readerSettings;\n            }\n            set => readerSettings = value ?? throw new ArgumentNullException(nameof(value));\n        }\n\n        /// <summary>\n        /// Gets or sets the writer settings.\n        /// </summary>\n        /// <value>\n        /// The writer settings.\n        /// </value>\n        /// <exception cref=\"System.ArgumentNullException\">value</exception>\n        public XmlWriterSettings WriterSettings\n        {\n            get\n            {\n                ApplyOverrideSettings();\n                return writerSettings;\n            }\n            set => writerSettings = value ?? throw new ArgumentNullException(nameof(value));\n        }\n\n        /// <summary>\n        /// The writer and reader settings are set by the caller, but certain properties\n        /// should remain set to meet the demands of the XmlContentSerializer. Those properties\n        /// are always set here.\n        /// </summary>\n        void ApplyOverrideSettings()\n        {\n            writerSettings.Async = true;\n            readerSettings.Async = true;\n        }\n    }\n\n    /// <summary>\n    /// XmlContentSerializerSettings.\n    /// </summary>\n    public class XmlContentSerializerSettings\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"XmlContentSerializerSettings\"/> class.\n        /// </summary>\n        public XmlContentSerializerSettings()\n        {\n            XmlDefaultNamespace = null;\n            XmlReaderWriterSettings = new XmlReaderWriterSettings();\n            XmlNamespaces = new XmlSerializerNamespaces(\n                [new XmlQualifiedName(string.Empty, string.Empty),]\n            );\n\n            XmlAttributeOverrides = new XmlAttributeOverrides();\n        }\n\n        /// <summary>\n        /// Gets or sets the XML default namespace.\n        /// </summary>\n        /// <value>\n        /// The XML default namespace.\n        /// </value>\n        public string? XmlDefaultNamespace { get; set; }\n\n        /// <summary>\n        /// Gets or sets the XML reader writer settings.\n        /// </summary>\n        /// <value>\n        /// The XML reader writer settings.\n        /// </value>\n        public XmlReaderWriterSettings XmlReaderWriterSettings { get; set; }\n\n        /// <summary>\n        /// Gets or sets the XML namespaces.\n        /// </summary>\n        /// <value>\n        /// The XML namespaces.\n        /// </value>\n        public XmlSerializerNamespaces XmlNamespaces { get; set; }\n\n        /// <summary>\n        /// Gets or sets the XML attribute overrides.\n        /// </summary>\n        /// <value>\n        /// The XML attribute overrides.\n        /// </value>\n        public XmlAttributeOverrides XmlAttributeOverrides { get; set; }\n    }\n}\n"
  },
  {
    "path": "Refit.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 18\nVisualStudioVersion = 18.4.11612.150 stable\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{4F1C8991-7097-4471-A9A6-A72005AB594D}\"\n\tProjectSection(SolutionItems) = preProject\n\t\t.editorconfig = .editorconfig\n\t\t.github\\workflows\\ci-build.yml = .github\\workflows\\ci-build.yml\n\t\tDirectory.build.props = Directory.build.props\n\t\tLICENSE = LICENSE\n\t\tREADME.md = README.md\n\t\t.github\\workflows\\release.yml = .github\\workflows\\release.yml\n\t\tversion.json = version.json\n\tEndProjectSection\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Tests\", \"Tests\", \"{0E99249A-FB80-4C60-8FD3-13820E853FF7}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Refit\", \"Refit\\Refit.csproj\", \"{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Refit.Tests\", \"Refit.Tests\\Refit.Tests.csproj\", \"{EB833B36-D3CA-4308-A776-8D574F2ADF64}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Refit.HttpClientFactory\", \"Refit.HttpClientFactory\\Refit.HttpClientFactory.csproj\", \"{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Refit.Newtonsoft.Json\", \"Refit.Newtonsoft.Json\\Refit.Newtonsoft.Json.csproj\", \"{2210E606-1C91-4EA0-8876-3B2F501F2669}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"InterfaceStubGenerator.Roslyn38\", \"InterfaceStubGenerator.Roslyn38\\InterfaceStubGenerator.Roslyn38.csproj\", \"{72869789-0310-4916-9A41-20D16A01C1B8}\"\nEndProject\nProject(\"{D954291E-2A0B-460D-934E-DC6B0785DB48}\") = \"InterfaceStubGenerator.Shared\", \"InterfaceStubGenerator.Shared\\InterfaceStubGenerator.Shared.shproj\", \"{B591423D-F92D-4E00-B0EB-615C9853506C}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"InterfaceStubGenerator.Roslyn41\", \"InterfaceStubGenerator.Roslyn41\\InterfaceStubGenerator.Roslyn41.csproj\", \"{A4B61169-3314-41DB-8156-BE9677C90C9F}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"InterfaceStubGenerator.Roslyn50\", \"InterfaceStubGenerator.Roslyn50\\InterfaceStubGenerator.Roslyn50.csproj\", \"{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Refit.Xml\", \"Refit.Xml\\Refit.Xml.csproj\", \"{C4E38B33-3D17-47A7-A47F-8F3900F07499}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Refit.Benchmarks\", \"Refit.Benchmarks\\Refit.Benchmarks.csproj\", \"{ABD72A27-9C30-481A-8303-D8F825A8FD47}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Refit.GeneratorTests\", \"Refit.GeneratorTests\\Refit.GeneratorTests.csproj\", \"{CE7894EA-D411-494A-BA8B-1C231D45025D}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Examples\", \"Examples\", \"{FA3CFAFC-3218-487F-837B-E8755672EA27}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Meow.Common\", \"examples\\Meow.Common\\Meow.Common.csproj\", \"{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Meow\", \"examples\\Meow\\Meow.csproj\", \"{73AB8215-BABD-D6DE-F2D5-20BF123DE073}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"LibraryWithSDKandRefitService\", \"examples\\SampleUsingLocalApi\\LibraryWithSDKandRefitService\\LibraryWithSDKandRefitService.csproj\", \"{55ED7170-CB15-0A50-9C4F-C3A0188E150B}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleSampleUsingLocalApi\", \"examples\\SampleUsingLocalApi\\ConsoleApplication\\ConsoleSampleUsingLocalApi.csproj\", \"{BE9DED31-FAE3-F798-BD79-7BA96883D07A}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"RestApiForTest\", \"examples\\SampleUsingLocalApi\\RestApiforTest\\RestApiForTest.csproj\", \"{23305490-94C3-7131-087F-54EDF910A7ED}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tDebug|ARM = Debug|ARM\n\t\tDebug|x64 = Debug|x64\n\t\tDebug|x86 = Debug|x86\n\t\tRelease|Any CPU = Release|Any CPU\n\t\tRelease|ARM = Release|ARM\n\t\tRelease|x64 = Release|x64\n\t\tRelease|x86 = Release|x86\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Release|x64.Build.0 = Release|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{613670B3-BBC6-4479-A3D6-B6A6E80D94FD}.Release|x86.Build.0 = Release|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Release|x64.Build.0 = Release|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64}.Release|x86.Build.0 = Release|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Release|x64.Build.0 = Release|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{01AE14AC-88D1-49C4-A612-2F9B2DEB5DEA}.Release|x86.Build.0 = Release|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Release|x64.Build.0 = Release|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{2210E606-1C91-4EA0-8876-3B2F501F2669}.Release|x86.Build.0 = Release|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Release|x64.Build.0 = Release|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{72869789-0310-4916-9A41-20D16A01C1B8}.Release|x86.Build.0 = Release|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Release|x64.Build.0 = Release|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{A4B61169-3314-41DB-8156-BE9677C90C9F}.Release|x86.Build.0 = Release|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Release|x64.Build.0 = Release|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{4F855D43-6D47-4D31-9C17-82E6D7EF50A1}.Release|x86.Build.0 = Release|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Release|x64.Build.0 = Release|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{C4E38B33-3D17-47A7-A47F-8F3900F07499}.Release|x86.Build.0 = Release|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Release|x64.Build.0 = Release|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47}.Release|x86.Build.0 = Release|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Release|x64.Build.0 = Release|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D}.Release|x86.Build.0 = Release|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Release|x64.Build.0 = Release|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B}.Release|x86.Build.0 = Release|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Release|x64.Build.0 = Release|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073}.Release|x86.Build.0 = Release|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Release|x64.Build.0 = Release|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B}.Release|x86.Build.0 = Release|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Release|x64.Build.0 = Release|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A}.Release|x86.Build.0 = Release|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Debug|ARM.ActiveCfg = Debug|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Debug|ARM.Build.0 = Debug|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Debug|x64.ActiveCfg = Debug|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Debug|x64.Build.0 = Debug|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Debug|x86.ActiveCfg = Debug|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Debug|x86.Build.0 = Debug|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Release|ARM.ActiveCfg = Release|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Release|ARM.Build.0 = Release|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Release|x64.ActiveCfg = Release|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Release|x64.Build.0 = Release|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Release|x86.ActiveCfg = Release|Any CPU\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED}.Release|x86.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(NestedProjects) = preSolution\n\t\t{EB833B36-D3CA-4308-A776-8D574F2ADF64} = {0E99249A-FB80-4C60-8FD3-13820E853FF7}\n\t\t{ABD72A27-9C30-481A-8303-D8F825A8FD47} = {0E99249A-FB80-4C60-8FD3-13820E853FF7}\n\t\t{CE7894EA-D411-494A-BA8B-1C231D45025D} = {0E99249A-FB80-4C60-8FD3-13820E853FF7}\n\t\t{18EEE85D-7CEE-6DE4-7A39-F6E0F417D87B} = {FA3CFAFC-3218-487F-837B-E8755672EA27}\n\t\t{73AB8215-BABD-D6DE-F2D5-20BF123DE073} = {FA3CFAFC-3218-487F-837B-E8755672EA27}\n\t\t{55ED7170-CB15-0A50-9C4F-C3A0188E150B} = {FA3CFAFC-3218-487F-837B-E8755672EA27}\n\t\t{BE9DED31-FAE3-F798-BD79-7BA96883D07A} = {FA3CFAFC-3218-487F-837B-E8755672EA27}\n\t\t{23305490-94C3-7131-087F-54EDF910A7ED} = {FA3CFAFC-3218-487F-837B-E8755672EA27}\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {6E9C2873-AFF9-4D32-A784-1BA094814054}\n\tEndGlobalSection\n\tGlobalSection(SharedMSBuildProjectFiles) = preSolution\n\t\tInterfaceStubGenerator.Shared\\InterfaceStubGenerator.Shared.projitems*{72869789-0310-4916-9a41-20d16a01c1b8}*SharedItemsImports = 5\n\t\tInterfaceStubGenerator.Shared\\InterfaceStubGenerator.Shared.projitems*{a4b61169-3314-41db-8156-be9677c90c9f}*SharedItemsImports = 5\n\t\tInterfaceStubGenerator.Shared\\InterfaceStubGenerator.Shared.projitems*{4f855d43-6d47-4d31-9c17-82e6d7ef50a1}*SharedItemsImports = 5\n\t\tInterfaceStubGenerator.Shared\\InterfaceStubGenerator.Shared.projitems*{b591423d-f92d-4e00-b0eb-615c9853506c}*SharedItemsImports = 13\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "_config.yml",
    "content": "title: Refit\ndescription: The automatic type-safe REST library for Xamarin and .NET\ngoogle_analytics: \nshow_downloads: true\ntheme: jekyll-theme-dinky\n\ngems:\n  - jekyll-mentions\n"
  },
  {
    "path": "config/filelist.txt",
    "content": "**/Refit.*\n**/InterfaceStubGenerator.*"
  },
  {
    "path": "config/signclient.json",
    "content": "{\n  \"SignClient\": {\n    \"AzureAd\": {\n      \"AADInstance\": \"https://login.microsoftonline.com/\",\n      \"ClientId\": \"c248d68a-ba6f-4aa9-8a68-71fe872063f8\",\n      \"TenantId\": \"16076fdc-fcc1-4a15-b1ca-32c9a255900e\"\n    },\n    \"Service\": {\n      \"Url\": \"https://codesign.dotnetfoundation.org/\",\n      \"ResourceId\": \"https://SignService/3c30251f-36f3-490b-a955-520addb85001\"\n    }\n  }\n}"
  },
  {
    "path": "examples/Meow/Meow.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <OutputType>Exe</OutputType>\n    <TargetFramework>net8.0</TargetFramework>\n    <ImplicitUsings>enable</ImplicitUsings>\n    <Nullable>enable</Nullable>\n    <IsPackable>false</IsPackable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\Meow.Common\\Meow.Common.csproj\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "examples/Meow/Program.cs",
    "content": "﻿using Serilog;\n\nnamespace Meow;\n\npublic static class Program\n{\n    public static async Task Main(string[] args)\n    {\n        Log.Logger = new LoggerConfiguration()\n            .WriteTo.Console()\n            .MinimumLevel.Verbose()\n            .CreateLogger();\n\n        await Issue2056And2058Demo.RunAsync();\n\n        Log.Information(\"Issue #2056 and #2058 demo checks passed.\");\n\n        var service = new CatsService(new Uri(\"https://api.thecatapi.com\"));\n        var results = await service.Search(\"bengal\");\n\n        Log.Debug(\"{results}\", results);\n    }\n}\n"
  },
  {
    "path": "examples/Meow.Common/Meow.Common.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFramework>net8.0</TargetFramework>\n    <ImplicitUsings>enable</ImplicitUsings>\n    <Nullable>enable</Nullable>\n    <IsPackable>false</IsPackable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\Refit\\Refit.csproj\" />\n    <ProjectReference Include=\"..\\..\\Refit.Newtonsoft.Json\\Refit.Newtonsoft.Json.csproj\" />\n    <ProjectReference Include=\"..\\..\\InterfaceStubGenerator.Roslyn41\\InterfaceStubGenerator.Roslyn41.csproj\"\n                      ReferenceOutputAssembly=\"false\"\n                      OutputItemType=\"Analyzer\"\n                      PrivateAssets=\"all\" />\n    <PackageReference Include=\"Serilog\" Version=\"4.3.0\" />\n    <PackageReference Include=\"Serilog.Sinks.Console\" Version=\"6.1.1\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "examples/Meow.Common/Middleware/HttpClientDiagnosticsHandler.cs",
    "content": "﻿using System.Diagnostics;\n\nusing Serilog;\n\nnamespace HttpClientDiagnostics;\n\n[DebuggerStepThrough]\npublic class HttpClientDiagnosticsHandler : DelegatingHandler\n{\n    public HttpClientDiagnosticsHandler(HttpMessageHandler innerHandler)\n        : base(innerHandler) { }\n\n    public HttpClientDiagnosticsHandler() { }\n\n    protected override async Task<HttpResponseMessage> SendAsync(\n        HttpRequestMessage request,\n        CancellationToken cancellationToken\n    )\n    {\n        var totalElapsedTime = Stopwatch.StartNew();\n\n        Log.Debug(string.Format(\"Request: {0}\", request));\n        if (request.Content != null)\n        {\n            var content = await request.Content.ReadAsStringAsync().ConfigureAwait(false);\n            Log.Debug(string.Format(\"Request Content: {0}\", content));\n        }\n\n        var responseElapsedTime = Stopwatch.StartNew();\n        var response = await base.SendAsync(request, cancellationToken);\n\n        Log.Debug(string.Format(\"Response: {0}\", response));\n        if (response.Content != null)\n        {\n            var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false);\n            Log.Debug(string.Format(\"Response Content: {0}\", content));\n        }\n\n        responseElapsedTime.Stop();\n        Log.Debug(\n            string.Format(\n                \"Response elapsed time: {0} ms\",\n                responseElapsedTime.ElapsedMilliseconds\n            )\n        );\n\n        totalElapsedTime.Stop();\n        Log.Debug(\n            string.Format(\"Total elapsed time: {0} ms\", totalElapsedTime.ElapsedMilliseconds)\n        );\n\n        return response;\n    }\n}\n"
  },
  {
    "path": "examples/Meow.Common/Responses/SearchResponse.cs",
    "content": "﻿namespace Meow.Responses;\n\npublic class SearchResult\n{\n    public Breed[] breeds { get; set; }\n    public string id { get; set; }\n    public string url { get; set; }\n    public int width { get; set; }\n    public int height { get; set; }\n}\n\npublic class Breed\n{\n    public Weight weight { get; set; }\n    public string id { get; set; }\n    public string name { get; set; }\n    public string cfa_url { get; set; }\n    public string vetstreet_url { get; set; }\n    public string vcahospitals_url { get; set; }\n    public string temperament { get; set; }\n    public string origin { get; set; }\n    public string country_codes { get; set; }\n    public string country_code { get; set; }\n    public string description { get; set; }\n    public string life_span { get; set; }\n    public int indoor { get; set; }\n    public int lap { get; set; }\n    public string alt_names { get; set; }\n    public int adaptability { get; set; }\n    public int affection_level { get; set; }\n    public int child_friendly { get; set; }\n    public int dog_friendly { get; set; }\n    public int energy_level { get; set; }\n    public int grooming { get; set; }\n    public int health_issues { get; set; }\n    public int intelligence { get; set; }\n    public int shedding_level { get; set; }\n    public int social_needs { get; set; }\n    public int stranger_friendly { get; set; }\n    public int vocalisation { get; set; }\n    public int experimental { get; set; }\n    public int hairless { get; set; }\n    public int natural { get; set; }\n    public int rare { get; set; }\n    public int rex { get; set; }\n    public int suppressed_tail { get; set; }\n    public int short_legs { get; set; }\n    public string wikipedia_url { get; set; }\n    public int hypoallergenic { get; set; }\n}\n\npublic class Weight\n{\n    public string imperial { get; set; }\n    public string metric { get; set; }\n}\n"
  },
  {
    "path": "examples/Meow.Common/Services/CatsService.cs",
    "content": "﻿using HttpClientDiagnostics;\n\nusing Meow.Responses;\n\nusing Refit;\n\nnamespace Meow;\n\npublic class CatsService\n{\n    private readonly HttpClient _httpClient;\n    private readonly ITheCatsAPI _theCatsApi;\n\n    public CatsService(Uri baseUrl)\n    {\n        _httpClient = new HttpClient(new HttpClientDiagnosticsHandler(new HttpClientHandler()))\n        {\n            BaseAddress = baseUrl\n        };\n        _theCatsApi = RestService.For<ITheCatsAPI>(_httpClient);\n    }\n\n    public async Task<IEnumerable<SearchResult>> Search(string breed)\n    {\n        return await _theCatsApi.Search(breed).ConfigureAwait(false);\n    }\n}\n"
  },
  {
    "path": "examples/Meow.Common/Services/ITheCatsAPI.cs",
    "content": "﻿using Meow.Responses;\n\nusing Refit;\n\nnamespace Meow;\n\n[Headers(\"x-api-key: b95bfb30-55bc-4327-bb8b-35d740f70051\")]\npublic interface ITheCatsAPI\n{\n    [Get(\"/v1/images/search\")]\n    Task<IEnumerable<SearchResult>> Search([AliasAs(\"q\")] string breedIdentifier);\n}\n"
  },
  {
    "path": "examples/Meow.Common/Services/Issue2056And2058Demo.cs",
    "content": "﻿using System.Net;\nusing System.Text;\n\nusing Newtonsoft.Json;\n\nusing Refit;\n\nnamespace Meow;\n\npublic static class Issue2056And2058Demo\n{\n    public static async Task RunAsync()\n    {\n        using var httpClient = new HttpClient(\n            new CustomerIdHeaderHandler(new DemoBackendHandler())\n        )\n        {\n            BaseAddress = new Uri(\"https://demo.local\")\n        };\n\n        var api = RestService.For<IIssueDemoApi>(\n            httpClient,\n            new RefitSettings\n            {\n                ContentSerializer = new NewtonsoftJsonContentSerializer()\n            }\n        );\n\n        await ValidateIssue2056Async(api);\n        await ValidateIssue2058Async(api);\n    }\n\n    static async Task ValidateIssue2056Async(IIssueDemoApi api)\n    {\n        var customerIds = Enumerable.Range(1000, 50).ToArray();\n\n        var responses = await Task.WhenAll(\n            customerIds.Select(async customerId =>\n            {\n                var echo = await api.EchoCustomerAsync(customerId);\n                return (Expected: customerId, Actual: echo.CustomerIdHeader);\n            })\n        );\n\n        var mismatches = responses.Where(x => x.Expected.ToString() != x.Actual).ToArray();\n        if (mismatches.Length > 0)\n        {\n            throw new InvalidOperationException(\n                $\"Issue #2056 check failed. Found {mismatches.Length} mismatched CustomerId headers.\"\n            );\n        }\n    }\n\n    static async Task ValidateIssue2058Async(IIssueDemoApi api)\n    {\n        var payload = await api.GetLargePayloadAsync(2000);\n        if (payload.Items.Count != 2000)\n        {\n            throw new InvalidOperationException(\n                $\"Issue #2058 check failed. Expected 2000 items but got {payload.Items.Count}.\"\n            );\n        }\n    }\n}\n\npublic interface IIssueDemoApi\n{\n    [Get(\"/echo-customer\")]\n    Task<CustomerEchoResponse> EchoCustomerAsync([Property(\"CustomerId\")] int customerId);\n\n    [Get(\"/large-payload\")]\n    Task<LargePayloadResponse> GetLargePayloadAsync([AliasAs(\"size\")] int size);\n}\n\npublic sealed class CustomerEchoResponse\n{\n    [JsonProperty(\"customerIdHeader\")]\n    public string? CustomerIdHeader { get; set; }\n}\n\npublic sealed class LargePayloadResponse\n{\n    [JsonProperty(\"items\")]\n    public List<int> Items { get; set; } = [];\n}\n\npublic sealed class CustomerIdHeaderHandler(HttpMessageHandler innerHandler) : DelegatingHandler(innerHandler)\n{\n    static readonly HttpRequestOptionsKey<object?> CustomerIdKey = new(\"CustomerId\");\n\n    protected override Task<HttpResponseMessage> SendAsync(\n        HttpRequestMessage request,\n        CancellationToken cancellationToken\n    )\n    {\n        if (request.Options.TryGetValue(CustomerIdKey, out var customerId) && customerId is not null)\n        {\n            request.Headers.Remove(\"CustomerId\");\n            request.Headers.TryAddWithoutValidation(\"CustomerId\", customerId.ToString());\n        }\n\n        return base.SendAsync(request, cancellationToken);\n    }\n}\n\npublic sealed class DemoBackendHandler : HttpMessageHandler\n{\n    protected override Task<HttpResponseMessage> SendAsync(\n        HttpRequestMessage request,\n        CancellationToken cancellationToken\n    )\n    {\n        if (request.RequestUri?.AbsolutePath == \"/echo-customer\")\n        {\n            var customerIdHeader = request.Headers.TryGetValues(\"CustomerId\", out var values)\n                ? values.FirstOrDefault()\n                : null;\n\n            return Task.FromResult(\n                new HttpResponseMessage(HttpStatusCode.OK)\n                {\n                    Content = new StringContent(\n                        JsonConvert.SerializeObject(new CustomerEchoResponse\n                        {\n                            CustomerIdHeader = customerIdHeader\n                        }),\n                        Encoding.UTF8,\n                        \"application/json\"\n                    )\n                }\n            );\n        }\n\n        if (request.RequestUri?.AbsolutePath == \"/large-payload\")\n        {\n            var query = request.RequestUri.Query.TrimStart('?').Split('&', StringSplitOptions.RemoveEmptyEntries);\n            var size = 100;\n            foreach (var part in query)\n            {\n                var kv = part.Split('=', 2);\n                if (kv.Length == 2 && kv[0] == \"size\" && int.TryParse(Uri.UnescapeDataString(kv[1]), out var parsed))\n                {\n                    size = parsed;\n                    break;\n                }\n            }\n            var payload = JsonConvert.SerializeObject(new LargePayloadResponse\n            {\n                Items = Enumerable.Range(1, size).ToList()\n            });\n\n            return Task.FromResult(\n                new HttpResponseMessage(HttpStatusCode.OK)\n                {\n                    Content = new AsyncOnlyJsonHttpContent(payload)\n                }\n            );\n        }\n\n        return Task.FromResult(new HttpResponseMessage(HttpStatusCode.NotFound));\n    }\n}\n\npublic sealed class AsyncOnlyJsonHttpContent(string json) : HttpContent\n{\n    readonly byte[] _buffer = Encoding.UTF8.GetBytes(json);\n\n    protected override Task SerializeToStreamAsync(Stream stream, TransportContext? context) =>\n        stream.WriteAsync(_buffer, 0, _buffer.Length);\n\n    protected override bool TryComputeLength(out long length)\n    {\n        length = _buffer.Length;\n        return true;\n    }\n\n    protected override Task<Stream> CreateContentReadStreamAsync() =>\n        Task.FromResult<Stream>(new AsyncOnlyReadStream(_buffer));\n}\n\npublic sealed class AsyncOnlyReadStream(byte[] data) : Stream\n{\n    readonly MemoryStream _inner = new(data, writable: false);\n\n    public override bool CanRead => true;\n    public override bool CanSeek => _inner.CanSeek;\n    public override bool CanWrite => false;\n    public override long Length => _inner.Length;\n    public override long Position\n    {\n        get => _inner.Position;\n        set => _inner.Position = value;\n    }\n\n    public override void Flush() => _inner.Flush();\n\n    public override int Read(byte[] buffer, int offset, int count) =>\n        throw new NotSupportedException(\"Synchronous reads are not supported in this stream.\");\n\n    public override async ValueTask<int> ReadAsync(\n        Memory<byte> buffer,\n        CancellationToken cancellationToken = default\n    ) => await _inner.ReadAsync(buffer, cancellationToken);\n\n    public override Task<int> ReadAsync(\n        byte[] buffer,\n        int offset,\n        int count,\n        CancellationToken cancellationToken\n    ) => _inner.ReadAsync(buffer, offset, count, cancellationToken);\n\n    public override long Seek(long offset, SeekOrigin origin) => _inner.Seek(offset, origin);\n\n    public override void SetLength(long value) => throw new NotSupportedException();\n\n    public override void Write(byte[] buffer, int offset, int count) =>\n        throw new NotSupportedException();\n}\n"
  },
  {
    "path": "examples/Meow.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 16\nVisualStudioVersion = 16.0.28711.60\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Meow\", \"Meow\\Meow.csproj\", \"{F89AADAA-1C9E-4125-B6CF-9AD1E6CD94F1}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Meow.Common\", \"Meow.Common\\Meow.Common.csproj\", \"{270B1965-B666-4360-AE18-D129DFE3CB9F}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{F89AADAA-1C9E-4125-B6CF-9AD1E6CD94F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{F89AADAA-1C9E-4125-B6CF-9AD1E6CD94F1}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{F89AADAA-1C9E-4125-B6CF-9AD1E6CD94F1}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{F89AADAA-1C9E-4125-B6CF-9AD1E6CD94F1}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{270B1965-B666-4360-AE18-D129DFE3CB9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{270B1965-B666-4360-AE18-D129DFE3CB9F}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{270B1965-B666-4360-AE18-D129DFE3CB9F}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{270B1965-B666-4360-AE18-D129DFE3CB9F}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {DCB37AC1-9A6D-4947-AA9D-61B0A757E0D6}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/ConsoleApplication/ConsoleSampleUsingLocalApi.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <OutputType>Exe</OutputType>\n    <TargetFramework>net8.0</TargetFramework>\n    <IsPackable>false</IsPackable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\LibraryWithSDKandRefitService\\LibraryWithSDKandRefitService.csproj\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/ConsoleApplication/Program.cs",
    "content": "﻿using System;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Net.Http.Headers;\nusing LibraryWithSDKandRefitService;\nusing Refit;\n\nnamespace ConsoleSampleUsingLocalApi\n{\n    class Program\n    {\n        static void Main(string[] args)\n        {\n            Console.WriteLine(\"Hello World!\");\n            HttpClient _client = new HttpClient { BaseAddress = new Uri(\"http://localhost:61868\") };\n            IRestService _restApiService = RestService.For<IRestService>(_client);\n            Console.WriteLine(\n                \"Enter from the following numbers to access the APIs,\\n1 for get ,\\n2 for get with argument, \\n3 for post,\\n4 for put, \\n5 for Delete \\n\"\n            );\n            while (true)\n            {\n                int choice = Int32.Parse(Console.ReadLine() ?? \"6\");\n                switch (choice)\n                {\n                    case 1:\n                        var result1 = _restApiService.GetWithNoParameter().Result;\n                        Console.WriteLine(result1);\n                        break;\n                    case 2:\n                        var result2 = _restApiService.GetWithParameter(4).Result;\n                        Console.WriteLine(result2);\n                        break;\n                    case 3:\n                        var result3 = _restApiService.PostWithTestObject(new ModelForTest()).Result;\n                        Console.WriteLine(result3);\n                        break;\n                    case 4:\n                        var result4 = _restApiService\n                            .PutWithParameters(4, new ModelForTest())\n                            .Result;\n                        Console.WriteLine(result4);\n                        break;\n                    case 5:\n                        var result5 = _restApiService.DeleteWithParameters(5).Result;\n                        Console.WriteLine(result5);\n                        break;\n                    default:\n                        Console.WriteLine(\"Bhai Please Enter valid if you are really serious\");\n                        break;\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/LibraryWithSDKandRefitService/IRestService.cs",
    "content": "﻿using System.Collections.Generic;\nusing System.Threading.Tasks;\nusing Refit;\n\nnamespace LibraryWithSDKandRefitService\n{\n    public interface IRestService\n    {\n        [Get(\"/api/values\")]\n        Task<string> GetWithNoParameter();\n\n        [Get(\"/api/values/{id}\")]\n        Task<string> GetWithParameter([AliasAs(\"id\")] int id);\n\n        [Post(\"/api/values\")]\n        Task<string> PostWithTestObject([Body] ModelForTest modelObject);\n\n        [Put(\"/api/values/{id}\")]\n        Task<string> PutWithParameters([AliasAs(\"id\")] int id, [Body] ModelForTest modelObject);\n\n        [Delete(\"/api/values/{id}\")]\n        Task<string> DeleteWithParameters([AliasAs(\"id\")] int id);\n    }\n}\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/LibraryWithSDKandRefitService/LibraryWithSDKandRefitService.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <TargetFramework>net8.0</TargetFramework>\n    <IsPackable>false</IsPackable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\..\\Refit.Newtonsoft.Json\\Refit.Newtonsoft.Json.csproj\" />\n    <ProjectReference Include=\"..\\..\\..\\Refit\\Refit.csproj\" />\n    <ProjectReference Include=\"..\\..\\..\\InterfaceStubGenerator.Roslyn41\\InterfaceStubGenerator.Roslyn41.csproj\"\n                      ReferenceOutputAssembly=\"false\"\n                      OutputItemType=\"Analyzer\"\n                      PrivateAssets=\"all\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/LibraryWithSDKandRefitService/ModelForTest.cs",
    "content": "﻿namespace LibraryWithSDKandRefitService\n{\n    public class ModelForTest\n    {\n        public string TestVariable { get; set; }\n    }\n}\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/RestApiforTest/Controllers/ValuesController.cs",
    "content": "﻿using LibraryWithSDKandRefitService;\n\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace RestApiforTest.Controllers;\n\n/// <summary>\n/// Represents an API controller that provides endpoints for managing and retrieving values.\n/// </summary>\n/// <remarks>This controller defines standard HTTP endpoints for GET, POST, PUT, and DELETE operations\n/// using RESTful conventions. Each action corresponds to a specific HTTP verb and route, allowing clients to\n/// interact with value resources. The controller is intended for demonstration or template purposes and can be\n/// extended to implement actual data operations.</remarks>\n[Route(\"api/[controller]\")]\n[ApiController]\npublic class ValuesController : ControllerBase\n{\n    /// <summary>\n    /// Handles HTTP GET requests and returns a confirmation message indicating that the API was called without\n    /// arguments.\n    /// </summary>\n    /// <returns>An <see cref=\"ActionResult{String}\"/> containing a message that the API was called with no arguments.</returns>\n    [HttpGet]\n    public ActionResult<string> Get()\n    {\n        return \"Get Api with no argument was Called\";\n    }\n\n    /// <summary>\n    /// Retrieves a string response for the specified identifier.\n    /// </summary>\n    /// <param name=\"id\">The identifier for which to retrieve the response.</param>\n    /// <returns>An <see cref=\"ActionResult{String}\"/> containing the response string for the specified identifier.</returns>\n    [HttpGet(\"{id}\")]\n    public ActionResult<string> Get(int id)\n    {\n        return \"Get Api was called\";\n    }\n\n    /// <summary>\n    /// Handles HTTP POST requests to create a new resource using the provided test object.\n    /// </summary>\n    /// <param name=\"testObject\">The object containing the data to be processed in the POST request. Cannot be null.</param>\n    /// <returns>An ActionResult containing a string that indicates the result of the POST operation.</returns>\n    [HttpPost]\n    public ActionResult<string> Post([FromBody] ModelForTest testObject)\n    {\n        return \"Post Api was Called\";\n    }\n\n    /// <summary>\n    /// Updates the resource identified by the specified ID with the provided data.\n    /// </summary>\n    /// <param name=\"id\">The unique identifier of the resource to update.</param>\n    /// <param name=\"testObject\">The data used to update the resource. Cannot be null.</param>\n    /// <returns>An ActionResult containing a confirmation message indicating that the update operation was called.</returns>\n    [HttpPut(\"{id}\")]\n    public ActionResult<string> Put(int id, [FromBody] ModelForTest testObject)\n    {\n        return \"Put Api was called\";\n    }\n\n    /// <summary>\n    /// Deletes the resource identified by the specified ID.\n    /// </summary>\n    /// <param name=\"id\">The unique identifier of the resource to delete.</param>\n    /// <returns>An ActionResult containing a message indicating that the delete operation was called.</returns>\n    [HttpDelete(\"{id}\")]\n    public ActionResult<string> Delete(int id)\n    {\n        return \"Delete Api was Called\";\n    }\n}\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/RestApiforTest/Program.cs",
    "content": "﻿namespace RestApiforTest;\n\n/// <summary>\n/// Provides the entry point and web host configuration methods for the application.\n/// </summary>\ninternal static class Program\n{\n    /// <summary>\n    /// Serves as the entry point for the application.\n    /// </summary>\n    /// <remarks>This method configures and starts the web host. It is typically called automatically\n    /// by the runtime and should not be invoked directly.</remarks>\n    /// <param name=\"args\">An array of command-line arguments supplied to the application.</param>\n    public static void Main(string[] args)\n    {\n        CreateWebHostBuilder(args).Build().Run();\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the web host builder with pre-configured defaults and the specified startup\n    /// class.\n    /// </summary>\n    /// <remarks>This method sets up the web host with default configuration, logging, and Kestrel\n    /// server settings, and specifies the application's startup class. It is typically called from the\n    /// application's entry point to configure and launch the ASP.NET Core application.</remarks>\n    /// <param name=\"args\">An array of command-line arguments to configure the web host. May be empty but cannot be null.</param>\n    /// <returns>A configured web host builder instance that can be used to build and run the web application.</returns>\n    public static IHostBuilder CreateWebHostBuilder(string[] args) =>\n        Host.CreateDefaultBuilder(args)\n            .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());\n}\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/RestApiforTest/Properties/launchSettings.json",
    "content": "{\n  \"profiles\": {\n    \"IIS Express\": {\n      \"commandName\": \"IISExpress\",\n      \"launchBrowser\": true,\n      \"launchUrl\": \"api/values\",\n      \"environmentVariables\": {\n        \"ASPNETCORE_ENVIRONMENT\": \"Development\"\n      }\n    },\n    \"RestApiforTest\": {\n      \"commandName\": \"Project\",\n      \"launchBrowser\": true,\n      \"launchUrl\": \"api/values\",\n      \"environmentVariables\": {\n        \"ASPNETCORE_ENVIRONMENT\": \"Development\"\n      },\n      \"applicationUrl\": \"http://localhost:5000\"\n    }\n  },\n  \"$schema\": \"http://json.schemastore.org/launchsettings.json\",\n  \"iisSettings\": {\n    \"windowsAuthentication\": false,\n    \"anonymousAuthentication\": true,\n    \"iisExpress\": {\n      \"applicationUrl\": \"http://localhost:51523/\",\n      \"sslPort\": 44302\n    }\n  }\n}"
  },
  {
    "path": "examples/SampleUsingLocalApi/RestApiforTest/RestApiForTest.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n\n  <PropertyGroup>\n    <TargetFramework>net8.0</TargetFramework>\n    <AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>\n    <IsPackable>false</IsPackable>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\LibraryWithSDKandRefitService\\LibraryWithSDKandRefitService.csproj\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/RestApiforTest/Startup.cs",
    "content": "﻿namespace RestApiforTest;\n\n/// <summary>\n/// Provides configuration and service setup for the application's startup process.\n/// </summary>\n/// <remarks>The Startup class is used by the ASP.NET Core runtime to configure services and the HTTP\n/// request pipeline for the application. It defines methods for registering services with the dependency injection\n/// container and for specifying how HTTP requests are handled. This class is typically specified as the entry point\n/// for application startup in the program's host configuration.</remarks>\ninternal class Startup\n{\n    /// <summary>\n    /// Initializes a new instance of the Startup class with the specified application configuration settings.\n    /// </summary>\n    /// <param name=\"configuration\">The application configuration settings to be used for configuring services and the app's request pipeline.\n    /// Cannot be null.</param>\n    public Startup(IConfiguration configuration)\n    {\n        Configuration = configuration;\n    }\n\n    /// <summary>\n    /// Gets the application's configuration settings.\n    /// </summary>\n    /// <remarks>Use this property to access key-value pairs and configuration sections defined for\n    /// the application, such as settings from appsettings.json, environment variables, or other configuration\n    /// providers.</remarks>\n    public IConfiguration Configuration { get; }\n\n    /// <summary>\n    /// Configures the application's services by adding required service registrations to the dependency injection\n    /// container.\n    /// </summary>\n    /// <remarks>Call this method to register services needed by the application, such as MVC\n    /// controllers and related infrastructure. This method is typically called by the runtime during application\n    /// startup.</remarks>\n    /// <param name=\"services\">The collection of service descriptors to which application services are added. This parameter must not be\n    /// null.</param>\n    public void ConfigureServices(IServiceCollection services)\n    {\n        services.AddControllers();\n    }\n\n    /// <summary>\n    /// Configures the application's request pipeline and environment-specific middleware.\n    /// </summary>\n    /// <remarks>In a development environment, this method adds middleware to display detailed\n    /// exception information. It also configures MVC routing for handling HTTP requests.</remarks>\n    /// <param name=\"app\">The application builder used to configure the HTTP request pipeline.</param>\n    /// <param name=\"env\">The hosting environment information for the current application.</param>\n    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n    {\n        if (env.IsDevelopment())\n        {\n            app.UseDeveloperExceptionPage();\n        }\n\n        app.UseRouting();\n\n        app.UseEndpoints(endpoints =>\n        {\n            endpoints.MapControllers();\n        });\n    }\n}\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/RestApiforTest/appsettings.Development.json",
    "content": "{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Debug\",\n      \"System\": \"Information\",\n      \"Microsoft\": \"Information\"\n    }\n  }\n}\n"
  },
  {
    "path": "examples/SampleUsingLocalApi/RestApiforTest/appsettings.json",
    "content": "{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Warning\"\n    }\n  },\n  \"AllowedHosts\": \"*\"\n}\n"
  },
  {
    "path": "examples/SampleUsingLocalApi.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.28307.852\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"LibraryWithSDKandRefitService\", \"SampleUsingLocalApi\\LibraryWithSDKandRefitService\\LibraryWithSDKandRefitService.csproj\", \"{97A0AF3F-830B-4067-BFC3-0BA7AC6851E7}\"\nEndProject\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"RestApiForTest\", \"SampleUsingLocalApi\\RestApiforTest\\RestApiForTest.csproj\", \"{1A2E3E56-878E-4D2D-89D3-626DB0825120}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ConsoleSampleUsingLocalApi\", \"SampleUsingLocalApi\\ConsoleApplication\\ConsoleSampleUsingLocalApi.csproj\", \"{D7F3EC64-7473-4FD3-AB05-D7BE55009BE3}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{97A0AF3F-830B-4067-BFC3-0BA7AC6851E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{97A0AF3F-830B-4067-BFC3-0BA7AC6851E7}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{97A0AF3F-830B-4067-BFC3-0BA7AC6851E7}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{97A0AF3F-830B-4067-BFC3-0BA7AC6851E7}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{1A2E3E56-878E-4D2D-89D3-626DB0825120}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{1A2E3E56-878E-4D2D-89D3-626DB0825120}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{1A2E3E56-878E-4D2D-89D3-626DB0825120}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{1A2E3E56-878E-4D2D-89D3-626DB0825120}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{D7F3EC64-7473-4FD3-AB05-D7BE55009BE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{D7F3EC64-7473-4FD3-AB05-D7BE55009BE3}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{D7F3EC64-7473-4FD3-AB05-D7BE55009BE3}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{D7F3EC64-7473-4FD3-AB05-D7BE55009BE3}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {ACEEE495-B3D1-4788-9EE2-C33449109B85}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "stylesheets/pygment_trac.css",
    "content": ".highlight  { background: #ffffff; }\n.highlight .c { color: #999988; font-style: italic } /* Comment */\n.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */\n.highlight .k { font-weight: bold } /* Keyword */\n.highlight .o { font-weight: bold } /* Operator */\n.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */\n.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */\n.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */\n.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */\n.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */\n.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */\n.highlight .ge { font-style: italic } /* Generic.Emph */\n.highlight .gr { color: #aa0000 } /* Generic.Error */\n.highlight .gh { color: #999999 } /* Generic.Heading */\n.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */\n.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */\n.highlight .go { color: #888888 } /* Generic.Output */\n.highlight .gp { color: #555555 } /* Generic.Prompt */\n.highlight .gs { font-weight: bold } /* Generic.Strong */\n.highlight .gu { color: #800080; font-weight: bold; } /* Generic.Subheading */\n.highlight .gt { color: #aa0000 } /* Generic.Traceback */\n.highlight .kc { font-weight: bold } /* Keyword.Constant */\n.highlight .kd { font-weight: bold } /* Keyword.Declaration */\n.highlight .kn { font-weight: bold } /* Keyword.Namespace */\n.highlight .kp { font-weight: bold } /* Keyword.Pseudo */\n.highlight .kr { font-weight: bold } /* Keyword.Reserved */\n.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */\n.highlight .m { color: #009999 } /* Literal.Number */\n.highlight .s { color: #d14 } /* Literal.String */\n.highlight .na { color: #008080 } /* Name.Attribute */\n.highlight .nb { color: #0086B3 } /* Name.Builtin */\n.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */\n.highlight .no { color: #008080 } /* Name.Constant */\n.highlight .ni { color: #800080 } /* Name.Entity */\n.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */\n.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */\n.highlight .nn { color: #555555 } /* Name.Namespace */\n.highlight .nt { color: #000080 } /* Name.Tag */\n.highlight .nv { color: #008080 } /* Name.Variable */\n.highlight .ow { font-weight: bold } /* Operator.Word */\n.highlight .w { color: #bbbbbb } /* Text.Whitespace */\n.highlight .mf { color: #009999 } /* Literal.Number.Float */\n.highlight .mh { color: #009999 } /* Literal.Number.Hex */\n.highlight .mi { color: #009999 } /* Literal.Number.Integer */\n.highlight .mo { color: #009999 } /* Literal.Number.Oct */\n.highlight .sb { color: #d14 } /* Literal.String.Backtick */\n.highlight .sc { color: #d14 } /* Literal.String.Char */\n.highlight .sd { color: #d14 } /* Literal.String.Doc */\n.highlight .s2 { color: #d14 } /* Literal.String.Double */\n.highlight .se { color: #d14 } /* Literal.String.Escape */\n.highlight .sh { color: #d14 } /* Literal.String.Heredoc */\n.highlight .si { color: #d14 } /* Literal.String.Interpol */\n.highlight .sx { color: #d14 } /* Literal.String.Other */\n.highlight .sr { color: #009926 } /* Literal.String.Regex */\n.highlight .s1 { color: #d14 } /* Literal.String.Single */\n.highlight .ss { color: #990073 } /* Literal.String.Symbol */\n.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */\n.highlight .vc { color: #008080 } /* Name.Variable.Class */\n.highlight .vg { color: #008080 } /* Name.Variable.Global */\n.highlight .vi { color: #008080 } /* Name.Variable.Instance */\n.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */\n\n.type-csharp .highlight .k { color: #0000FF }\n.type-csharp .highlight .kt { color: #0000FF }\n.type-csharp .highlight .nf { color: #000000; font-weight: normal }\n.type-csharp .highlight .nc { color: #2B91AF }\n.type-csharp .highlight .nn { color: #000000 }\n.type-csharp .highlight .s { color: #A31515 }\n.type-csharp .highlight .sc { color: #A31515 }\n"
  },
  {
    "path": "stylesheets/styles.css",
    "content": "@import url(https://fonts.googleapis.com/css?family=Arvo:400,700,400italic);\n\n/* MeyerWeb Reset */\n\nhtml, body, div, span, applet, object, iframe,\nh1, h2, h3, h4, h5, h6, p, blockquote, pre,\na, abbr, acronym, address, big, cite, code,\ndel, dfn, em, img, ins, kbd, q, s, samp,\nsmall, strike, strong, sub, sup, tt, var,\nb, u, i, center,\ndl, dt, dd, ol, ul, li,\nfieldset, form, label, legend,\ntable, caption, tbody, tfoot, thead, tr, th, td,\narticle, aside, canvas, details, embed,\nfigure, figcaption, footer, header, hgroup,\nmenu, nav, output, ruby, section, summary,\ntime, mark, audio, video {\n  margin: 0;\n  padding: 0;\n  border: 0;\n  font: inherit;\n  vertical-align: baseline;\n}\n\n\n/* Base text styles */\n\nbody {\n  padding:10px 50px 0 0;\n  font-family:\"Helvetica Neue\", Helvetica, Arial, sans-serif;\n\tfont-size: 14px;\n\tcolor: #232323;\n\tbackground-color: #FBFAF7;\n\tmargin: 0;\n\tline-height: 1.8em;\n\t-webkit-font-smoothing: antialiased;\n\n}\n\nh1, h2, h3, h4, h5, h6 {\n  color:#232323;\n  margin:36px 0 10px;\n}\n\np, ul, ol, table, dl {\n  margin:0 0 22px;\n}\n\nh1, h2, h3 {\n\tfont-family: Arvo, Monaco, serif;\n  line-height:1.3;\n\tfont-weight: normal;\n}\n\nh1,h2, h3 {\n\tdisplay: block;\n\tborder-bottom: 1px solid #ccc;\n\tpadding-bottom: 5px;\n}\n\nh1 {\n\tfont-size: 30px;\n}\n\nh2 {\n\tfont-size: 24px;\n}\n\nh3 {\n\tfont-size: 18px;\n}\n\nh4, h5, h6 {\n\tfont-family: Arvo, Monaco, serif;\n\tfont-weight: 700;\n}\n\na {\n  color:#C30000;\n  font-weight:200;\n  text-decoration:none;\n}\n\na:hover {\n\ttext-decoration: underline;\n}\n\na small {\n\tfont-size: 12px;\n}\n\nem {\n\tfont-style: italic;\n}\n\nstrong {\n  font-weight:700;\n}\n\nul li {\n  list-style: inside;\n  padding-left: 25px;\n}\n\nol li {\n  list-style: decimal inside;\n  padding-left: 20px;\n}\n\nblockquote {\n  margin: 0;\n  padding: 0 0 0 20px;\n  font-style: italic;\n}\n\ndl, dt, dd, dl p {\n\tfont-color: #444;\n}\n\ndl dt {\n  font-weight: bold;\n}\n\ndl dd {\n  padding-left: 20px;\n  font-style: italic;\n}\n\ndl p {\n  padding-left: 20px;\n  font-style: italic;\n}\n\nhr {\n  border:0;\n  background:#ccc;\n  height:1px;\n  margin:0 0 24px;\n}\n\n/* Images */\n\nimg {\n  position: relative;\n  margin: 0 auto;\n  max-width: 650px;\n  padding: 5px;\n  margin: 10px 0 32px 0;\n  border: 1px solid #ccc;\n}\n\n\n/* Code blocks */\n\ncode, pre {\n\tfont-family: Monaco, \"Bitstream Vera Sans Mono\", \"Lucida Console\", Terminal, monospace;\n  color:#000;\n  font-size:14px;\n}\n\npre {\n\tpadding: 4px 12px;\n  background: #FDFEFB;\n  border-radius:4px;\n  border:1px solid #D7D8C8;\n  overflow: auto;\n  overflow-y: hidden;\n\tmargin-bottom: 32px;\n}\n\n\n/* Tables */\n\ntable {\n  width:100%;\n}\n\ntable {\n  border: 1px solid #ccc;\n  margin-bottom: 32px;\n  text-align: left;\n }\n\nth {\n  font-family: 'Arvo', Helvetica, Arial, sans-serif;\n\tfont-size: 18px;\n\tfont-weight: normal;\n  padding: 10px;\n  background: #232323;\n  color: #FDFEFB;\n }\n\ntd {\n  padding: 10px;\n\tbackground: #ccc;\n }\n\n\n/* Wrapper */\n.wrapper {\n  width:960px;\n}\n\n\n/* Header */\n\nheader {\n\tbackground-color: #171717;\n\tcolor: #FDFDFB;\n  width:170px;\n  float:left;\n  position:fixed;\n\tborder: 1px solid #000;\n\t-webkit-border-top-right-radius: 4px;\n\t-webkit-border-bottom-right-radius: 4px;\n\t-moz-border-radius-topright: 4px;\n\t-moz-border-radius-bottomright: 4px;\n\tborder-top-right-radius: 4px;\n\tborder-bottom-right-radius: 4px;\n\tpadding: 34px 25px 22px 50px;\n\tmargin: 30px 25px 0 0;\n\t-webkit-font-smoothing: antialiased;\n}\n\np.header {\n\tfont-size: 16px;\n}\n\nh1.header {\n\tfont-family: Arvo, sans-serif;\n\tfont-size: 30px;\n\tfont-weight: 300;\n\tline-height: 1.3em;\n\tborder-bottom: none;\n\tmargin-top: 0;\n}\n\n\nh1.header, a.header, a.name, header a{\n\tcolor: #fff;\n}\n\na.header {\n\ttext-decoration: underline;\n}\n\na.name {\n\twhite-space: nowrap;\n}\n\nheader ul {\n  list-style:none;\n  padding:0;\n}\n\nheader li {\n\tlist-style-type: none;\n  width:132px;\n  height:15px;\n\tmargin-bottom: 12px;\n\tline-height: 1em;\n\tpadding: 6px 6px 6px 7px;\n\n\tbackground: #AF0011;\n\tbackground: -moz-linear-gradient(top, #AF0011 0%, #820011 100%);\n  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd));\n  background: -webkit-linear-gradient(top, #AF0011 0%,#820011 100%);\n  background: -o-linear-gradient(top, #AF0011 0%,#820011 100%);\n  background: -ms-linear-gradient(top, #AF0011 0%,#820011 100%);\n  background: linear-gradient(top, #AF0011 0%,#820011 100%);\n\n\tborder-radius:4px;\n  border:1px solid #0D0D0D;\n\n\t-webkit-box-shadow: inset 0px 1px 1px 0 rgba(233,2,38, 1);\n\tbox-shadow: inset 0px 1px 1px 0 rgba(233,2,38, 1);\n\n}\n\nheader li:hover {\n\tbackground: #C3001D;\n\tbackground: -moz-linear-gradient(top, #C3001D 0%, #950119 100%);\n  background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd));\n  background: -webkit-linear-gradient(top, #C3001D 0%,#950119 100%);\n  background: -o-linear-gradient(top, #C3001D 0%,#950119 100%);\n  background: -ms-linear-gradient(top, #C3001D 0%,#950119 100%);\n  background: linear-gradient(top, #C3001D 0%,#950119 100%);\n}\n\na.buttons {\n\t-webkit-font-smoothing: antialiased;\n\tbackground: url(../images/arrow-down.png) no-repeat;\n\tfont-weight: normal;\n\ttext-shadow: rgba(0, 0, 0, 0.4) 0 -1px 0;\n\tpadding: 2px 2px 2px 22px;\n\theight: 30px;\n}\n\na.github {\n\tbackground: url(../images/octocat-small.png) no-repeat 1px;\n}\n\na.buttons:hover {\n\tcolor: #fff;\n\ttext-decoration: none;\n}\n\n\n/* Section - for main page content */\n\nsection {\n  width:650px;\n  float:right;\n  padding-bottom:50px;\n}\n\n\n/* Footer */\n\nfooter {\n  width:170px;\n  float:left;\n  position:fixed;\n  bottom:10px;\n\tpadding-left: 50px;\n}\n\n@media print, screen and (max-width: 960px) {\n\n  div.wrapper {\n    width:auto;\n    margin:0;\n  }\n\n  header, section, footer {\n    float:none;\n    position:static;\n    width:auto;\n  }\n\n\tfooter {\n\t\tborder-top: 1px solid #ccc;\n\t\tmargin:0 84px 0 50px;\n\t\tpadding:0;\n\t}\n\n  header {\n    padding-right:320px;\n  }\n\n  section {\n    padding:20px 84px 20px 50px;\n    margin:0 0 20px;\n  }\n\n  header a small {\n    display:inline;\n  }\n\n  header ul {\n    position:absolute;\n    right:130px;\n    top:84px;\n  }\n}\n\n@media print, screen and (max-width: 720px) {\n  body {\n    word-wrap:break-word;\n  }\n\n  header {\n    padding:10px 20px 0;\n\t\tmargin-right: 0;\n  }\n\n\tsection {\n    padding:10px 0 10px 20px;\n    margin:0 0 30px;\n  }\n\n\tfooter {\n\t\tmargin: 0 0 0 30px;\n\t}\n\n  header ul, header p.view {\n    position:static;\n  }\n}\n\n@media print, screen and (max-width: 480px) {\n\n  header ul li.download {\n    display:none;\n  }\n\n\tfooter {\n\t\tmargin: 0 0 0 20px;\n\t}\n\n\tfooter a{\n\t\tdisplay:block;\n\t}\n\n}\n\n@media print {\n  body {\n    padding:0.4in;\n    font-size:12pt;\n    color:#444;\n  }\n}"
  },
  {
    "path": "version.json",
    "content": "{\n  \"version\": \"10.1\",\n  \"publicReleaseRefSpec\": [\n    \"^refs/heads/main\", // we release out of master\n    \"^refs/heads/rel/\\\\d+\\\\.\\\\d+\\\\.\\\\d+\" // we also release branches starting with rel/N.N.N\n  ],\n  \"nugetPackageVersion\":{\n    \"semVer\": 2\n  },\n  \"cloudBuild\": {\n    \"setVersionVariables\": true,\n    \"buildNumber\": {\n      \"enabled\": false\n    }\n  }\n}\n"
  }
]